Merge "Cleanups to MigrateFileRepoLayout"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1522 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1534 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html/php
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! html/parsoid
2068 <p> This is not
2069 preformatted text.</p>
2070 <pre>This is preformatted text.
2071 So is this.</pre>
2072 !! end
2073
2074 !! test
2075 Space before tab needs nowiki pre protection
2076 !! options
2077 parsoid=html2wt
2078 !! html/parsoid
2079 <p> a</p>
2080 !! wikitext
2081 <nowiki> </nowiki> a
2082 !! end
2083
2084 !! test
2085 Ident preformatting with inline content
2086 !! wikitext
2087 a
2088 ''b''
2089 !! html
2090 <pre>a
2091 <i>b</i>
2092 </pre>
2093 !! end
2094
2095 !! test
2096 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2097 !! wikitext
2098 <pre><nowiki>
2099 <b>
2100 <cite>
2101 <em>
2102 </nowiki></pre>
2103 !! html
2104 <pre>
2105 &lt;b&gt;
2106 &lt;cite&gt;
2107 &lt;em&gt;
2108 </pre>
2109
2110 !! end
2111
2112 !! test
2113 Regression with preformatted in <center>
2114 !! wikitext
2115 <center>
2116 Blah
2117 </center>
2118 !! html
2119 <center>
2120 <pre>Blah
2121 </pre>
2122 </center>
2123
2124 !! end
2125
2126 !! test
2127 Bug 52763: Preformatted in <blockquote>
2128 !! wikitext
2129 <blockquote>
2130 Blah
2131 {|
2132 |
2133 indented cell (no pre-wrapping!)
2134 |}
2135 </blockquote>
2136 !! html
2137 <blockquote>
2138 <p> Blah
2139 </p>
2140 <table>
2141 <tr>
2142 <td>
2143 <p> indented cell (no pre-wrapping!)
2144 </p>
2145 </td></tr></table>
2146 </blockquote>
2147
2148 !! end
2149
2150 !! test
2151 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2152 !! wikitext
2153 <blockquote>
2154 Foo
2155
2156 Bar
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo
2161 </p><p>Bar
2162 </p>
2163 </blockquote>
2164
2165 !! end
2166
2167 !! test
2168 Bug 15491: <ins>/<del> in blockquote
2169 !! wikitext
2170 <blockquote>
2171 Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>
2175 <p>Foo <del>bar</del> <ins>baz</ins> quux
2176 </p>
2177 </blockquote>
2178
2179 !! end
2180
2181 # Note that the p-wrapping is newline sensitive, which could be
2182 # considered a bug: tidy will wrap only the 'Foo' in the example
2183 # below in a <p> tag. (see comment 23-25 of bug #6200)
2184 !! test
2185 Bug 15491: <ins>/<del> in blockquote (2)
2186 !! wikitext
2187 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2188 </blockquote>
2189 !! html
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192
2193 !! html+tidy
2194 <blockquote>
2195 <p>Foo</p>
2196 <del>bar</del> <ins>baz</ins> quux</blockquote>
2197 !! end
2198
2199 !! test
2200 <pre> with attributes (bug 3202)
2201 !! wikitext
2202 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2203 !! html
2204 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2205
2206 !! end
2207
2208 !! test
2209 <pre> with width attribute (bug 3202)
2210 !! wikitext
2211 <pre width="8">Narrow screen goodies</pre>
2212 !! html
2213 <pre width="8">Narrow screen goodies</pre>
2214
2215 !! end
2216
2217 !! test
2218 <pre> with forbidden attribute (bug 3202)
2219 !! wikitext
2220 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2221 !! html
2222 <pre width="8">Narrow screen goodies</pre>
2223
2224 !! end
2225
2226 !! test
2227 Entities inside <pre>
2228 !! wikitext
2229 <pre>&lt;</pre>
2230 !! html
2231 <pre>&lt;</pre>
2232
2233 !! end
2234
2235 !! test
2236 <pre> with forbidden attribute values (bug 3202)
2237 !! wikitext
2238 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2239 !! html
2240 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2241
2242 !! end
2243
2244 !! test
2245 <nowiki> inside <pre> (bug 13238)
2246 !! wikitext
2247 <pre>
2248 <nowiki>
2249 </pre>
2250 <pre>
2251 <nowiki></nowiki>
2252 </pre>
2253 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2254 !! html
2255 <pre>
2256 &lt;nowiki&gt;
2257 </pre>
2258 <pre>
2259
2260 </pre>
2261 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2262
2263 !! end
2264
2265 !! test
2266 <nowiki> and <pre> preference (first one wins)
2267 !! wikitext
2268 <pre>
2269 <nowiki>
2270 </pre>
2271 </nowiki>
2272 </pre>
2273
2274 <nowiki>
2275 <pre>
2276 <nowiki>
2277 </pre>
2278 </nowiki>
2279 </pre>
2280
2281 !! html/php
2282 <pre>
2283 &lt;nowiki&gt;
2284 </pre>
2285 <p>&lt;/nowiki&gt;
2286 &lt;/pre&gt;
2287 </p><p>
2288 &lt;pre&gt;
2289 &lt;nowiki&gt;
2290 &lt;/pre&gt;
2291
2292 &lt;/pre&gt;
2293 </p>
2294 !! html/parsoid
2295 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2296 </pre>
2297 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2298 &lt;/pre></p>
2299
2300 <p><span typeof="mw:Nowiki">
2301 &lt;pre>
2302 &lt;nowiki>
2303 &lt;/pre>
2304 </span>
2305 &lt;/pre></p>
2306 !! end
2307
2308 !! test
2309 </pre> inside nowiki
2310 !! wikitext
2311 <nowiki></pre></nowiki>
2312 !! html
2313 <p>&lt;/pre&gt;
2314 </p>
2315 !! end
2316
2317 # Parsoid doesn't strip empty tags, like Tidy does.
2318 !! test
2319 Empty pre; pre inside other HTML tags (bug 54946)
2320 !! options
2321 parsoid=wt2html,wt2wt
2322 !! wikitext
2323 a
2324
2325 <div><pre>
2326 foo
2327 </pre></div>
2328 <pre></pre>
2329 !! html/php
2330 <p>a
2331 </p>
2332 <div><pre>
2333 foo
2334 </pre></div>
2335 <pre></pre>
2336
2337 !! html/php+tidy
2338 <p>a</p>
2339 <div>
2340 <pre>
2341 foo
2342 </pre></div>
2343 !! html/parsoid
2344 <p>a</p>
2345
2346 <div><pre>foo
2347 </pre></div>
2348 <pre></pre>
2349 !! end
2350
2351 !! test
2352 HTML pre followed by indent-pre
2353 !! wikitext
2354 <pre>foo</pre>
2355 bar
2356 !! html
2357 <pre>foo</pre>
2358 <pre>bar
2359 </pre>
2360 !! end
2361
2362 # Note that tidy removes the empty <p> tags from the start and end.
2363 # Parsoid does not, by design.
2364 !!test
2365 Block tag pre
2366 !! wikitext
2367 <p><pre>foo</pre></p>
2368 !! html/php+tidy
2369 <pre>
2370 foo
2371 </pre>
2372 !! html/parsoid
2373 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2374 !!end
2375
2376 !!test
2377 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2378 !! wikitext
2379 {{echo|}}
2380 !! html
2381
2382 !!end
2383
2384 !!test
2385 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2386 !! wikitext
2387 {{echo|
2388 foo}}
2389 !! html
2390 <p>foo
2391 </p>
2392 !!end
2393
2394 !! test
2395 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2396 !! wikitext
2397 {{echo|a
2398 b}}
2399 !! html
2400 <pre>a
2401 </pre>
2402 <p>b
2403 </p>
2404 !!end
2405
2406 !! test
2407 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2408 !! wikitext
2409 {{echo|a
2410 b
2411 c
2412 d
2413 e
2414 }}
2415 !! html
2416 <pre>a
2417 </pre>
2418 <p>b
2419 c
2420 </p>
2421 <pre>d
2422 </pre>
2423 <p>e
2424 </p>
2425 !!end
2426
2427 !!test
2428 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2429 !! wikitext
2430 {{echo| foo}}
2431
2432 {{echo| foo}}{{echo| bar}}
2433
2434 {{echo| foo}}
2435 {{echo| bar}}
2436
2437 {{echo|<!--cmt--> foo}}
2438
2439 <!--cmt-->{{echo| foo}}
2440
2441 {{echo|{{echo| }}bar}}
2442 !! html
2443 <pre>foo
2444 </pre>
2445 <pre>foo bar
2446 </pre>
2447 <pre>foo
2448 bar
2449 </pre>
2450 <pre>foo
2451 </pre>
2452 <pre>foo
2453 </pre>
2454 <pre>bar
2455 </pre>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo| }}a
2462
2463 {{echo|
2464 }}a
2465
2466 {{echo|
2467 b}}
2468
2469 {{echo|a
2470 }}b
2471
2472 {{echo|a
2473 }} b
2474 !! html
2475 <pre>a
2476 </pre>
2477 <p><br />
2478 </p>
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>b
2484 </pre>
2485 <p>a
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 !!end
2494
2495 !! test
2496 Pres with newline attributes
2497 !! wikitext
2498 <pre class="one
2499 two">hi</pre>
2500 !! html/php
2501 <pre class="one two">hi</pre>
2502
2503 !! html/parsoid
2504 <pre class="one
2505 two" data-parsoid='{"stx":"html"}'>hi</pre>
2506 !! end
2507
2508 !! test
2509 Things that look like <pre> tags aren't treated as such
2510 !! wikitext
2511 Barack Obama <President> of the United States
2512 <President></President>
2513 !! html
2514 <p>Barack Obama &lt;President&gt; of the United States
2515 &lt;President&gt;&lt;/President&gt;
2516 </p>
2517 !! end
2518
2519 ## PHP parser discards the "<pre " string
2520 !! test
2521 Handle broken pre-like tags (bug 64025)
2522 !! options
2523 parsoid=wt2html
2524 !! wikitext
2525 {{echo|<pre <pre>x</pre>}}
2526
2527 <table><pre </table>
2528 !! html/php
2529 <pre>x</pre>
2530 <table><pre></pre></table>
2531
2532 !! html/parsoid
2533 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2534
2535
2536 <p>&lt;pre </p>
2537
2538 <table></table>
2539 !! end
2540
2541 !! test
2542 Parsoid: handle pre with space after attribute
2543 !! options
2544 parsoid=wt2html
2545 !! wikitext
2546 <pre style="width:50%;" >{{echo|foo}}</pre>
2547 !! html/php
2548 <pre style="width:50%;">{{echo|foo}}</pre>
2549
2550 !! html/parsoid
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552 !! end
2553
2554 # TODO / maybe: fix wt2wt for this
2555 !! test
2556 Parsoid: Don't paragraph-wrap fosterable content
2557 !! options
2558 parsoid=wt2html
2559 !! wikitext
2560 {|
2561 <td></td>
2562 <td></td>
2563
2564
2565
2566 |}
2567 !! html
2568 <table>
2569
2570 <tbody>
2571 <tr>
2572 <td></td>
2573
2574 <td></td></tr>
2575
2576
2577
2578 </tbody></table>
2579 !! end
2580
2581 !! test
2582 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2583 !! options
2584 parsoid=wt2html
2585 !! wikitext
2586 {|
2587 <td>
2588 <td>
2589 </td>
2590
2591
2592
2593 |}
2594 !! html
2595 <table>
2596
2597 <tbody>
2598 <tr>
2599 <td></td>
2600
2601 <td>
2602 </td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609
2610 #--------------------------------------------------------------------
2611 # Transclusion parameter whitespace stripping tests
2612 # Behavior is different for positional and named parameters
2613 #--------------------------------------------------------------------
2614 !! test
2615 Templates: Strip leading and trailing whitespace from named-param values
2616 !! wikitext
2617 {{echo|1= a }}
2618
2619 {{echo|1= {{echo|b}} }}
2620
2621 {{echo| 1 =
2622 c }}
2623
2624 {{echo| 1 =
2625 * d
2626 }}
2627 !! html
2628 <p>a
2629 </p><p>b
2630 </p><p>c
2631 </p>
2632 <ul><li> d</li></ul>
2633
2634 !! end
2635
2636 !! test
2637 Templates: Don't strip whitespace from positional-param values
2638 !! wikitext
2639 {{echo|a }}
2640
2641 {{echo|{{echo|b}} }}
2642
2643 {{echo| c
2644 }}
2645
2646 {{echo| {{echo|d}}
2647 }}
2648
2649 {{echo|
2650 e}}
2651
2652 {{echo|
2653 * f}}
2654
2655 {{echo|
2656 }}g
2657 !! html
2658 <p>a
2659 </p><p>b
2660 </p>
2661 <pre>c
2662 </pre>
2663 <p><br />
2664 </p>
2665 <pre>d
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>e
2670 </pre>
2671 <p><br />
2672 </p>
2673 <ul><li> f</li></ul>
2674 <p><br />
2675 </p>
2676 <pre>g
2677 </pre>
2678 !! end
2679
2680 !! test
2681 Templates: Handle empty comment-and-ws-only lines correctly
2682 !! wikitext
2683 {{echo|foo
2684 <!--should be ignored-->
2685 <!--should be ignored as well-->
2686 bar}}
2687 !! html
2688 <p>foo
2689 bar
2690 </p>
2691 !! end
2692
2693 !! test
2694 Templates: Handle comments in the target
2695 !! wikitext
2696 {{echo
2697 <!-- should be ignored -->
2698 |foo}}
2699
2700 {{echo<!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->|foo}}
2704
2705 {{<!-- should be ignored -->echo|foo}}
2706 !!html/parsoid
2707 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2708
2709 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2710
2711 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714 !!end
2715
2716 !! test
2717 Templates: Handle comments in parameter names (bug 67657)
2718 !! wikitext
2719 {{echo|1
2720 <!-- should be ignored -->
2721 =foo}}
2722
2723 {{echo|
2724 <!-- should be ignored -->
2725 1 = foo}}
2726
2727 {{echo|1<!-- should be ignored --> = foo}}
2728
2729 {{echo|<!-- should be ignored -->1 = foo}}
2730 !!html/parsoid
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2732
2733 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2734
2735 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2736
2737 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2738 !!end
2739
2740 !! test
2741 Templates: Other wikitext in parameter names (bug 67657)
2742 !! wikitext
2743 {{echo|''1''=foo}}
2744 !!html/parsoid
2745 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2746 !!html/php
2747 <p>{{{1}}}
2748 </p>
2749 !!end
2750
2751 #--------------------------------------------------------------------
2752 # Transclusion parameter escaping tests
2753 #--------------------------------------------------------------------
2754 !! test
2755 Templates: Parsoid parameter escaping test 1
2756 !! wikitext
2757 {{echo|[foo]|{{echo|[bar]}}}}
2758 !! html/php+tidy
2759 <p>[foo]</p>
2760 !! html/parsoid
2761 <p about="#mwt1" typeof="mw:Transclusion"
2762 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2763 !! end
2764
2765 !! test
2766 Parsoid: Pipes in external links in template parameter
2767 !! wikitext
2768 {{echo|[{{echo|http://example.com}} link]}}
2769 !! html/php+tidy
2770 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2771 !! html/parsoid
2772 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2773 !! end
2774
2775 !! test
2776 Parsoid: pipe in transclusion parameter
2777 !! wikitext
2778 {{echo|http://foo.com/a&#124;b}}
2779 !! html/php+tidy
2780 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2781 !! html/parsoid
2782 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2783 typeof="mw:Transclusion"
2784 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in external link target and content in template parameter
2789 !! options
2790 parsoid=html2wt,wt2wt
2791 !! wikitext
2792 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2793 !! html/php+tidy
2794 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2795 !! html/parsoid
2796 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2797 typeof="mw:Transclusion"
2798 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2799 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2800 !! end
2801
2802 !! test
2803 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2804 !! options
2805 parsoid
2806 !! wikitext
2807 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2808 !! html
2809 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2810 !! end
2811
2812 !! test
2813 Templates: Don't escape already nowiki-escaped text in template parameters
2814 !! options
2815 parsoid=html2wt,wt2wt
2816 !! wikitext
2817 {{echo|foo<nowiki>|</nowiki>bar}}
2818 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2819 {{echo|<nowiki></nowiki>}}
2820 !! html/php+tidy
2821 <p>foo|bar &lt;div&gt;</p>
2822 !! html/parsoid
2823 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2824 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2825 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2826 </p>
2827 !! end
2828
2829 ## Bug 52824
2830 !! test
2831 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|{{echo|1=bar}}}}
2836 !! html/php+tidy
2837 <p>bar</p>
2838 !! html/parsoid
2839 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2840 !! end
2841
2842 ## Bug 56733
2843 !! test
2844 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2845 !! wikitext
2846 {{echo|a : b}}
2847 !! html/php+tidy
2848 <p>a&#160;: b</p>
2849 !! html/parsoid
2850 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2851 !! end
2852
2853 ## Bug T73412
2854 !! test
2855 Templates: Preserve blank parameter names
2856 !! wikitext
2857 {{echo|=foo}}
2858 !! html/php+tidy
2859 <p>{{{1}}}</p>
2860 !! html/parsoid
2861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2862 !! end
2863
2864 !! test
2865 Templates: Preserve blank parameter names in other positions
2866 !! wikitext
2867 {{blank_param|bar|=foo}}
2868 !! html/php+tidy
2869 <p>bar foo</p>
2870 !! html/parsoid
2871 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2872 foo</p>
2873 !! end
2874
2875 ###
2876 ### Parsoid-centric tests for testing RT edge cases for pre
2877 ###
2878
2879 !!test
2880 1a. Indent-Pre and Comments
2881 !! wikitext
2882 a
2883 <!--a-->
2884 c
2885 !! html
2886 <pre>a
2887 </pre>
2888 <p>c
2889 </p>
2890 !!end
2891
2892 !!test
2893 1b. Indent-Pre and Comments
2894 !! wikitext
2895 a
2896 <!--a-->
2897 c
2898 !! html
2899 <pre>a
2900 </pre>
2901 <p>c
2902 </p>
2903 !!end
2904
2905 !!test
2906 1c. Indent-Pre and Comments
2907 !! wikitext
2908 <!--a--> a
2909
2910 <!--a--> a
2911 !! html
2912 <pre> a
2913 </pre>
2914 <pre> a
2915 </pre>
2916 !!end
2917
2918 !!test
2919 1d. Indent-Pre and Comments
2920 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2921 !! wikitext
2922 <!--a--> a
2923
2924 <!--b-->b
2925 !! html
2926 <pre>a
2927 </pre>
2928 <pre>b
2929 </pre>
2930 !!end
2931
2932 !!test
2933 2a. Indent-Pre and tables
2934 !! wikitext
2935 {|
2936 |-
2937 !h1!!h2
2938 |foo||bar
2939 |}
2940 !! html
2941 <table>
2942
2943 <tr>
2944 <th>h1</th>
2945 <th>h2
2946 </th>
2947 <td>foo</td>
2948 <td>bar
2949 </td></tr></table>
2950
2951 !!end
2952
2953 !!test
2954 2b. Indent-Pre and tables
2955 !! wikitext
2956 {|
2957 |-
2958 |foo
2959 |}
2960 !! html
2961 <table>
2962
2963 <tr>
2964 <td>foo
2965 </td></tr></table>
2966
2967 !!end
2968
2969 !!test
2970 2c. Indent-Pre and tables (bug 42252)
2971 !! wikitext
2972 {|
2973 |+ foo
2974 ! | bar
2975 |}
2976 !! html
2977 <table>
2978 <caption> foo
2979 </caption>
2980 <tr>
2981 <th> bar
2982 </th></tr></table>
2983
2984 !!end
2985
2986 !!test
2987 2d. Indent-Pre and tables
2988 !! wikitext
2989 a
2990 {|
2991 | b
2992 |}
2993 !! html/php
2994 <pre>a
2995 </pre>
2996 <table>
2997 <tr>
2998 <td> b
2999 </td></tr></table>
3000
3001 !! html/parsoid
3002 <pre>a</pre>
3003 <table>
3004 <tbody><tr><td> b</td></tr>
3005 </tbody></table>
3006 !!end
3007
3008 !!test
3009 2e. Indent-Pre and table-line syntax
3010 !! wikitext
3011 a
3012 | b
3013 | c
3014 !! html/php
3015 <pre>a
3016 | b
3017 | c
3018 </pre>
3019 !!end
3020
3021 !!test
3022 2f. Indent-pre started by table-line syntax
3023 !! wikitext
3024 a
3025 | b
3026 | c
3027 !! html/php
3028 <p>a
3029 </p>
3030 <pre>| b
3031 | c
3032 </pre>
3033 !! html/parsoid
3034 <p>a</p>
3035 <pre>
3036 | b
3037 | c</pre>
3038 !!end
3039
3040 !!test
3041 3a. Indent-Pre and block tags (single-line html)
3042 !! wikitext
3043 a <p> foo </p>
3044 b <div> foo </div>
3045 c <blockquote> foo </blockquote>
3046 <span> foo </span>
3047 !! html
3048 a <p> foo </p>
3049 b <div> foo </div>
3050 c <blockquote> foo </blockquote>
3051 <pre><span> foo </span>
3052 </pre>
3053 !! html/parsoid
3054 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3055 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3056 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3057 <pre><span> foo </span>
3058 </pre>
3059 !! html+tidy
3060 <p>a</p>
3061 <p>foo</p>
3062 <p>b</p>
3063 <div>foo</div>
3064 <p>c</p>
3065 <blockquote>
3066 <p>foo</p>
3067 </blockquote>
3068 <pre>
3069 <span> foo </span>
3070 </pre>
3071 !! end
3072
3073 !!test
3074 3b. Indent-Pre and block tags (multi-line html)
3075 !! wikitext
3076 a <span>foo</span>
3077 b <div> foo </div>
3078 !! html
3079 <pre>a <span>foo</span>
3080 </pre>
3081 b <div> foo </div>
3082
3083 !! html/parsoid
3084 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3085 b <div data-parsoid='{"stx":"html"}'> foo </div>
3086 !! html+tidy
3087 <pre>
3088 a <span>foo</span>
3089 </pre>
3090 <p>b</p>
3091 <div>foo</div>
3092 !!end
3093
3094 !!test
3095 3c. Indent-Pre and block tags (pre-content on separate line)
3096 !! wikitext
3097 <p>
3098 foo
3099 </p>
3100
3101 <div>
3102 foo
3103 </div>
3104
3105 <center>
3106 foo
3107 </center>
3108
3109 <blockquote>
3110 foo
3111 </blockquote>
3112
3113 <blockquote>
3114 <pre>
3115 foo
3116 </pre>
3117 </blockquote>
3118
3119 <table><tr><td>
3120 foo
3121 </td></tr></table>
3122
3123 <ul><li>
3124 foo
3125 </li></ul>
3126
3127 !! html
3128 <p>
3129 foo
3130 </p>
3131 <div>
3132 <pre>foo
3133 </pre>
3134 </div>
3135 <center>
3136 <pre>foo
3137 </pre>
3138 </center>
3139 <blockquote>
3140 <p> foo
3141 </p>
3142 </blockquote>
3143 <blockquote>
3144 <pre>
3145 foo
3146 </pre>
3147 </blockquote>
3148 <table><tr><td>
3149 <pre>foo
3150 </pre>
3151 </td></tr></table>
3152 <ul><li>
3153 foo
3154 </li></ul>
3155
3156 !!end
3157
3158 !!test
3159 4. Indent-Pre and extension tags
3160 !! wikitext
3161 a <gallery>
3162 File:foobar.jpg
3163 </gallery>
3164 !! html
3165 a <ul class="gallery mw-gallery-traditional">
3166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3167 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3168 <div class="gallerytext">
3169 </div>
3170 </div></li>
3171 </ul>
3172
3173 !! html+tidy
3174 <p>a</p>
3175 <ul class="gallery mw-gallery-traditional">
3176 <li class="gallerybox" style="width: 155px">
3177 <div style="width: 155px">
3178 <div class="thumb" style="width: 150px;">
3179 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3180 </div>
3181 <div class="gallerytext"></div>
3182 </div>
3183 </li>
3184 </ul>
3185 !!end
3186
3187 !! test
3188 Table wikitext syntax outside wiki-tables
3189 !! wikitext
3190 a
3191 ! not a table heading
3192 |- not a table row
3193 | not a table cell
3194 | class="foo bar" | baz
3195 b
3196 |}
3197 |-
3198 c
3199 !! html
3200 <p>a
3201 ! not a table heading
3202 |- not a table row
3203 | not a table cell
3204 | class="foo bar" | baz
3205 b
3206 |}
3207 |-
3208 c
3209 </p>
3210 !! end
3211
3212 !!test
3213 Render paragraphs when indent-pre is suppressed in blocklevels
3214 !! wikitext
3215 <blockquote>
3216 foo
3217
3218 bar
3219 </blockquote>
3220 !! html
3221 <blockquote>
3222 <p> foo
3223 </p><p> bar
3224 </p>
3225 </blockquote>
3226
3227 !!end
3228
3229 !!test
3230 4. Multiple spaces at start-of-line
3231 !! wikitext
3232 <p> foo </p>
3233 foo
3234 {|
3235 |foo
3236 |}
3237 !! html
3238 <p> foo </p>
3239 <pre> foo
3240 </pre>
3241 <table>
3242 <tr>
3243 <td>foo
3244 </td></tr></table>
3245
3246 !!end
3247
3248 ## NOTE: the leading white-space chars on empty line are significant
3249 !! test
3250 5a. White-space in indent-pre
3251 !! wikitext
3252 a<br />
3253
3254 b
3255 !! html
3256 <pre>a<br />
3257
3258 b
3259 </pre>
3260 !! end
3261
3262 ## NOTE: the leading white-space chars on empty line are significant
3263 !! test
3264 5b. White-space in indent-pre
3265 !! wikitext
3266 a
3267
3268 b
3269
3270
3271 c
3272 !! html
3273 <pre>a
3274
3275 b
3276
3277
3278 c
3279 </pre>
3280 !! end
3281
3282 !! test
3283 5c. White-space in indent-pre
3284 !! wikitext
3285 ''a''
3286 ''b''
3287 ''c''
3288 !! html
3289 <pre><i>a</i>
3290 <i>b</i>
3291 <i>c</i>
3292 </pre>
3293 !! end
3294
3295 !! test
3296 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3297 !! wikitext
3298 a
3299
3300 <!-- continue -->
3301 b
3302
3303 c
3304
3305 d
3306 !! html
3307 <pre>a
3308
3309 b
3310 </pre>
3311 <pre>c
3312
3313 </pre>
3314 <p>d
3315 </p>
3316 !! end
3317
3318 !! test
3319 7a. Indent-pre and category links
3320 !! options
3321 parsoid=wt2html,wt2wt
3322 !! wikitext
3323 [[Category:foo]] <!-- No pre-wrapping -->
3324 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3325 !! html/php+tidy
3326 !! html/parsoid
3327 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3328 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3329 !! end
3330
3331 !! test
3332 7b. Indent-pre and category links
3333 !! options
3334 parsoid=wt2html,wt2wt
3335 !! wikitext
3336 [[Category:foo]] a
3337 [[Category:foo]] {{echo|b}}
3338 !! html
3339 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3340 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3341 !! end
3342
3343 !! test
3344 Indent-Pre: Newlines in comments shouldn't affect sol state
3345 !! wikitext
3346 a <!--
3347 foo
3348 --> b
3349 !! html/php+tidy
3350 <p>a b</p>
3351 !! html/parsoid
3352 <p>a <!--
3353 foo
3354 --> b</p>
3355 !! end
3356
3357 ###
3358 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3359 ###
3360
3361 !!test
3362 HTML-pre: 1. embedded newlines
3363 !! wikitext
3364 <pre>foo</pre>
3365
3366 <pre>
3367 foo
3368 </pre>
3369
3370 <pre>
3371
3372 foo
3373 </pre>
3374
3375 <pre>
3376
3377
3378 foo
3379 </pre>
3380 !! html/php+tidy
3381 <pre>
3382 foo
3383 </pre>
3384 <pre>
3385 foo
3386 </pre>
3387 <pre>
3388
3389 foo
3390 </pre>
3391 <pre>
3392
3393
3394 foo
3395 </pre>
3396 !! html/parsoid
3397 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3398
3399 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3400 foo
3401 </pre>
3402
3403 <pre data-parsoid='{"stx":"html"}'>
3404
3405 foo
3406 </pre>
3407
3408 <pre data-parsoid='{"stx":"html"}'>
3409
3410
3411 foo
3412 </pre>
3413 !!end
3414
3415 !! test
3416 HTML-pre: big spaces
3417 !! wikitext
3418 <pre>
3419
3420
3421
3422
3423 haha
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 </pre>
3434 !! html/php+tidy
3435 <pre>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! html/parsoid
3452 <pre data-parsoid='{"stx":"html"}'>
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 </pre>
3468 !! end
3469
3470 !!test
3471 HTML-pre: 2: indented text
3472 !! wikitext
3473 <pre>
3474 foo
3475 </pre>
3476 !! html
3477 <pre>
3478 foo
3479 </pre>
3480
3481 !!end
3482
3483 !!test
3484 HTML-pre: 3: other wikitext
3485 !! wikitext
3486 <pre>
3487 * foo
3488 # bar
3489 = no-h =
3490 '' no-italic ''
3491 [[ NoLink ]]
3492 </pre>
3493 !! html/php
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501
3502 !! html/parsoid
3503 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509 !!end
3510
3511 ###
3512 ### Definition lists
3513 ###
3514 !! test
3515 Simple definition
3516 !! wikitext
3517 ; name : Definition
3518 !! html
3519 <dl><dt> name&#160;</dt>
3520 <dd> Definition</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Definition list for indentation only
3526 !! wikitext
3527 : Indented text
3528 !! html
3529 <dl><dd> Indented text</dd></dl>
3530
3531 !! end
3532
3533 !! test
3534 Definition list with no space
3535 !! wikitext
3536 ;name:Definition
3537 !! html
3538 <dl><dt>name</dt>
3539 <dd>Definition</dd></dl>
3540
3541 !!end
3542
3543 !! test
3544 Definition list with URL link
3545 !! wikitext
3546 ; http://example.com/ : definition
3547 !! html
3548 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3549 <dd> definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list with bracketed URL link
3555 !! wikitext
3556 ;[http://www.example.com/ Example]:Something about it
3557 !! html
3558 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3559 <dd>Something about it</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition list with wikilink containing colon
3565 !! wikitext
3566 ; [[Help:FAQ]]: The least-read page on Wikipedia
3567 !! html
3568 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3569 <dd> The least-read page on Wikipedia</dd></dl>
3570
3571 !! end
3572
3573 # At Brion's and JeLuF's insistence... :)
3574 !! test
3575 Definition list with news link containing colon
3576 !! wikitext
3577 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3578 !! html/php
3579 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3580 <dd> This isn't even a real newsgroup!</dd></dl>
3581
3582 !! html/parsoid
3583 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3584 !! end
3585
3586 !! test
3587 Malformed definition list with colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3590 !! html
3591 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3592
3593 !! end
3594
3595 !! test
3596 Definition lists: colon in external link text
3597 !! wikitext
3598 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3599 !! html
3600 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3601 <dd> OK, I made that up</dd></dl>
3602
3603 !! end
3604
3605 !! test
3606 Definition lists: colon in HTML attribute
3607 !! wikitext
3608 ;<b style="display: inline">bold</b>
3609 !! html
3610 <dl><dt><b style="display: inline">bold</b></dt></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition lists: self-closed tag
3616 !! wikitext
3617 ;one<br/>two : two-line fun
3618 !! html
3619 <dl><dt>one<br />two&#160;</dt>
3620 <dd> two-line fun</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Bug 11748: Literal closing tags
3626 !! wikitext
3627 <dl>
3628 <dt>test 1</dt>
3629 <dd>test test test test test</dd>
3630 <dt>test 2</dt>
3631 <dd>test test test test test</dd>
3632 </dl>
3633 !! html
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3645 !! wikitext
3646 <ul><li>
3647 ; term : description
3648 * unordered
3649 </li></ul>
3650 !! html
3651 <ul><li>
3652 <dl><dt> term&#160;</dt>
3653 <dd> description</dd></dl>
3654 <ul><li> unordered</li></ul>
3655 </li></ul>
3656
3657 !! end
3658
3659 !! test
3660
3661 Definition list with empty definition and following paragraph
3662 !! wikitext
3663 ; term:
3664 Paragraph text
3665 !! html
3666 <dl><dt> term</dt>
3667 <dd></dd></dl>
3668 <p>Paragraph text
3669 </p>
3670 !! end
3671
3672 !! test
3673 Nested definition lists using html syntax
3674 !! wikitext
3675 <dl><dt>x</dt>
3676 <dd>a</dd>
3677 <dd>b</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition Lists: No nesting: Multiple dd's
3683 !! wikitext
3684 ;x
3685 :a
3686 :b
3687 !! html
3688 <dl><dt>x</dt>
3689 <dd>a</dd>
3690 <dd>b</dd></dl>
3691
3692 !! end
3693
3694 !! test
3695 Definition Lists: Indentation: Regular
3696 !! wikitext
3697 :i1
3698 ::i2
3699 :::i3
3700 !! html
3701 <dl><dd>i1
3702 <dl><dd>i2
3703 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3704
3705 !! end
3706
3707 !! test
3708 Definition Lists: Indentation: Missing 1st level
3709 !! wikitext
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd><dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Multi-level indent
3720 !! wikitext
3721 :::i3
3722 !! html
3723 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Hacky use to indent tables
3729 !! wikitext
3730 ::{|
3731 |foo
3732 |bar
3733 |}
3734 this text
3735 should be left alone
3736 !! html
3737 <dl><dd><dl><dd><table>
3738 <tr>
3739 <td>foo
3740 </td>
3741 <td>bar
3742 </td></tr></table></dd></dl></dd></dl>
3743 <p>this text
3744 should be left alone
3745 </p>
3746 !! end
3747
3748 !! test
3749 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3750 !! wikitext
3751 <!-- foo -->
3752 ::{|
3753 |foo
3754 |bar
3755 |}<!-- bar -->
3756 this text
3757 should be left alone
3758 !! html/parsoid
3759 <!-- foo -->
3760 <dl><dd><dl><dd><table><tr>
3761 <td>foo</td>
3762 <td>bar</td>
3763 </tr></table><!-- bar --></dd></dl></dd></dl>
3764 <p>this text
3765 should be left alone</p>
3766 !! end
3767
3768 !! test
3769 Definition Lists: Hacky use to indent tables, with comment before table
3770 !! wikitext
3771 ::<!-- foo -->{|
3772 |foo
3773 |}
3774 !! html/parsoid
3775 <dl><dd><dl><dd><!-- foo --><table><tr>
3776 <td>foo</td>
3777 </tr></table></dd></dl></dd></dl>
3778 !! end
3779
3780 # The trailing whitespace in this test is to catch a regression in
3781 # Parsoid after T54473.
3782 !! test
3783 Definition Lists: Hacky use to indent tables (WS-insensitive)
3784 !! wikitext
3785 : {|
3786 |a
3787 |}
3788 !! html/php
3789 <dl><dd><table>
3790 <tr>
3791 <td>a
3792 </td></tr></table></dd></dl>
3793
3794 !! html/parsoid
3795 <dl><dd> <table>
3796 <tbody><tr><td>a</td></tr>
3797 </tbody></table> </dd></dl>
3798 !! end
3799
3800 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3801 ## as an empty dt item. It also ignores all but the last ";" when followed
3802 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3803 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3804 ## ";"s.
3805 ##
3806 ## Ex: ";;t2 ::d2" is transformed into:
3807 ##
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>
3811 ## <dl>
3812 ## <dt></dt>
3813 ## <dd>d2</dd>
3814 ## </dl>
3815 ## </dd>
3816 ## </dl>
3817 ##
3818 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3819 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3820 ##
3821 ## <dl>
3822 ## <dt>
3823 ## <dl>
3824 ## <dt>t2 </dt>
3825 ## <dd>:d2</dd>
3826 ## </dl>
3827 ## </dt>
3828 ## </dl>
3829 ##
3830 ## All Parsoid only definition list tests have this difference.
3831 ##
3832 ## See also: https://phabricator.wikimedia.org/T8569
3833 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3834
3835 !! test
3836 Table / list interaction: indented table with lists in table contents
3837 !! wikitext
3838 :{|
3839 |-
3840 | a
3841 * b
3842 |-
3843 | c
3844 * d
3845 |}
3846 !! html
3847 <dl><dd><table>
3848
3849 <tr>
3850 <td> a
3851 <ul><li> b</li></ul>
3852 </td></tr>
3853 <tr>
3854 <td> c
3855 <ul><li> d</li></ul>
3856 </td></tr></table></dd></dl>
3857
3858 !! end
3859
3860 !!test
3861 Table / list interaction: lists nested in tables nested in indented lists
3862 !! wikitext
3863 :{|
3864 |
3865 :a
3866 :b
3867 |
3868 *c
3869 *d
3870 |}
3871
3872 *e
3873 *f
3874 !! html
3875 <dl><dd><table>
3876 <tr>
3877 <td>
3878 <dl><dd>a</dd>
3879 <dd>b</dd></dl>
3880 </td>
3881 <td>
3882 <ul><li>c</li>
3883 <li>d</li></ul>
3884 </td></tr></table></dd></dl>
3885 <ul><li>e</li>
3886 <li>f</li></ul>
3887
3888 !!end
3889
3890 !! test
3891 Definition Lists: Nesting: Multi-level (Parsoid only)
3892 !! options
3893 parsoid
3894 !! wikitext
3895 ;t1 :d1
3896 ;;t2 ::d2
3897 ;;;t3 :::d3
3898 !! html
3899 <dl>
3900 <dt>t1 </dt>
3901 <dd>d1</dd>
3902 <dt>
3903 <dl>
3904 <dt>t2 </dt>
3905 <dd>:d2</dd>
3906 <dt>
3907 <dl>
3908 <dt>t3 </dt>
3909 <dd>::d3</dd>
3910 </dl>
3911 </dt>
3912 </dl>
3913 </dt>
3914 </dl>
3915
3916
3917 !! end
3918
3919
3920 !! test
3921 Definition Lists: Nesting: Test 2 (Parsoid only)
3922 !! wikitext
3923 ;t1
3924 ::d2
3925 !! html/php+tidy
3926 <dl>
3927 <dt>t1</dt>
3928 <dd>
3929 <dl>
3930 <dd>d2</dd>
3931 </dl>
3932 </dd>
3933 </dl>
3934 !! html/parsoid
3935 <dl>
3936 <dt>t1</dt>
3937 <dd>
3938 <dl>
3939 <dd>d2</dd>
3940 </dl>
3941 </dd>
3942 </dl>
3943
3944 !! end
3945
3946
3947 !! test
3948 Definition Lists: Nesting: Test 3 (Parsoid only)
3949 !! wikitext
3950 :;t1
3951 ::::d2
3952 !! html/php+tidy
3953 <dl>
3954 <dd>
3955 <dl>
3956 <dt>t1</dt>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 !! html/parsoid
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dt>t1</dt>
3974 <dd>
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dd>d2</dd>
3979 </dl>
3980 </dd>
3981 </dl>
3982 </dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986
3987 !! end
3988
3989
3990 !! test
3991 Definition Lists: Nesting: Test 4
3992 !! wikitext
3993 ::;t3
3994 :::d3
3995 !! html
3996 <dl><dd><dl><dd><dl><dt>t3</dt>
3997 <dd>d3</dd></dl></dd></dl></dd></dl>
3998
3999 !! end
4000
4001
4002 ## The Parsoid team believes the following three test exposes a
4003 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4004 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4005 ## It also exposes a "misfeature" in tidy, which doesn't like
4006 ## <dl> tags with a single <dt> child; it converts the <dt> into
4007 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4008 !! test
4009 Definition Lists: Mixed Lists: Test 1
4010 !! wikitext
4011 :;* foo
4012 ::* bar
4013 :; baz
4014 !! html/php
4015 <dl><dd><dl><dt><ul><li> foo</li>
4016 <li> bar</li></ul></dt></dl>
4017 <dl><dt> baz</dt></dl></dd></dl>
4018
4019 !! html/php+tidy
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <ul>
4025 <li>foo</li>
4026 <li>bar</li>
4027 </ul>
4028 </dd>
4029 </dl>
4030 <dl>
4031 <dt>baz</dt>
4032 </dl>
4033 </dd>
4034 </dl>
4035 !! html/parsoid
4036 <dl>
4037 <dd><dl>
4038 <dt><ul>
4039 <li> foo
4040 </li>
4041 </ul></dt>
4042 <dd><ul>
4043 <li> bar
4044 </li>
4045 </ul></dd>
4046 <dt> baz</dt>
4047 </dl></dd>
4048 </dl>
4049 !! end
4050
4051 !! test
4052 Definition Lists: Mixed Lists: Test 2
4053 !! wikitext
4054 *: d1
4055 *: d2
4056 !! html
4057 <ul><li><dl><dd> d1</dd>
4058 <dd> d2</dd></dl></li></ul>
4059
4060 !! end
4061
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 3
4065 !! wikitext
4066 *::: d1
4067 *::: d2
4068 !! html
4069 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 4
4077 !! wikitext
4078 *;d1 :d2
4079 *;d3 :d4
4080 !! html
4081 <ul><li><dl><dt>d1&#160;</dt>
4082 <dd>d2</dd>
4083 <dt>d3&#160;</dt>
4084 <dd>d4</dd></dl></li></ul>
4085
4086 !! end
4087
4088
4089 !! test
4090 Definition Lists: Mixed Lists: Test 5
4091 !! wikitext
4092 *:d1
4093 *:: d2
4094 !! html
4095 <ul><li><dl><dd>d1
4096 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 6
4103 !! wikitext
4104 #*:d1
4105 #*::: d3
4106 !! html
4107 <ol><li><ul><li><dl><dd>d1
4108 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 7
4115 !! wikitext
4116 :* d1
4117 :* d2
4118 !! html
4119 <dl><dd><ul><li> d1</li>
4120 <li> d2</li></ul></dd></dl>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 8
4127 !! wikitext
4128 :* d1
4129 ::* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li></ul>
4132 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 9
4139 !! wikitext
4140 *;foo :bar
4141 !! html
4142 <ul><li><dl><dt>foo&#160;</dt>
4143 <dd>bar</dd></dl></li></ul>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 10
4150 !! wikitext
4151 *#;foo :bar
4152 !! html
4153 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ol></li></ul>
4155
4156 !! end
4157
4158 # The Parsoid team disagrees with the PHP parser's seemingly-random
4159 # rules regarding dd/dt on the next two tests. Parsoid is more
4160 # consistent, and recognizes the shared nesting and keeps the
4161 # still-open tags around until the nesting is complete.
4162 # (And tidy again converts <dt> to <dd> before 'bar'.)
4163
4164 !! test
4165 Definition Lists: Mixed Lists: Test 11
4166 !! wikitext
4167 *#*#;*;;foo :bar
4168 *#*#;boo :baz
4169 !! html/php
4170 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4171 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4172 <dl><dt>boo&#160;</dt>
4173 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4174
4175 !! html/php+tidy
4176 <ul>
4177 <li>
4178 <ol>
4179 <li>
4180 <ul>
4181 <li>
4182 <ol>
4183 <li>
4184 <dl>
4185 <dt>foo&#160;</dt>
4186 <dd>
4187 <ul>
4188 <li>
4189 <dl>
4190 <dd>
4191 <dl>
4192 <dt>bar</dt>
4193 </dl>
4194 </dd>
4195 </dl>
4196 </li>
4197 </ul>
4198 </dd>
4199 </dl>
4200 <dl>
4201 <dt>boo&#160;</dt>
4202 <dd>baz</dd>
4203 </dl>
4204 </li>
4205 </ol>
4206 </li>
4207 </ul>
4208 </li>
4209 </ol>
4210 </li>
4211 </ul>
4212 !! html/parsoid
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <ul>
4218 <li>
4219 <ol>
4220 <li>
4221 <dl>
4222 <dt>
4223 <ul>
4224 <li>
4225 <dl>
4226 <dt>
4227 <dl>
4228 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4229 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4230 </dl></dt>
4231 </dl></li>
4232 </ul></dt>
4233 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4234 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4235 </dl></li>
4236 </ol></li>
4237 </ul></li>
4238 </ol></li>
4239 </ul>
4240 !! end
4241
4242
4243 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4244 # From whitelist:
4245 # * The test is wrong, there are two colons where there should be :;
4246 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4247 !! test
4248 Definition Lists: Weird Ones: Test 1
4249 !! wikitext
4250 *#;*::;; foo : bar (who uses this?)
4251 !! html/php
4252 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4253 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4254
4255 !! html/php+tidy
4256 <ul>
4257 <li>
4258 <ol>
4259 <li>
4260 <dl>
4261 <dt>foo&#160;</dt>
4262 <dd>
4263 <ul>
4264 <li>
4265 <dl>
4266 <dd>
4267 <dl>
4268 <dd>
4269 <dl>
4270 <dd>
4271 <dl>
4272 <dt>bar (who uses this?)</dt>
4273 </dl>
4274 </dd>
4275 </dl>
4276 </dd>
4277 </dl>
4278 </dd>
4279 </dl>
4280 </li>
4281 </ul>
4282 </dd>
4283 </dl>
4284 </li>
4285 </ol>
4286 </li>
4287 </ul>
4288 !! html/parsoid
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dd>
4299 <dl>
4300 <dd>
4301 <dl>
4302 <dt>
4303 <dl>
4304 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4305 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4306 </dl></dt>
4307 </dl></dd>
4308 </dl></dd>
4309 </dl></li>
4310 </ul></dt>
4311 </dl></li>
4312 </ol></li>
4313 </ul>
4314 !! end
4315
4316 !! test
4317 Definition Lists: colons occurring in tags
4318 !! wikitext
4319 ;a:b
4320 ;'''a:b'''
4321 ;<i>a:b</i>
4322 ;<span>a:b</span>
4323 ;<div>a:b</div>
4324 ;<div>a
4325 :b</div>
4326 ;{{echo|a:b}}
4327 ;{{echo|''a:b''}}
4328 ;;;''a:b''
4329 !! html+tidy
4330 <dl>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><b>a:b</b></dt>
4334 <dt><i>a:b</i></dt>
4335 <dt><span>a:b</span></dt>
4336 <dd>
4337 <div>a:b</div>
4338 </dd>
4339 <dd>
4340 <div>a
4341 <dl>
4342 <dd>b</dd>
4343 </dl>
4344 </div>
4345 </dd>
4346 <dt>a</dt>
4347 <dd>b</dd>
4348 <dt><i>a:b</i></dt>
4349 </dl>
4350 <dl>
4351 <dd>
4352 <dl>
4353 <dd>
4354 <dl>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 </dd>
4358 </dl>
4359 </dd>
4360 </dl>
4361 !! html/parsoid
4362 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4363 <dt><b>a:b</b></dt>
4364 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4365 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4366 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4367 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4368 <dd>b</dd>
4369 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4370 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4371 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4372 !! end
4373
4374 !! test
4375 Definition Lists: colons and tables 1
4376 !! wikitext
4377 :{|
4378 | x
4379 |}
4380 :{|
4381 | y
4382 |}
4383 !! html
4384 <dl><dd><table>
4385 <tr>
4386 <td> x
4387 </td></tr></table></dd></dl>
4388 <dl><dd><table>
4389 <tr>
4390 <td> y
4391 </td></tr></table></dd></dl>
4392
4393 !! end
4394
4395 # Parsoid's output (as documented below) differs from php's in this case.
4396 # This is probably a bug. If we fixup parsoid to match php's output, the
4397 # above test should pass and the below test case can be removed. It is
4398 # unclear which output is more desirable.
4399
4400 !! test
4401 Definition Lists: colons and tables 2
4402 !! wikitext
4403 :{|
4404 | x
4405 |}
4406 :{|
4407 | y
4408 |}
4409 !! html/parsoid
4410 <dl><dd><table>
4411 <tr>
4412 <td> x
4413 </td></tr></table></dd>
4414 <dd><table>
4415 <tr>
4416 <td> y
4417 </td></tr></table></dd></dl>
4418 !! end
4419
4420 !! test
4421 Definition Lists: template interaction
4422 !! wikitext
4423 ::{{definition_list}}
4424
4425 :one
4426 ::{{definition_list}}
4427 :::two
4428 :::three
4429 ::four
4430 !! html/parsoid
4431 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4432 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4433
4434 <dl><dd data-parsoid='{}'>one
4435 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4436 </span><dd about="#mwt2">two
4437 <dl><dd>two</dd>
4438 <dd>three</dd></dl></dd>
4439 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4440 !! end
4441
4442
4443 ###
4444 ### External links
4445 ###
4446 !! test
4447 External links: non-bracketed
4448 !! wikitext
4449 Non-bracketed: http://example.com
4450 !! html
4451 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4452 </p>
4453 !! end
4454
4455 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4456 !! test
4457 External links: numbered
4458 !! wikitext
4459 Numbered: [http://example.com]
4460 Numbered: [http://example.net]
4461 Numbered: [http://example.com]
4462 !! html/php
4463 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4464 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4466 </p>
4467 !! html/parsoid
4468 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4469 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4470 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4471 !!end
4472
4473 !! test
4474 External links: specified text
4475 !! wikitext
4476 Specified text: [http://example.com link]
4477 !! html
4478 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 External links: trail
4484 !! wikitext
4485 Linktrails should not work for external links: [http://example.com link]s
4486 !! html
4487 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4488 </p>
4489 !! end
4490
4491 !! test
4492 External links: dollar sign in URL
4493 !! wikitext
4494 http://example.com/1$2345
4495 !! html
4496 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4497 </p>
4498 !! end
4499
4500 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4501 !! test
4502 External links: dollar sign in URL (autonumber)
4503 !! wikitext
4504 [http://example.com/1$2345]
4505 !! html/php
4506 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4507 </p>
4508 !! html/parsoid
4509 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4510 !!end
4511
4512 !! test
4513 External links: open square bracket forbidden in URL (bug 4377)
4514 !! options
4515 parsoid=wt2html,wt2wt,html2html
4516 !! wikitext
4517 http://example.com/1[2345
4518 !! html/php
4519 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4520 </p>
4521 !! html/parsoid
4522 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4523 !! end
4524
4525 !! test
4526 External links: open square bracket forbidden in URL (named) (bug 4377)
4527 !! options
4528 parsoid=wt2html,html2html
4529 !! wikitext
4530 [http://example.com/1[2345]
4531 !! html/php
4532 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4533 </p>
4534 !! html/parsoid
4535 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4536 !!end
4537
4538 # parsoid adds a space before the link name
4539 !! test
4540 External links: open square bracket forbidden in URL (named) (bug 4377)
4541 Parsoid variant.
4542 !! wikitext
4543 [http://example.com/1 [2345]
4544 !! html
4545 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4546 </p>
4547 !!end
4548
4549 !! test
4550 External links: nowiki in URL link text (bug 6230)
4551 !! wikitext
4552 [http://example.com/ <nowiki>''example site''</nowiki>]
4553 !! html
4554 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4555 </p>
4556 !! end
4557
4558 !! test
4559 External links: newline forbidden in text (bug 6230 regression check)
4560 !! wikitext
4561 [http://example.com/ first
4562 second]
4563 !! html
4564 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4565 second]
4566 </p>
4567 !!end
4568
4569 !! test
4570 External links: Pipe char between url and text
4571 !! wikitext
4572 [http://example.com | link]
4573 !! html
4574 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4575 </p>
4576 !!end
4577
4578 !! test
4579 External links: protocol-relative URL in brackets
4580 !! wikitext
4581 [//example.com/ Test]
4582 !! html
4583 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4584 </p>
4585 !! end
4586
4587 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4588 !! test
4589 External links: protocol-relative URL in brackets without text
4590 !! wikitext
4591 [//example.com]
4592 !! html/php
4593 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4594 </p>
4595 !! html/parsoid
4596 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4597 !! end
4598
4599 !! test
4600 External links: protocol-relative URL in free text is left alone
4601 !! wikitext
4602 //example.com/Foo
4603 !! html
4604 <p>//example.com/Foo
4605 </p>
4606 !!end
4607
4608 !! test
4609 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4610 !! wikitext
4611 foo//example.com/Foo
4612 !! html
4613 <p>foo//example.com/Foo
4614 </p>
4615 !! end
4616
4617 !! test
4618 External links: with no contents
4619 !! wikitext
4620 [http://en.wikipedia.org/wiki/Foo]
4621
4622 [[wikipedia:Foo|Bar]]
4623
4624 [[wikipedia:Foo|<span>Bar</span>]]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4627 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4628 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4629 </p>
4630 !! html/parsoid
4631 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4632 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4633 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4634 !! end
4635
4636 !! test
4637 External links: Free with trailing punctuation
4638 !! wikitext
4639 http://example.com,
4640 http://example.com;
4641 http://example.com\
4642 http://example.com.
4643 http://example.com:
4644 http://example.com!
4645 http://example.com?
4646 http://example.com)
4647 http://example.com/url_with_(brackets)
4648 (http://example.com/url_without_brackets)
4649 http://example.com/url_with_entity&amp;
4650 http://example.com/url_with_entity&#x26;
4651 http://example.com/url_with_entity&#038;
4652 http://example.com/url_with_entity&nbsp;
4653 http://example.com/url_with_entity&#xA0;
4654 http://example.com/url_with_entity&#160;
4655 http://example.com/url_with_entity&lt;
4656 http://example.com/url_with_entity&#x3C;
4657 http://example.com/url_with_entity&#60;
4658 !! html/php
4659 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4661 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4664 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4665 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4667 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4670 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4671 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4672 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4673 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4674 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4678 </p>
4679 !! html/parsoid
4680 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4681 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4682 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4683 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4684 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4685 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4686 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4687 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4688 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4689 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4690 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4691 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4692 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4693 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4694 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4695 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4696 !! end
4697
4698 !! test
4699 External links: Lone protocols are never linked (T105697)
4700 !! wikitext
4701 http://
4702 http://;
4703 (http://)
4704 bitcoin:
4705 bitcoin:;
4706 (bitcoin:)
4707 !! html
4708 <p>http://
4709 http://;
4710 (http://)
4711 bitcoin:
4712 bitcoin:;
4713 (bitcoin:)
4714 </p>
4715 !! end
4716
4717 !! test
4718 External links: No preceding word characters allowed (bug 65278)
4719 !! wikitext
4720 NOPEhttp://example.com
4721 N0http://example.com
4722 ok:http://example.com
4723 ok-http://example.com
4724 !! html
4725 <p>NOPEhttp://example.com
4726 N0http://example.com
4727 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4728 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4729 </p>
4730 !! end
4731
4732 !! test
4733 External image
4734 !! wikitext
4735 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4736 !! html
4737 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4738 </p>
4739 !! end
4740
4741 !! test
4742 External image from https
4743 !! wikitext
4744 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4745 !! html
4746 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4747 </p>
4748 !! end
4749
4750 !! test
4751 External image (when not allowed)
4752 !! options
4753 wgAllowExternalImages=0
4754 !! wikitext
4755 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4756 !! html
4757 <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>
4758 </p>
4759 !! end
4760
4761 !! test
4762 Link to non-http image, no img tag
4763 !! wikitext
4764 Link to non-http image, no img tag: ftp://example.com/test.jpg
4765 !! html
4766 <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>
4767 </p>
4768 !! end
4769
4770 !! test
4771 External links: terminating separator
4772 !! wikitext
4773 Terminating separator: http://example.com/thing,
4774 !! html
4775 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4776 </p>
4777 !! end
4778
4779 !! test
4780 External links: intervening separator
4781 !! wikitext
4782 Intervening separator: http://example.com/1,2,3
4783 !! html
4784 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4785 </p>
4786 !! end
4787
4788 !! test
4789 External links: old bug with URL in query
4790 !! wikitext
4791 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4792 !! html
4793 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4794 </p>
4795 !! end
4796
4797 !! test
4798 External links: old URL-in-URL bug, mixed protocols
4799 !! wikitext
4800 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4801 !! html
4802 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4803 </p>
4804 !!end
4805
4806 !! test
4807 External links: URL in text
4808 !! wikitext
4809 URL in text: [http://example.com http://example.com]
4810 !! html
4811 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4812 </p>
4813 !! end
4814
4815 !! test
4816 External links: Clickable images
4817 !! wikitext
4818 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4819 !! html/php
4820 <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>
4821 </p>
4822 !! html/parsoid
4823 <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>
4824 !! end
4825
4826 !! test
4827 External links: raw ampersand
4828 !! wikitext
4829 Old &amp; use: http://x&y
4830 !! html
4831 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: encoded ampersand
4837 !! wikitext
4838 Old &amp; use: http://x&amp;y
4839 !! html/php
4840 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4841 </p>
4842 !! html/parsoid
4843 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4844 !! end
4845
4846 !! test
4847 External links: encoded equals (bug 6102)
4848 !! wikitext
4849 http://example.com/?foo&#61;bar
4850 !! html/php
4851 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4852 </p>
4853 !! html/parsoid
4854 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4855 !! end
4856
4857 ##
4858 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4859 ## does it number them. As discussed in bug 53505, we can identify
4860 ## autonumbered links via CSS.
4861 ##
4862
4863 !! test
4864 External links: [raw ampersand]
4865 !! wikitext
4866 Old &amp; use: [http://x&y]
4867 !! html/php
4868 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4869 </p>
4870 !! html/parsoid
4871 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4872 !! end
4873
4874 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4875 # mode will return the [raw ampersand] wikitext
4876 !! test
4877 External links: [encoded ampersand]
4878 !! options
4879 parsoid=wt2html,wt2wt,html2html
4880 !! wikitext
4881 Old &amp; use: [http://x&amp;y]
4882 !! html/php
4883 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4884 </p>
4885 !! html/parsoid
4886 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4887 !! end
4888
4889 !! test
4890 External links: [raw equals]
4891 !! wikitext
4892 [http://example.com/?foo=bar]
4893 !! html/php
4894 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4895 </p>
4896 !! html/parsoid
4897 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4898 !! end
4899
4900 # note that parsoid html is identical to [raw equals] case; so html2wt
4901 # mode will return the [raw equals] wikitext
4902 !! test
4903 External links: [encoded equals] (bug 6102)
4904 !! options
4905 parsoid=wt2html,wt2wt,html2html
4906 !! wikitext
4907 [http://example.com/?foo&#61;bar]
4908 !! html/php
4909 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4910 </p>
4911 !! html/parsoid
4912 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4913 !! end
4914
4915 # xxx parsoid strips the IDN character, so the round-trip tests will
4916 # obviously fail and are disabled. --cscott
4917 !! test
4918 External links: [IDN ignored character reference in hostname; strip it right off]
4919 !! options
4920 parsoid=wt2html,wt2wt,html2html
4921 !! wikitext
4922 [http://e&zwnj;xample.com/]
4923 !! html/php
4924 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4925 </p>
4926 !! html/parsoid
4927 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4928 !! end
4929
4930 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4931 # Where an external link could easily circumvent the sanitization of the text of
4932 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4933 # test demands a higher standard. That's a bit strange.
4934 #
4935 # Example:
4936 #
4937 # http://e‌xample.com -> [http://example.com|http://example.com]
4938 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4939 #
4940 # The first example is sanitized, but the second is not. Any security benefits
4941 # from this production are trivial to circumvent. Either remove this test and
4942 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4943 # the test accordingly.
4944 #
4945 # All our love,
4946 # The Parsoid team.
4947 # xxx parsoid strips the IDN character, so the round-trip tests will
4948 # obviously fail and are disabled. --cscott
4949 !! test
4950 External links: IDN ignored character reference in hostname; strip it right off
4951 !! options
4952 parsoid=wt2html,html2html
4953 !! wikitext
4954 http://e&zwnj;xample.com/
4955 !! html/php
4956 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4960 !! end
4961
4962 !! test
4963 External links: www.jpeg.org (bug 554)
4964 !! wikitext
4965 http://www.jpeg.org
4966 !! html
4967 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4968 </p>
4969 !! end
4970
4971 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4972 !! test
4973 External links: URL within URL (original bug 2)
4974 !! wikitext
4975 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4976 !! html/php
4977 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4981 !! end
4982
4983 !! test
4984 BUG 361: URL inside bracketed URL
4985 !! wikitext
4986 [http://www.example.com/foo http://www.example.com/bar]
4987 !! html
4988 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4989 </p>
4990 !! end
4991
4992 !! test
4993 BUG 361: URL within URL, not bracketed
4994 !! wikitext
4995 http://www.example.com/foo?=http://www.example.com/bar
4996 !! html
4997 <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>
4998 </p>
4999 !! end
5000
5001 !! test
5002 BUG 289: ">"-token in URL-tail
5003 !! wikitext
5004 http://www.example.com/<hello>
5005 !! html
5006 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5007 </p>
5008 !!end
5009
5010 !! test
5011 BUG 289: literal ">"-token in URL-tail
5012 !! wikitext
5013 http://www.example.com/<b>html</b>
5014 !! html/php
5015 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5016 </p>
5017 !! html/parsoid
5018 <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>
5019 !! end
5020
5021 !! test
5022 BUG 289: ">"-token in bracketed URL
5023 !! wikitext
5024 [http://www.example.com/<hello> stuff]
5025 !! html
5026 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5027 </p>
5028 !!end
5029
5030 !! test
5031 BUG 289: literal ">"-token in bracketed URL
5032 !! wikitext
5033 [http://www.example.com/<b>html</b> stuff]
5034 !! html
5035 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5036 </p>
5037 !!end
5038
5039 !! test
5040 BUG 289: literal double quote at end of URL
5041 !! wikitext
5042 http://www.example.com/"hello"
5043 !! html
5044 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5045 </p>
5046 !!end
5047
5048 !! test
5049 BUG 289: literal double quote in bracketed URL
5050 !! wikitext
5051 [http://www.example.com/"hello" stuff]
5052 !! html
5053 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5054 </p>
5055 !!end
5056
5057 !! test
5058 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5059 !! wikitext
5060 [http://www.example.com test]
5061 !! html
5062 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5063 </p>
5064 !! end
5065
5066 !! test
5067 External links: link text with spaces
5068 !! wikitext
5069 [http://www.example.com a b c]
5070 [http://www.example.com ''a'' ''b'']
5071 !! html
5072 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5073 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5074 </p>
5075 !! end
5076
5077 !! test
5078 External links: wiki links within external link (Bug 3695)
5079 !! wikitext
5080 [http://example.com [[wikilink]] embedded in ext link]
5081 !! html/php
5082 <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>
5083 </p>
5084 !! html/parsoid
5085 <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>
5086 !! end
5087
5088 !! test
5089 BUG 787: Links with one slash after the url protocol are invalid
5090 !! wikitext
5091 http:/example.com
5092
5093 [http:/example.com title]
5094 !! html
5095 <p>http:/example.com
5096 </p><p>[http:/example.com title]
5097 </p>
5098 !! end
5099
5100 !! test
5101 Bracketed external links with template-generated invalid target
5102 !! wikitext
5103 [{{echo|http:/example.com}} title]
5104 !! html
5105 <p>[http:/example.com title]
5106 </p>
5107 !! end
5108
5109 !! test
5110 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5111 !! wikitext
5112 ''[http://example.com text'']
5113 [http://example.com '''text]'''
5114 ''Something [http://example.com in italic'']
5115 ''Something [http://example.com mixed''''', even bold]'''
5116 '''''Now [http://example.com both''''']
5117 !! html
5118 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5119 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5120 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5121 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5122 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5123 </p>
5124 !! end
5125
5126
5127 !! test
5128 Bug 4781: %26 in URL
5129 !! wikitext
5130 http://www.example.com/?title=AT%26T
5131 !! html/php
5132 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5133 </p>
5134 !! html/parsoid
5135 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5136 !! end
5137
5138 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5139 # % is actually legal in HTML5. Any change in output would need testing though.
5140 !! test
5141 Bug 4781, 5267: %25 in URL
5142 !! wikitext
5143 http://www.example.com/?title=100%25_Bran
5144 !! html/php
5145 <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>
5146 </p>
5147 !! html/parsoid
5148 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5149 !! end
5150
5151 !! test
5152 Bug 4781, 5267: %28, %29 in URL
5153 !! wikitext
5154 http://www.example.com/?title=Ben-Hur_%281959_film%29
5155 !! html/php
5156 <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>
5157 </p>
5158 !! html/parsoid
5159 <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>
5160 !! end
5161
5162
5163 !! test
5164 Bug 4781: %26 in autonumber URL
5165 !! wikitext
5166 [http://www.example.com/?title=AT%26T]
5167 !! html/php
5168 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5169 </p>
5170 !! html/parsoid
5171 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5172 !! end
5173
5174 !! test
5175 Bug 4781, 5267: %26 in autonumber URL
5176 !! wikitext
5177 [http://www.example.com/?title=100%25_Bran]
5178 !! html/php
5179 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5180 </p>
5181 !! html/parsoid
5182 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5183 !! end
5184
5185 !! test
5186 Bug 4781, 5267: %28, %29 in autonumber URL
5187 !! wikitext
5188 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5189 !! html/php
5190 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5191 </p>
5192 !! html/parsoid
5193 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5194 !! end
5195
5196
5197 !! test
5198 Bug 4781: %26 in bracketed URL
5199 !! wikitext
5200 [http://www.example.com/?title=AT%26T link]
5201 !! html/php
5202 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5203 </p>
5204 !! html/parsoid
5205 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5206 !! end
5207
5208 !! test
5209 Bug 4781, 5267: %25 in bracketed URL
5210 !! wikitext
5211 [http://www.example.com/?title=100%25_Bran link]
5212 !! html
5213 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5214 </p>
5215 !! end
5216
5217 !! test
5218 Bug 4781, 5267: %28, %29 in bracketed URL
5219 !! wikitext
5220 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5221 !! html/php
5222 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5223 </p>
5224 !! html/parsoid
5225 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5226 !! end
5227
5228 !! test
5229 External link containing a period in the anchor. (bug 63947)
5230 !! wikitext
5231 [//foo.org/bar#baz. bang]
5232
5233 [//foo.org/bar. bang]
5234 !! html/php
5235 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5236 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5237 </p>
5238 !! html/parsoid
5239 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5240 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5241 !! end
5242
5243 !! test
5244 External link containing a single quote. (bug 63947)
5245 !! wikitext
5246 [//foo.org/bar'baz]
5247
5248 [//foo.org/bar'baz bang]
5249 !! html/php
5250 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5251 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5252 </p>
5253 !! html/parsoid
5254 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5255 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5256 !! end
5257
5258 !! test
5259 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5260 !! wikitext
5261 Some [http://example.com/ pretty ''italics'' and stuff]!
5262 !! html
5263 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5264 </p>
5265 !! end
5266
5267 !! test
5268 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5269 !! wikitext
5270 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5271 !! html
5272 <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>
5273 </p>
5274 !! end
5275
5276 !! test
5277 External link containing double-single-quotes with no space separating the url from text in italics
5278 !! wikitext
5279 [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]].]
5280 !! html/php
5281 <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>
5282 </p>
5283 !! html/php+tidy
5284 <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>
5285 !! html/parsoid
5286 <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>
5287 !! end
5288
5289 !! test
5290 External link with comments in link text
5291 !! wikitext
5292 [http://www.google.com Google <!-- comment -->]
5293 !! html/php
5294 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5295 </p>
5296 !! html/parsoid
5297 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5298 !! end
5299
5300 !! test
5301 External link to bare IPv4 address
5302 !! wikitext
5303 [http://192.168.0.1 Link]
5304 !! html/php
5305 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5306 </p>
5307 !! html/parsoid
5308 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5309 !! end
5310
5311 !! test
5312 URL-encoding in URL functions (single parameter)
5313 !! wikitext
5314 {{localurl:Some page|amp=&}}
5315 !! html
5316 <p>/index.php?title=Some_page&amp;amp=&amp;
5317 </p>
5318 !! end
5319
5320 !! test
5321 URL-encoding in URL functions (multiple parameters)
5322 !! wikitext
5323 {{localurl:Some page|q=?&amp=&}}
5324 !! html
5325 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5326 </p>
5327 !! end
5328
5329 !! test
5330 Brackets in urls
5331 !! wikitext
5332 http://example.com/index.php?foozoid%5B%5D=bar
5333
5334 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5335 !! html/php
5336 <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>
5337 </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>
5338 </p>
5339 !! html/parsoid
5340 <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>
5341
5342 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5343 !! end
5344
5345 !! test
5346 IPv6 urls, autolink format (T23261)
5347 !! wikitext
5348 http://[2404:130:0:1000::187:2]/index.php
5349
5350 Examples from RFC 2373, section 2.2:
5351 * http://[1080::8:800:200C:417A]/unicast
5352 * http://[FF01::101]/multicast
5353 * http://[::1]/loopback
5354 * http://[::]/unspecified
5355 * http://[::13.1.68.3]/ipv4compat
5356 * http://[::FFFF:129.144.52.38]/ipv4compat
5357
5358 Examples from RFC 2732, section 2:
5359 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5360 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5361 * http://[3ffe:2a00:100:7031::1]
5362 * http://[1080::8:800:200C:417A]/foo
5363 * http://[::192.9.5.5]/ipng
5364 * http://[::FFFF:129.144.52.38]:80/index.html
5365 * http://[2010:836B:4179::836B:4179]
5366
5367 !! html/php
5368 <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>
5369 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5370 </p>
5371 <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>
5372 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5375 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5376 <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>
5377 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5378 </p>
5379 <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>
5380 <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>
5381 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5382 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5383 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5384 <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>
5385 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5386
5387 !! html/parsoid
5388 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5389
5390 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5391 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5392 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5393 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5394 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5395 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5396 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5397
5398 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5399 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5400 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5401 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5402 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5403 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5404 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5405 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5406 !! end
5407
5408 !! test
5409 IPv6 urls, bracketed format (T23261)
5410 !! wikitext
5411 [http://[2404:130:0:1000::187:2]/index.php test]
5412
5413 Examples from RFC 2373, section 2.2:
5414 * [http://[1080::8:800:200C:417A] unicast]
5415 * [http://[FF01::101] multicast]
5416 * [http://[::1]/ loopback]
5417 * [http://[::] unspecified]
5418 * [http://[::13.1.68.3] ipv4compat]
5419 * [http://[::FFFF:129.144.52.38] ipv4compat]
5420
5421 Examples from RFC 2732, section 2:
5422 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5423 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5424 * [http://[3ffe:2a00:100:7031::1] 3]
5425 * [http://[1080::8:800:200C:417A]/foo 4]
5426 * [http://[::192.9.5.5]/ipng 5]
5427 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5428 * [http://[2010:836B:4179::836B:4179] 7]
5429
5430 !! html/php
5431 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5432 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5433 </p>
5434 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5435 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5436 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5437 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5438 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5439 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5440 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5441 </p>
5442 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5443 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5444 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5445 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5446 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5447 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5448 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5449
5450 !! html/parsoid
5451 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5452
5453 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5454 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5455 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5460
5461 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5462 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5463 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5468 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5469 !! end
5470
5471 !! test
5472 Non-extlinks in brackets
5473 !! wikitext
5474 [foo]
5475 [foo bar]
5476 [foo ''bar'']
5477 [fool's] errand
5478 [fool's errand]
5479 [{{echo|foo}}]
5480 [{{echo|foo}} bar]
5481 [{{echo|foo}} ''bar'']
5482 [{{echo|foo}}l's] errand
5483 [{{echo|foo}}l's errand]
5484 [url={{echo|foo}}]
5485 [url=http://example.com]
5486 [http:// bare protocols don't count]
5487 !! html/php
5488 <p>[foo]
5489 [foo bar]
5490 [foo <i>bar</i>]
5491 [fool's] errand
5492 [fool's errand]
5493 [foo]
5494 [foo bar]
5495 [foo <i>bar</i>]
5496 [fool's] errand
5497 [fool's errand]
5498 [url=foo]
5499 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5500 [http:// bare protocols don't count]
5501 </p>
5502 !! html/parsoid
5503 <p>[foo]
5504 [foo bar]
5505 [foo <i>bar</i>]
5506 [fool's] errand
5507 [fool's errand]
5508 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5509 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5510 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5511 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5512 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5513 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5514 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5515 [http:// bare protocols don't count]</p>
5516 !! end
5517
5518 !! test
5519 Percent encoding in external links
5520 !! wikitext
5521 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5522 !! html/php
5523 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5524 </p>
5525 !! html/parsoid
5526 <p><a rel="mw:ExtLink"
5527 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5528 !! end
5529
5530 !! test
5531 Use url link syntax for links where the content is equal the link target
5532 !! wikitext
5533 http://example.com
5534 !! html/php
5535 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5536 </p>
5537 !! html/parsoid
5538 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5539 !! end
5540
5541 !! test
5542 Parenthesis in external links, especially URL links
5543 !! wikitext
5544 http://example.com)
5545
5546 http://example.com/test)
5547
5548 http://example.com/(test)
5549
5550 http://example.com/((test)
5551
5552 (http://example.com/(test))
5553
5554 (http://example.com/(test)))))
5555
5556 http://example.com/a)b
5557
5558 [http://example.com) foo]
5559 !! html/php
5560 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5561 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5562 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5563 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5564 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5565 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5566 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5567 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5571 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5572 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5573 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5574 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5575 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5576 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5577 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5578 !! end
5579
5580 !! test
5581 Parenthesis in external links, w/ transclusion or comment
5582 !! wikitext
5583 (http://example.com/{{echo|hi}})
5584
5585 (http://example.com<!-- hi -->)
5586 !! html/php
5587 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5588 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5589 </p>
5590 !! html/parsoid
5591 <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>
5592
5593 <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>
5594 !! end
5595
5596 !! test
5597 Serialize <a> tags with invalid link targets as plain text
5598 !! options
5599 parsoid=html2wt
5600 !! html/parsoid
5601 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5602 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5603 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5604 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5605 !! wikitext
5606 text
5607 <nowiki>*</nowiki>text
5608 <nowiki>[[foo]]</nowiki>
5609 <nowiki>*a [[foo]]</nowiki>
5610 !! end
5611
5612 !! test
5613 mw:ExtLink -vs- mw:WikiLink (T94723)
5614 !! options
5615 parsoid=html2wt
5616 !! html/parsoid
5617 <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>
5618 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5619 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5620 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5621 <p>
5622 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5623 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5624 </p>
5625 !! wikitext
5626 [[Foo|Bar]]
5627 [[Foo|Bar]]
5628 [[wikipedia:Foo|Bar]]
5629 [[wikipedia:Foo|Bar]]
5630
5631 [[wikipedia:European_Robin|European Robin]]
5632 [[wikipedia:European_Robin|European Robin]]
5633 !! end
5634
5635 !! test
5636 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5637 !! options
5638 parsoid=wt2wt
5639 !! wikitext
5640 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5641 !! html/parsoid
5642 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5643 !! end
5644
5645
5646 ###
5647 ### Quotes
5648 ###
5649
5650 !! test
5651 Quotes
5652 !! wikitext
5653 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5654
5655 Normal text. '''''Bold italic text.''''' Normal text.
5656 !! html
5657 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5658 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5659 </p>
5660 !! end
5661
5662
5663 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5664 # parser strips. The wikitext contains just the first half of the bold
5665 # quote pair.
5666 !! test
5667 Unclosed and unmatched quotes
5668 !! wikitext
5669 '''''Bold italic text '''with bold deactivated''' in between.'''''
5670
5671 '''''Bold italic text ''with italic deactivated'' in between.'''''
5672
5673 '''Bold text..
5674
5675 ..spanning two paragraphs (should not work).'''
5676
5677 '''Bold tag left open
5678
5679 ''Italic tag left open
5680
5681 Normal text.
5682
5683 <!-- Unmatching number of opening, closing tags: -->
5684 '''This year''''s election ''should'' beat '''last year''''s.
5685
5686 ''Tom'''s car is bigger than ''Susan'''s.
5687
5688 Plain ''italic'''s plain
5689 !! html/php
5690 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5691 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5692 </p><p><b>Bold text..</b>
5693 </p><p>..spanning two paragraphs (should not work).
5694 </p><p><b>Bold tag left open</b>
5695 </p><p><i>Italic tag left open</i>
5696 </p><p>Normal text.
5697 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5698 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5699 </p><p>Plain <i>italic'</i>s plain
5700 </p>
5701 !! html/parsoid
5702 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5703 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5704 </p><p><b>Bold text..</b>
5705 </p><p>..spanning two paragraphs (should not work).<b></b>
5706 </p><p><b>Bold tag left open</b>
5707 </p><p><i>Italic tag left open</i>
5708 </p><p>Normal text.
5709 </p>
5710 <!-- Unmatching number of opening, closing tags: -->
5711 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5712 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5713 </p><p>Plain <i>italic'</i>s plain
5714 </p>
5715 !! end
5716
5717 ###
5718 ### Tables
5719 ###
5720 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5721 ###
5722
5723 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5724 # is the bare minimum required by the spec, see:
5725 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5726 # Parsoid team replies: empty table tags are legal in HTML5
5727 !! test
5728 A table with no data.
5729 !! options
5730 parsoid=wt2html
5731 !! wikitext
5732 {||}
5733 !! html/php
5734
5735 !! html/parsoid
5736 <table></table>
5737
5738 !! end
5739
5740 !! test
5741 A table with stray table end tags on start tag line (wt2html)
5742 !! options
5743 parsoid=wt2html
5744 !! wikitext
5745 {|style="color: red;"|}
5746
5747 {|style="color: red;" |}
5748 |foo
5749 |}
5750
5751 {|style="color: red;"|} id="foo"
5752 |foo
5753 |}
5754
5755 {|style="color: red;" |} id="foo"
5756 |foo
5757 |}
5758 !! html
5759 <table style="color: red;"></table>
5760
5761 <table style="color: red;">
5762 <tbody><tr>
5763 <td>foo</td>
5764 </tr></tbody>
5765 </table>
5766
5767 <table style="color: red;" id="foo">
5768 <tbody><tr>
5769 <td>foo</td>
5770 </tr></tbody>
5771 </table>
5772
5773 <table style="color: red;" id="foo">
5774 <tbody><tr>
5775 <td>foo</td>
5776 </tr></tbody>
5777 </table>
5778
5779 !! end
5780
5781 !! test
5782 A table with no data (take 2)
5783 !! wikitext
5784 {|
5785 |}
5786 !! html/parsoid
5787 <table></table>
5788 !! end
5789
5790 # A table with nothing but a caption is invalid XHTML, we might want to render
5791 # this as <p>caption</p>
5792 # Parsoid team replies: table with only a caption is legal in HTML5
5793 !! test
5794 A table with nothing but a caption
5795 !! wikitext
5796 {|
5797 |+ caption
5798 |}
5799 !! html/php
5800 <table>
5801 <caption> caption
5802 </caption><tr><td></td></tr></table>
5803
5804 !! html/parsoid
5805 <table><caption> caption</caption></table>
5806 !! end
5807
5808 !! test
5809 A table with caption with default-spaced attributes and a table row
5810 !! wikitext
5811 {|
5812 |+ style="color: red;" | caption1
5813 |-
5814 | foo
5815 |}
5816 !! html
5817 <table>
5818 <caption style="color: red;"> caption1
5819 </caption>
5820 <tr>
5821 <td> foo
5822 </td></tr></table>
5823
5824 !! end
5825
5826 !! test
5827 A table with captions with non-default spaced attributes and a table row
5828 !! wikitext
5829 {|
5830 |+style="color: red;"|caption2
5831 |+ style="color: red;"| caption3
5832 |-
5833 | foo
5834 |}
5835 !! html
5836 <table>
5837 <caption style="color: red;">caption2
5838 </caption>
5839 <caption style="color: red;"> caption3
5840 </caption>
5841 <tr>
5842 <td> foo
5843 </td></tr></table>
5844
5845 !! end
5846
5847 !! test
5848 Table td-cell syntax variations
5849 !! wikitext
5850 {|
5851 | foo bar foo | baz
5852 | foo bar foo || baz
5853 | style='color:red;' | baz
5854 | style='color:red;' || baz
5855 |}
5856 !! html
5857 <table>
5858 <tr>
5859 <td> baz
5860 </td>
5861 <td> foo bar foo </td>
5862 <td> baz
5863 </td>
5864 <td style="color:red;"> baz
5865 </td>
5866 <td> style='color:red;' </td>
5867 <td> baz
5868 </td></tr></table>
5869
5870 !! end
5871
5872 !! test
5873 Simple table
5874 !! wikitext
5875 {|
5876 | 1 || 2
5877 |-
5878 | 3 || 4
5879 |}
5880 !! html
5881 <table>
5882 <tr>
5883 <td> 1 </td>
5884 <td> 2
5885 </td></tr>
5886 <tr>
5887 <td> 3 </td>
5888 <td> 4
5889 </td></tr></table>
5890
5891 !! end
5892
5893 !! test
5894 Simple table but with multiple dashes for row wikitext
5895 !! wikitext
5896 {|
5897 | foo
5898 |-----
5899 | bar
5900 |}
5901 !! html
5902 <table>
5903 <tr>
5904 <td> foo
5905 </td></tr>
5906 <tr>
5907 <td> bar
5908 </td></tr></table>
5909
5910 !! end
5911
5912 !! test
5913 Multiplication table
5914 !! wikitext
5915 {| border="1" cellpadding="2"
5916 |+Multiplication table
5917 |-
5918 ! &times; !! 1 !! 2 !! 3
5919 |-
5920 ! 1
5921 | 1 || 2 || 3
5922 |-
5923 ! 2
5924 | 2 || 4 || 6
5925 |-
5926 ! 3
5927 | 3 || 6 || 9
5928 |-
5929 ! 4
5930 | 4 || 8 || 12
5931 |-
5932 ! 5
5933 | 5 || 10 || 15
5934 |}
5935 !! html
5936 <table border="1" cellpadding="2">
5937 <caption>Multiplication table
5938 </caption>
5939 <tr>
5940 <th> &#215; </th>
5941 <th> 1 </th>
5942 <th> 2 </th>
5943 <th> 3
5944 </th></tr>
5945 <tr>
5946 <th> 1
5947 </th>
5948 <td> 1 </td>
5949 <td> 2 </td>
5950 <td> 3
5951 </td></tr>
5952 <tr>
5953 <th> 2
5954 </th>
5955 <td> 2 </td>
5956 <td> 4 </td>
5957 <td> 6
5958 </td></tr>
5959 <tr>
5960 <th> 3
5961 </th>
5962 <td> 3 </td>
5963 <td> 6 </td>
5964 <td> 9
5965 </td></tr>
5966 <tr>
5967 <th> 4
5968 </th>
5969 <td> 4 </td>
5970 <td> 8 </td>
5971 <td> 12
5972 </td></tr>
5973 <tr>
5974 <th> 5
5975 </th>
5976 <td> 5 </td>
5977 <td> 10 </td>
5978 <td> 15
5979 </td></tr></table>
5980
5981 !! end
5982
5983 !! test
5984 Accept "||" in table headings
5985 !! wikitext
5986 {|
5987 !h1 || h2
5988 |}
5989 !! html
5990 <table>
5991 <tr>
5992 <th>h1 </th>
5993 <th> h2
5994 </th></tr></table>
5995
5996 !! end
5997
5998 !! test
5999 Accept "!!" in table data
6000 !! wikitext
6001 {|
6002 | Foo!! ||
6003 |}
6004 !! html
6005 <table>
6006 <tr>
6007 <td> Foo!! </td>
6008 <td>
6009 </td></tr></table>
6010
6011 !! html/parsoid
6012 <table>
6013 <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>
6014 </tbody></table>
6015 !! end
6016
6017 !! test
6018 Accept "||" in indented table headings
6019 !! wikitext
6020 :{|
6021 !h1 || h2
6022 |}
6023 !! html
6024 <dl><dd><table>
6025 <tr>
6026 <th>h1 </th>
6027 <th> h2
6028 </th></tr></table></dd></dl>
6029
6030 !! end
6031
6032 !! test
6033 Accept "!!" in templates
6034 !! wikitext
6035 {|
6036 !a {{echo|b!!c}}
6037 |}
6038 !! html/php
6039 <table>
6040 <tr>
6041 <th>a b</th>
6042 <th>c
6043 </th></tr></table>
6044
6045 !! html/parsoid
6046 <table>
6047 <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>
6048 !! end
6049
6050 !! test
6051 Accept "!!" in table headings after newline
6052 !! wikitext
6053 {|
6054 !a
6055 b!!c
6056 |}
6057 !! html/php
6058 <table>
6059 <tr>
6060 <th>a
6061 <p>b!!c
6062 </p>
6063 </th></tr></table>
6064
6065 !! html/parsoid
6066 <table>
6067 <tbody><tr><th>a
6068 <p>b!!c</p></th></tr>
6069 </tbody></table>
6070 !! end
6071
6072 !! test
6073 Accept "!!" in table data of mixed wikitext / html syntax
6074 !! wikitext
6075 {|
6076 !a
6077 <tr><td>b!!c</td></tr>
6078 |}
6079 !! html+tidy
6080 <table>
6081 <tr>
6082 <th>a</th>
6083 </tr>
6084 <tr>
6085 <td>b!!c</td>
6086 </tr>
6087 </table>
6088 !! html/parsoid
6089 <table>
6090 <tbody><tr><th>a</th></tr>
6091 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6092 </tbody></table>
6093 !! end
6094
6095 !! test
6096 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6097 !! wikitext
6098 {|
6099 !| h1
6100 || a
6101 |}
6102 !! html
6103 <table>
6104 <tr>
6105 <th> h1
6106 </th>
6107 <td> a
6108 </td></tr></table>
6109
6110 !! end
6111
6112 !!test
6113 Accept "| !" at start of line in tables (ignore !-attribute)
6114 !! wikitext
6115 {|
6116 |-
6117 | !style="color:red" | bar
6118 |}
6119 !! html
6120 <table>
6121
6122 <tr>
6123 <td> bar
6124 </td></tr></table>
6125
6126 !!end
6127
6128 !!test
6129 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 +/-
6130 !! wikitext
6131 {|
6132 |-
6133 |style='color:red;'|+1
6134 |style='color:blue;'|-1
6135 |-
6136 | 1 || 2 || 3
6137 | 1 ||+2 ||-3
6138 |-
6139 | +1
6140 | -1
6141 |}
6142 !! html
6143 <table>
6144
6145 <tr>
6146 <td style="color:red;">+1
6147 </td>
6148 <td style="color:blue;">-1
6149 </td></tr>
6150 <tr>
6151 <td> 1 </td>
6152 <td> 2 </td>
6153 <td> 3
6154 </td>
6155 <td> 1 </td>
6156 <td>+2 </td>
6157 <td>-3
6158 </td></tr>
6159 <tr>
6160 <td> +1
6161 </td>
6162 <td> -1
6163 </td></tr></table>
6164
6165 !!end
6166
6167 !! test
6168 Table rowspan
6169 !! wikitext
6170 {| border=1
6171 | Cell 1, row 1
6172 |rowspan=2| Cell 2, row 1 (and 2)
6173 | Cell 3, row 1
6174 |-
6175 | Cell 1, row 2
6176 | Cell 3, row 2
6177 |}
6178 !! html
6179 <table border="1">
6180 <tr>
6181 <td> Cell 1, row 1
6182 </td>
6183 <td rowspan="2"> Cell 2, row 1 (and 2)
6184 </td>
6185 <td> Cell 3, row 1
6186 </td></tr>
6187 <tr>
6188 <td> Cell 1, row 2
6189 </td>
6190 <td> Cell 3, row 2
6191 </td></tr></table>
6192
6193 !! end
6194
6195 !! test
6196 Nested table
6197 !! wikitext
6198 {| border=1
6199 | &alpha;
6200 |
6201 {| bgcolor=#ABCDEF border=2
6202 |nested
6203 |-
6204 |table
6205 |}
6206 |the original table again
6207 |}
6208 !! html
6209 <table border="1">
6210 <tr>
6211 <td> &#945;
6212 </td>
6213 <td>
6214 <table bgcolor="#ABCDEF" border="2">
6215 <tr>
6216 <td>nested
6217 </td></tr>
6218 <tr>
6219 <td>table
6220 </td></tr></table>
6221 </td>
6222 <td>the original table again
6223 </td></tr></table>
6224
6225 !! end
6226
6227 !! test
6228 Invalid attributes in table cell (bug 1830)
6229 !! wikitext
6230 {|
6231 |Cell:|broken
6232 |}
6233 !! html
6234 <table>
6235 <tr>
6236 <td>broken
6237 </td></tr></table>
6238
6239 !! end
6240
6241 !! test
6242 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6243 !! wikitext
6244 {|
6245 | title="foo" |bar
6246 | title="foo<nowiki>|</nowiki>" |bar
6247 | title="foo<nowiki>|</nowiki>" bar
6248 |}
6249 !! html/php
6250 <table>
6251 <tr>
6252 <td title="foo">bar
6253 </td>
6254 <td title="foo&#124;">bar
6255 </td>
6256 <td> title="foo|" bar
6257 </td></tr></table>
6258
6259 !! html/parsoid
6260 <table>
6261 <tbody><tr><td title="foo">bar</td>
6262 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6263 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6264 </tbody></table>
6265 !! end
6266
6267 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6268 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6269 # *2wt modes will fail.
6270 !! test
6271 Table security: embedded pipes
6272 !! options
6273 parsoid=wt2html,html2html
6274 !! wikitext
6275 {|
6276 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6277 !! html/php
6278 <table>
6279 <tr>
6280 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6281 <td>]" onmouseover="alert(document.cookie)"&gt;test
6282 </td>
6283 </tr>
6284 </table>
6285
6286 !! html/parsoid
6287 <table><tbody>
6288 <tr>
6289 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6290 !! end
6291
6292 # FIXME: The output seems broken. Filed as T110268.
6293 !! test
6294 ! and || in td attributes should not be parsed as <th>/<td>
6295 !! options
6296 parsoid=wt2html
6297 !! wikitext
6298 {|
6299 | style="color: red !important;" data-contrived="put this here ||" | foo
6300 |}
6301 !! html/php
6302 <table>
6303 <tr>
6304 <td> style="color: red !important;" data-contrived="put this here </td>
6305 <td> foo
6306 </td></tr></table>
6307
6308 !! html/parsoid
6309 <table>
6310 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6311 </tbody></table>
6312 !! end
6313
6314 !! test
6315 Indented table markup mixed with indented pre content (proposed in bug 6200)
6316 !! wikitext
6317 <table>
6318 <tr>
6319 <td>
6320 Text that should be rendered preformatted
6321 </td>
6322 </tr>
6323 </table>
6324 !! html
6325 <table>
6326 <tr>
6327 <td>
6328 <pre>Text that should be rendered preformatted
6329 </pre>
6330 </td>
6331 </tr>
6332 </table>
6333
6334 !! end
6335
6336 !! test
6337 1. Template-generated table cell attributes and cell content
6338 !! wikitext
6339 {|
6340 |{{table_attribs}}
6341 | {{table_attribs}}
6342 || {{table_attribs_5}}
6343 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6344 |align=center {{table_attribs}}
6345 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6346 |}
6347 !! html
6348 <table>
6349 <tr>
6350 <td style="color:red;">Foo
6351 </td>
6352 <td style="color:red;">Foo
6353 </td>
6354 <td> style="color:red;"</td>
6355 <td>Bar
6356 </td>
6357 <td style="color:red;">Foo
6358 </td>
6359 <td align="center" style="color:red;">Foo
6360 </td>
6361 <td align="center" style="color:red;">Foo
6362 </td></tr></table>
6363
6364 !! end
6365
6366 !! test
6367 2. Template-generated table cell attributes and cell content
6368 !! wikitext
6369 {|
6370 |{{table_attribs_2}}
6371 |}
6372 !! html/php
6373 <table>
6374 <tr>
6375 <td style="color:red;">Foo
6376 </td>
6377 <td>Bar</td>
6378 <td>Baz
6379 </td></tr></table>
6380
6381 !! html/parsoid
6382 <table>
6383 <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>
6384 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6385 </tbody></table>
6386 !! end
6387
6388 !! test
6389 3. Template-generated table cell attributes and cell content
6390 !! wikitext
6391 {|
6392 !align=center {{table_header_cells}}
6393 |-
6394 |align=center {{table_cells}}
6395 |}
6396 !! html/php
6397 <table>
6398 <tr>
6399 <th align="center" style="color:red;">Foo</th>
6400 <th style="color:red;"><i>Bar</i></th>
6401 <th style="color:brown;"><i>Foo</i> and Baz
6402 </th></tr>
6403 <tr>
6404 <td align="center" style="color:red;">Foo</td>
6405 <td style="color:red;"><i>Bar</i></td>
6406 <td style="color:brown;"><i>Foo</i> and Baz
6407 </td></tr></table>
6408
6409 !! html/parsoid
6410 <table>
6411 <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>
6412 <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>
6413 </tbody></table>
6414 !! end
6415
6416 !! test
6417 4. Template-generated table cell attributes and cell content inside a templated table
6418 !! wikitext
6419 {{tbl-start}}
6420 !align=center {{table_header_cells}}
6421 |-
6422 |align=center {{table_cells}}
6423 {{tbl-end}}
6424 !! html/php
6425 <table>
6426 <tr>
6427 <th align="center" style="color:red;">Foo</th>
6428 <th style="color:red;"><i>Bar</i></th>
6429 <th style="color:brown;"><i>Foo</i> and Baz
6430 </th></tr>
6431 <tr>
6432 <td align="center" style="color:red;">Foo</td>
6433 <td style="color:red;"><i>Bar</i></td>
6434 <td style="color:brown;"><i>Foo</i> and Baz
6435 </td></tr></table>
6436
6437 !! html/parsoid
6438 <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}}]}'>
6439 <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>
6440 <tr>
6441 <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>
6442 </tbody></table>
6443 !! end
6444
6445 ## Edge case fix to prevent future regressions
6446 !! test
6447 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6448 !! wikitext
6449 {|
6450 |{{table_attribs_7}}
6451 |}
6452 <references />
6453 !! html/parsoid
6454 <table>
6455 <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>
6456 </tbody></table>
6457 <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>
6458 !! end
6459
6460 !! test
6461 Table with row followed by newlines and table heading
6462 !! wikitext
6463 {|
6464 |-
6465
6466 ! foo
6467 |}
6468 !! html
6469 <table>
6470
6471
6472 <tr>
6473 <th> foo
6474 </th></tr></table>
6475
6476 !! end
6477
6478 !! test
6479 Table with empty line following the start tag
6480 !! wikitext
6481 {|
6482
6483 |-
6484 | foo
6485 |}
6486 !! html
6487 <table>
6488
6489
6490 <tr>
6491 <td> foo
6492 </td></tr></table>
6493
6494 !! end
6495
6496 # FIXME: Preserve the attribute properly (with an empty string as value) in
6497 # the PHP parser. Parsoid implements the behavior below.
6498 !! test
6499 Table attributes with empty value
6500 !! wikitext
6501 {|
6502 | style=| hello
6503 |}
6504 !! html/parsoid
6505 <table>
6506 <tbody>
6507 <tr>
6508 <td style=""> hello
6509 </td></tr></tbody></table>
6510
6511 !! end
6512
6513 !! test
6514 Wikitext table with a lot of comments
6515 !! wikitext
6516 {|
6517 <!-- c0 -->
6518 | foo
6519 <!-- c1 -->
6520 |-<!-- c2 -->
6521 <!-- c3 -->
6522 |<!-- c4 -->
6523 <!-- c5 -->
6524 |}
6525 !! html
6526 <table>
6527 <tr>
6528 <td> foo
6529 </td></tr>
6530 <tr>
6531 <td>
6532 </td></tr></table>
6533
6534 !! end
6535
6536 !! test
6537 Wikitext table comments represented in parsoid dom
6538 !! wikitext
6539 {|<!--c1--><!--c2-->
6540 |-<!--c3-->
6541 | x
6542 |}
6543 !! html/php+tidy
6544 <table>
6545 <tr>
6546 <td>x</td>
6547 </tr>
6548 </table>
6549 !! html/parsoid
6550 <table><!--c1--><!--c2-->
6551 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6552 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6553 </tbody></table>
6554 !! end
6555
6556 !! test
6557 Wikitext table with double-line table cell
6558 !! wikitext
6559 {|
6560 |a
6561 b
6562 |}
6563 !! html
6564 <table>
6565 <tr>
6566 <td>a
6567 <p>b
6568 </p>
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Table cell with a single comment
6575 !! wikitext
6576 {|
6577 | <!-- c1 -->
6578 | a
6579 |}
6580 !! html
6581 <table>
6582 <tr>
6583 <td>
6584 </td>
6585 <td> a
6586 </td></tr></table>
6587
6588 !! end
6589
6590 !! test
6591 Table-cell after a comment-only-empty-line
6592 !! wikitext
6593 {|
6594 |a
6595 <!--c1-->
6596 <!--c2-->| b
6597 |}
6598 !! html
6599 <table>
6600 <tr>
6601 <td>a
6602 </td>
6603 <td> b
6604 </td></tr></table>
6605
6606 !! html/parsoid
6607 <table>
6608 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6609 <!--c1-->
6610 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6611 </tbody></table>
6612
6613 !! end
6614
6615 !! test
6616 Build table with {{!}}
6617 !! wikitext
6618 {{{!}} class="wikitable"
6619 ! header
6620 ! second header
6621 {{!}}- style="color:red;"
6622 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6623 {{!}}}
6624 !! html
6625 <table class="wikitable">
6626 <tr>
6627 <th> header
6628 </th>
6629 <th> second header
6630 </th></tr>
6631 <tr style="color:red;">
6632 <td> data </td>
6633 <td style="color:red;"> second data
6634 </td></tr></table>
6635
6636 !! end
6637
6638 !! test
6639 Build table with pipe as data
6640 !! wikitext
6641 {| class="wikitable"
6642 ! header
6643 ! second header
6644 |- style="color:red;"
6645 | data || style="color:red;" | second data
6646 |-
6647 | style="color:red;" | data with | || style="color:red;" | second data with |
6648 |-
6649 || data with | ||| second data with |
6650 |}
6651 !! html
6652 <table class="wikitable">
6653 <tr>
6654 <th> header
6655 </th>
6656 <th> second header
6657 </th></tr>
6658 <tr style="color:red;">
6659 <td> data </td>
6660 <td style="color:red;"> second data
6661 </td></tr>
6662 <tr>
6663 <td style="color:red;"> data with | </td>
6664 <td style="color:red;"> second data with |
6665 </td></tr>
6666 <tr>
6667 <td> data with | </td>
6668 <td> second data with |
6669 </td></tr></table>
6670
6671 !! end
6672
6673 !! test
6674 Build table with wikilink
6675 !! wikitext
6676 {| class="wikitable"
6677 ! header || second header
6678 |- style="color:red;"
6679 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6680 |-
6681 | data || second data [[Main Page|link|text with pipe]]
6682 |}
6683 !! html
6684 <table class="wikitable">
6685 <tr>
6686 <th> header </th>
6687 <th> second header
6688 </th></tr>
6689 <tr style="color:red;">
6690 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6691 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6692 </td></tr>
6693 <tr>
6694 <td> data </td>
6695 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6696 </td></tr></table>
6697
6698 !! end
6699
6700 # The expected HTML structure in this test is debatable. The PHP parser does
6701 # not parse this kind of table at all. The main focus for Parsoid is on
6702 # round-tripping, so this output is ok for now. TODO: revisit!
6703 !! test
6704 Wikitext table with html-syntax row
6705 !! wikitext
6706 {|
6707 |-
6708 <td>foo</td>
6709 |}
6710 !! html/parsoid
6711 <table>
6712 <tbody>
6713 <tr>
6714 <td>foo</td></tr></tbody></table>
6715 !! end
6716
6717 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6718 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6719 ## PHP parser, which tidy then compounds by fostering the content
6720 ## entirely out of the table. Parsoid recognizes the table context
6721 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6722 ## depends on PHP's treatment of broken table markup!
6723 !! test
6724 Implicit <td> after a |-
6725 !! options
6726 parsoid=wt2html,html2html
6727 !! wikitext
6728 {|
6729 |-
6730 a
6731 |}
6732 !! html/php
6733 <table>
6734
6735 a
6736 </table>
6737
6738 !! html/php+tidy
6739 <p>a</p>
6740 !! html/parsoid
6741 <table>
6742 <tr><td>a</td></tr>
6743 </table>
6744 !! end
6745
6746 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6747 !! test
6748 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6749 !! options
6750 parsoid=wt2html,html2html
6751 !! wikitext
6752 {|
6753 |-
6754 |
6755 a
6756 |-
6757 b
6758 |}
6759 !! html/php
6760 <table>
6761
6762 <tr>
6763 <td>
6764 <pre>a
6765 </pre>
6766 </td></tr>
6767 b
6768 </table>
6769
6770 !! html/php+tidy
6771 <p>b</p>
6772 <table>
6773 <tr>
6774 <td>
6775 <pre>
6776 a
6777 </pre></td>
6778 </tr>
6779 </table>
6780 !! html/parsoid
6781 <table>
6782 <tbody>
6783 <tr><td><pre>a</pre></td></tr>
6784 <tr><td> b</td></tr>
6785 </tbody>
6786 </table>
6787 !! end
6788
6789 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6790 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6791 !! test
6792 Lists should be recognized in an implicit <td> context
6793 !! options
6794 parsoid=wt2html,html2html
6795 !! wikitext
6796 {|
6797 |-
6798 *a
6799 |}
6800 !! html/php
6801 <table>
6802
6803 <ul><li>a</li></ul>
6804 </table>
6805
6806 !! html/php+tidy
6807 <ul>
6808 <li>a</li>
6809 </ul>
6810 !! html/parsoid
6811 <table>
6812 <tr>
6813 <td><ul>
6814 <li>a</li>
6815 </ul></td>
6816 </tr>
6817 </table>
6818 !! end
6819
6820 !! test
6821 Table cells not properly parsed in an implicit-td context
6822 !! wikitext
6823 {|
6824 |-
6825 {{table_attribs_4}} || a || b
6826 |}
6827 !! html/php+tidy
6828 <table>
6829 <tr>
6830 <td style="background-color:#DC241f;" width="10px"></td>
6831 <td>a</td>
6832 <td>b</td>
6833 </tr>
6834 </table>
6835 !! html/parsoid
6836 <table>
6837 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6838 <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>
6839 </tbody></table>
6840 !! end
6841
6842 !! test
6843 Parsoid: Round-trip tables directly followed by content (bug 51219)
6844 !! options
6845 parsoid=wt2html,wt2wt
6846 !! wikitext
6847 {|
6848 |foo
6849 |} bar
6850
6851 {|
6852 |baz
6853 |}<b>quux</b>
6854 !! html+tidy
6855 <table>
6856 <tr>
6857 <td>foo</td>
6858 </tr>
6859 </table>
6860 <p>bar</p>
6861 <table>
6862 <tr>
6863 <td>baz</td>
6864 </tr>
6865 </table>
6866 <p><b>quux</b></p>
6867 !! end
6868
6869 !! test
6870 Parsoid: Default to a newline after tables in new content (bug 51219)
6871 !! options
6872 parsoid=html2wt
6873 !! html/parsoid
6874 <table><tbody>
6875 <tr><td>foo</td></tr></tbody></table> bar
6876 <table><tbody>
6877 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6878 !! wikitext
6879 {|
6880 |foo
6881 |}
6882 <nowiki> </nowiki>bar
6883 {|
6884 |baz
6885 |}
6886 '''quux'''
6887 !! end
6888
6889 !! test
6890 Parsoid: newline inducing block nodes don't suppress <nowiki>
6891 !! options
6892 parsoid=html2wt
6893 !! html/parsoid
6894 a<h1>foo</h1>
6895 !! wikitext
6896 <nowiki> </nowiki>a
6897
6898 = foo =
6899 !! end
6900
6901 !! test
6902 Parsoid: Row-syntax table headings followed by comment & table cells
6903 !! options
6904 parsoid=wt2html,wt2wt
6905 !! wikitext
6906 {|
6907 ! foo || bar
6908 <!-- foo --> || baz || quux
6909 |}
6910 !! html/php
6911 <table>
6912 <tr>
6913 <th> foo </th>
6914 <th> bar
6915 </th>
6916 <td> baz </td>
6917 <td> quux
6918 </td></tr></table>
6919
6920 !! html/parsoid
6921 <table>
6922 <tbody><tr><th> foo </th><th> bar
6923 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6924 </tbody></table>
6925 !! end
6926
6927 !!test
6928 Parsoid: Recover better from broken table attributes
6929 !!options
6930 parsoid=wt2html
6931 !!wikitext
6932 {| class="foo
6933 | class="bar" |
6934 foo
6935 |}
6936 !!html/php+tidy
6937 <table class="foo">
6938 <tr>
6939 <td class="bar">
6940 <p>foo</p>
6941 </td>
6942 </tr>
6943 </table>
6944 !!html/parsoid
6945 <table class="foo">
6946 <tr>
6947 <td class="bar">
6948 <p>foo</p></td></tr>
6949 </tbody></table>
6950 !!end
6951
6952 !! test
6953 Tables: Digest broken attributes on table and tr tag
6954 !! options
6955 parsoid=wt2html
6956 !! wikitext
6957 {| || |} ++
6958 |- || || ++ --
6959 |- > [
6960 |}
6961 !! html
6962 <table>
6963 <tbody>
6964 <tr></tr>
6965 <tr></tr>
6966 </tbody></table>
6967 !! end
6968
6969 !! test
6970 Strip unsupported table tags
6971 !! options
6972 parsoid=html2wt
6973 !! html/parsoid
6974 <table>
6975 <thead>
6976 <tr>
6977 <th>Month</th>
6978 <th>Savings</th>
6979 </tr>
6980 </thead>
6981 <tbody>
6982 <tr>
6983 <td>January</td>
6984 <td>$100</td>
6985 </tr>
6986 <tr>
6987 <td>February</td>
6988 <td>$80</td>
6989 </tr>
6990 </tbody>
6991 <tfoot>
6992 <tr>
6993 <td>Sum</td>
6994 <td>$180</td>
6995 </tr>
6996 </tfoot>
6997 </table>
6998 !! wikitext
6999 {|
7000
7001 !Month
7002 !Savings
7003
7004 |January
7005 |$100
7006
7007 |-
7008 |February
7009 |$80
7010
7011 |Sum
7012 |$180
7013
7014 |}
7015 !! end
7016
7017 !!test
7018 Testing serialization after deletion of table cells
7019 !!options
7020 parsoid={
7021 "modes": ["wt2wt", "selser"],
7022 "changes": [
7023 ["#x", "remove"]
7024 ]
7025 }
7026 !!wikitext
7027 {|
7028 !h1 !!h2 !!h3
7029 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7030 |}
7031 !! wikitext/edited
7032 {|
7033 !h1 !!h2 !!h3
7034 |c2 |||c3
7035 |}
7036 !!end
7037
7038 ###
7039 ### Internal links
7040 ###
7041 !! test
7042 Plain link, capitalized
7043 !! wikitext
7044 [[Main Page]]
7045 !! html
7046 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7047 </p>
7048 !! end
7049
7050 !! test
7051 Plain link, uncapitalized
7052 !! wikitext
7053 [[main Page]]
7054 !! html
7055 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7056 </p>
7057 !! end
7058
7059 !! test
7060 Piped link
7061 !! wikitext
7062 [[Main Page|The Main Page]]
7063 !! html
7064 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7065 </p>
7066 !! end
7067
7068 !! test
7069 Piped link with comment in link text
7070 !! wikitext
7071 [[Main Page|The Main<!--front--> Page]]
7072 !! html
7073 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7074 </p>
7075 !! end
7076
7077 !! test
7078 Piped link with multiple pipe characters in link text
7079 !! wikitext
7080 [[Main Page||The|Main|Page|]]
7081 !! html/php
7082 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7083 </p>
7084 !! html/parsoid
7085 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7086 !! end
7087
7088 !! test
7089 Broken link
7090 !! wikitext
7091 [[Zigzagzogzagzig]]
7092 !! html
7093 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7094 </p>
7095 !! end
7096
7097 !! test
7098 Broken link with fragment
7099 !! wikitext
7100 [[Zigzagzogzagzig#zug]]
7101 !! html
7102 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7103 </p>
7104 !! end
7105
7106 !! test
7107 Special page link with fragment
7108 !! wikitext
7109 [[Special:Version#anchor]]
7110 !! html
7111 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7112 </p>
7113 !! end
7114
7115 !! test
7116 Nonexistent special page link with fragment
7117 !! wikitext
7118 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7119 !! html
7120 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7121 </p>
7122 !! end
7123
7124 !! test
7125 Link with prefix
7126 !! wikitext
7127 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7128 !! html
7129 <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>
7130 </p>
7131 !! end
7132
7133 !! test
7134 Link with suffix
7135 !! wikitext
7136 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7137 !! html
7138 <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>!!!
7139 </p>
7140 !! end
7141
7142 !! article
7143 prefixed article
7144 !! text
7145 Some text
7146 !! endarticle
7147
7148 !! test
7149 Bug 43661: Piped links with identical prefixes
7150 !! wikitext
7151 [[prefixed article|prefixed articles with spaces]]
7152
7153 [[prefixed article|prefixed articlesaoeu]]
7154
7155 [[Main Page|Main Page test]]
7156 !! html
7157 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7158 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7159 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7160 </p>
7161 !! end
7162
7163
7164 !! test
7165 Link with HTML entity in suffix / tail
7166 !! wikitext
7167 [[Main Page]]&quot;, [[Main Page]]&#97;
7168 !! html/php
7169 <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;
7170 </p>
7171 !! html/parsoid
7172 <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>
7173 !! end
7174
7175 !! test
7176 Link with 3 brackets
7177 !! wikitext
7178 [[[Main Page]]]
7179 Foo [[[Main Page]]]
7180 !! html
7181 <p>[[[Main Page]]]
7182 Foo [[[Main Page]]]
7183 </p>
7184 !! end
7185
7186 !! test
7187 Link with 4 brackets
7188 !! wikitext
7189 [[[[Main Page]]]]
7190 !! html
7191 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7192 </p>
7193 !! end
7194
7195 !! test
7196 Piped link with 3 brackets
7197 !! wikitext
7198 [[[main page|the main page]]]
7199 !! html
7200 <p>[[[main page|the main page]]]
7201 </p>
7202 !! end
7203
7204 !! test
7205 Piped link with extlink-like text
7206 !! wikitext
7207 [[Main Page|[bar]]]
7208 [[Main Page|This is a [bar]]]
7209 !! html/php
7210 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7211 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7212 </p>
7213 !! html/parsoid
7214 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7215 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7216 !! end
7217
7218 !! test
7219 Link with multiple pipes
7220 !! wikitext
7221 [[Main Page|The|Main|Page]]
7222 !! html
7223 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7224 </p>
7225 !! end
7226
7227 # Note that parsoid does not munge anchor text; all non-space
7228 # characters are valid in HTML5 ids.
7229 !! test
7230 Anchor containing a #. (bug 63430)
7231 !! wikitext
7232 [[Main Page#And#Link]]
7233 !! html/php
7234 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7235 </p>
7236 !! html/parsoid
7237 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7238 !! end
7239
7240 !! test
7241 Link to namespaces
7242 !! wikitext
7243 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7244 !! html
7245 <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>
7246 </p>
7247 !! end
7248
7249 !! test
7250 Link with space in namespace
7251 !! wikitext
7252 [[User talk:Foo bar]]
7253 !! html
7254 <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>
7255 </p>
7256 !! end
7257
7258 !! article
7259 MemoryAlpha:AlphaTest
7260 !! text
7261 This is an article in the MemoryAlpha namespace
7262 (which shadows the memoryalpha interwiki link).
7263 !! endarticle
7264
7265 !! test
7266 Namespace takes precedence over interwiki link (bug 51680)
7267 !! wikitext
7268 [[MemoryAlpha:AlphaTest]]
7269 !! html
7270 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7271 </p>
7272 !! end
7273
7274 # The previous test doesn't work correctly in html2*, due to not recognizing the
7275 # link as an internal one. This one checks for the correct behavior.
7276 !! test
7277 Link to namespace preferred over interwiki with correct rel attribute
7278 !! options
7279 parsoid=html2wt,html2html
7280 !! html/parsoid
7281 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7282 !! wikitext
7283 [[MemoryAlpha:AlphaTest]]
7284 !! end
7285
7286 !! test
7287 Piped link to namespace
7288 !! wikitext
7289 [[Meta:Disclaimers|The disclaimers]]
7290 !! html
7291 <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>
7292 </p>
7293 !! end
7294
7295 !! test
7296 Link containing }
7297 !! wikitext
7298 [[Usually caused by a typo (oops}]]
7299 !! html
7300 <p>[[Usually caused by a typo (oops}]]
7301 </p>
7302 !! end
7303
7304 !! article
7305 7% Solution
7306 !! text
7307 Just a test of an article title containing a percent.
7308 !! endarticle
7309
7310 !! test
7311 Link containing % (not as a hex sequence)
7312 !! wikitext
7313 [[7% Solution]]
7314 !! html/php
7315 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7316 </p>
7317 !! html/parsoid
7318 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7319 !! end
7320
7321 # note that the parsoid HTML is identical to the previous test output,
7322 # so the previous test ensures that the html2wt mode will generate the
7323 # "not as a hex sequence" wikitext.
7324 !! test
7325 Link containing % as a single hex sequence interpreted to char
7326 !! options
7327 parsoid=wt2wt,wt2html,html2html
7328 !! wikitext
7329 [[7%25 Solution]]
7330 !! html/php
7331 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7332 </p>
7333 !! html/parsoid
7334 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7335 !!end
7336
7337 !! test
7338 Link containing % as a double hex sequence interpreted to hex sequence
7339 !! wikitext
7340 [[7%2525 Solution]]
7341 !! html
7342 <p>[[7%2525 Solution]]
7343 </p>
7344 !!end
7345
7346 # note that parsoid does not munge anchor text; all non-space
7347 # characters are valid in HTML5 anchors.
7348 !! test
7349 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7350 Example for such a section: == < ==
7351 !! wikitext
7352 [[%23%3c]][[%23%3e]]
7353 !! html/php
7354 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7355 </p>
7356 !! html/parsoid
7357 <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>
7358 !! end
7359
7360 !! test
7361 Link containing "<#" and ">#" as a hex sequences
7362 !! wikitext
7363 [[%3c%23]][[%3e%23]]
7364 !! html
7365 <p>[[%3c%23]][[%3e%23]]
7366 </p>
7367 !! end
7368
7369 !! test
7370 Link containing an equals sign
7371 !! wikitext
7372 [[Special:BookSources/isbn=4-00-026157-6]]
7373 !! html/php
7374 <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>
7375 </p>
7376 !! html/parsoid
7377 <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>
7378 !! end
7379
7380 !! article
7381 Foo~bar
7382 !! text
7383 Just a test of an article title containing a tilde.
7384 !! endarticle
7385
7386 # note that links containing signatures, like [[Foo~~~~]], are
7387 # massaged by the pre-save transform (PST) and so the tildes are never
7388 # seen by the parser.
7389 !! test
7390 Link containing a tilde
7391 !! wikitext
7392 [[Foo~bar]]
7393 !! html/php
7394 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7395 </p>
7396 !! html/parsoid
7397 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7398 !! end
7399
7400 !! test
7401 Link containing double-single-quotes '' (bug 4598)
7402 !! wikitext
7403 [[Lista d''e paise d''o munno]]
7404 !! html/php
7405 <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>
7406 </p>
7407 !! html/parsoid
7408 <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>
7409 !! end
7410
7411 !! test
7412 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7413 !! wikitext
7414 Some [[Link|pretty ''italics'' and stuff]]!
7415 !! html/php
7416 <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>!
7417 </p>
7418 !! html/parsoid
7419 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7420 !! end
7421
7422 !! test
7423 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7424 !! wikitext
7425 ''Some [[Link|pretty ''italics'' and stuff]]!''
7426 !! html
7427 <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>
7428 </p>
7429 !! end
7430
7431 !! test
7432 Link with double quotes in title part (literal) and alternate part (interpreted)
7433 !! wikitext
7434 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7435
7436 [[''Pentecoste'']]
7437
7438 [[''Pentecoste''|Pentecoste]]
7439
7440 [[''Pentecoste''|''Pentecoste'']]
7441 !! html/php
7442 <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>
7443 </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>
7444 </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>
7445 </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>
7446 </p>
7447 !! html/parsoid
7448 <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>
7449 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7450 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7451 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7452 !! end
7453
7454 !! test
7455 Broken image links with HTML captions (bug 39700)
7456 !! wikitext
7457 [[File:Nonexistent|<script></script>]]
7458 [[File:Nonexistent|100x100px|<script></script>]]
7459 [[File:Nonexistent|&lt;]]
7460 [[File:Nonexistent|a<i>b</i>c]]
7461 !! html/php
7462 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7463 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7464 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7465 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7466 </p>
7467 !! html/parsoid
7468 <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>
7469 <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>
7470 <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>
7471 <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>
7472 !! end
7473
7474 !! test
7475 Plain link to URL
7476 !! wikitext
7477 [[http://www.example.com]]
7478 !! html/php
7479 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7480 </p>
7481 !! html/parsoid
7482 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7483 !! end
7484
7485 !! test
7486 Plain link to URL with link text
7487 !! wikitext
7488 [[http://www.example.com Link text]]
7489 !! html
7490 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7491 </p>
7492 !! end
7493
7494 !! test
7495 Plain link to protocol-relative URL
7496 !! wikitext
7497 [[//www.example.com]]
7498 !! html/php
7499 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7500 </p>
7501 !! html/parsoid
7502 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7503 !! end
7504
7505 !! test
7506 Plain link to protocol-relative URL with link text
7507 !! wikitext
7508 [[//www.example.com Link text]]
7509 !! html
7510 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7511 </p>
7512 !! end
7513
7514 !! test
7515 Plain link to page with question mark in title
7516 !! wikitext
7517 [[A?b]]
7518
7519 [[A?b|Baz]]
7520 !! html
7521 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7522 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7523 </p>
7524 !! end
7525
7526
7527 # I'm fairly sure the expected result here is wrong.
7528 # We want these to be URL links, not pseudo-pages with URLs for titles....
7529 # However the current output is also pretty screwy.
7530 #
7531 # ----
7532 # I'm changing it to match the current output--it arguably makes more
7533 # sense in the light of the test above. Old expected result was:
7534 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7535 #</p>
7536 # But I think this test is bordering on "garbage in, garbage out" anyway.
7537 # -- wtm
7538 !! test
7539 Piped link to URL
7540 !! wikitext
7541 Piped link to URL: [[http://www.example.com|an example URL]]
7542 !! html/php
7543 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7544 </p>
7545 !! html/parsoid
7546 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7547 !! end
7548
7549 !! test
7550 BUG 2: [[page|http://url/]] should link to page, not http://url/
7551 !! wikitext
7552 [[Main Page|http://url/]]
7553 !! html/php
7554 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7555 </p>
7556 !! html/parsoid
7557 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7558 !! end
7559
7560 # Parsoid does not mark self-links, by design.
7561 !! test
7562 BUG 337: Escaped self-links should be bold
7563 !! options
7564 title=[[Bug462]]
7565 !! wikitext
7566 [[Bu&#103;462]] [[Bug462]]
7567 !! html/php
7568 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7569 </p>
7570 !! html/php+tidy
7571 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7572 !! html/parsoid
7573 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7574 !! end
7575
7576 !! test
7577 Self-link to section should not be bold
7578 !! options
7579 title=[[Main Page]]
7580 !! wikitext
7581 [[Main Page#section]]
7582 !! html
7583 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7584 </p>
7585 !! end
7586
7587 !! article
7588 00
7589 !! text
7590 This is 00.
7591 !! endarticle
7592
7593 !!test
7594 Self-link to numeric title
7595 !!options
7596 title=[[0]]
7597 !! wikitext
7598 [[0]]
7599 !! html
7600 <p><strong class="selflink">0</strong>
7601 </p>
7602 !!end
7603
7604 !!test
7605 Link to numeric-equivalent title
7606 !!options
7607 title=[[0]]
7608 !! wikitext
7609 [[00]]
7610 !! html
7611 <p><a href="/wiki/00" title="00">00</a>
7612 </p>
7613 !!end
7614
7615 !! test
7616 <nowiki> inside a link
7617 !! wikitext
7618 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7619 !! html
7620 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7621 </p>
7622 !! end
7623
7624 !! test
7625 Non-breaking spaces in title
7626 !! wikitext
7627 [[&nbsp; Main &nbsp; Page &nbsp;]]
7628 !! html
7629 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7630 </p>
7631 !!end
7632
7633 !! test
7634 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7635 !! options
7636 language=ca
7637 !! wikitext
7638 '''[[Main Page]]'''
7639 !! html
7640 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7641 </p>
7642 !! end
7643
7644 !! test
7645 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7646 !! options
7647 language=ca
7648 !! wikitext
7649 ''[[Main Page]]''
7650 !! html
7651 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7652 </p>
7653 !! end
7654
7655 !! test
7656 Internal link with en linktrail: no apostrophes (bug 27473)
7657 !! options
7658 language=en
7659 !! wikitext
7660 [[Something]]'nice
7661 !! html
7662 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7663 </p>
7664 !! end
7665
7666 !! test
7667 Internal link with ca linktrail with apostrophes (bug 27473)
7668 !! options
7669 language=ca
7670 !! wikitext
7671 [[Something]]'nice
7672 !! html
7673 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7674 </p>
7675 !! end
7676
7677 !! test
7678 Internal link with kaa linktrail with apostrophes (bug 27473)
7679 !! options
7680 language=kaa
7681 !! wikitext
7682 [[Something]]'nice
7683 !! html
7684 <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>
7685 </p>
7686 !! end
7687
7688 !! test
7689 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7690 !! wikitext
7691 [[User:Foo/Test/63636:Bar|Test]]
7692 !! html/php
7693 <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>
7694 </p>
7695 !! html/parsoid
7696 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7697 !! end
7698
7699 !! test
7700 Purely hash wikilink
7701 !! options
7702 title=[[User:test/123]]
7703 !! wikitext
7704 [[#a|b]]
7705 !! html/php
7706 <p><a href="#a">b</a>
7707 </p>
7708 !! html/parsoid
7709 <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>
7710 !! end
7711
7712 !! test
7713 1. Interaction of linktrail and template encapsulation
7714 !! options
7715 parsoid
7716 !! wikitext
7717 {{echo|[[Foo]]}}l
7718 !! html
7719 <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>
7720 !! end
7721
7722 !! test
7723 2. Interaction of linktrail and template encapsulation
7724 !! options
7725 parsoid
7726 !! wikitext
7727 {{echo|Some [[Fool]]}}s
7728 !! html
7729 <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>
7730 !! end
7731
7732 !! test
7733 3. Interaction of linktrail and template encapsulation
7734 !! options
7735 parsoid
7736 !! wikitext
7737 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7738 !! html
7739 <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>
7740 !! end
7741
7742 !! article
7743 Söfnuður
7744 !! text
7745 Test.
7746 !! endarticle
7747
7748 !! test
7749 Internal link with is link prefix
7750 !! options
7751 language=is
7752 !! wikitext
7753 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7754 !! html
7755 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7756 </p>
7757 !! end
7758
7759 !! article
7760 Mótmælendatrú
7761 !! text
7762 Test.
7763 !! endarticle
7764
7765 !! test
7766 Internal link with is link trail and link prefix
7767 !! options
7768 language=is
7769 !! wikitext
7770 [[mótmælendatrú|xxx]]ar
7771 [[mótmælendatrú]]ar
7772 mótmælenda[[söfnuður]]
7773 mótmælenda[[söfnuður|söfnuðir]]
7774 mótmælenda[[söfnuður|söfnuðir]]xxx
7775 !! html
7776 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7777 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7778 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7779 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7780 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Parsoid link trail escaping
7786 !! options
7787 parsoid=html2wt,html2html
7788 !! html/parsoid
7789 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7790 !! wikitext
7791 [[apple]]<nowiki/>s
7792 !! end
7793
7794 !! test
7795 Parsoid link prefix escaping
7796 !! options
7797 language=is
7798 parsoid=html2wt,html2html
7799 !! html/parsoid
7800 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7801 !! wikitext
7802 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7803 !! end
7804
7805 !! test
7806 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7807 !! wikitext
7808 [[Foo| bar]]
7809
7810 [[Foo| ''bar'']]
7811
7812 [http://wp.org foo]
7813
7814 [http://wp.org ''foo'']
7815 !! html
7816 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7817 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7818 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7819 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7820 </p>
7821 !! end
7822
7823 !! test
7824 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7825 !! options
7826 parsoid
7827 !! wikitext
7828 [[Foo|{{echo|a}} b {{echo|c}}]]
7829 !! html
7830 <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>
7831 !! end
7832
7833 !! test
7834 Link with angle bracket after anchor
7835 !! wikitext
7836 [[Foo#<bar>]]
7837 !! html/php
7838 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7839 </p>
7840 !! html/parsoid
7841 <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>
7842 !! end
7843
7844 ###
7845 ### Interwiki links (see maintenance/interwiki.sql)
7846 ###
7847
7848 !! test
7849 Inline interwiki link
7850 !! options
7851 parsoid=wt2html,wt2wt,html2html
7852 !! wikitext
7853 [[MeatBall:SoftSecurity]]
7854 !! html/php
7855 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7856 </p>
7857 !! html/parsoid
7858 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7859 !! end
7860
7861 !! test
7862 Inline interwiki link with empty title (bug 2372)
7863 !! options
7864 parsoid=wt2html,wt2wt,html2html
7865 !! wikitext
7866 [[MeatBall:]]
7867 !! html/php
7868 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7869 </p>
7870 !! html/parsoid
7871 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7872 !! end
7873
7874 !! test
7875 Interwiki link encoding conversion (bug 1636)
7876 !! wikitext
7877 *[[Wikipedia:ro:Olteni&#0355;a]]
7878 *[[Wikipedia:ro:Olteni&#355;a]]
7879 !! html
7880 <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>
7881 <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>
7882
7883 !! html+tidy
7884 <ul>
7885 <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>
7886 <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>
7887 </ul>
7888 !! end
7889
7890 !! test
7891 Interwiki link with fragment (bug 2130)
7892 !! wikitext
7893 [[MeatBall:SoftSecurity#foo]]
7894 !! html
7895 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7896 </p>
7897 !! end
7898
7899 # Ideally the wikipedia: prefix here should be proto-relative too
7900 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7901 # define the 'en' prefix, and originally the test used 'wikipedia',
7902 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7903 # article.
7904 !! test
7905 Different interwiki prefixes mapping to the same URL
7906 !! wikitext
7907 [[:en:Foo]]
7908
7909 [[:en:Foo|Foo]]
7910
7911 [[wikipedia:Foo]]
7912
7913 [[:wikipedia:Foo|Foo]]
7914
7915 [[wikipedia:en:Foo]]
7916
7917 [[:wikipedia:en:Foo]]
7918
7919 [[ wikiPEdia :Foo]]
7920 !! html/parsoid
7921 <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>
7922
7923 <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>
7924
7925 <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>
7926
7927 <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>
7928
7929 <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>
7930
7931 <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>
7932
7933 <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>
7934 !! end
7935
7936 !! test
7937 Interwiki links that cannot be represented in wiki syntax
7938 !! wikitext
7939 [[meatball:ok]]
7940 [[meatball:ok#foo|ok with fragment]]
7941 [[meatball:ok_as_well?|ok ending with ? mark]]
7942 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7943 [http://de.wikipedia.org/wiki/#foo is just fragment]
7944
7945 !! html/php
7946 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7947 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7948 <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>
7949 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7950 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7951 </p>
7952 !! html/parsoid
7953 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7954 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7955 <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>
7956 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7957 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7958 !! end
7959
7960 !! test
7961 Interwiki links: trail
7962 !! wikitext
7963 [[wikipedia:Foo|Ba]]r
7964 !! html/php
7965 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7966 </p>
7967 !! html/parsoid
7968 <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>
7969 !! end
7970
7971 !! test
7972 Local interwiki link
7973 !! options
7974 parsoid=wt2html,wt2wt,html2html
7975 !! wikitext
7976 [[local:Template:Foo]]
7977 !! html/php
7978 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7979 </p>
7980 !! html/parsoid
7981 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7982 !! end
7983
7984 # Parsoid does not mark self-links, by design.
7985 !! test
7986 Local interwiki link: self-link to current page
7987 !! options
7988 title=[[Main Page]]
7989 parsoid=wt2html,wt2wt,html2html
7990 !! wikitext
7991 [[local:Main Page]]
7992 !! html/php
7993 <p><strong class="selflink">local:Main Page</strong>
7994 </p>
7995 !! html/parsoid
7996 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7997 !! end
7998
7999 !! test
8000 Local interwiki link: prefix only (bug 64167)
8001 !! options
8002 parsoid=wt2html,wt2wt,html2html
8003 !! wikitext
8004 [[local:]]
8005 !! html/php
8006 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8007 </p>
8008 !! html/parsoid
8009 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8010 !! end
8011
8012 !! test
8013 Local interwiki link: with additional interwiki prefix (bug 61357)
8014 !! options
8015 parsoid=wt2html,wt2wt,html2html
8016 !! wikitext
8017 [[local:meatball:Hello]]
8018 !! html/php
8019 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8020 </p>
8021 !! html/parsoid
8022 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8023 !! end
8024
8025 !! test
8026 Multiple local interwiki link prefixes
8027 !! wikitext
8028 [[local:local:local:local:mi:local:Foo]]
8029 !! options
8030 parsoid=wt2html,wt2wt,html2html
8031 !! html/php
8032 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8033 </p>
8034 !! html/parsoid
8035 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8036 !! end
8037
8038 ###
8039 ### Interlanguage links
8040 ### Language links (so that searching for '### language' matches..)
8041 ###
8042
8043 !! test
8044 Interlanguage link
8045 !! options
8046 parsoid=wt2html,wt2wt,html2html
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 Interlanguage link with spacing
8060 !! options
8061 parsoid=wt2html,wt2wt,html2html
8062 !! wikitext
8063 Blah blah blah
8064 [[ zh : Chinese ]]
8065 !! html/php
8066 <p>Blah blah blah
8067 </p>
8068 !! html/parsoid
8069 <p>Blah blah blah</p>
8070 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8071 !! end
8072
8073 !! test
8074 Double interlanguage link
8075 !! options
8076 parsoid=wt2html,wt2wt,html2html
8077 !! wikitext
8078 Blah blah blah
8079 [[es:Spanish]]
8080 [[zh:Chinese]]
8081 !! html/php
8082 <p>Blah blah blah
8083 </p>
8084 !! html/parsoid
8085 <p>Blah blah blah</p>
8086 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8087 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8088 !! end
8089
8090 !! test
8091 Interlanguage link variations
8092 !! options
8093 parsoid=wt2html,wt2wt,html2html
8094 !! wikitext
8095 Blah blah blah
8096 [[ es :Spanish]]
8097 [[ ZH :Chinese]]
8098 [[es:Foo_bar]]
8099 !! html/php
8100 <p>Blah blah blah
8101 </p>
8102 !! html/parsoid
8103 <p>Blah blah blah</p>
8104 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8105 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8106 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8107 !! end
8108
8109 !! test
8110 Space and question mark encoding in interlanguage links (T95473)
8111 !! options
8112 parsoid=wt2html,wt2wt,html2html
8113 !! wikitext
8114 Blah blah blah
8115 [[es:Foo bar?]]
8116 !! html/php
8117 <p>Blah blah blah
8118 </p>
8119 !! html/parsoid
8120 <p>Blah blah blah</p>
8121 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8122 !! end
8123
8124 !! test
8125 Interlanguage link, with prefix links
8126 !! options
8127 language=ln
8128 !! wikitext
8129 Blah blah blah
8130 [[zh:Chinese]]
8131 !! html/php
8132 <p>Blah blah blah
8133 </p>
8134 !! html/parsoid
8135 <p>Blah blah blah</p>
8136 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8137 !! end
8138
8139 !! test
8140 Double interlanguage link, with prefix links (bug 8897)
8141 !! options
8142 language=ln
8143 !! wikitext
8144 Blah blah blah
8145 [[es:Spanish]]
8146 [[zh:Chinese]]
8147 !! html/php
8148 <p>Blah blah blah
8149 </p>
8150 !! html/parsoid
8151 <p>Blah blah blah</p>
8152 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8153 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8154 !! end
8155
8156 !! test
8157 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8158 !! wikitext
8159 Blah blah blah
8160 [[mul:Article]]
8161 !! html/php
8162 <p>Blah blah blah
8163 </p>
8164 !! html/parsoid
8165 <p>Blah blah blah</p>
8166 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8167 !! end
8168
8169 !! test
8170 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8171 !! options
8172 language=ln
8173 !! wikitext
8174 [[WW&nbsp;II]]
8175 !! html
8176 <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>
8177 </p>
8178 !! end
8179
8180 !! test
8181 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8182 !! options
8183 parsoid=html2wt
8184 !! html/parsoid
8185 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8186 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8187 !! wikitext
8188 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8189
8190 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8191 !! end
8192
8193 !! test
8194 Parsoid: handle constructor well
8195 !! wikitext
8196 [[constructor]]
8197
8198 [[constructor:foo]]
8199 !! html/php
8200 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8201 </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>
8202 </p>
8203 !! html/parsoid
8204 <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>
8205
8206 <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>
8207 !! end
8208
8209 !! article
8210 ko:
8211 !! text
8212 Test.
8213 !! endarticle
8214
8215 # Note that `ko` isn't a known interlanguage prefix
8216 !! test
8217 Parsoid: recognize interlanguage links without a target page
8218 !! options
8219 ill
8220 !! wikitext
8221 [[es:]]
8222
8223 [[ko:]]
8224 !! html/php
8225 es:
8226 !! html/parsoid
8227 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8228
8229 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8230 !! end
8231
8232 # Note that `ko` isn't a known interwiki prefix
8233 !! test
8234 Parsoid: recognize interwiki links without a target page
8235 !! options
8236 parsoid=wt2html,wt2wt,html2html
8237 !! wikitext
8238 [[:es:]]
8239
8240 [[:ko:]]
8241 !! html/php
8242 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8243 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8244 </p>
8245 !! html/parsoid
8246 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8247 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8248 !! end
8249
8250 !! test
8251 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8252 !! wikitext
8253 [[mi:Foo]]
8254 !! html/php
8255 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8256 </p>
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8259 !! end
8260
8261 !! test
8262 Interlanguage link with preceding local interwiki link (bug 68085)
8263 !! options
8264 parsoid=wt2html,wt2wt,html2html
8265 !! wikitext
8266 Blah blah blah
8267 [[local:es:Spanish]]
8268 !! html/php
8269 <p>Blah blah blah
8270 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8271 </p>
8272 !! html/parsoid
8273 <p>Blah blah blah
8274 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8275 !! end
8276
8277 !! test
8278 Looks like an interlanguage link, but is actually a local interwiki
8279 !! options
8280 parsoid=wt2html,wt2wt,html2html
8281 !! wikitext
8282 Blah blah blah
8283 [[mi:Template:Foo]]
8284 !! html/php
8285 <p>Blah blah blah
8286 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8287 </p>
8288 !! html/parsoid
8289 <p>Blah blah blah
8290 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8291 !! end
8292
8293 ###
8294 ### Redirects, Parsoid-only
8295 ###
8296
8297 !! test
8298 1. Simple redirect to page
8299 !! wikitext
8300 #REDIRECT [[Main Page]]
8301 !! html/parsoid
8302 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8303 !! end
8304
8305 !! test
8306 2. Other redirect variants
8307 !! wikitext
8308 #REDIRECT [[Main_Page]]
8309 !! html/parsoid
8310 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8311 !! end
8312
8313 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8314 # This tests the Parsoid bail-out code.
8315 !! test
8316 3. Other redirect variants
8317 !! wikitext
8318 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8319 !! html/parsoid
8320 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8321 !! end
8322
8323 !! test
8324 4. Redirect to a templated destination
8325 !! wikitext
8326 #REDIRECT [[{{echo|Foo}}bar]]
8327 !! html/parsoid
8328 <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"}]]}'/>
8329 !! end
8330
8331 !! test
8332 Empty redirect
8333 !! options
8334 parsoid=wt2html,wt2wt
8335 !! wikitext
8336 #REDIRECT [[]]
8337 !! html/parsoid
8338 <ol>
8339 <li>REDIRECT [[]]</li></ol>
8340 !! end
8341
8342 !! test
8343 Optional colon in #REDIRECT
8344 !! options
8345 # the colon is archaic syntax. we support it for wt2html, but we
8346 # don't care that it roundtrips back to the modern syntax.
8347 parsoid=wt2html,html2html
8348 !! wikitext
8349 #REDIRECT:[[Main Page]]
8350 !! html/parsoid
8351 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8352 !! end
8353
8354 !! test
8355 Whitespace in #REDIRECT with optional colon
8356 !! options
8357 # the colon and gratuitous whitespace is archaic syntax. we support
8358 # it for wt2html, but we don't care that it roundtrips back to the
8359 # modern syntax (without extra whitespace)
8360 parsoid=wt2html,html2html
8361 !! wikitext
8362
8363 #REDIRECT
8364 :
8365 [[Main Page]]
8366 !! html/parsoid
8367 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8368 !! end
8369
8370 !! test
8371 Piped link in #REDIRECT
8372 !! options
8373 # content after piped link is ignored. we support this syntax,
8374 # but don't care that the piped link is lost when we roundtrip this.
8375 parsoid=wt2html
8376 !! wikitext
8377 #REDIRECT [[Main Page|bar]]
8378 !! html/parsoid
8379 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8380 !! end
8381
8382 !! test
8383 Redirect to category (T104502)
8384 !! options
8385 parsoid=wt2html,wt2wt
8386 !! wikitext
8387 #REDIRECT [[Category:Foo]]
8388 !! html/parsoid
8389 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8390 !! end
8391
8392 !! test
8393 Redirect to category with URL encoding (T104502)
8394 !! options
8395 parsoid=wt2html
8396 !! wikitext
8397 #REDIRECT [[Category%3AFoo]]
8398 !! html/parsoid
8399 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8400 !! end
8401
8402 !! test
8403 Redirect to category page
8404 !! wikitext
8405 #REDIRECT [[:Category:Foo]]
8406 !! html/parsoid
8407 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8408 !! end
8409
8410 !! test
8411 Redirect to image page (1)
8412 !! wikitext
8413 #REDIRECT [[File:Wiki.png]]
8414 !! html/parsoid
8415 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8416 !! end
8417
8418 !! test
8419 Redirect to image page (2)
8420 !! wikitext
8421 #REDIRECT [[Image:Wiki.png]]
8422 !! html/parsoid
8423 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8424 !! end
8425
8426 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8427 # Next test confirms this.
8428 !! test
8429 Redirect to language (1) (T104918)
8430 !! options
8431 parsoid=wt2html,wt2wt,html2html
8432 !! wikitext
8433 #REDIRECT [[en:File:Wiki.png]]
8434 !! html/parsoid
8435 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8436 !! end
8437
8438 !! test
8439 Redirect to language (2) (T104918)
8440 !! wikitext
8441 #REDIRECT [[:en:File:Wiki.png]]
8442 !! html/parsoid
8443 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8444 !! end
8445
8446 !! test
8447 Redirect to interwiki (T104918)
8448 !! wikitext
8449 #REDIRECT [[meatball:File:Wiki.png]]
8450 !! html/parsoid
8451 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8452 !! end
8453
8454 !! test
8455 Non-English #REDIRECT
8456 !! options
8457 language=is
8458 !! wikitext
8459 #TILVÍSUN [[Main Page]]
8460 !! html/parsoid
8461 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8462 !! end
8463
8464 !! test
8465 Redirect syntax under text isn't considered a redirect
8466 !! wikitext
8467 some text
8468 #redirect [[Main Page]]
8469 !! html/parsoid
8470 <p>some text</p>
8471 <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>
8472 !! end
8473
8474 # FIXME: Should hoist the redirect to the top of the page and ensure there
8475 # is only one.
8476 !! test
8477 New redirect
8478 !! options
8479 parsoid=html2wt
8480 !! html/parsoid
8481 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8482 !! wikitext
8483 Foo
8484 #REDIRECT [[Foo]]
8485 !! end
8486
8487 ##
8488 ## XHTML tidiness
8489 ###
8490
8491 !! test
8492 <br> to <br />
8493 !! wikitext
8494 1<br>2<br />3
8495 !! html
8496 <p>1<br />2<br />3
8497 </p>
8498 !! end
8499
8500 !! test
8501 Broken br tag sanitization
8502 !! wikitext
8503 </br>
8504 !! html/php
8505 <p>&lt;/br&gt;
8506 </p>
8507 !! end
8508
8509 # TODO: Fix html2html mode (bug 51055)!
8510 !! test
8511 Parsoid: Broken br tag recognition
8512 !! options
8513 parsoid=wt2html
8514 !! wikitext
8515 </br>
8516
8517 <br/ >
8518 !! html+tidy
8519 <p><br /></p>
8520 <p><br /></p>
8521 !! end
8522
8523 !! test
8524 Incorrecly removing closing slashes from correctly formed XHTML
8525 !! wikitext
8526 <br style="clear:both;" />
8527 !! html
8528 <p><br style="clear:both;" />
8529 </p>
8530 !! end
8531
8532 !! test
8533 Failing to transform badly formed HTML into correct XHTML
8534 !! wikitext
8535 <br style="clear: left;">
8536 <br style="clear: right;">
8537 <br style="clear: both;">
8538 !! html
8539 <p><br style="clear: left;" />
8540 <br style="clear: right;" />
8541 <br style="clear: both;" />
8542 </p>
8543 !!end
8544
8545 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8546 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8547 !! test
8548 Handling html with a div self-closing tag
8549 !! wikitext
8550 <div title />
8551 <div title/>
8552 <div title/ >
8553 <div title=bar />
8554 <div title=bar/>
8555 <div title=bar/ >
8556 !! html/php
8557 <p>&lt;div title /&gt;
8558 &lt;div title/&gt;
8559 </p>
8560 <div>
8561 <p>&lt;div title=bar /&gt;
8562 &lt;div title=bar/&gt;
8563 </p>
8564 <div title="bar/"></div>
8565 </div>
8566
8567 !! html/parsoid
8568 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8569 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8570 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8571 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8572 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8573 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8574 !! end
8575
8576 !! test
8577 Handling html with a br self-closing tag
8578 !! wikitext
8579 <br title />
8580 <br title/>
8581 <br title/ >
8582 <br title=bar />
8583 <br title=bar/>
8584 <br title=bar/ >
8585 !! html/php
8586 <p><br title="" />
8587 <br title="" />
8588 <br />
8589 <br title="bar" />
8590 <br title="bar" />
8591 <br title="bar/" />
8592 </p>
8593 !! html/parsoid
8594 <p><br title="" />
8595 <br title="" />
8596 <br title="" />
8597 <br title="bar" />
8598 <br title="bar" />
8599 <br title="bar/" />
8600 </p>
8601 !! end
8602
8603 !! test
8604 Horizontal ruler (should it add that extra space?)
8605 !! wikitext
8606 <hr>
8607 <hr >
8608 foo <hr
8609 > bar
8610 !! html+tidy
8611 <hr />
8612 <hr />
8613 <p>foo</p>
8614 <hr />
8615 <p>bar</p>
8616 !! end
8617
8618 !! test
8619 Horizontal ruler -- 4+ dashes render hr
8620 !! wikitext
8621 ----
8622 !! html
8623 <hr />
8624
8625 !! end
8626
8627 !! test
8628 Horizontal ruler -- eats additional dashes on the same line
8629 !! wikitext
8630 ---------
8631 !! html
8632 <hr />
8633
8634 !! end
8635
8636 !! test
8637 Horizontal ruler -- does not collapse dashes on consecutive lines
8638 !! wikitext
8639 ----
8640 ----
8641 !! html
8642 <hr />
8643 <hr />
8644
8645 !! end
8646
8647 !! test
8648 Horizontal ruler -- <4 dashes render as plain text
8649 !! wikitext
8650 ---
8651 !! html
8652 <p>---
8653 </p>
8654 !! end
8655
8656 !! test
8657 Horizontal ruler -- Supports content following dashes on same line
8658 !! wikitext
8659 ---- Foo
8660 !! html
8661 <hr /> Foo
8662
8663 !! html+tidy
8664 <hr />
8665 <p>Foo</p>
8666 !! end
8667
8668 ###
8669 ### Block-level elements
8670 ###
8671 !! test
8672 Common list
8673 !! wikitext
8674 *Common list
8675 * item 2
8676 *item 3
8677 !! html
8678 <ul><li>Common list</li>
8679 <li> item 2</li>
8680 <li>item 3</li></ul>
8681
8682 !! end
8683
8684 !! test
8685 Numbered list
8686 !! wikitext
8687 #Numbered list
8688 #item 2
8689 # item 3
8690 !! html
8691 <ol><li>Numbered list</li>
8692 <li>item 2</li>
8693 <li> item 3</li></ol>
8694
8695 !! end
8696
8697 !! test
8698 Mixed list
8699 !! wikitext
8700 *Mixed list
8701 *# with numbers
8702 ** and bullets
8703 *# and numbers
8704 *bullets again
8705 **bullet level 2
8706 ***bullet level 3
8707 ***#Number on level 4
8708 **bullet level 2
8709 **#Number on level 3
8710 **#Number on level 3
8711 *#number level 2
8712 *Level 1
8713 *** Level 3
8714 #** Level 3, but ordered
8715 !! html
8716 <ul><li>Mixed list
8717 <ol><li> with numbers</li></ol>
8718 <ul><li> and bullets</li></ul>
8719 <ol><li> and numbers</li></ol></li>
8720 <li>bullets again
8721 <ul><li>bullet level 2
8722 <ul><li>bullet level 3
8723 <ol><li>Number on level 4</li></ol></li></ul></li>
8724 <li>bullet level 2
8725 <ol><li>Number on level 3</li>
8726 <li>Number on level 3</li></ol></li></ul>
8727 <ol><li>number level 2</li></ol></li>
8728 <li>Level 1
8729 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8730 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8731
8732 !! end
8733
8734 !! test
8735 Nested lists 1
8736 !! wikitext
8737 *foo
8738 **bar
8739 !! html
8740 <ul><li>foo
8741 <ul><li>bar</li></ul></li></ul>
8742
8743 !! end
8744
8745 !! test
8746 Nested lists 2
8747 !! wikitext
8748 **foo
8749 *bar
8750 !! html
8751 <ul><li><ul><li>foo</li></ul></li>
8752 <li>bar</li></ul>
8753
8754 !! end
8755
8756 !! test
8757 Nested lists 3 (first element empty)
8758 !! wikitext
8759 *
8760 **bar
8761 !! html
8762 <ul><li>
8763 <ul><li>bar</li></ul></li></ul>
8764
8765 !! end
8766
8767 !! test
8768 Nested lists 4 (first element empty)
8769 !! wikitext
8770 **
8771 *bar
8772 !! html
8773 <ul><li><ul><li></li></ul></li>
8774 <li>bar</li></ul>
8775
8776 !! end
8777
8778 !! test
8779 Nested lists 5 (both elements empty)
8780 !! wikitext
8781 **
8782 *
8783 !! html
8784 <ul><li><ul><li></li></ul></li>
8785 <li></li></ul>
8786
8787 !! end
8788
8789 !! test
8790 Nested lists 6 (both elements empty)
8791 !! wikitext
8792 *
8793 **
8794 !! html
8795 <ul><li>
8796 <ul><li></li></ul></li></ul>
8797
8798 !! end
8799
8800 !! test
8801 Nested lists 7 (skip initial nesting levels)
8802 !! wikitext
8803 *** foo
8804 !! html
8805 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8806
8807 !! end
8808
8809 !! test
8810 Nested lists 8 (multiple nesting transitions)
8811 !! wikitext
8812 * foo
8813 *** bar
8814 ** baz
8815 * boo
8816 !! html
8817 <ul><li> foo
8818 <ul><li><ul><li> bar</li></ul></li>
8819 <li> baz</li></ul></li>
8820 <li> boo</li></ul>
8821
8822 !! end
8823
8824 !! test
8825 Nested lists 9 (extension interaction)
8826 !! options
8827 parsoid
8828 !! wikitext
8829 *<references />
8830 !! html/parsoid
8831 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8832 !! end
8833
8834 !! test
8835 1. Lists with start-of-line-transparent tokens before bullets: Comments
8836 !! wikitext
8837 *foo
8838 *<!--cmt-->bar
8839 <!--cmt-->*baz
8840 !! html
8841 <ul><li>foo</li>
8842 <li>bar</li>
8843 <li>baz</li></ul>
8844
8845 !! end
8846
8847 !! test
8848 2. Lists with start-of-line-transparent tokens before bullets: Template close
8849 !! wikitext
8850 *foo {{echo|bar
8851 }}*baz
8852 !! html
8853 <ul><li>foo bar</li>
8854 <li>baz</li></ul>
8855
8856 !! end
8857
8858 !! test
8859 List items are not parsed correctly following a <pre> block (bug 785)
8860 !! wikitext
8861 * <pre>foo</pre>
8862 * <pre>bar</pre>
8863 * zar
8864 !! html/php
8865 <ul><li> <pre>foo</pre></li>
8866 <li> <pre>bar</pre></li>
8867 <li> zar</li></ul>
8868
8869 !! html/parsoid
8870 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8871 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8872 <li> zar</li></ul>
8873 !! end
8874
8875 !! test
8876 List items from template
8877 !! wikitext
8878
8879 {{inner list}}
8880 * item 2
8881
8882 * item 0
8883 {{inner list}}
8884 * item 2
8885
8886 * item 0
8887 * notSOL{{inner list}}
8888 * item 2
8889 !! html
8890 <ul><li> item 1</li>
8891 <li> item 2</li></ul>
8892 <ul><li> item 0</li>
8893 <li> item 1</li>
8894 <li> item 2</li></ul>
8895 <ul><li> item 0</li>
8896 <li> notSOL</li>
8897 <li> item 1</li>
8898 <li> item 2</li></ul>
8899
8900 !! end
8901
8902 !! test
8903 List interrupted by empty line or heading
8904 !! wikitext
8905 * foo
8906
8907 ** bar
8908 == A heading ==
8909 * Another list item
8910 !! html
8911 <ul><li> foo</li></ul>
8912 <ul><li><ul><li> bar</li></ul></li></ul>
8913 <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>
8914 <ul><li> Another list item</li></ul>
8915
8916 !!end
8917
8918 !!test
8919 Multiple list tags generated by templates
8920 !! wikitext
8921 {{echo|<li>}}a
8922 {{echo|<li>}}b
8923 {{echo|<li>}}c
8924 !! html
8925 <li>a
8926 <li>b
8927 <li>c</li>
8928 </li>
8929 </li>
8930
8931 !! html+tidy
8932 <ul>
8933 <li>a</li>
8934 <li>b</li>
8935 <li>c</li>
8936 </ul>
8937 !!end
8938
8939 !!test
8940 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8941 !! wikitext
8942 *a
8943 <!--This line will NOT split the list-->
8944 *b
8945 <!--This line will NOT split the list either-->
8946 *c
8947 <!--foo--> <!----> <!--This line NOT split the list either-->
8948 *d
8949 !! html
8950 <ul><li>a</li>
8951 <li>b</li>
8952 <li>c</li>
8953 <li>d</li></ul>
8954
8955 !!end
8956
8957 !!test
8958 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8959 !! wikitext
8960 *a
8961 <!--This line will NOT split the list-->
8962 *b
8963 <!--This line will NOT split the list either-->
8964 *c
8965 <!--foo--> <!----> <!--This line NOT split the list
8966 either-->
8967 *d
8968 !! html
8969 <ul><li>a</li>
8970 <li>b</li>
8971 <li>c</li>
8972 <li>d</li></ul>
8973
8974 !!end
8975
8976 !!test
8977 Test the li-hack
8978 (The PHP parser relies on Tidy for the hack)
8979 !!options
8980 parsoid=wt2html,wt2wt
8981 !! wikitext
8982 * foo
8983 * <li>li-hack
8984 * {{echo|<li>templated li-hack}}
8985 * <!--foo--> <li> unsupported li-hack with preceding comments
8986
8987 <ul>
8988 <li><li>not a li-hack
8989 </li>
8990 </ul>
8991 !! html+tidy
8992 <ul>
8993 <li>foo</li>
8994 <li>li-hack</li>
8995 <li>templated li-hack</li>
8996 <li>unsupported li-hack with preceding comments</li>
8997 </ul>
8998 <ul>
8999 <li>not a li-hack</li>
9000 </ul>
9001 !!end
9002
9003 !! test
9004 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9005 !! options
9006 parsoid
9007 !! wikitext
9008 # foo
9009 ## bar
9010 * foo
9011 ** bar
9012 : foo
9013 :: bar
9014 !! html
9015 <ol>
9016 <li> foo<ol>
9017 <li> bar</li>
9018 </ol></li>
9019 </ol><ul>
9020 <li> foo<ul>
9021 <li> bar</li>
9022 </ul></li>
9023 </ul><dl>
9024 <dd> foo<dl>
9025 <dd> bar</dd>
9026 </dl></dd>
9027 </dl>
9028 !! end
9029
9030 !! test
9031 Parsoid: Test of whitespace serialization with Templated bullets
9032 !! options
9033 parsoid
9034 !! wikitext
9035 * {{bullet}}
9036 !! html
9037 <ul>
9038 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9039 </ul>
9040 !! end
9041
9042 # ------------------------------------------------------------------------
9043 # The next set of tests are about Parsoid's ability to handle badly nested
9044 # tags (parse, minimize scope of fixup, and roundtrip back)
9045 # ------------------------------------------------------------------------
9046
9047 !! test
9048 Unbalanced closing block tags break a list
9049 (php parser relies on Tidy to fix up)
9050 !! wikitext
9051 <div>
9052 *a</div><div>
9053 *b</div>
9054 !! html+tidy
9055 <div>
9056 <ul>
9057 <li>a</li>
9058 </ul>
9059 </div>
9060 <div>
9061 <ul>
9062 <li>b</li>
9063 </ul>
9064 </div>
9065 !! end
9066
9067 # Parsoid fails this test, but it might be tricky to support properly.
9068 # See bug 68395.
9069 !! test
9070 Unbalanced closing non-block tags don't break a list
9071 (php parser relies on Tidy to fix up)
9072 !! wikitext
9073 <span>
9074 *a</span><span>
9075 *b</span>
9076 !! html/php+tidy
9077 <ul>
9078 <li><span>a</span></li>
9079 <li><span>b</span></li>
9080 </ul>
9081 !! html/parsoid
9082 <span>
9083 <ul>
9084 <li>a<span></span>
9085 </li>
9086 <li>b
9087 </li>
9088 </ul>
9089 </span>
9090 !! end
9091
9092 !! test
9093 Unclosed formatting tags that straddle lists are closed and reopened
9094 (php parser relies on Tidy to fix up)
9095 !! options
9096 parsoid=wt2html,wt2wt,html2html
9097 !! wikitext
9098 # <s> a
9099 # b </s>
9100 !! html/php+tidy
9101 <ol>
9102 <li><s>a</s></li>
9103 <li><s>b</s></li>
9104 </ol>
9105 !! html/parsoid
9106 <ol><li> <s> a</s></li>
9107 <li><s> b </s></li></ol>
9108 !! end
9109
9110 # See bug 68395.
9111 !!test
9112 1. List embedded in a formatting tag
9113 !! wikitext
9114 <small>
9115 * foo
9116 </small>
9117 !! html/php+tidy
9118 <ul>
9119 <li><small>foo</small></li>
9120 </ul>
9121 !! html/parsoid
9122 <small>
9123 <ul>
9124 <li> foo</li>
9125 </ul>
9126 </small>
9127 !!end
9128
9129 ## Ugly Parsoid output here
9130 ## Not sure what the right output is.
9131 !!test
9132 2. List embedded in a formatting tag
9133 !! wikitext
9134 <small>
9135 *a
9136 *b</small>
9137 !! html/php+tidy
9138 <ul>
9139 <li><small>a</small></li>
9140 <li><small>b</small></li>
9141 </ul>
9142 !! html/parsoid
9143 <small></small>
9144 <ul><small>
9145 <li>a</li>
9146 </small>
9147 <li><small>b</small></li>
9148 </ul>
9149 !!end
9150
9151 # Ugly Parsoid and PHP parser output here
9152 # Not sure if we want to make this a test!
9153 #
9154 ## !!test
9155 ## 3. Unclosed formatting tags in list elements
9156 ## !! wikitext
9157 ## *<small>a
9158 ## *<small>b
9159 ## !! html/php+tidy
9160 ## <ul>
9161 ## <li><small>a</small></li>
9162 ## <li><small><small>b</small></small></li>
9163 ## </ul>
9164 ## !! html/parsoid
9165 ## <ul>
9166 ## <li><small>a</small></li>
9167 ## <small>
9168 ## <li><small>b</small></li>
9169 ## </small></ul>
9170 ## !!end
9171
9172 # This is a bug in the PHP parser + tidy combination.
9173 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9174 # and then fostered out of the table by tidy.)
9175 # We believe the Parsoid output to be correct.
9176 !! test
9177 Table with missing opening <tr> tag
9178 !! options
9179 parsoid=wt2html,wt2wt
9180 !! wikitext
9181 <table>
9182 <td>foo</td>
9183 </tr>
9184 </table>
9185 !! html+tidy
9186 <table>
9187 <tr>
9188 <td>foo</td>
9189 </tr>
9190 </table>
9191 !! end
9192
9193 ###
9194 ### Magic Words
9195 ###
9196
9197 # Note that the current date is hard-coded as
9198 # 1970-01-01T00:02:03Z (a Thursday)
9199 # when running parser tests. The timezone is also fixed to GMT, so
9200 # local date will be identical to current date.
9201
9202 !! test
9203 Magic Word: {{CURRENTDAY}}
9204 !! wikitext
9205 {{CURRENTDAY}}
9206 !! html
9207 <p>1
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{CURRENTDAY2}}
9213 !! wikitext
9214 {{CURRENTDAY2}}
9215 !! html
9216 <p>01
9217 </p>
9218 !! end
9219
9220 !! test
9221 Magic Word: {{CURRENTDAYNAME}}
9222 !! wikitext
9223 {{CURRENTDAYNAME}}
9224 !! html
9225 <p>Thursday
9226 </p>
9227 !! end
9228
9229 !! test
9230 Magic Word: {{CURRENTDOW}}
9231 !! wikitext
9232 {{CURRENTDOW}}
9233 !! html
9234 <p>4
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{CURRENTMONTH}}
9240 !! wikitext
9241 {{CURRENTMONTH}}
9242 !! html
9243 <p>01
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Word: {{CURRENTMONTH1}}
9249 !! wikitext
9250 {{CURRENTMONTH1}}
9251 !! html
9252 <p>1
9253 </p>
9254 !! end
9255
9256 !! test
9257 Magic Word: {{CURRENTMONTHABBREV}}
9258 !! wikitext
9259 {{CURRENTMONTHABBREV}}
9260 !! html
9261 <p>Jan
9262 </p>
9263 !! end
9264
9265 !! test
9266 Magic Word: {{CURRENTMONTHNAME}}
9267 !! wikitext
9268 {{CURRENTMONTHNAME}}
9269 !! html
9270 <p>January
9271 </p>
9272 !! end
9273
9274 !! test
9275 Magic Word: {{CURRENTMONTHNAMEGEN}}
9276 !! wikitext
9277 {{CURRENTMONTHNAMEGEN}}
9278 !! html
9279 <p>January
9280 </p>
9281 !! end
9282
9283 !! test
9284 Magic Word: {{CURRENTTIME}}
9285 !! wikitext
9286 {{CURRENTTIME}}
9287 !! html
9288 <p>00:02
9289 </p>
9290 !! end
9291
9292 !! test
9293 Magic Word: {{CURRENTHOUR}}
9294 !! wikitext
9295 {{CURRENTHOUR}}
9296 !! html
9297 <p>00
9298 </p>
9299 !! end
9300
9301 !! test
9302 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9303 !! wikitext
9304 {{CURRENTWEEK}}
9305 !! html
9306 <p>1
9307 </p>
9308 !! end
9309
9310 !! test
9311 Magic Word: {{CURRENTYEAR}}
9312 !! wikitext
9313 {{CURRENTYEAR}}
9314 !! html
9315 <p>1970
9316 </p>
9317 !! end
9318
9319 !! test
9320 Magic Word: {{CURRENTTIMESTAMP}}
9321 !! wikitext
9322 {{CURRENTTIMESTAMP}}
9323 !! html
9324 <p>19700101000203
9325 </p>
9326 !! end
9327
9328 !! test
9329 Magic Words LOCAL (UTC)
9330 !! wikitext
9331 * {{LOCALMONTH}}
9332 * {{LOCALMONTH1}}
9333 * {{LOCALMONTHNAME}}
9334 * {{LOCALMONTHNAMEGEN}}
9335 * {{LOCALMONTHABBREV}}
9336 * {{LOCALDAY}}
9337 * {{LOCALDAY2}}
9338 * {{LOCALDAYNAME}}
9339 * {{LOCALYEAR}}
9340 * {{LOCALTIME}}
9341 * {{LOCALHOUR}}
9342 * {{LOCALWEEK}}
9343 * {{LOCALDOW}}
9344 * {{LOCALTIMESTAMP}}
9345 !! html
9346 <ul><li> 01</li>
9347 <li> 1</li>
9348 <li> January</li>
9349 <li> January</li>
9350 <li> Jan</li>
9351 <li> 1</li>
9352 <li> 01</li>
9353 <li> Thursday</li>
9354 <li> 1970</li>
9355 <li> 00:02</li>
9356 <li> 00</li>
9357 <li> 1</li>
9358 <li> 4</li>
9359 <li> 19700101000203</li></ul>
9360
9361 !! end
9362
9363 !! test
9364 Magic Word: {{FULLPAGENAME}}
9365 !! options
9366 title=[[User:Ævar Arnfjörð Bjarmason]]
9367 !! wikitext
9368 {{FULLPAGENAME}}
9369 !! html
9370 <p>User:Ævar Arnfjörð Bjarmason
9371 </p>
9372 !! end
9373
9374 !! test
9375 Magic Word: {{FULLPAGENAMEE}}
9376 !! options
9377 title=[[User:Ævar Arnfjörð Bjarmason]]
9378 !! wikitext
9379 {{FULLPAGENAMEE}}
9380 !! html
9381 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9382 </p>
9383 !! end
9384
9385 !! test
9386 Magic Word: {{TALKSPACE}}
9387 !! options
9388 title=[[User:Ævar Arnfjörð Bjarmason]]
9389 !! wikitext
9390 {{TALKSPACE}}
9391 !! html
9392 <p>User talk
9393 </p>
9394 !! end
9395
9396 !! test
9397 Magic Word: {{TALKSPACE}}, same namespace
9398 !! options
9399 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9400 !! wikitext
9401 {{TALKSPACE}}
9402 !! html
9403 <p>User talk
9404 </p>
9405 !! end
9406
9407 !! test
9408 Magic Word: {{TALKSPACE}}, main namespace
9409 !! options
9410 title=[[Parser Test]]
9411 !! wikitext
9412 {{TALKSPACE}}
9413 !! html
9414 <p>Talk
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Word: {{TALKSPACEE}}
9420 !! options
9421 title=[[User:Ævar Arnfjörð Bjarmason]]
9422 !! wikitext
9423 {{TALKSPACEE}}
9424 !! html
9425 <p>User_talk
9426 </p>
9427 !! end
9428
9429 !! test
9430 Magic Word: {{SUBJECTSPACE}}
9431 !! options
9432 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9433 !! wikitext
9434 {{SUBJECTSPACE}}
9435 !! html
9436 <p>User
9437 </p>
9438 !! end
9439
9440 !! test
9441 Magic Word: {{SUBJECTSPACE}}, same namespace
9442 !! options
9443 title=[[User:Ævar Arnfjörð Bjarmason]]
9444 !! wikitext
9445 {{SUBJECTSPACE}}
9446 !! html
9447 <p>User
9448 </p>
9449 !! end
9450
9451 !! test
9452 Magic Word: {{SUBJECTSPACE}}, main namespace
9453 !! options
9454 title=[[Parser Test]]
9455 !! wikitext
9456 {{SUBJECTSPACE}}
9457 !! html
9458
9459 !! end
9460
9461 !! test
9462 Magic Word: {{SUBJECTSPACEE}}
9463 !! options
9464 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9465 !! wikitext
9466 {{SUBJECTSPACEE}}
9467 !! html
9468 <p>User
9469 </p>
9470 !! end
9471
9472 !! test
9473 Magic Word: {{NAMESPACE}}
9474 !! options
9475 title=[[User:Ævar Arnfjörð Bjarmason]]
9476 !! wikitext
9477 {{NAMESPACE}}
9478 !! html
9479 <p>User
9480 </p>
9481 !! end
9482
9483 !! test
9484 Magic Word: {{NAMESPACEE}}
9485 !! options
9486 title=[[User:Ævar Arnfjörð Bjarmason]]
9487 !! wikitext
9488 {{NAMESPACEE}}
9489 !! html
9490 <p>User
9491 </p>
9492 !! end
9493
9494 !! test
9495 Magic Word: {{NAMESPACENUMBER}}
9496 !! options
9497 title=[[User:Ævar Arnfjörð Bjarmason]]
9498 !! wikitext
9499 {{NAMESPACENUMBER}}
9500 !! html
9501 <p>2
9502 </p>
9503 !! end
9504
9505 !! test
9506 Magic Word: {{SUBPAGENAME}}
9507 !! options
9508 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9509 !! wikitext
9510 {{SUBPAGENAME}}
9511 !! html
9512 <p>sub ö
9513 </p>
9514 !! end
9515
9516 !! test
9517 Magic Word: {{SUBPAGENAMEE}}
9518 !! options
9519 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9520 !! wikitext
9521 {{SUBPAGENAMEE}}
9522 !! html
9523 <p>sub_%C3%B6
9524 </p>
9525 !! end
9526
9527 !! test
9528 Magic Word: {{ROOTPAGENAME}}
9529 !! options
9530 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9531 !! wikitext
9532 {{ROOTPAGENAME}}
9533 !! html
9534 <p>Ævar Arnfjörð Bjarmason
9535 </p>
9536 !! end
9537
9538 !! test
9539 Magic Word: {{ROOTPAGENAMEE}}
9540 !! options
9541 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9542 !! wikitext
9543 {{ROOTPAGENAMEE}}
9544 !! html
9545 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9546 </p>
9547 !! end
9548
9549 !! test
9550 Magic Word: {{BASEPAGENAME}}
9551 !! options
9552 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9553 !! wikitext
9554 {{BASEPAGENAME}}
9555 !! html
9556 <p>Ævar Arnfjörð Bjarmason
9557 </p>
9558 !! end
9559
9560 !! test
9561 Magic Word: {{BASEPAGENAMEE}}
9562 !! options
9563 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9564 !! wikitext
9565 {{BASEPAGENAMEE}}
9566 !! html
9567 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9568 </p>
9569 !! end
9570
9571 !! test
9572 Magic Word: {{TALKPAGENAME}}
9573 !! options
9574 title=[[User:Ævar Arnfjörð Bjarmason]]
9575 !! wikitext
9576 {{TALKPAGENAME}}
9577 !! html
9578 <p>User talk:Ævar Arnfjörð Bjarmason
9579 </p>
9580 !! end
9581
9582 !! test
9583 Magic Word: {{TALKPAGENAMEE}}
9584 !! options
9585 title=[[User:Ævar Arnfjörð Bjarmason]]
9586 !! wikitext
9587 {{TALKPAGENAMEE}}
9588 !! html
9589 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9590 </p>
9591 !! end
9592
9593 !! test
9594 Magic Word: {{SUBJECTPAGENAME}}
9595 !! options
9596 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9597 !! wikitext
9598 {{SUBJECTPAGENAME}}
9599 !! html
9600 <p>User:Ævar Arnfjörð Bjarmason
9601 </p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{SUBJECTPAGENAMEE}}
9606 !! options
9607 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9608 !! wikitext
9609 {{SUBJECTPAGENAMEE}}
9610 !! html
9611 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9612 </p>
9613 !! end
9614
9615 !! test
9616 Magic Word: {{NUMBEROFFILES}}
9617 !! wikitext
9618 {{NUMBEROFFILES}}
9619 !! html
9620 <p>5
9621 </p>
9622 !! end
9623
9624 !! test
9625 Magic Word: {{PAGENAME}}
9626 !! options
9627 title=[[User:Ævar Arnfjörð Bjarmason]]
9628 !! wikitext
9629 {{PAGENAME}}
9630 !! html
9631 <p>Ævar Arnfjörð Bjarmason
9632 </p>
9633 !! end
9634
9635 !! test
9636 Magic Word: {{PAGENAME}} with metacharacters
9637 !! options
9638 title=[['foo & bar = baz']]
9639 !! wikitext
9640 ''{{PAGENAME}}''
9641 !! html/php
9642 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9643 </p>
9644 !! html+tidy
9645 <p><i>'foo &amp; bar = baz'</i></p>
9646 !! end
9647
9648 !! test
9649 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9650 !! options
9651 title=[[*RFC 1234 http://example.com/]]
9652 !! wikitext
9653 {{PAGENAME}}
9654 !! html/php
9655 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9656 </p>
9657 !! html+tidy
9658 <p>*RFC 1234 http://example.com/</p>
9659 !! end
9660
9661 !! test
9662 Magic Word: {{PAGENAMEE}}
9663 !! options
9664 title=[[User:Ævar Arnfjörð Bjarmason]]
9665 !! wikitext
9666 {{PAGENAMEE}}
9667 !! html
9668 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9669 </p>
9670 !! end
9671
9672 !! test
9673 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9674 !! options
9675 title=[[*RFC 1234 http://example.com/]]
9676 !! wikitext
9677 {{PAGENAMEE}}
9678 !! html/php
9679 <p>&#42;RFC_1234_http&#58;//example.com/
9680 </p>
9681 !! html+tidy
9682 <p>*RFC_1234_http://example.com/</p>
9683 !! end
9684
9685 !! test
9686 Magic Word: {{REVISIONID}}
9687 !! wikitext
9688 {{REVISIONID}}
9689 !! html
9690 <p>1337
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{SCRIPTPATH}}
9696 !! wikitext
9697 {{SCRIPTPATH}}
9698 !! html
9699 <p>/
9700 </p>
9701 !! end
9702
9703 !! test
9704 Magic Word: {{STYLEPATH}}
9705 !! wikitext
9706 {{STYLEPATH}}
9707 !! html
9708 <p>/skins
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{SERVER}}
9714 !! wikitext
9715 {{SERVER}}
9716 !! html
9717 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9718 </p>
9719 !! end
9720
9721 !! test
9722 Magic Word: {{SERVERNAME}}
9723 !! wikitext
9724 {{SERVERNAME}}
9725 !! html
9726 <p>example.org
9727 </p>
9728 !! end
9729
9730 !! test
9731 Magic Word: {{SITENAME}}
9732 !! wikitext
9733 {{SITENAME}}
9734 !! html
9735 <p>MediaWiki
9736 </p>
9737 !! end
9738
9739 !! test
9740 Case-sensitive magic words, when cased differently, should just be template transclusions
9741 !! wikitext
9742 {{CurrentMonth}}
9743 {{currentday}}
9744 {{cURreNTweEK}}
9745 {{currentHour}}
9746 !! html
9747 <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>
9748 <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>
9749 <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>
9750 <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>
9751 </p>
9752 !! end
9753
9754 !! test
9755 Case-insensitive magic words should still work with weird casing.
9756 !! wikitext
9757 {{sErVeRNaMe}}
9758 {{LCFirst:AOEU}}
9759 {{ucFIRST:aoeu}}
9760 {{SERver}}
9761 !! html
9762 <p>example.org
9763 aOEU
9764 Aoeu
9765 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9766 </p>
9767 !! end
9768
9769 # From plwiki:PLOS_ONE
9770 !! test
9771 Parsoid: Page property magic word with magic word contents
9772 !! wikitext
9773 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9774 !! html/parsoid
9775 <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>"}]]}'/>
9776 !! end
9777
9778 !! test
9779 Parsoid: Template-generated DISPLAYTITLE
9780 !! wikitext
9781 {{{{echo|DISPLAYTITLE}}:Foo}}
9782 !! html/parsoid
9783 <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}}]}'/>
9784 !! end
9785
9786 !! test
9787 Namespace 1 {{ns:1}}
9788 !! wikitext
9789 {{ns:1}}
9790 !! html
9791 <p>Talk
9792 </p>
9793 !! end
9794
9795 !! test
9796 Namespace 1 {{ns:01}}
9797 !! wikitext
9798 {{ns:01}}
9799 !! html
9800 <p>Talk
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace 0 {{ns:0}} (bug 4783)
9806 !! wikitext
9807 {{ns:0}}
9808 !! html
9809
9810 !! end
9811
9812 !! test
9813 Namespace 0 {{ns:00}} (bug 4783)
9814 !! wikitext
9815 {{ns:00}}
9816 !! html
9817
9818 !! end
9819
9820 !! test
9821 Namespace -1 {{ns:-1}}
9822 !! wikitext
9823 {{ns:-1}}
9824 !! html
9825 <p>Special
9826 </p>
9827 !! end
9828
9829 !! test
9830 Namespace User {{ns:User}}
9831 !! wikitext
9832 {{ns:User}}
9833 !! html
9834 <p>User
9835 </p>
9836 !! end
9837
9838 !! test
9839 Namespace User talk {{ns:User_talk}}
9840 !! wikitext
9841 {{ns:User_talk}}
9842 !! html
9843 <p>User talk
9844 </p>
9845 !! end
9846
9847 !! test
9848 Namespace User talk {{ns:uSeR tAlK}}
9849 !! wikitext
9850 {{ns:uSeR tAlK}}
9851 !! html
9852 <p>User talk
9853 </p>
9854 !! end
9855
9856 !! test
9857 Namespace File {{ns:File}}
9858 !! wikitext
9859 {{ns:File}}
9860 !! html
9861 <p>File
9862 </p>
9863 !! end
9864
9865 !! test
9866 Namespace File {{ns:Image}}
9867 !! wikitext
9868 {{ns:Image}}
9869 !! html
9870 <p>File
9871 </p>
9872 !! end
9873
9874 !! test
9875 Namespace (lang=de) Benutzer {{ns:User}}
9876 !! options
9877 language=de
9878 !! wikitext
9879 {{ns:User}}
9880 !! html
9881 <p>Benutzer
9882 </p>
9883 !! end
9884
9885 !! test
9886 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9887 !! options
9888 language=de
9889 !! wikitext
9890 {{ns:3}}
9891 !! html
9892 <p>Benutzer Diskussion
9893 </p>
9894 !! end
9895
9896
9897 !! test
9898 Urlencode
9899 !! wikitext
9900 {{urlencode:hi world?!}}
9901 {{urlencode:hi world?!|WIKI}}
9902 {{urlencode:hi world?!|PATH}}
9903 {{urlencode:hi world?!|QUERY}}
9904 !! html
9905 <p>hi+world%3F%21
9906 hi_world%3F!
9907 hi%20world%3F%21
9908 hi+world%3F%21
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Word: prioritize type info over data-parsoid
9914 !! options
9915 parsoid=html2wt
9916 !! html/parsoid
9917 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9918 !! wikitext
9919 __FORCETOC__
9920 !! end
9921
9922 !! test
9923 Magic Word: serialize on separate line (parsoid)
9924 !! options
9925 parsoid=wt2wt,html2wt
9926 !! wikitext
9927 foo
9928 __NOTOC__
9929 bar
9930 !! html/parsoid
9931 foo<meta property="mw:PageProp/notoc"/>bar
9932 !! end
9933
9934 !! test
9935 Magic Word: rt non-english wikis
9936 !! options
9937 parsoid=wt2wt
9938 language=de
9939 !! wikitext
9940 __NOEDITSECTION__
9941 !! html/parsoid
9942 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9943 !! end
9944
9945 !!test
9946 __proto__ is treated as normal wikitext (T105997)
9947 !!wikitext
9948 __proto__
9949 !!html
9950 <p>__proto__
9951 </p>
9952 !!end
9953
9954 ###
9955 ### Magic links
9956 ###
9957 !! test
9958 Magic links: internal link to RFC (bug 479)
9959 !! wikitext
9960 [[RFC 123]]
9961 !! html/php
9962 <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>
9963 </p>
9964 !! html/parsoid
9965 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
9966 !! end
9967
9968 !! test
9969 Magic links: RFC (bug 479)
9970 !! wikitext
9971 RFC 822
9972 !! html/php
9973 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9974 </p>
9975 !! html/parsoid
9976 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
9977 !! end
9978
9979 !! test
9980 Magic links: RFC (bug 65278)
9981 !! wikitext
9982 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9983 !! html/php
9984 <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.
9985 </p>
9986 !! html/parsoid
9987 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
9988 !! end
9989
9990 !! test
9991 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9992 !! wikitext
9993 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9994 RFC
9995 822
9996 !! html/php
9997 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9998 RFC
9999 822
10000 </p>
10001 !! html/parsoid
10002 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10003 RFC
10004 822</p>
10005 !! end
10006
10007 !! test
10008 Magic links: ISBN (bug 1937)
10009 !! wikitext
10010 ISBN 0-306-40615-2
10011 !! html/php
10012 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10013 </p>
10014 !! html/parsoid
10015 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10016 !! end
10017
10018 !! test
10019 Magic links: ISBN (bug 65278)
10020 !! wikitext
10021 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10022 !! html/php
10023 <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.
10024 </p>
10025 !! html/parsoid
10026 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10027 !! end
10028
10029 !! test
10030 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10031 !! wikitext
10032 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10033 ISBN
10034 9780316098113
10035 ISBN 978
10036 0316098113
10037 !! html/php
10038 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10039 ISBN
10040 9780316098113
10041 ISBN 978
10042 0316098113
10043 </p>
10044 !! html/parsoid
10045 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10046 ISBN
10047 9780316098113
10048 ISBN 978
10049 0316098113</p>
10050 !! end
10051
10052 !! test
10053 Magic links: PMID incorrectly converts space to underscore
10054 !! wikitext
10055 PMID 1234
10056 !! html/php
10057 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10058 </p>
10059 !! html/parsoid
10060 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10061 !! end
10062
10063 !! test
10064 Magic links: PMID (bug 65278)
10065 !! wikitext
10066 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10067 !! html/php
10068 <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.
10069 </p>
10070 !! html/parsoid
10071 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10072 !! end
10073
10074 !! test
10075 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10076 !! wikitext
10077 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10078 PMID
10079 1234
10080 !! html/php
10081 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10082 PMID
10083 1234
10084 </p>
10085 !! html/parsoid
10086 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10087 PMID
10088 1234</p>
10089 !! end
10090
10091 ###
10092 ### Templates
10093 ####
10094
10095 !! test
10096 Nonexistent template
10097 !! wikitext
10098 {{thistemplatedoesnotexist}}
10099 !! html
10100 <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>
10101 </p>
10102 !! end
10103
10104 !! test
10105 Template with invalid target containing tags
10106 !! wikitext
10107 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10108 !! html
10109 <p>{{a<b>b</b>|foo|a=b|a = b}}
10110 </p>
10111 !! end
10112
10113 !! test
10114 Template with invalid target containing unclosed tag
10115 !! wikitext
10116 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10117 !! html
10118 <p>{{a<b>|foo|a=b|a = b}}</b>
10119 </p>
10120 !! end
10121
10122 !! test
10123 Template with invalid target containing wikilink
10124 !! wikitext
10125 {{[[Main Page]]}}
10126 !! html/php
10127 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10128 </p>
10129 !! html/parsoid
10130 <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>
10131 !! end
10132
10133 !! test
10134 Template with just whitespace in it, bug #68421
10135 !! wikitext
10136 {{echo|{{ }}}}
10137 !! html/parsoid
10138 <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>
10139 !! end
10140
10141 !! article
10142 Template:test
10143 !! text
10144 This is a test template
10145 !! endarticle
10146
10147 !! test
10148 Simple template
10149 !! wikitext
10150 {{test}}
10151 !! html
10152 <p>This is a test template
10153 </p>
10154 !! end
10155
10156 !! test
10157 Template with explicit namespace
10158 !! wikitext
10159 {{Template:test}}
10160 !! html
10161 <p>This is a test template
10162 </p>
10163 !! end
10164
10165
10166 !! article
10167 Template:paramtest
10168 !! text
10169 This is a test template with parameter {{{param}}}
10170 !! endarticle
10171
10172 !! test
10173 Template parameter
10174 !! wikitext
10175 {{paramtest|param=foo}}
10176 !! html
10177 <p>This is a test template with parameter foo
10178 </p>
10179 !! end
10180
10181 !! article
10182 Template:paramtestnum
10183 !! text
10184 [[{{{1}}}|{{{2}}}]]
10185 !! endarticle
10186
10187 !! test
10188 Template unnamed parameter
10189 !! wikitext
10190 {{paramtestnum|Main Page|the main page}}
10191 !! html
10192 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10193 </p>
10194 !! end
10195
10196 !! article
10197 Template:templatesimple
10198 !! text
10199 (test)
10200 !! endarticle
10201
10202 !! article
10203 Template:templateredirect
10204 !! text
10205 #redirect [[Template:templatesimple]]
10206 !! endarticle
10207
10208 !! article
10209 Template:templateasargtestnum
10210 !! text
10211 {{{{{1}}}}}
10212 !! endarticle
10213
10214 !! article
10215 Template:templateasargtest
10216 !! text
10217 {{template{{{templ}}}}}
10218 !! endarticle
10219
10220 !! article
10221 Template:templateasargtest2
10222 !! text
10223 {{{{{templ}}}}}
10224 !! endarticle
10225
10226 !! test
10227 Template with template name as unnamed argument
10228 !! wikitext
10229 {{templateasargtestnum|templatesimple}}
10230 !! html
10231 <p>(test)
10232 </p>
10233 !! end
10234
10235 !! test
10236 Template with template name as argument
10237 !! wikitext
10238 {{templateasargtest|templ=simple}}
10239 !! html
10240 <p>(test)
10241 </p>
10242 !! end
10243
10244 !! test
10245 Template with template name as argument (2)
10246 !! wikitext
10247 {{templateasargtest2|templ=templatesimple}}
10248 !! html
10249 <p>(test)
10250 </p>
10251 !! end
10252
10253 !! article
10254 Template:templateasargtestdefault
10255 !! text
10256 {{{{{templ|templatesimple}}}}}
10257 !! endarticle
10258
10259 !! article
10260 Template:templa
10261 !! text
10262 '''templ'''
10263 !! endarticle
10264
10265 !! test
10266 Template with default value
10267 !! wikitext
10268 {{templateasargtestdefault}}
10269 !! html
10270 <p>(test)
10271 </p>
10272 !! end
10273
10274 !! test
10275 Template with default value (value set)
10276 !! wikitext
10277 {{templateasargtestdefault|templ=templa}}
10278 !! html
10279 <p><b>templ</b>
10280 </p>
10281 !! end
10282
10283 !! test
10284 Template redirect
10285 !! wikitext
10286 {{templateredirect}}
10287 !! html/php
10288 <p>(test)
10289 </p>
10290 !! html/parsoid
10291 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10292 !! end
10293
10294 !! test
10295 Template with argument in separate line
10296 !! wikitext
10297 {{ templateasargtest |
10298 templ = simple }}
10299 !! html
10300 <p>(test)
10301 </p>
10302 !! end
10303
10304 !! test
10305 Template with complex template as argument
10306 !! wikitext
10307 {{paramtest|
10308 param ={{ templateasargtest |
10309 templ = simple }}}}
10310 !! html
10311 <p>This is a test template with parameter (test)
10312 </p>
10313 !! end
10314
10315 !! test
10316 Template with thumb image (with link in description)
10317 !! wikitext
10318 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10319 !! html/php
10320 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>
10321
10322 !! html+tidy
10323 <p>This is a test template with parameter</p>
10324 <div class="thumb tright">
10325 <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>
10326 <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>
10327 </div>
10328 </div>
10329 !! html/parsoid
10330 <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>
10331 !! end
10332
10333 !! article
10334 Template:complextemplate
10335 !! text
10336 {{{1}}} {{paramtest|
10337 param ={{{param}}}}}
10338 !! endarticle
10339
10340 !! test
10341 Template with complex arguments
10342 !! wikitext
10343 {{complextemplate|
10344 param ={{ templateasargtest |
10345 templ = simple }}|[[Template:complextemplate|link]]}}
10346 !! html
10347 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10348 </p>
10349 !! end
10350
10351 !! test
10352 BUG 553: link with two variables in a piped link
10353 !! wikitext
10354 {|
10355 |[[{{{1}}}|{{{2}}}]]
10356 |}
10357 !! html/php
10358 <table>
10359 <tr>
10360 <td>[[{{{1}}}|{{{2}}}]]
10361 </td></tr></table>
10362
10363 !! html/parsoid
10364 <table>
10365 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10366 !! end
10367
10368 # See: T2553
10369 !! test
10370 Abort table cell attribute parsing on wikilink
10371 !! wikitext
10372 {|
10373 | testing [[one|two]] | three || four
10374 | testing one two | three || four
10375 |}
10376 !! html/php
10377 <table>
10378 <tr>
10379 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10380 <td> four
10381 </td>
10382 <td> three </td>
10383 <td> four
10384 </td></tr></table>
10385
10386 !! html/parsoid
10387 <table>
10388 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10389 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10390 </tbody></table>
10391 !! end
10392
10393 !! test
10394 Don't abort table cell attribute parsing if wikilink is found in template arg
10395 !! wikitext
10396 {|
10397 | Test {{#tag:ref|One two "[[three]]" four}}
10398 |}
10399 !! html/parsoid
10400 <table>
10401 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10402 </tbody></table>
10403 !! end
10404
10405 !! test
10406 Magic variable as template parameter
10407 !! wikitext
10408 {{paramtest|param={{SITENAME}}}}
10409 !! html
10410 <p>This is a test template with parameter MediaWiki
10411 </p>
10412 !! end
10413
10414 !! article
10415 Template:linktest
10416 !! text
10417 [[{{{param}}}|link]]
10418 !! endarticle
10419
10420 !! test
10421 Template parameter as link source
10422 !! wikitext
10423 {{linktest|param=Main Page}}
10424 !! html
10425 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10426 </p>
10427 !! end
10428
10429 !!article
10430 Template:paramtest2
10431 !! text
10432 including another template, {{paramtest|param={{{arg}}}}}
10433 !! endarticle
10434
10435 !! test
10436 Template passing argument to another template
10437 !! wikitext
10438 {{paramtest2|arg='hmm'}}
10439 !! html
10440 <p>including another template, This is a test template with parameter 'hmm'
10441 </p>
10442 !! end
10443
10444 !! article
10445 Template:Linktest2
10446 !! text
10447 Main Page
10448 !! endarticle
10449
10450 !! test
10451 Template as link source
10452 !! wikitext
10453 [[{{linktest2}}]]
10454
10455 [[{{linktest2}}|Main Page]]
10456
10457 [[{{linktest2}}]]Page
10458 !! html
10459 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10460 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10461 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10462 </p>
10463 !! end
10464
10465
10466 !! article
10467 Template:loop1
10468 !! text
10469 {{loop2}}
10470 !! endarticle
10471
10472 !! article
10473 Template:loop2
10474 !! text
10475 {{loop1}}
10476 !! endarticle
10477
10478 !! test
10479 Template infinite loop
10480 !! wikitext
10481 {{loop1}}
10482 !! html
10483 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10484 </p>
10485 !! end
10486
10487 !! test
10488 Template from main namespace
10489 !! wikitext
10490 {{:Main Page}}
10491 !! html
10492 <p>blah blah
10493 </p>
10494 !! end
10495
10496 !! article
10497 Template:table
10498 !! text
10499 {|
10500 | 1 || 2
10501 |-
10502 | 3 || 4
10503 |}
10504 !! endarticle
10505
10506 !! test
10507 BUG 529: Template with table, not included at beginning of line
10508 !! wikitext
10509 foo {{table}}
10510 !! html
10511 <p>foo
10512 </p>
10513 <table>
10514 <tr>
10515 <td> 1 </td>
10516 <td> 2
10517 </td></tr>
10518 <tr>
10519 <td> 3 </td>
10520 <td> 4
10521 </td></tr></table>
10522
10523 !! end
10524
10525 !! test
10526 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10527 !! wikitext
10528 foo
10529 {{table}}
10530 !! html
10531 <p>foo
10532 </p>
10533 <table>
10534 <tr>
10535 <td> 1 </td>
10536 <td> 2
10537 </td></tr>
10538 <tr>
10539 <td> 3 </td>
10540 <td> 4
10541 </td></tr></table>
10542
10543 !! end
10544
10545 !! test
10546 BUG 41: Template parameters shown as broken links
10547 !! wikitext
10548 {{{parameter}}}
10549 !! html
10550 <p>{{{parameter}}}
10551 </p>
10552 !! end
10553
10554 !! test
10555 Template with targets containing wikilinks
10556 !! wikitext
10557 {{[[foo]]}}
10558
10559 {{[[{{echo|foo}}]]}}
10560
10561 {{{{echo|[[foo}}]]}}
10562 !! html
10563 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10564 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10565 </p><p>{{[[foo}}]]
10566 </p>
10567 !! end
10568
10569 !! article
10570 Template:''
10571 !! text
10572 bar
10573 !! endarticle
10574
10575 !! test
10576 Templates: Double quotes as template target
10577 !! wikitext
10578 foo {{''}} baz
10579 !! html/php
10580 <p>foo bar baz
10581 </p>
10582 !! html/parsoid
10583 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10584 </p>
10585 !! end
10586
10587 !! article
10588 Template:MSGNW test
10589 !! text
10590 ''None'' of '''this''' should be
10591 * interpreted
10592 but rather passed unmodified
10593 {{test}}
10594 <gallery>
10595 File:Foobar.jpg
10596 </gallery>
10597 <!-- comment -->
10598 !! endarticle
10599
10600 # hmm, fix this or just deprecate msgnw and document its behavior?
10601 !! test
10602 msgnw keyword
10603 !! wikitext
10604 {{msgnw:MSGNW test}}
10605 !! html/php
10606 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10607 &#42; interpreted
10608 &#32;but rather passed unmodified
10609 &#123;&#123;test&#125;&#125;
10610 &#60;gallery&#62;
10611 File:Foobar.jpg
10612 &#60;/gallery&#62;
10613 &#60;!-- comment --&#62;
10614 </p>
10615 !! end
10616
10617 !! test
10618 int keyword
10619 !! wikitext
10620 {{int:youhavenewmessages|lots of money|not!}}
10621 !! html
10622 <p>You have lots of money (not!).
10623 </p>
10624 !! end
10625
10626 !! test
10627 int keyword - non-existing message
10628 !! wikitext
10629 {{int:var}}
10630 !! html
10631 <p>&lt;var&gt;
10632 </p>
10633 !! end
10634
10635 !! article
10636 Template:Includes
10637 !! text
10638 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10639 !! endarticle
10640
10641 !! test
10642 <includeonly> and <noinclude> being included
10643 !! wikitext
10644 {{Includes}}
10645 !! html
10646 <p>Foobar
10647 </p>
10648 !! end
10649
10650 !! article
10651 Template:Includes2
10652 !! text
10653 <onlyinclude>Foo</onlyinclude>bar
10654 !! endarticle
10655
10656 !! test
10657 <onlyinclude> being included
10658 !! wikitext
10659 {{Includes2}}
10660 !! html
10661 <p>Foo
10662 </p>
10663 !! end
10664
10665
10666 !! article
10667 Template:Includes3
10668 !! text
10669 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10670 !! endarticle
10671
10672 !! test
10673 <onlyinclude> and <includeonly> being included
10674 !! wikitext
10675 {{Includes3}}
10676 !! html
10677 <p>Foo
10678 </p>
10679 !! end
10680
10681 !! test
10682 <includeonly> and <noinclude> on a page
10683 !! wikitext
10684 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10685 !! html
10686 <p>Foozar
10687 </p>
10688 !! end
10689
10690 !! test
10691 Un-closed <noinclude>
10692 !! wikitext
10693 <noinclude>
10694 !! html
10695 !! end
10696
10697 !! test
10698 <onlyinclude> on a page
10699 !! wikitext
10700 <onlyinclude>Foo</onlyinclude>bar
10701 !! html
10702 <p>Foobar
10703 </p>
10704 !! end
10705
10706 !! test
10707 Un-closed <onlyinclude>
10708 !! wikitext
10709 <onlyinclude>
10710 !! html
10711 !! end
10712
10713 !!test
10714 Self-closed noinclude, includeonly, onlyinclude tags
10715 !! wikitext
10716 <noinclude />
10717 <includeonly />
10718 <onlyinclude />
10719 !! html
10720 <p><br />
10721 </p>
10722 !!end
10723
10724 !!test
10725 Unbalanced includeonly and noinclude tags
10726 !! wikitext
10727 {|
10728 |a</noinclude>
10729 |b</noinclude></noinclude>
10730 |c</noinclude></includeonly>
10731 |d</includeonly></includeonly>
10732 |}
10733 !! html
10734 <table>
10735 <tr>
10736 <td>a
10737 </td>
10738 <td>b
10739 </td>
10740 <td>c&lt;/includeonly&gt;
10741 </td>
10742 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10743 </td></tr></table>
10744
10745 !!end
10746
10747 !! article
10748 Template:Includeonly section
10749 !! text
10750 <includeonly>
10751 ==Includeonly section==
10752 </includeonly>
10753 ==Section T-1==
10754 !!endarticle
10755
10756 !! test
10757 Bug 6563: Edit link generation for section shown by <includeonly>
10758 !! wikitext
10759 {{includeonly section}}
10760 !! html
10761 <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>
10762 <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>
10763
10764 !! end
10765
10766 # Uses same input as the contents of [[Template:Includeonly section]]
10767 !! test
10768 Bug 6563: Section extraction for section shown by <includeonly>
10769 !! options
10770 section=T-2
10771 !! wikitext
10772 <includeonly>
10773 ==Includeonly section==
10774 </includeonly>
10775 ==Section T-2==
10776 !! html
10777 ==Section T-2==
10778 !! end
10779
10780 !! test
10781 Bug 6563: Edit link generation for section suppressed by <includeonly>
10782 !! wikitext
10783 <includeonly>
10784 ==Includeonly section==
10785 </includeonly>
10786 ==Section 1==
10787 !! html
10788 <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>
10789
10790 !! end
10791
10792 !! test
10793 Bug 6563: Section extraction for section suppressed by <includeonly>
10794 !! options
10795 section=1
10796 !! wikitext
10797 <includeonly>
10798 ==Includeonly section==
10799 </includeonly>
10800 ==Section 1==
10801 !! html
10802 ==Section 1==
10803 !! end
10804
10805 !! test
10806 Un-closed <includeonly>
10807 !! wikitext
10808 <includeonly>
10809 !! html
10810 !! end
10811
10812 !! test
10813 Includes and comments at SOL
10814 !! wikitext
10815 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10816
10817 <noinclude>
10818 some
10819 </noinclude>* stuff
10820 * here
10821
10822 <includeonly>can have stuff</includeonly>=== here ===
10823
10824 !! html/php
10825 <h2><span class="mw-headline" id="hu">hu</span></h2>
10826 <p>some
10827 </p>
10828 <ul><li> stuff</li>
10829 <li> here</li></ul>
10830 <h3><span class="mw-headline" id="here">here</span></h3>
10831
10832 !! html/parsoid
10833 <!-- 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>
10834
10835 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10836 <p>some</p>
10837 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10838 <li> here</li></ul>
10839
10840 <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>
10841
10842 !! end
10843
10844 # TODO: test with DOM fragment reuse!
10845 !! test
10846 Parsoid: DOM fragment reuse
10847 !! options
10848 parsoid=wt2wt,wt2html
10849 !! wikitext
10850 a{{echo|b<table></table>c}}d
10851
10852 a{{echo|b
10853 <table></table>
10854 c}}d
10855
10856 {{echo|a
10857
10858 <table></table>
10859
10860 b}}
10861 !! html
10862 <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>
10863
10864 <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">
10865 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10866 </span><p about="#mwt2">cd</p>
10867
10868 <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">
10869
10870 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10871
10872 </span><p about="#mwt3">b</p>
10873 !! end
10874
10875 !! test
10876 Parsoid: Merge double tds (T52603)
10877 !! options
10878 parsoid
10879 !! wikitext
10880 {|
10881 |{{echo|{{!}} foo}}
10882 |}
10883 !! html
10884 <table><tbody>
10885 <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>
10886 </tbody></table>
10887 !! end
10888
10889 !! test
10890 Parsoid: Merge double tds in nested transclusion content (T52603)
10891 !! options
10892 parsoid
10893 !! wikitext
10894 {{echo|<div>}}
10895 {|
10896 |{{echo|{{!}} foo}}
10897 |}
10898 {{echo|</div>}}
10899 !! html
10900 <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}}]}'>
10901 <table><tbody>
10902 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10903 </tbody></table>
10904 </div>
10905 !! end
10906
10907 ###
10908 ### <includeonly> and <noinclude> in attributes
10909 ###
10910 !!test
10911 0. includeonly around the entire attribute
10912 !! wikitext
10913 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10914 !! html
10915 <p><span id="v2">bar</span>
10916 </p>
10917 !!end
10918
10919 !!test
10920 1. includeonly in html attr key
10921 !! wikitext
10922 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10923 !! html
10924 <p><span id="foo">bar</span>
10925 </p>
10926 !!end
10927
10928 !!test
10929 2. includeonly in html attr value
10930 !! wikitext
10931 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10932 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10933 !! html
10934 <p><span id="v1">bar</span>
10935 <span id="v1">bar</span>
10936 </p>
10937 !!end
10938
10939 !!test
10940 3. includeonly in part of an attr value
10941 !! wikitext
10942 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10943 !! html
10944 <p><span style="color:red;">bar</span>
10945 </p>
10946 !!end
10947
10948 !!test
10949 4. includeonly in table attributes
10950 !! wikitext
10951 {|
10952 |- <noinclude>
10953 |-
10954 |a
10955 </noinclude>
10956 |- <includeonly>
10957 |-
10958 |b
10959 </includeonly>
10960 |}
10961 !! html
10962 <table>
10963
10964
10965 <tr>
10966 <td>a
10967 </td></tr>
10968 </table>
10969
10970 !!end
10971
10972 ###
10973 ### Token Stream Patcher tests
10974 ###
10975 ### These tests won't always pass wt2wt and other modes because
10976 ### on serialization, the table will be output on a new line.
10977 ### For now, we are blacklisting them, and using this to test selser.
10978 ###
10979
10980 !!test
10981 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10982 !!options
10983 parsoid=wt2html,wt2wt
10984 !!wikitext
10985 {{echo|}}{| width = '100%'
10986 |foo
10987 |}
10988 !!html/parsoid
10989 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10990 <tbody><tr><td>foo</td></tr>
10991 </tbody></table>
10992 !!end
10993
10994 !!test
10995 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10996 !!options
10997 parsoid=wt2html,wt2wt
10998 !!wikitext
10999 <includeonly>a</includeonly>{| {{{b}}}
11000 |c
11001 |}
11002 !!html/parsoid
11003 <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}}}":""}}'>
11004 <tbody><tr><td>c</td></tr>
11005 </tbody></table>
11006
11007 !!end
11008
11009 ###
11010 ### Testing parsing of templates where a template arg
11011 ### has the same name as the template itself.
11012 ###
11013
11014 !! article
11015 Template:quote
11016 !! text
11017 {{{quote|{{{1}}}}}}
11018 !! endarticle
11019
11020 !!test
11021 Templates: Template Name/Arg clash: 1. Use of positional param
11022 !! wikitext
11023 {{quote|foo}}
11024 !! html
11025 <p>foo
11026 </p>
11027 !!end
11028
11029 !!test
11030 Templates: Template Name/Arg clash: 2. Use of named param
11031 !! wikitext
11032 {{quote|quote=foo}}
11033 !! html
11034 <p>foo
11035 </p>
11036 !!end
11037
11038 !!test
11039 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11040 !! wikitext
11041 {{quote|quote}}
11042 !! html
11043 <p>quote
11044 </p>
11045 !!end
11046
11047 ###
11048 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11049 ###
11050
11051 !!test
11052 Templates: 1. Simple use
11053 !! wikitext
11054 {{echo|Foo}}
11055 !! html
11056 <p>Foo
11057 </p>
11058 !!end
11059
11060 !!test
11061 Templates: 2. Inside a block tag
11062 !! wikitext
11063 <div>{{echo|Foo}}</div>
11064 <blockquote>{{echo|Foo}}</blockquote>
11065 !! html
11066 <div>Foo</div>
11067 <blockquote>Foo</blockquote>
11068
11069 !! html+tidy
11070 <div>Foo</div>
11071 <blockquote>
11072 <p>Foo</p>
11073 </blockquote>
11074 !!end
11075
11076 !!test
11077 Templates: P-wrapping: 1a. Templates on consecutive lines
11078 !! wikitext
11079 {{echo|Foo}}
11080 {{echo|bar}}
11081 !! html
11082 <p>Foo
11083 bar
11084 </p>
11085 !!end
11086
11087 !!test
11088 Templates: P-wrapping: 1b. Templates on consecutive lines
11089 !! wikitext
11090 Foo
11091
11092 {{echo|bar}}
11093 {{echo|baz}}
11094 !! html
11095 <p>Foo
11096 </p><p>bar
11097 baz
11098 </p>
11099 !!end
11100
11101 !!test
11102 Templates: P-wrapping: 1c. Templates on consecutive lines
11103 !! wikitext
11104 {{echo|Foo}}
11105 {{echo|bar}} <div>baz</div>
11106 !! html
11107 <p>Foo
11108 </p>
11109 bar <div>baz</div>
11110
11111 !! html+tidy
11112 <p>Foo</p>
11113 <p>bar</p>
11114 <div>baz</div>
11115 !! end
11116
11117 !!test
11118 Templates: P-wrapping: 1d. Template preceded by comment-only line
11119 !!options
11120 parsoid
11121 !! wikitext
11122 <!-- foo -->
11123 {{echo|Bar}}
11124 !! html
11125 <!-- foo -->
11126
11127 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11128 !!end
11129
11130 !!test
11131 Templates: Inline Text: 1. Multiple template uses
11132 !! wikitext
11133 {{echo|Foo}}bar{{echo|baz}}
11134 !! html
11135 <p>Foobarbaz
11136 </p>
11137 !!end
11138
11139 !!test
11140 Templates: Inline Text: 2. Back-to-back template uses
11141 !! wikitext
11142 {{echo|Foo}}{{echo|bar}}
11143 !! html
11144 <p>Foobar
11145 </p>
11146 !!end
11147
11148 !!test
11149 Templates: Block Tags: 1. Multiple template uses
11150 !! wikitext
11151 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11152 !! html
11153 <div>Foo</div><div>bar</div><div>baz</div>
11154
11155 !!end
11156
11157 !!test
11158 Templates: Block Tags: 2. Back-to-back template uses
11159 !! wikitext
11160 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11161 !! html
11162 <div>Foo</div><div>bar</div>
11163
11164 !!end
11165
11166 # This is an edge case relating to paragraph wrapping.
11167 !!test
11168 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11169 !! wikitext
11170 {{echo|a
11171 b</p>}}
11172 !! html/parsoid
11173 <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
11174 b</p>
11175 !!end
11176
11177 !!test
11178 Templates: Links: 1. Simple example
11179 !! wikitext
11180 {{echo|[[Foo|bar]]}}
11181 !! html
11182 <p><a href="/wiki/Foo" title="Foo">bar</a>
11183 </p>
11184 !!end
11185
11186 !!test
11187 Templates: Links: 2. Generation of link href
11188 !! wikitext
11189 [[{{echo|Foo}}|bar]]
11190 !! html
11191 <p><a href="/wiki/Foo" title="Foo">bar</a>
11192 </p>
11193 !!end
11194
11195 !!test
11196 Templates: Links: 3. Generation of part of a link href
11197 !! wikitext
11198 [[Fo{{echo|o}}|bar]]
11199
11200 [[Foo{{echo|bar}}]]
11201
11202 [[Foo{{echo|bar}}baz]]
11203
11204 [[Foo{{echo|bar}}|bar]]
11205
11206 [[:Foo{{echo|bar}}]]
11207
11208 [[:Foo{{echo|bar}}|bar]]
11209 !! html
11210 <p><a href="/wiki/Foo" title="Foo">bar</a>
11211 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11212 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11213 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11214 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11215 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11216 </p>
11217 !!end
11218
11219 !!test
11220 Templates: Links: 4. Multiple templates generating link href
11221 !! wikitext
11222 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11223 !! html
11224 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11225 </p>
11226 !!end
11227
11228 !!test
11229 Templates: Links: 5. Generation of link text
11230 !! wikitext
11231 [[Foo|{{echo|bar}}]]
11232 !! html
11233 <p><a href="/wiki/Foo" title="Foo">bar</a>
11234 </p>
11235 !!end
11236
11237 !!test
11238 Templates: Links: 5. Nested templates (only outermost template should be marked)
11239 !! wikitext
11240 {{echo|[[{{echo|Foo}}|bar]]}}
11241 !! html
11242 <p><a href="/wiki/Foo" title="Foo">bar</a>
11243 </p>
11244 !!end
11245
11246 !!test
11247 Templates: HTML Tag: 1. Generation of HTML attr. key
11248 !! wikitext
11249 <div {{echo|style}}="color:red;">foo</div>
11250 !! html
11251 <div style="color:red;">foo</div>
11252
11253 !!end
11254
11255 !!test
11256 Templates: HTML Tag: 2. Generation of HTML attr. value
11257 !! wikitext
11258 <div style={{echo|'color:red;'}}>foo</div>
11259 !! html
11260 <div style="color:red;">foo</div>
11261
11262 !!end
11263
11264 !!test
11265 Templates: HTML Tag: 3. Generation of HTML attr key and value
11266 !! wikitext
11267 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11268 !! html
11269 <div style="color:red;">foo</div>
11270
11271 !!end
11272
11273 !!test
11274 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11275 !! wikitext
11276 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11277 !! html
11278 <div title="This is a long title with just one piece templated">foo</div>
11279
11280 !!end
11281
11282 !!test
11283 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11284 !! wikitext
11285 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11286 !! html
11287 <div title="This is a long title with just one piece templated">foo</div>
11288
11289 !!end
11290
11291 !!test
11292 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11293 !! wikitext
11294 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11295 !! html
11296 <div title="This is a long title with just one piece templated">foo</div>
11297
11298 !!end
11299
11300 # SSS FIXME: While it is great we added support for all this,
11301 # do we want to make this part of the spec? Maybe we want to
11302 # deprecate this kind of usage in the future?
11303 !!test
11304 Templates: HTML Tag: 7. Generation of partial attribute key string
11305 !! wikitext
11306 <div st{{echo|yle}}="color:red;">foo</div>
11307 !! html
11308 <div style="color:red;">foo</div>
11309
11310 !!end
11311
11312 !! test
11313 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11314 !! wikitext
11315 <div {{echo|1=id="v1"}}>bar</div>
11316 !! html
11317 <div id="v1">bar</div>
11318
11319 !!end
11320
11321 !! test
11322 Templates: HTML Tag: 9. Multiple template-generated attributes
11323 !! wikitext
11324 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11325 !! html
11326 <div id="v1" title="foo">bar</div>
11327
11328 !!end
11329
11330 !! test
11331 Templates: Support for templates generating attributes and content
11332 !! wikitext
11333 {| {{mixed_attr_content_template}}
11334 |-
11335 |bar
11336 |}
11337 !! html/php
11338 <table style="color:red;" title="T48811">
11339
11340 <tr>
11341 <td>foo
11342 </td></tr>
11343 <tr>
11344 <td>bar
11345 </td></tr></table>
11346
11347 !! html/parsoid
11348 <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|}"]}'>
11349 <tbody><tr>
11350 <td>foo</td></tr>
11351 <tr>
11352 <td>bar</td></tr>
11353 </tbody></table>
11354 !!end
11355
11356 !! test
11357 1. Entities and nowikis inside templated attributes should be handled correctly
11358 !! wikitext
11359 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11360 !! html/php
11361 <div style="background:#f9f9f9;">foo</div>
11362
11363 !! html/parsoid
11364 <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>
11365 !! end
11366
11367 !! test
11368 2. Entities and nowikis inside templated attributes should be handled correctly
11369 !! wikitext
11370 {|
11371 |{{table_attribs_3}}
11372 |}
11373 !! html/php
11374 <table>
11375 <tr>
11376 <td style="background:#f9f9f9;">Foo
11377 </td></tr></table>
11378
11379 !! html/parsoid
11380 <table>
11381 <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>
11382 </tbody></table>
11383 !! end
11384
11385 !! test
11386 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11387 !! wikitext
11388 {{tbl-start}}
11389 |{{table_attribs_3}}
11390 {{tbl-end}}
11391 !! html/php
11392 <table>
11393 <tr>
11394 <td style="background:#f9f9f9;">Foo
11395 </td></tr></table>
11396
11397 !! html/parsoid
11398 <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}}]}'>
11399 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11400 </tbody></table>
11401 !! end
11402
11403 # T107622
11404 !! test
11405 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11406 !! wikitext
11407 {|
11408 | {{table_attribs_6}} hi
11409 |}
11410 !! html/php
11411 <table>
11412 <tr>
11413 <td style="background: red;"> hi
11414 </td></tr></table>
11415
11416 !! html/parsoid
11417 <table>
11418 <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>
11419 </tbody></table>
11420 !! end
11421
11422 !!test
11423 Templates: HTML Tables: 1. Generating start of a HTML table
11424 !! wikitext
11425 {{echo|<table><tr><td>foo</td>}}</tr></table>
11426 !! html
11427 <table><tr><td>foo</td></tr></table>
11428
11429 !!end
11430
11431 !!test
11432 Templates: HTML Tables: 2a. Generating middle of a HTML table
11433 !! wikitext
11434 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11435 !! html
11436 <table><tr><td>foo</td></tr></table>
11437
11438 !!end
11439
11440 !!test
11441 Templates: HTML Tables: 2b. Generating middle of a HTML table
11442 !! wikitext
11443 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11444 !! html
11445 <table><tr><td>foo</td></tr></table>
11446
11447 !!end
11448
11449 !!test
11450 Templates: HTML Tables: 3. Generating end of a HTML table
11451 !! wikitext
11452 <table><tr>{{echo|<td>foo</td></tr></table>}}
11453 !! html
11454 <table><tr><td>foo</td></tr></table>
11455
11456 !!end
11457
11458 !!test
11459 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11460 !! wikitext
11461 {{echo|<table>}}<tr><td>foo</td></tr></table>
11462 !! html
11463 <table><tr><td>foo</td></tr></table>
11464
11465 !!end
11466
11467 !!test
11468 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11469 !! wikitext
11470 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11471 !! html
11472 <table><tr><td>foo</td></tr></table>
11473
11474 !!end
11475
11476 !!test
11477 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11478 !! wikitext
11479 <table><tr>{{echo|<td>}}foo</td></tr></table>
11480 !! html
11481 <table><tr><td>foo</td></tr></table>
11482
11483 !!end
11484
11485 !!test
11486 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11487 !! wikitext
11488 <table><tr><td>foo{{echo|</td>}}</tr></table>
11489 !! html
11490 <table><tr><td>foo</td></tr></table>
11491
11492 !!end
11493
11494 !!test
11495 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11496 !! wikitext
11497 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11498 !! html
11499 <table><tr><td>foo</td></tr></table>
11500
11501 !!end
11502
11503 !!test
11504 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11505 !! wikitext
11506 <table><tr><td>foo</td></tr>{{echo|</table>}}
11507 !! html
11508 <table><tr><td>foo</td></tr></table>
11509
11510 !!end
11511
11512 !!test
11513 Templates: HTML Tables: 5. Proper fostering of categories from inside
11514 !!options
11515 parsoid=wt2html,wt2wt
11516 !! wikitext
11517 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11518 <!--Two categories (Bug 50330)-->
11519 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11520 !! html
11521 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11522 <!--Two categories (Bug 50330)-->
11523 <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>
11524 !!end
11525
11526 !!test
11527 Templates: Wiki Tables: 1a. Fostering of entire template content
11528 !! wikitext
11529 {|
11530 {{echo|a}}
11531 |}
11532 !! html
11533 <table>
11534 a
11535 <tr><td></td></tr></table>
11536
11537 !! html+tidy
11538 <p>a</p>
11539 <table>
11540 <tr>
11541 <td></td>
11542 </tr>
11543 </table>
11544 !! end
11545
11546 !!test
11547 Templates: Wiki Tables: 1b. Fostering of entire template content
11548 !! wikitext
11549 {|
11550 {{echo|<div>}}
11551 foo
11552 {{echo|</div>}}
11553 |}
11554 !! html
11555 <table>
11556 <div>
11557 <p>foo
11558 </p>
11559 </div>
11560 <tr><td></td></tr></table>
11561
11562 !! html+tidy
11563 <div>
11564 <p>foo</p>
11565 </div>
11566 <table>
11567 <tr>
11568 <td></td>
11569 </tr>
11570 </table>
11571 !! end
11572
11573 !!test
11574 Templates: Wiki Tables: 2. Fostering of partial template content
11575 !! wikitext
11576 {|
11577 {{echo|a
11578 <div>b</div>}}
11579 |}
11580 !! html
11581 <table>
11582 a
11583 <div>b</div>
11584 <tr><td></td></tr></table>
11585
11586 !! html+tidy
11587 <p>a</p>
11588 <div>b</div>
11589 <table>
11590 <tr>
11591 <td></td>
11592 </tr>
11593 </table>
11594 !! end
11595
11596 !!test
11597 Templates: Wiki Tables: 3. td-content via multiple templates
11598 !! wikitext
11599 {|
11600 {{echo|{{pipe}}a}}{{echo|b}}
11601 |}
11602 !! html
11603 <table>
11604 <tr>
11605 <td>ab
11606 </td></tr></table>
11607
11608 !!end
11609
11610 !!test
11611 Templates: Wiki Tables: 4. Templated tags, no content
11612 !! wikitext
11613 {{tbl-start}}
11614 {{tbl-end}}
11615 !! html
11616 <table>
11617 <tr><td></td></tr></table>
11618
11619 !!end
11620
11621 !!test
11622 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11623 !! wikitext
11624 {{tbl-start}}
11625 |foo
11626 {{tbl-end}}
11627 !! html
11628 <table>
11629 <tr>
11630 <td>foo
11631 </td></tr></table>
11632
11633 !!end
11634
11635 !!test
11636 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11637 !! wikitext
11638 {{tbl-start}}
11639 {{!}}foo
11640 {{tbl-end}}
11641 !! html
11642 <table>
11643 <tr>
11644 <td>foo
11645 </td></tr></table>
11646
11647 !!end
11648
11649 ## This test case is very specific to Parsoid's internals
11650 ## and is hence only tested for Parsoid's code. Parsoid uses
11651 ## a <meta> marker tag for <ref> tags and they are expanded
11652 ## much later. We are verifying that this <meta> tag usage
11653 ## doesn't prevent foster parenting.
11654 !!test
11655 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11656 !!wikitext
11657 {{PartialTable}}<ref>foo</ref>
11658 |}
11659
11660 <references />
11661 !!html/parsoid
11662 <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">
11663 <tbody>
11664 </tbody></table>
11665
11666 <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>
11667 !!end
11668
11669 !! test
11670 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11671 !! wikitext
11672 {{echo|
11673 {{{!}}
11674 {{!}}-}}
11675 <onlyinclude>
11676 |foo
11677 </onlyinclude>
11678 {{!}}}
11679 !! html/parsoid
11680 <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{{!}}}"]}'>
11681 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11682 <tbody><tr>
11683
11684 <td>foo
11685 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11686 </tbody></table>
11687 !! end
11688
11689 !!test
11690 Templates: Lists: Multi-line list-items via templates
11691 !! wikitext
11692 *{{echo|a {{nonexistent|
11693 unused}}}}
11694 *{{echo|b {{nonexistent|
11695 unused}}}}
11696 !! html
11697 <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>
11698 <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>
11699
11700 !!end
11701
11702 !!test
11703 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11704 !! wikitext
11705 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11706 !! html
11707 <p><i>ab</i>c<i>d</i>e
11708 </p>
11709 !!end
11710
11711 !!test
11712 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11713 (PHP parser generates misnested html)
11714 !! wikitext
11715 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11716 !! html/parsoid
11717 <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>
11718 !!end
11719
11720 !!test
11721 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11722 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11723 !! options
11724 parsoid=wt2html,wt2wt
11725 !! wikitext
11726 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11727 !! html
11728 <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>
11729 <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>
11730 <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>
11731 !!end
11732
11733 !!test
11734 Templates: Ugly nesting: 4. Divs opened/closed across templates
11735 !! wikitext
11736 a<div>b{{echo|c</div>d}}e
11737 !! html
11738 a<div>bc</div>de
11739
11740 !! html+tidy
11741 <p>a</p>
11742 <div>bc</div>
11743 <p>de</p>
11744 !! end
11745
11746 !!test
11747 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11748 (Parsoid-centric)
11749 !! options
11750 parsoid
11751 !! wikitext
11752 {|
11753 |{{echo|foo</table>}}
11754 |bar
11755 |}
11756 !! html
11757 <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|}"]}'>
11758
11759 <tbody>
11760 <tr>
11761 <td>foo</td></tr></tbody></table><span about="#mwt1">
11762 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11763 |}</span>
11764 !!end
11765
11766 !!test
11767 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11768 (Parsoid-centric)
11769 !! options
11770 parsoid
11771 !! wikitext
11772 <table>
11773 <tr>
11774 <td>
11775 <table>
11776 <tr>
11777 <td>1. {{echo|foo </table>}}</td>
11778 <td> bar </td>
11779 <td>2. {{echo|baz </table>}}</td>
11780 </tr>
11781 <tr>
11782 <td>abc</td>
11783 </tr>
11784 </table>
11785 </td>
11786 </tr>
11787 <tr>
11788 <td>xyz</td>
11789 </tr>
11790 </table>
11791 !! html
11792 <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>"]}'>
11793 <tbody><tr>
11794 <td>
11795 <table>
11796 <tbody><tr>
11797 <td>1. foo </td></tr></tbody></table></td>
11798 <td> bar </td>
11799 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11800 </span><span about="#mwt2">
11801 </span><span about="#mwt2">
11802 </span><span about="#mwt2">abc</span><span about="#mwt2">
11803 </span><span about="#mwt2">
11804 </span><span about="#mwt2">
11805 </span><span about="#mwt2">
11806 </span><span about="#mwt2">
11807 </span><span about="#mwt2">
11808 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11809 </span><span about="#mwt2">
11810 </span>
11811 !!end
11812
11813 !! test
11814 Templates: Ugly templates: 3. newline-only template parameter
11815 !! wikitext
11816 foo {{echo|
11817 }}
11818 !! html
11819 <p>foo
11820 </p>
11821 !! end
11822
11823 # This looks like a bug: a single newline triggers p/br for some reason.
11824 !! test
11825 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11826 !! wikitext
11827 {{echo|
11828 }}
11829 !! html
11830 <p><br />
11831 </p>
11832 !! end
11833
11834 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11835 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11836 !! test
11837 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11838 !! wikitext
11839 {{echo|<table>}}
11840 {{echo|<div>foo}}
11841 {{echo|</table>}}
11842 !! html/parsoid
11843 <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
11844 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11845 </table>
11846 !! end
11847
11848 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11849 # that are "identical" and generate nesting cycles in the algorithm
11850 !! test
11851 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11852 !! wikitext
11853 {{echo|<table><tr><td><table>}}
11854 {{echo|<div>}}
11855 {{echo|</div>}}
11856 !! html/parsoid
11857 <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"}'>
11858 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11859 </table></td></tr></tbody></table>
11860 !! end
11861
11862 !! test
11863 Templates: Parameters substituted at the top-level
11864 !! wikitext
11865 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
11866 !! html/php
11867 <p><i>who</i> me? <b>never!</b>
11868 </p>
11869 !! html/parsoid
11870 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
11871 !! end
11872
11873 !!test
11874 Parser Functions: 1. Simple example
11875 !! wikitext
11876 {{uc:foo}}
11877 !! html
11878 <p>FOO
11879 </p>
11880 !!end
11881
11882 !!test
11883 Parser Functions: 2. Nested use (only outermost should be marked up)
11884 !! wikitext
11885 {{uc:{{lc:FOO}}}}
11886 !! html
11887 <p>FOO
11888 </p>
11889 !!end
11890
11891 ###
11892 ### Pre-save transform tests
11893 ###
11894 !! test
11895 pre-save transform: subst:
11896 !! options
11897 pst
11898 !! wikitext
11899 {{subst:test}}
11900 !! html/php
11901 This is a test template
11902 !! end
11903
11904 !! test
11905 pre-save transform: normal template
11906 !! options
11907 pst
11908 !! wikitext
11909 {{test}}
11910 !! html/php
11911 {{test}}
11912 !! end
11913
11914 !! test
11915 pre-save transform: nonexistent template
11916 !! options
11917 pst
11918 !! wikitext
11919 {{thistemplatedoesnotexist}}
11920 !! html/php
11921 {{thistemplatedoesnotexist}}
11922 !! end
11923
11924 !! test
11925 pre-save transform: subst magic variables
11926 !! options
11927 pst
11928 !! wikitext
11929 {{subst:SITENAME}}
11930 !! html/php
11931 MediaWiki
11932 !! end
11933
11934 # This is bug 89, which I fixed. -- wtm
11935 !! test
11936 pre-save transform: subst: templates with parameters
11937 !! options
11938 pst
11939 !! wikitext
11940 {{subst:paramtest|param="something else"}}
11941 !! html/php
11942 This is a test template with parameter "something else"
11943 !! end
11944
11945 !! article
11946 Template:nowikitest
11947 !! text
11948 <nowiki>'''not wiki'''</nowiki>
11949 !! endarticle
11950
11951 !! test
11952 pre-save transform: nowiki in subst (bug 1188)
11953 !! options
11954 pst
11955 !! wikitext
11956 {{subst:nowikitest}}
11957 !! html/php
11958 <nowiki>'''not wiki'''</nowiki>
11959 !! end
11960
11961 !! article
11962 Template:commenttest
11963 !! text
11964 This template has <!-- a comment --> in it.
11965 !! endarticle
11966
11967 !! test
11968 pre-save transform: comment in subst (bug 1936)
11969 !! options
11970 pst
11971 !! wikitext
11972 {{subst:commenttest}}
11973 !! html/php
11974 This template has <!-- a comment --> in it.
11975 !! end
11976
11977 !! test
11978 pre-save transform: unclosed tag
11979 !! options
11980 pst noxml
11981 !! wikitext
11982 <nowiki>'''not wiki'''
11983 !! html/php
11984 <nowiki>'''not wiki'''
11985 !! end
11986
11987 !! test
11988 pre-save transform: mixed tag case
11989 !! options
11990 pst noxml
11991 !! wikitext
11992 <NOwiki>'''not wiki'''</noWIKI>
11993 !! html/php
11994 <NOwiki>'''not wiki'''</noWIKI>
11995 !! end
11996
11997 !! test
11998 pre-save transform: unclosed comment in <nowiki>
11999 !! options
12000 pst noxml
12001 !! wikitext
12002 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12003 !! html/php
12004 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12005 !!end
12006
12007 # Leading @ in this template definition works around a limitation
12008 # in parsoid's parserTests which otherwise strips the <span> from the
12009 # result (confusing it for a template wrapper)
12010 !! article
12011 Template:dangerous
12012 !!text
12013 @<span onmouseover="alert('crap')">Oh no</span>
12014 !!endarticle
12015
12016 !!test
12017 (confirming safety of fix for subst bug 1936)
12018 !! wikitext
12019 {{Template:dangerous}}
12020 !! html
12021 <p>@<span>Oh no</span>
12022 </p>
12023 !! end
12024
12025 !! test
12026 pre-save transform: comment containing gallery (bug 5024)
12027 !! options
12028 pst
12029 !! wikitext
12030 <!-- <gallery>data</gallery> -->
12031 !! html/php
12032 <!-- <gallery>data</gallery> -->
12033 !!end
12034
12035 !! test
12036 pre-save transform: comment containing extension
12037 !! options
12038 pst
12039 !! wikitext
12040 <!-- <tag>data</tag> -->
12041 !! html/php
12042 <!-- <tag>data</tag> -->
12043 !!end
12044
12045 !! test
12046 pre-save transform: comment containing nowiki
12047 !! options
12048 pst
12049 !! wikitext
12050 <!-- <nowiki>data</nowiki> -->
12051 !! html/php
12052 <!-- <nowiki>data</nowiki> -->
12053 !!end
12054
12055 !! test
12056 pre-save transform: <noinclude> in subst (bug 3298)
12057 !! options
12058 pst
12059 !! wikitext
12060 {{subst:Includes}}
12061 !! html/php
12062 Foobar
12063 !! end
12064
12065 !! test
12066 pre-save transform: <onlyinclude> in subst (bug 3298)
12067 !! options
12068 pst
12069 !! wikitext
12070 {{subst:Includes2}}
12071 !! html/php
12072 Foo
12073 !! end
12074
12075 !! article
12076 Template:SubstTest
12077 !!text
12078 {{<includeonly>subst:</includeonly>Includes}}
12079 !! endarticle
12080
12081 !! article
12082 Template:SafeSubstTest
12083 !! text
12084 {{<includeonly>safesubst:</includeonly>Includes}}
12085 !! endarticle
12086
12087 !! test
12088 bug 22297: safesubst: works during PST
12089 !! options
12090 pst
12091 !! wikitext
12092 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12093 !! html/php
12094 FoobarFoobar
12095 !! end
12096
12097 !! test
12098 bug 22297: safesubst: works during normal parse
12099 !! wikitext
12100 {{SafeSubstTest}}
12101 !! html
12102 <p>Foobar
12103 </p>
12104 !! end
12105
12106 !! test
12107 subst: does not work during normal parse
12108 !! wikitext
12109 {{SubstTest}}
12110 !! html
12111 <p>{{subst:Includes}}
12112 </p>
12113 !! end
12114
12115 !! test
12116 pre-save transform: context links ("pipe trick")
12117 !! options
12118 pst
12119 !! wikitext
12120 [[Article (context)|]]
12121 [[Bar:Article|]]
12122 [[:Bar:Article|]]
12123 [[Bar:Article (context)|]]
12124 [[:Bar:Article (context)|]]
12125 [[|Article]]
12126 [[|Article (context)]]
12127 [[Bar:X (Y) Z|]]
12128 [[:Bar:X (Y) Z|]]
12129 !! html/php
12130 [[Article (context)|Article]]
12131 [[Bar:Article|Article]]
12132 [[:Bar:Article|Article]]
12133 [[Bar:Article (context)|Article]]
12134 [[:Bar:Article (context)|Article]]
12135 [[Article]]
12136 [[Article (context)]]
12137 [[Bar:X (Y) Z|X (Y) Z]]
12138 [[:Bar:X (Y) Z|X (Y) Z]]
12139 !! end
12140
12141 !! test
12142 pre-save transform: context links ("pipe trick") with interwiki prefix
12143 !! options
12144 pst
12145 !! wikitext
12146 [[interwiki:Article|]]
12147 [[:interwiki:Article|]]
12148 [[interwiki:Bar:Article|]]
12149 [[:interwiki:Bar:Article|]]
12150 !! html/php
12151 [[interwiki:Article|Article]]
12152 [[:interwiki:Article|Article]]
12153 [[interwiki:Bar:Article|Bar:Article]]
12154 [[:interwiki:Bar:Article|Bar:Article]]
12155 !! end
12156
12157 !! test
12158 pre-save transform: context links ("pipe trick") with parens in title
12159 !! options
12160 pst title=[[Somearticle (context)]]
12161 !! wikitext
12162 [[|Article]]
12163 !! html/php
12164 [[Article (context)|Article]]
12165 !! end
12166
12167 !! test
12168 pre-save transform: context links ("pipe trick") with comma in title
12169 !! options
12170 pst title=[[Someplace, Somewhere]]
12171 !! wikitext
12172 [[|Otherplace]]
12173 [[Otherplace, Elsewhere|]]
12174 [[Otherplace, Elsewhere, Anywhere|]]
12175 !! html/php
12176 [[Otherplace, Somewhere|Otherplace]]
12177 [[Otherplace, Elsewhere|Otherplace]]
12178 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12179 !! end
12180
12181 !! test
12182 pre-save transform: context links ("pipe trick") with parens and comma
12183 !! options
12184 pst title=[[Someplace (IGNORED), Somewhere]]
12185 !! wikitext
12186 [[|Otherplace]]
12187 [[Otherplace (place), Elsewhere|]]
12188 !! html/php
12189 [[Otherplace, Somewhere|Otherplace]]
12190 [[Otherplace (place), Elsewhere|Otherplace]]
12191 !! end
12192
12193 !! test
12194 pre-save transform: context links ("pipe trick") with comma and parens
12195 !! options
12196 pst title=[[Who, me? (context)]]
12197 !! wikitext
12198 [[|Yes, you.]]
12199 [[Me, Myself, and I (1937 song)|]]
12200 !! html/php
12201 [[Yes, you. (context)|Yes, you.]]
12202 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12203 !! end
12204
12205 !! test
12206 pre-save transform: context links ("pipe trick") with namespace
12207 !! options
12208 pst title=[[Ns:Somearticle]]
12209 !! wikitext
12210 [[|Article]]
12211 !! html/php
12212 [[Ns:Article|Article]]
12213 !! end
12214
12215 !! test
12216 pre-save transform: context links ("pipe trick") with namespace and parens
12217 !! options
12218 pst title=[[Ns:Somearticle (context)]]
12219 !! wikitext
12220 [[|Article]]
12221 !! html/php
12222 [[Ns:Article (context)|Article]]
12223 !! end
12224
12225 !! test
12226 pre-save transform: context links ("pipe trick") with namespace and comma
12227 !! options
12228 pst title=[[Ns:Somearticle, Context, Whatever]]
12229 !! wikitext
12230 [[|Article]]
12231 !! html/php
12232 [[Ns:Article, Context, Whatever|Article]]
12233 !! end
12234
12235 !! test
12236 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12237 !! options
12238 pst title=[[Ns:Somearticle, Context (context)]]
12239 !! wikitext
12240 [[|Article]]
12241 !! html/php
12242 [[Ns:Article (context)|Article]]
12243 !! end
12244
12245 !! test
12246 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12247 !! options
12248 pst title=[[Ns:Somearticle (IGNORED), Context]]
12249 !! wikitext
12250 [[|Article]]
12251 !! html/php
12252 [[Ns:Article, Context|Article]]
12253 !! end
12254
12255 !! test
12256 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12257 !! options
12258 pst
12259 !! wikitext
12260 [[Article(context)|]]
12261 [[Bar:Article(context)|]]
12262 [[:Bar:Article(context)|]]
12263 [[|Article(context)]]
12264 [[Bar:X(Y)Z|]]
12265 [[:Bar:X(Y)Z|]]
12266 !! html/php
12267 [[Article(context)|Article]]
12268 [[Bar:Article(context)|Article]]
12269 [[:Bar:Article(context)|Article]]
12270 [[Article(context)]]
12271 [[Bar:X(Y)Z|X(Y)Z]]
12272 [[:Bar:X(Y)Z|X(Y)Z]]
12273 !! end
12274
12275 !! test
12276 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12277 !! options
12278 pst
12279 !! wikitext
12280 [[Article (context)|]]
12281 [[Bar:Article (context)|]]
12282 [[:Bar:Article (context)|]]
12283 [[|Article (context)]]
12284 [[Bar:X (Y) Z|]]
12285 [[:Bar:X (Y) Z|]]
12286 !! html/php
12287 [[Article (context)|Article]]
12288 [[Bar:Article (context)|Article]]
12289 [[:Bar:Article (context)|Article]]
12290 [[Article (context)]]
12291 [[Bar:X (Y) Z|X (Y) Z]]
12292 [[:Bar:X (Y) Z|X (Y) Z]]
12293 !! end
12294
12295 !! test
12296 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12297 !! options
12298 pst
12299 !! wikitext
12300 [[Article(context)|]]
12301 [[Bar:Article(context)|]]
12302 [[:Bar:Article(context)|]]
12303 [[|Article(context)]]
12304 [[Bar:X(Y)Z|]]
12305 [[:Bar:X(Y)Z|]]
12306 !! html/php
12307 [[Article(context)|Article]]
12308 [[Bar:Article(context)|Article]]
12309 [[:Bar:Article(context)|Article]]
12310 [[Article(context)]]
12311 [[Bar:X(Y)Z|X(Y)Z]]
12312 [[:Bar:X(Y)Z|X(Y)Z]]
12313 !! end
12314
12315 !! test
12316 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12317 !! options
12318 pst
12319 !! wikitext
12320 [[Article (context), context|]]
12321 [[Article (context),context|]]
12322 [[Bar:Article (context), context|]]
12323 [[Bar:Article (context),context|]]
12324 [[:Bar:Article (context), context|]]
12325 [[:Bar:Article (context),context|]]
12326 !! html/php
12327 [[Article (context), context|Article]]
12328 [[Article (context),context|Article]]
12329 [[Bar:Article (context), context|Article]]
12330 [[Bar:Article (context),context|Article]]
12331 [[:Bar:Article (context), context|Article]]
12332 [[:Bar:Article (context),context|Article]]
12333 !! end
12334
12335 !! test
12336 pre-save transform: trim trailing empty lines
12337 !! options
12338 pst
12339 !! wikitext
12340 Empty lines are trimmed
12341
12342
12343
12344
12345 !! html/php
12346 Empty lines are trimmed
12347 !! end
12348
12349 !! test
12350 pre-save transform: Signature expansion
12351 !! options
12352 pst
12353 !! wikitext
12354 * ~~~
12355 * <noinclude>~~~</noinclude>
12356 * <includeonly>~~~</includeonly>
12357 * <onlyinclude>~~~</onlyinclude>
12358 !! html/php
12359 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12360 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12361 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12362 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12363 !! end
12364
12365
12366 !! test
12367 pre-save transform: Signature expansion in nowiki tags (bug 93)
12368 !! options
12369 pst disabled
12370 !! wikitext
12371 Shall not expand:
12372
12373 <nowiki>~~~~</nowiki>
12374
12375 <includeonly><nowiki>~~~~</nowiki></includeonly>
12376
12377 <noinclude><nowiki>~~~~</nowiki></noinclude>
12378
12379 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12380
12381 {{subst:Foo}} shall be converted to FOO
12382
12383 As well as inside noinclude/onlyinclude
12384 <noinclude>{{subst:Foo}}</noinclude>
12385 <onlyinclude>{{subst:Foo}}</onlyinclude>
12386
12387 But not inside includeonly
12388 <includeonly>{{subst:Foo}}</includeonly>
12389 !! html/php
12390 Shall not expand:
12391
12392 <nowiki>~~~~</nowiki>
12393
12394 <includeonly><nowiki>~~~~</nowiki></includeonly>
12395
12396 <noinclude><nowiki>~~~~</nowiki></noinclude>
12397
12398 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12399
12400 FOO shall be converted to FOO
12401
12402 As well as inside noinclude/onlyinclude
12403 <noinclude>FOO</noinclude>
12404 <onlyinclude>FOO</onlyinclude>
12405
12406 But not inside includeonly
12407 <includeonly>{{subst:Foo}}</includeonly>
12408 !! end
12409
12410 !! test
12411 Parsoid: Recognize nowiki with trailing space in tags
12412 !! options
12413 parsoid=wt2html
12414 !! wikitext
12415 <nowiki ><div>[[foo]]</nowiki >
12416
12417 a<nowiki / >b
12418
12419 c<nowiki />d
12420
12421 e<nowiki/ >f
12422 !! html
12423 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12424 <p>ab</p>
12425 <p>cd</p>
12426 <p>ef</p>
12427 !! end
12428
12429 !! test
12430 Parsoid: Recognize nowiki with odd capitalization
12431 !! options
12432 parsoid=wt2html
12433 !! wikitext
12434 <noWikI ><div>[[foo]]</Nowiki >
12435 !! html
12436 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12437 !! end
12438
12439
12440 !! test
12441 Parsoid: Escape nowiki with trailing space in tags
12442 !! options
12443 parsoid=html2wt
12444 !! html/parsoid
12445 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12446 <p>a&lt;nowiki /&gt;b</p>
12447 <p>c&lt;nowiki/ &gt;d</p>
12448 !! wikitext
12449 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12450
12451 a&lt;nowiki /&gt;b
12452
12453 c&lt;nowiki/ &gt;d
12454 !! end
12455
12456 !! test
12457 Parsoid: Escape weird noWikI capitalizations
12458 !! options
12459 parsoid=html2wt
12460 !! html/parsoid
12461 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12462 !! wikitext
12463 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12464 !! end
12465
12466 ###
12467 ### Message transform tests
12468 ###
12469 !! test
12470 message transform: magic variables
12471 !! options
12472 msg
12473 !! wikitext
12474 {{SITENAME}}
12475 !! html
12476 MediaWiki
12477 !! end
12478
12479 !! test
12480 message transform: should not transform wiki markup
12481 !! options
12482 msg
12483 !! wikitext
12484 ''test''
12485 !! html
12486 ''test''
12487 !! end
12488
12489 !! test
12490 message transform: <noinclude> in transcluded template (bug 4926)
12491 !! options
12492 msg
12493 !! wikitext
12494 {{Includes}}
12495 !! html
12496 Foobar
12497 !! end
12498
12499 !! test
12500 message transform: <onlyinclude> in transcluded template (bug 4926)
12501 !! options
12502 msg
12503 !! wikitext
12504 {{Includes2}}
12505 !! html
12506 Foo
12507 !! end
12508
12509 !! test
12510 {{#special:}} page name, known
12511 !! options
12512 msg
12513 !! wikitext
12514 {{#special:Recentchanges}}
12515 !! html
12516 Special:RecentChanges
12517 !! end
12518
12519 !! test
12520 {{#special:}} page name with subpage, known
12521 !! options
12522 msg
12523 !! wikitext
12524 {{#special:Recentchanges/param}}
12525 !! html
12526 Special:RecentChanges/param
12527 !! end
12528
12529 !! test
12530 {{#special:}} page name, unknown
12531 !! options
12532 msg
12533 !! wikitext
12534 {{#special:foobar nonexistent}}
12535 !! html
12536 Special:Foobar nonexistent
12537 !! end
12538
12539 !! test
12540 {{#speciale:}} page name, known
12541 !! options
12542 msg
12543 !! wikitext
12544 {{#speciale:Recentchanges}}
12545 !! html
12546 Special:RecentChanges
12547 !! end
12548
12549 !! test
12550 {{#speciale:}} page name with subpage, known
12551 !! options
12552 msg
12553 !! wikitext
12554 {{#speciale:Recentchanges/param}}
12555 !! html
12556 Special:RecentChanges/param
12557 !! end
12558
12559 !! test
12560 {{#speciale:}} page name, unknown
12561 !! options
12562 msg
12563 !! wikitext
12564 {{#speciale:foobar nonexistent}}
12565 !! html
12566 Special:Foobar_nonexistent
12567 !! end
12568
12569 ###
12570 ### Images
12571 ###
12572 ### For Parsoid-specific tests, see
12573 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12574
12575 !! test
12576 Simple image
12577 !! options
12578 parsoid=wt2html,wt2wt,html2html
12579 !! wikitext
12580 [[Image:foobar.jpg]]
12581 !! html/php
12582 <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>
12583 </p>
12584 !! html/parsoid
12585 <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>
12586 !! end
12587
12588 !! test
12589 Simple image (using File: namespace, now canonical)
12590 !! wikitext
12591 [[File:Foobar.jpg]]
12592 !! html/php
12593 <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>
12594 </p>
12595 !! html/parsoid
12596 <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>
12597 !! end
12598
12599 !! test
12600 Right-aligned image
12601 !! wikitext
12602 [[File:Foobar.jpg|right]]
12603 !! html/php
12604 <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>
12605
12606 !! html/parsoid
12607 <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>
12608 !! end
12609
12610 !! test
12611 Image with caption
12612 !! wikitext
12613 [[File:Foobar.jpg|right|Caption text]]
12614 !! html/php
12615 <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>
12616
12617 !! html/parsoid
12618 <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>
12619 !! end
12620
12621 !! test
12622 Image with caption, bug 53312 #1
12623 !! wikitext
12624 [[File:Foobar.jpg|right|Caption page stuff]]
12625 !! html/php
12626 <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>
12627
12628 !! html/parsoid
12629 <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>
12630 !! end
12631
12632 !! test
12633 Image with caption, bug 53312 #2
12634 !! wikitext
12635 [[File:Foobar.jpg|right|Caption page=]]
12636 !! html/php
12637 <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>
12638
12639 !! html/parsoid
12640 <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>
12641 !! end
12642
12643 !! test
12644 Image with caption, bug 53312 #3
12645 !! wikitext
12646 [[File:Foobar.jpg|right|Caption page=stuff]]
12647 !! html/php
12648 <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>
12649
12650 !! html/parsoid
12651 <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>
12652 !! end
12653
12654 !! test
12655 Allow empty links in image captions (Bug 60753)
12656 !! options
12657 thumbsize=220
12658 !! wikitext
12659 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12660 [[]]
12661 [[Link2]]
12662 ]]
12663 !! html/php
12664 <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>
12665
12666 !! html/parsoid
12667 <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>
12668 [[]]
12669 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12670 </figcaption></figure>
12671 !! end
12672
12673 !! test
12674 Titles in unlinked images (T23454)
12675 !! wikitext
12676 [[File:Foobar.jpg|link=|stuff]]
12677 !! html/php
12678 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12679 </p>
12680 !! end
12681
12682 !! test
12683 Link with empty target
12684 !! wikitext
12685 [[]]
12686 !! html
12687 <p>[[]]
12688 </p>
12689 !! end
12690
12691 !! test
12692 Image with link trail
12693 !! wikitext
12694 Linktrails should not work for images: [[File:Foobar.jpg]]s
12695 !! html/php
12696 <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
12697 </p>
12698 !! html/parsoid
12699 <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>
12700 !! end
12701
12702 !! test
12703 Image with empty attribute
12704 !! options
12705 parsoid=wt2html,wt2wt,html2html
12706 !! wikitext
12707 [[File:Foobar.jpg|right||Caption text]]
12708 !! html/php
12709 <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>
12710
12711 !! html/parsoid
12712 <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>
12713 !! end
12714
12715 !! test
12716 1. Block image with individual attributes from templates
12717 !! wikitext
12718 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12719 !! html/php
12720 <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>
12721
12722 !! html/parsoid
12723 <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>
12724 !! end
12725
12726 !! test
12727 2. Block Image with individual attributes from templates
12728 !! wikitext
12729 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12730 !! html/php
12731 <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>
12732
12733 !! html/parsoid
12734 <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>
12735 !! end
12736
12737 !! test
12738 3. Inline image with individual attributes from templates
12739 !! wikitext
12740 [[File:Foobar.jpg|{{echo|50px}}]]
12741 !! html/php
12742 <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>
12743 </p>
12744 !! html/parsoid
12745 <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>
12746 !! end
12747
12748 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12749 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12750 !! test
12751 Image with multiple attributes from the same template
12752 !! wikitext
12753 [[File:Foobar.jpg|{{image_attribs}}]]
12754 !! html/php
12755 <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>
12756
12757 !! html/parsoid
12758 <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>
12759 !! end
12760
12761 !! test
12762 Image with link tails
12763 !! options
12764 thumbsize=220
12765 !! wikitext
12766 123[[File:Foobar.jpg]]456
12767 123[[File:Foobar.jpg|right]]456
12768 123[[File:Foobar.jpg|thumb]]456
12769 !! html/php
12770 <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
12771 </p>
12772 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
12773 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
12774
12775 !! html/php+tidy
12776 <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>
12777 <p>123</p>
12778 <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>
12779 <p>456 123</p>
12780 <div class="thumb tright">
12781 <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>
12782 <div class="thumbcaption">
12783 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12784 </div>
12785 </div>
12786 </div>
12787 <p>456</p>
12788 !! html/parsoid
12789 <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>
12790 <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>
12791 <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>
12792 !! end
12793
12794 !! test
12795 Image with multiple captions -- only last one is accepted
12796 !! wikitext
12797 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12798 !! html/php
12799 <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>
12800
12801 !! html/parsoid
12802 <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>
12803 !! end
12804
12805 !! test
12806 Image with multiple widths -- use last
12807 !! wikitext
12808 [[File:Foobar.jpg|200px|300px|caption]]
12809 !! html/php
12810 <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>
12811 </p>
12812 !! html/parsoid
12813 <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>
12814 !! end
12815
12816 !! test
12817 Image with multiple alignments -- use first (bug 48664)
12818 !! options
12819 thumbsize=220
12820 !! wikitext
12821 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12822
12823 [[File:Foobar.jpg|middle|text-top|caption]]
12824 !! html/php
12825 <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>
12826 <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>
12827 </p>
12828 !! html/parsoid
12829 <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>
12830 <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>
12831 !! end
12832
12833 !! test
12834 Image with width attribute at different positions
12835 !! wikitext
12836 [[File:Foobar.jpg|200px|right|Caption]]
12837 [[File:Foobar.jpg|right|200px|Caption]]
12838 [[File:Foobar.jpg|right|Caption|200px]]
12839 !! html/php
12840 <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>
12841 <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>
12842 <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>
12843
12844 !! html/parsoid
12845 <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>
12846 <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>
12847 <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>
12848 !! end
12849
12850 # a sad bit of backward-compatibility
12851 !! test
12852 Image with size specified with pxpx (bug 13500, 51628)
12853 !! options
12854 parsoid=wt2html,wt2wt,html2html
12855 !! wikitext
12856 [[File:Foobar.jpg|20pxpx]]
12857 [[File:Foobar.jpg|200x20pxpx]]
12858 !! html/php
12859 <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>
12860 <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>
12861 </p>
12862 !! html/parsoid
12863 <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>
12864 !! end
12865
12866 !! test
12867 Image with link parameter, wiki target
12868 !! wikitext
12869 [[File:Foobar.jpg|link=Main Page]]
12870 !! html/php
12871 <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>
12872 </p>
12873 !! html/parsoid
12874 <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>
12875 !! end
12876
12877 # parsoid bug 49293 (part 1)
12878 !! test
12879 Image with link parameter, URL target
12880 !! wikitext
12881 [[File:Foobar.jpg|link=http://example.com/]]
12882 !! html/php
12883 <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>
12884 </p>
12885 !! html/parsoid
12886 <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>
12887 !! end
12888
12889 # parsoid bug 49293 (part 2)
12890 !! test
12891 Image with link parameter, protocol-less URL target
12892 !! wikitext
12893 [[File:Foobar.jpg|link=//example.com/]]
12894 !! html/php
12895 <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>
12896 </p>
12897 !! html/parsoid
12898 <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>
12899 !! end
12900
12901 !! test
12902 Escaping non-block captions (T107435)
12903 !! options
12904 parsoid={
12905 "modes": ["wt2wt"],
12906 "changes": [
12907 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12908 ]
12909 }
12910 !! wikitext
12911 [[Image:Foobar.jpg|caption]]
12912 !! wikitext/edited
12913 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12914 !! end
12915
12916 !! test
12917 Image with link parameter, wgExternalLinkTarget
12918 !! wikitext
12919 [[Image:foobar.jpg|link=http://example.com/]]
12920 !! config
12921 wgExternalLinkTarget='foobar'
12922 !! html
12923 <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>
12924 </p>
12925 !! end
12926
12927 !! test
12928 Image with link parameter, wgNoFollowLinks set to false
12929 !! wikitext
12930 [[Image:foobar.jpg|link=http://example.com/]]
12931 !! config
12932 wgNoFollowLinks=false
12933 !! html
12934 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12935 </p>
12936 !! end
12937
12938 !! test
12939 Image with link parameter, wgNoFollowDomainExceptions
12940 !! wikitext
12941 [[Image:foobar.jpg|link=http://example.com/]]
12942 !! config
12943 wgNoFollowDomainExceptions='example.com'
12944 !! html
12945 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12946 </p>
12947 !! end
12948
12949 !! test
12950 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12951 !! wikitext
12952 [[Image:foobar.jpg|link=http://example.com/|Title]]
12953 !! config
12954 wgExternalLinkTarget='foobar'
12955 !! html
12956 <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>
12957 </p>
12958 !! end
12959
12960 !! test
12961 Image with empty link parameter
12962 !! wikitext
12963 [[File:Foobar.jpg|link=]]
12964 !! html/php
12965 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12966 </p>
12967 !! html/parsoid
12968 <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>
12969 !! end
12970
12971 !! test
12972 Image with link parameter (wiki target) and unnamed parameter
12973 !! wikitext
12974 [[File:Foobar.jpg|link=Main_Page|Title]]
12975 !! html/php
12976 <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>
12977 </p>
12978 !! html/parsoid
12979 <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>
12980 !! end
12981
12982 !! test
12983 Image with link parameter (URL target) and unnamed parameter
12984 !! wikitext
12985 [[File:Foobar.jpg|link=http://example.com/|Title]]
12986 !! html/php
12987 <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>
12988 </p>
12989 !! html/parsoid
12990 <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>
12991 !! end
12992
12993 !! test
12994 Thumbnail image with link parameter
12995 !! options
12996 thumbsize=220
12997 parsoid=wt2html,wt2wt,html2html
12998 !! wikitext
12999 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13000 !! html/php
13001 <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>
13002
13003 !! html/parsoid
13004 <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>
13005 !! end
13006
13007 !! test
13008 Manually-specified thumbnail image
13009 !! options
13010 thumbsize=220
13011 !! wikitext
13012 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13013 !! html/php
13014 <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>
13015
13016 !! html/parsoid
13017 <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>
13018 !! end
13019
13020 !! test
13021 Manually-specified thumbnail image with explicit link to wiki page
13022 !! options
13023 thumbsize=220
13024 parsoid=wt2html,wt2wt,html2html
13025 !! wikitext
13026 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13027 !! html/php
13028 <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>
13029
13030 !! html/parsoid
13031 <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>
13032 !! end
13033
13034 !! test
13035 Manually-specified thumbnail image with explicit link to url
13036 !! options
13037 thumbsize=220
13038 parsoid=wt2html,wt2wt,html2html
13039 !! wikitext
13040 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13041 !! html/php
13042 <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>
13043
13044 !! html/parsoid
13045 <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>
13046 !! end
13047
13048 !! test
13049 Manually-specified thumbnail image with explicit no link
13050 !! options
13051 thumbsize=220
13052 parsoid=wt2html,wt2wt,html2html
13053 !! wikitext
13054 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13055 !! html/php
13056 <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>
13057
13058 !! html/parsoid
13059 <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>
13060 !! end
13061
13062 !! test
13063 Manually-specified thumbnail image with explicit link and alt text
13064 !! options
13065 thumbsize=220
13066 parsoid=wt2html,wt2wt,html2html
13067 !! wikitext
13068 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13069 !! html/php
13070 <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>
13071
13072 !! html/parsoid
13073 <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>
13074 !! end
13075
13076 !! test
13077 Image with frame and link
13078 !! options
13079 parsoid=wt2html,wt2wt,html2html
13080 !! wikitext
13081 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13082 !! html/php
13083 <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>
13084
13085 !! html/parsoid
13086 <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>
13087 !! end
13088
13089 !! test
13090 Image with frame and link and explicit alt
13091 !! options
13092 parsoid=wt2html,wt2wt,html2html
13093 !! wikitext
13094 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13095 !! html/php
13096 <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>
13097
13098 !! html/parsoid
13099 <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>
13100 !! end
13101
13102 !! test
13103 Image with wiki markup in implicit alt
13104 !! wikitext
13105 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13106
13107 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13108 !! html/php
13109 <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>
13110 </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>
13111 </p>
13112 !! html/parsoid
13113 <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>
13114 <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>
13115 !! end
13116
13117 !! test
13118 Alt image option should handle most kinds of wikitext without barfing
13119 !! wikitext
13120 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13121 !! html/php
13122 <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>
13123
13124 !! html/parsoid
13125 <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>
13126 !! end
13127
13128 ###################
13129 # Conflicting image format options.
13130 # First option specified should 'win'.
13131 # All three cases in each test should be identical.
13132
13133 !! test
13134 Image with 'frameless' first.
13135 !! options
13136 parsoid=wt2html,wt2wt,html2html
13137 !! wikitext
13138 [[File:Foobar.jpg|frameless|caption]]
13139
13140 [[File:Foobar.jpg|frameless|frame|caption]]
13141
13142 [[File:Foobar.jpg|frameless|thumb|caption]]
13143 !! html/php
13144 <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>
13145 </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>
13146 </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>
13147 </p>
13148 !! html/parsoid
13149 <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>
13150 <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>
13151 <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>
13152 !! end
13153
13154 !! test
13155 Image with 'frame' first.
13156 !! options
13157 parsoid=wt2html,wt2wt,html2html
13158 !! wikitext
13159 [[File:Foobar.jpg|frame|caption]]
13160 [[File:Foobar.jpg|frame|frameless|caption]]
13161 [[File:Foobar.jpg|frame|thumb|caption]]
13162 !! html/php
13163 <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>
13164 <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>
13165 <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>
13166
13167 !! html/parsoid
13168 <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>
13169 <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>
13170 <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>
13171 !! end
13172
13173 !! test
13174 Image with 'thumb' first.
13175 !! options
13176 parsoid=wt2html,wt2wt,html2html
13177 !! wikitext
13178 [[File:Foobar.jpg|thumb|caption]]
13179 [[File:Foobar.jpg|thumb|frameless|caption]]
13180 [[File:Foobar.jpg|thumb|frame|caption]]
13181 !! html/php
13182 <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>
13183 <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>
13184 <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>
13185
13186 !! html/parsoid
13187 <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>
13188 <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>
13189 <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>
13190 !! end
13191
13192 ###################
13193 # Image sizing.
13194 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13195 # and https://phabricator.wikimedia.org/T64258
13196 # Foobar has actual size of 1941x220
13197 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13198 # a scalable format.
13199 # 2. Framed images always ignore size options; always render at default size.
13200 # 3. "Unspecified format" and border are the only types which can be
13201 # enlarged.
13202
13203 !! test
13204 Image: "unspecified format" and border enlarge
13205 !! options
13206 parsoid=wt2html,wt2wt,html2html
13207 !! wikitext
13208 [[File:Foobar.jpg|2000px]]
13209
13210 [[File:Foobar.jpg|border|2000px]]
13211 !! html/php
13212 <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>
13213 </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>
13214 </p>
13215 !! html/parsoid
13216 <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>
13217 <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>
13218 !! end
13219
13220 !! test
13221 Image: "unspecified format" and border reduce
13222 !! options
13223 parsoid=wt2html,wt2wt,html2html
13224 !! wikitext
13225 [[File:Foobar.jpg|1000px]]
13226
13227 [[File:Foobar.jpg|border|1000px]]
13228 !! html/php
13229 <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>
13230 </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>
13231 </p>
13232 !! html/parsoid
13233 <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>
13234 <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>
13235 !! end
13236
13237 !! test
13238 Image: thumbs reduce
13239 !! options
13240 parsoid=wt2html,wt2wt,html2html
13241 !! wikitext
13242 [[File:Foobar.jpg|thumb|50px]]
13243 !! html/php
13244 <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>
13245
13246 !! html/parsoid
13247 <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>
13248 !! end
13249
13250 !! test
13251 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13252 !! options
13253 parsoid=wt2html,wt2wt,html2html
13254 !! wikitext
13255 [[File:Foobar.jpg|thumb|2000px]]
13256
13257 [[File:Foobar.svg|thumb|2000px]]
13258 !! html/php
13259 <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>
13260 <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>
13261
13262 !! html/parsoid
13263 <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>
13264 <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>
13265 !! end
13266
13267 !! test
13268 Image: frameless can reduce in size
13269 !! options
13270 parsoid=wt2html,wt2wt,html2html
13271 !! wikitext
13272 [[File:Foobar.jpg|frameless|50px]]
13273 !! html/php
13274 <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>
13275 </p>
13276 !! html/parsoid
13277 <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>
13278 !! end
13279
13280 !! test
13281 Image: bitmap frameless can't be enlarged past original size, but vector can
13282 !! options
13283 parsoid=wt2html,wt2wt,html2html
13284 !! wikitext
13285 [[File:Foobar.jpg|frameless|2000px]]
13286
13287 [[File:Foobar.svg|frameless|2000px]]
13288 !! html/php
13289 <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>
13290 </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>
13291 </p>
13292 !! html/parsoid
13293 <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>
13294 <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>
13295 !! end
13296
13297 !! test
13298 Image: framed images are always unscaled.
13299 !! options
13300 parsoid=wt2html,wt2wt,html2html
13301 !! wikitext
13302 [[File:Foobar.jpg|frame]]
13303
13304 [[File:Foobar.jpg|frame|50px]]
13305
13306 [[File:Foobar.jpg|frame|50x50px]]
13307
13308 [[File:Foobar.jpg|frame|2000px]]
13309 !! html/php
13310 <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>
13311 <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>
13312 <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>
13313 <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>
13314
13315 !! html/parsoid
13316 <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>
13317 <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>
13318 <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>
13319 <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>
13320 !! end
13321
13322 ###################
13323
13324 !! test
13325 Link to image page- image page normally doesn't exists, hence edit link
13326 Add test with existing image page
13327 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13328 !! wikitext
13329 [[:Image:test]]
13330 !! html
13331 <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>
13332 </p>
13333 !! end
13334
13335 !! test
13336 bug 18784 Link to non-existent image page with caption should use caption as link text
13337 !! wikitext
13338 [[:Image:test|caption]]
13339 !! html
13340 <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>
13341 </p>
13342 !! end
13343
13344 !! test
13345 Frameless image caption with a free URL
13346 !! wikitext
13347 [[File:Foobar.jpg|http://example.com]]
13348 !! html/php
13349 <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>
13350 </p>
13351 !! html/parsoid
13352 <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>
13353 !! end
13354
13355 !! test
13356 Thumbnail image caption with a free URL
13357 !! options
13358 thumbsize=220
13359 !! wikitext
13360 [[File:Foobar.jpg|thumb|http://example.com]]
13361 !! html/php
13362 <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>
13363
13364 !! html/parsoid
13365 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13366 !! end
13367
13368 !! test
13369 Thumbnail image caption with a free URL and explicit alt
13370 !! options
13371 thumbsize=220
13372 parsoid=wt2html,wt2wt,html2html
13373 !! wikitext
13374 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13375 !! html/php
13376 <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>
13377
13378 !! html/parsoid
13379 <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>
13380 !! end
13381
13382 !! test
13383 SVG thumbnails with no language set
13384 !! options
13385 !! wikitext
13386 [[File:Foobar.svg|thumb|caption]]
13387 !! html/php
13388 <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>
13389
13390 !! html/parsoid
13391 <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>
13392 !! end
13393
13394 !! test
13395 SVG thumbnails with language de
13396 !! options
13397 parsoid=wt2html,wt2wt,html2html
13398 !! wikitext
13399 [[File:Foobar.svg|thumb|caption|lang=de]]
13400 !! html/php
13401 <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>
13402
13403 !! html/parsoid
13404 <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>
13405 !! end
13406
13407 !! test
13408 SVG thumbnails with invalid language code
13409 !! options
13410 parsoid=wt2html,wt2wt,html2html
13411 !! wikitext
13412 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13413 !! html/php
13414 <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>
13415
13416 !! html/parsoid
13417 <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>
13418 !! end
13419
13420 !! test
13421 BUG 1887: A ISBN with a thumbnail
13422 !! wikitext
13423 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13424 !! html/php
13425 <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>
13426
13427 !! html/parsoid
13428 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13429 !! end
13430
13431 !! test
13432 BUG 1887: A RFC with a thumbnail
13433 !! wikitext
13434 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13435 !! html/php
13436 <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>
13437
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 !! test
13443 BUG 1887: A mailto link with a thumbnail
13444 !! wikitext
13445 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13446 !! html/php
13447 <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>
13448
13449 !! html/parsoid
13450 <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>
13451 !! end
13452
13453 # Pending resolution to bug 368
13454 !! test
13455 BUG 648: Frameless image caption with a link
13456 !! wikitext
13457 [[File:Foobar.jpg|text with a [[link]] in it]]
13458 !! html/php
13459 <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>
13460 </p>
13461 !! html/parsoid
13462 <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>
13463 !! end
13464
13465 !! test
13466 BUG 648: Frameless image caption with a link (suffix)
13467 !! wikitext
13468 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13469 !! html/php
13470 <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>
13471 </p>
13472 !! html/parsoid
13473 <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>
13474 !! end
13475
13476 !! test
13477 BUG 648: Frameless image caption with an interwiki link
13478 !! wikitext
13479 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13480 !! html/php
13481 <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>
13482 </p>
13483 !! html/parsoid
13484 <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>
13485 !! end
13486
13487 !! test
13488 BUG 648: Frameless image caption with a piped interwiki link
13489 !! wikitext
13490 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13491 !! html/php
13492 <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>
13493 </p>
13494 !! html/parsoid
13495 <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>
13496 !! end
13497
13498 !! test
13499 T107474: Frameless image caption with <nowiki>
13500 !! wikitext
13501 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13502 !! html/parsoid
13503 <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>
13504 !! end
13505
13506 !! test
13507 Escape HTML special chars in image alt text
13508 !! wikitext
13509 [[File:Foobar.jpg|& < > "]]
13510 !! html/php
13511 <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>
13512 </p>
13513 !! html/parsoid
13514 <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>
13515 !! end
13516
13517 !! test
13518 BUG 499: Alt text should have &#1234;, not &amp;1234;
13519 !! wikitext
13520 [[File:Foobar.jpg|&#9792;]]
13521 !! html/php
13522 <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>
13523 </p>
13524 !! html/parsoid
13525 <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>
13526 !! end
13527
13528 !! test
13529 Broken image caption with link
13530 !! options
13531 parsoid=wt2html,wt2wt,html2html
13532 !! wikitext
13533 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13534 !! html/php
13535 <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.
13536 </p>
13537 !! html/parsoid
13538 <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>
13539 !! end
13540
13541 !! test
13542 Image caption containing another image
13543 !! wikitext
13544 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13545 !! html/php
13546 <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>
13547
13548 !! html/parsoid
13549 <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>
13550 !! end
13551
13552 !! test
13553 Image: caption containing a newline
13554 !! wikitext
13555 [[File:Foobar.jpg|This
13556 *is some text]]
13557 !! html/php
13558 <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>
13559 </p>
13560 !! html/parsoid
13561 <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>
13562 !!end
13563
13564 !!test
13565 Image: caption containing leading space
13566 (The leading space should not trigger nowiki escaping in wt2wt mode)
13567 !! wikitext
13568 [[File:Foobar.jpg|thumb| bar]]
13569 !! html/php
13570 <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>
13571
13572 !! html/parsoid
13573 <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>
13574 !!end
13575
13576 !! test
13577 Image: caption containing a table
13578 !! options
13579 parsoid=wt2html,wt2wt,html2html
13580 !! wikitext
13581 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13582 {|
13583 ! Foo !! Bar
13584 |-
13585 | Foo1 || Bar1
13586 |}
13587 and some more text.]]
13588 !! html/php
13589 <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>
13590
13591 !! html/parsoid
13592 <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
13593 <table>
13594 <tbody>
13595 <tr><th>Foo </th><th>Bar</th></tr>
13596 <tr>
13597 <td>Foo1 </td>
13598 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13599 !! end
13600
13601 !! test
13602 Bug 3090: External links other than http: in image captions
13603 !! wikitext
13604 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13605 !! html/php
13606 <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>
13607
13608 !! html/parsoid
13609 <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>
13610 !! end
13611
13612 !! test
13613 Custom class
13614 !! options
13615 parsoid=wt2html,wt2wt,html2html
13616 !! wikitext
13617 [[Image:foobar.jpg|a|class=b]]
13618 !! html/php
13619 <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>
13620 </p>
13621 !! html/parsoid
13622 <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>
13623 !! end
13624
13625 !! test
13626 Localized image handling (1).
13627 !! options
13628 parsoid=wt2html,wt2wt,html2html
13629 language=es
13630 !! wikitext
13631 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13632 !! html/php
13633 <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>
13634
13635 !! html/parsoid
13636 <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>
13637 !! end
13638
13639 !! test
13640 Localized image handling (2).
13641 !! options
13642 thumbsize=220
13643 parsoid=wt2html,wt2wt,html2html
13644 language=es
13645 !! wikitext
13646 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13647 !! html/php
13648 <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>
13649
13650 !! html/parsoid
13651 <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>
13652 !! end
13653
13654 !! test
13655 "border", "frameless" and "class" attributes on an image.
13656 !! options
13657 thumbsize=220
13658 parsoid=wt2html,wt2wt,html2html
13659 !! wikitext
13660 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13661 !! html/php
13662 <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>
13663 </p>
13664 !! html/parsoid
13665 <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>
13666 !! end
13667
13668 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13669 !! test
13670 Invalid image attributes (bug 62500)
13671 !! options
13672 thumbsize=220
13673 parsoid=wt2html,wt2wt,html2html
13674 !! wikitext
13675 [[File:Foobar.jpg|thumb|float|left|caption]]
13676
13677 [[File:Foobar.jpg|thumb|righ|caption]]
13678
13679 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13680 !! html/php
13681 <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>
13682 <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>
13683 <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>
13684
13685 !! html/parsoid
13686 <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>
13687 <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>
13688 <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>
13689 !! end
13690
13691 !! article
13692 File:Barfoo.jpg
13693 !! text
13694 #REDIRECT [[File:Barfoo.jpg]]
13695 !! endarticle
13696
13697 # FIXME: Parsoid should run this test -- but we'd need to teach the
13698 # mockAPI about the redirected Barfoo.jpg image.
13699 !! test
13700 Redirected image
13701 !! wikitext
13702 [[Image:Barfoo.jpg]]
13703 !! html/php
13704 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13705 </p>
13706 !! end
13707
13708 !! test
13709 Missing image with uploads disabled
13710 !! options
13711 wgEnableUploads=0
13712 !! wikitext
13713 [[File:Foobaz.jpg]]
13714 !! html/php
13715 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13716 </p>
13717 !! html/parsoid
13718 <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>
13719 !! end
13720
13721 # Parsoid-specific testing for images
13722 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13723 # Currently imperfect due to a flaw in the Parsoid testrunner
13724 # Work in progress
13725 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13726 # image tests.
13727
13728 !! test
13729 Parsoid-specific image handling - simple image with size and middle alignment
13730 !! wikitext
13731 [[File:Foobar.jpg|middle|50px]]
13732 !! html/parsoid
13733 <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>
13734 !! end
13735
13736 !! test
13737 Parsoid-specific image handling - simple image with size, middle alignment,
13738 non-standard namespace alias
13739 !! options
13740 parsoid=wt2wt,wt2html,html2html
13741 !! wikitext
13742 [[Image:Foobar.jpg|middle|50px]]
13743 !! html/parsoid
13744 <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>
13745 !! end
13746
13747 !! test
13748 Parsoid-specific image handling - simple image with size and middle alignment
13749 (existing content)
13750 !! wikitext
13751 [[File:Foobar.jpg|50px|middle]]
13752 !! html/parsoid
13753 <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>
13754 !! end
13755
13756 !! test
13757 Parsoid-specific image handling - simple image with size and middle alignment
13758 and non-standard namespace name
13759 !! options
13760 parsoid=wt2html,wt2wt,html2html
13761 !! wikitext
13762 [[Image:Foobar.jpg|50px|middle]]
13763 !! html/parsoid
13764 <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>
13765 !! end
13766
13767 !! test
13768 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13769 !! wikitext
13770 [[File:Foobar.jpg|500x10px|baseline|caption]]
13771 !! html/parsoid
13772 <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>
13773 !! end
13774
13775 !! test
13776 Parsoid-specific image handling - simple image with border and size spec
13777 !! wikitext
13778 [[File:Foobar.jpg|50px|border|caption]]
13779 !! html/parsoid
13780 <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>
13781 !! end
13782
13783 !! test
13784 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13785 !! wikitext
13786 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13787 !! html/parsoid
13788 <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>
13789 !! end
13790
13791 !! test
13792 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13793 (existing content)
13794 !! wikitext
13795 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13796 !! html/parsoid
13797 <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>
13798 !! end
13799
13800 !! test
13801 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13802 !! wikitext
13803 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13804 !! html/parsoid
13805 <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>
13806 !! end
13807
13808 !! test
13809 Parsoid-specific image handling - thumbnail with specific size, halign,
13810 valign, and caption (existing content)
13811 !! wikitext
13812 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13813 !! html/parsoid
13814 <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>
13815 !! end
13816
13817 !! test
13818 Parsoid-specific image handling - framed image with specific size and caption
13819 (size is ignored)
13820 !! options
13821 parsoid=wt2html,wt2wt,html2html
13822 !! wikitext
13823 [[File:Foobar.jpg|frame|500x50px|caption]]
13824 !! html/parsoid
13825 <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>
13826 !! end
13827
13828 !! test
13829 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13830 (size is ignored)
13831 !! options
13832 parsoid=wt2html,wt2wt,html2html
13833 !! wikitext
13834 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13835 !! html/parsoid
13836 <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>
13837 !! end
13838
13839 !! test
13840 Parsoid-specific image handling - frameless image with specific size, border, and caption
13841 !! wikitext
13842 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13843 !! html/parsoid
13844 <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>
13845 !! end
13846
13847 !! test
13848 Parsoid-specific image handling - simple image with a formatted caption
13849 !! wikitext
13850 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13851 !! html/parsoid
13852 <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>
13853 !! end
13854
13855 !! test
13856 Parsoid-specific image handling - caption with a template in it
13857 !! wikitext
13858 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13859 !! html/parsoid
13860 <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>
13861 !! end
13862
13863 !! test
13864 Parsoid-specific image handling - caption with unbalanced tags in it
13865 !! options
13866 parsoid=wt2html,wt2wt,html2html
13867 !! wikitext
13868 foo
13869 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13870 bar
13871 !! html/parsoid
13872 <p>foo</p>
13873 <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>
13874 <p>bar</p>
13875 !! end
13876
13877 !! test
13878 Parsoid-specific image handling - empty caption (1)
13879 !! options
13880 parsoid=wt2html,wt2wt
13881 !! wikitext
13882 [[File:Foobar.jpg|thumb|]]
13883 !! html/parsoid
13884 <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>
13885 !! end
13886
13887 # empty captions don't get serialized unless we're in the "round trip" case
13888 !! test
13889 Parsoid-specific image handling - empty caption (2)
13890 !! options
13891 parsoid=html2wt
13892 !! html/parsoid
13893 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13894 <a href="./File:Foobar.jpg">
13895 <img resource="./File:Foobar.jpg"
13896 src="//example.com/images/3/3a/Foobar.jpg"
13897 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13898 height="25" width="220"/>
13899 </a>
13900 <figcaption></figcaption>
13901 </figure>
13902 !! wikitext
13903 [[File:Foobar.jpg|thumb]]
13904 !! end
13905
13906 !! test
13907 Parsoid-specific image handling - whitespace caption
13908 !! wikitext
13909 [[File:Foobar.jpg|thumb| ]]
13910 !! html/parsoid
13911 <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>
13912 !! end
13913
13914 !! test
13915 Parsoid-specific image handling - lang option
13916 !! wikitext
13917 foo
13918 [[File:Foobar.svg|lang=de|caption]]
13919 bar
13920 !! html/parsoid
13921 <p>foo
13922 <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>
13923 bar</p>
13924 !! end
13925
13926 ## Edge case bugs in Parsoid from T93580
13927 !! test
13928 T93580: 1. Templated <ref> inside block images
13929 !! wikitext
13930 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13931
13932 <references />
13933 !! html/parsoid
13934 <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>
13935
13936 <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>
13937 !! end
13938
13939 !! test
13940 T93580: 2. <ref> inside inline images
13941 !! wikitext
13942 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
13943
13944 <references />
13945 !! html/parsoid
13946 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13947
13948 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
13949 !! end
13950
13951 !! test
13952 T93580: 3. Templated <ref> inside inline images
13953 !! wikitext
13954 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
13955
13956 <references />
13957 !! html/parsoid
13958 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13959
13960 <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>
13961 !! end
13962
13963 ###
13964 ### Subpages
13965 ###
13966 !! article
13967 Subpage test/subpage
13968 !! text
13969 foo
13970 !! endarticle
13971
13972 !! test
13973 Subpage link
13974 !! options
13975 subpage title=[[Subpage test]]
13976 !! wikitext
13977 [[/subpage]]
13978 !! html
13979 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13980 </p>
13981 !! end
13982
13983 !! test
13984 Subpage noslash link
13985 !! options
13986 subpage title=[[Subpage test]]
13987 !! wikitext
13988 [[/subpage/]]
13989 !! html
13990 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13991 </p>
13992 !! end
13993
13994 !! article
13995 Subpage test/1/2/subpage
13996 !! text
13997 blah
13998 !! endarticle
13999
14000 !! test
14001 Relative subpage noslash link
14002 !! options
14003 parsoid=wt2wt,wt2html,html2html
14004 subpage title=[[Subpage test/1/2/3/4]]
14005 !! wikitext
14006 [[../../subpage/]]
14007
14008 [[../../subpage]]
14009 !! html/php
14010 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14011 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14012 </p>
14013 !! html/parsoid
14014 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14015 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14016 !! end
14017
14018 !! test
14019 Parsoid: dot-slash prefixed wikilinks
14020 !! wikitext
14021 [[./foo]]
14022
14023 [[././bar]]
14024
14025 [[././baz/]]
14026 !! html/php
14027 <p>[[./foo]]
14028 </p><p>[[././bar]]
14029 </p><p>[[././baz/]]
14030 </p>
14031 !! html/parsoid
14032 <p>[[./foo]]
14033 </p><p>[[././bar]]
14034 </p><p>[[././baz/]]
14035 </p>
14036 !! end
14037
14038 !! test
14039 Render invalid page names as plain text (bug 51090)
14040 !! wikitext
14041 [[./../foo|bar]]
14042 [[foo�|bar]]
14043 [[foo/.|bar]]
14044 [[foo/..|bar]]
14045 [[foo~~~bar]]
14046 [[foo>bar]]
14047 [[foo[bar]]
14048 [[.]]
14049 [[..]]
14050 [[foo././bar]]
14051
14052 [[{{echo|./../foo}}|bar]]
14053 [[{{echo|foo/.}}|bar]]
14054 [[{{echo|foo/..}}|bar]]
14055 [[{{echo|foo~~~~bar}}]]
14056 [[{{echo|foo>bar}}]]
14057 [[{{echo|foo././bar}}]]
14058 [[{{echo|foo{bar}}]]
14059 [[{{echo|foo}bar}}]]
14060 [[{{echo|foo[bar}}]]
14061 [[{{echo|foo]bar}}]]
14062 [[{{echo|foo<bar}}]]
14063 !!html/php
14064 <p>[[./../foo|bar]]
14065 [[foo�|bar]]
14066 [[foo/.|bar]]
14067 [[foo/..|bar]]
14068 [[foo~~~bar]]
14069 [[foo&gt;bar]]
14070 [[foo[bar]]
14071 [[.]]
14072 [[..]]
14073 [[foo././bar]]
14074 </p><p>[[./../foo|bar]]
14075 [[foo/.|bar]]
14076 [[foo/..|bar]]
14077 [[foo~~~~bar]]
14078 [[foo&gt;bar]]
14079 [[foo././bar]]
14080 [[foo{bar]]
14081 [[foo}bar]]
14082 [[foo[bar]]
14083 [[foo]bar]]
14084 [[foo&lt;bar]]
14085 </p>
14086 !!html/parsoid
14087 <p>[[./../foo|bar]]
14088 [[foo�|bar]]
14089 [[foo/.|bar]]
14090 [[foo/..|bar]]
14091 [[foo~~~bar]]
14092 [[foo>bar]]
14093 [[foo[bar]]
14094 [[.]]
14095 [[..]]
14096 [[foo././bar]]</p>
14097
14098 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14099 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14100 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14101 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14102 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14103 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14104 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14105 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14106 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14107 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14108 [[<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>
14109 !!end
14110
14111 !! test
14112 Disabled subpages
14113 !! wikitext
14114 [[/subpage]]
14115 !! html
14116 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14117 </p>
14118 !! end
14119
14120 !! test
14121 BUG 561: {{/Subpage}}
14122 !! options
14123 subpage title=[[Page]]
14124 !! wikitext
14125 {{/Subpage}}
14126 !! html
14127 <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>
14128 </p>
14129 !! end
14130
14131 ###
14132 ### Categories
14133 ###
14134 !! article
14135 Category:MediaWiki User's Guide
14136 !! text
14137 blah
14138 !! endarticle
14139
14140 !! test
14141 Link to category
14142 !! wikitext
14143 [[:Category:MediaWiki User's Guide]]
14144 !! html
14145 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14146 </p>
14147 !! end
14148
14149 !! test
14150 Simple category
14151 !! options
14152 cat
14153 !! wikitext
14154 [[Category:MediaWiki User's Guide]]
14155 !! html
14156 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14157 !! end
14158
14159 !! test
14160 PAGESINCATEGORY invalid title fatal (r33546 fix)
14161 !! wikitext
14162 {{PAGESINCATEGORY:<bogus>}}
14163 !! html
14164 <p>0
14165 </p>
14166 !! end
14167
14168 !! test
14169 Category with different sort key
14170 !! options
14171 cat
14172 !! wikitext
14173 [[Category:MediaWiki User's Guide|Foo]]
14174 !! html
14175 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14176 !! end
14177
14178 !! test
14179 Category with identical sort key
14180 !! options
14181 cat
14182 !! wikitext
14183 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14184 !! html
14185 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14186 !! end
14187
14188 !! test
14189 Category with empty sort key
14190 !! options
14191 cat
14192 pst
14193 !! wikitext
14194 [[Category:MediaWiki User's Guide|]]
14195 !! html
14196 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14197 !! end
14198
14199 !! test
14200 Category with empty sort key and parentheses
14201 !! options
14202 cat
14203 pst
14204 !! wikitext
14205 [[Category:Foo (bar)|]]
14206 !! html
14207 [[Category:Foo (bar)|Foo]]
14208 !! end
14209
14210 !! test
14211 Category with link tail
14212 !! options
14213 cat
14214 pst
14215 !! wikitext
14216 123[[Category:Foo]]456
14217 !! html
14218 123[[Category:Foo]]456
14219 !! end
14220
14221 !! test
14222 Category with template
14223 !! options
14224 cat
14225 pst
14226 !! wikitext
14227 [[Category:{{echo|Foo}}]]
14228 !! html
14229 [[Category:{{echo|Foo}}]]
14230 !! end
14231
14232 !! test
14233 Category with template in sort key
14234 !! options
14235 cat
14236 pst
14237 !! wikitext
14238 [[Category:Foo|{{echo|Bar}}]]
14239 !! html
14240 [[Category:Foo|{{echo|Bar}}]]
14241 !! end
14242
14243 !! test
14244 Category with template in sort key and title
14245 !! options
14246 cat
14247 pst
14248 !! wikitext
14249 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14250 !! html
14251 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14252 !! end
14253
14254 !! test
14255 Category / paragraph interactions
14256 !! wikitext
14257 Foo [[Category:Baz]] Bar
14258
14259 Foo [[Category:Baz]]
14260 Bar
14261
14262 Foo
14263 [[Category:Baz]]
14264 Bar
14265
14266 Foo
14267 [[Category:Baz]] Bar
14268
14269 Foo
14270 [[Category:Baz]]
14271 [[Category:Baz]]
14272 [[Category:Baz]]
14273 Bar
14274
14275 [[Category:Baz]]
14276 [[Category:Baz]]
14277 [[Category:Baz]]
14278
14279 [[Category:Baz]]
14280 {{echo|[[Category:Baz]]}}
14281 [[Category:Baz]]
14282 !! html
14283 <p>Foo Bar
14284 </p><p>Foo
14285 Bar
14286 </p><p>Foo
14287 Bar
14288 </p><p>Foo Bar
14289 </p><p>Foo
14290 Bar
14291 </p>
14292 !! end
14293
14294 ## The whitespace on the empty line is part of the test. Please do not delete
14295 !! test
14296 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14297 !! options
14298 parsoid=wt2html,wt2wt
14299 !! wikitext
14300 This
14301
14302 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14303
14304 {{echo|[[Category:Foo]] and so should this!}}
14305 !! html
14306 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14307 </p>
14308 !! html/parsoid
14309 <p>This
14310
14311 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14312
14313 <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>
14314 !! end
14315
14316 ## Parsoid will not try to wt2wt this while preserving newlines because
14317 ## it suppresses excess newlines within list items -- and we don't want to
14318 ## introduce a special case just for categories, which is, in reality somewhat
14319 ## odd behavior -- categories are unlikely to be used in list items like this
14320 ## in top-level pages and are only likely to show up in template-generated
14321 ## list items where this RT-ing is a non-issue.
14322 ##
14323 ## The whitespace on the empty line is part of the test. Please do not delete
14324 !! test
14325 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14326 !! options
14327 parsoid=wt2html
14328 !! wikitext
14329 * This
14330
14331 [[Category:Foo]] and this should be part of the same list item
14332 * So should this
14333
14334 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14335 !! html
14336 <ul><li>This and this should be part of the same list item</li>
14337 <li>So should this and this should be part of the same list item</li></ul>
14338 !! html/parsoid
14339 <ul>
14340 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14341 <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>
14342 </ul>
14343 !! end
14344
14345 ## Newlines and categories that follow the last item of a list
14346 ## are treated differently because this (list followed by categories)
14347 ## is an extremely common pattern on wikis.
14348 !! test
14349 3. Categories and newlines: newline suppression for last list item should RT properly
14350 !! wikitext
14351 * a
14352 * b
14353
14354 [[Category:Foo]]
14355
14356 [[Category:Bar]]
14357 [[Category:Baz]]
14358 !! html/parsoid
14359 <ul><li> a</li>
14360 <li> b</li></ul>
14361
14362 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14363
14364 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14365 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14366 !! end
14367
14368 !! test
14369 4. Categories and newlines: newline suppression for last list item should RT properly
14370 !! wikitext
14371 * a
14372 **** b
14373
14374 [[Category:Foo]]
14375 !! html/parsoid
14376 <ul><li> a
14377 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14378
14379 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14380 !! end
14381
14382 ## only wt2html for this to make sure the algo only applies to the rightmost path
14383 !! test
14384 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14385 !! options
14386 parsoid=wt2html
14387 !! wikitext
14388 * a
14389 ** b
14390 [[Category:Foo]]
14391 * c
14392 ** d
14393 [[Category:Foo]]
14394 !! html/parsoid
14395 <ul><li> a
14396 <ul><li> b
14397 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14398 <li> c
14399 <ul><li> d</li></ul></li></ul>
14400 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14401 !! end
14402
14403 !! test
14404 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14405 !! wikitext
14406 * a [[Category:Foo]]
14407 !! html/parsoid
14408 <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>
14409 !! end
14410
14411 # This test also demonstrates because of newline+category tunneling
14412 # through the list hander, template wrapping doesn't expand to the
14413 # containing list when the list item swallows the category.
14414 !! test
14415 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14416 !! wikitext
14417 * {{echo|a
14418 [[Category:Foo]]}}
14419 !! html/parsoid
14420 <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">
14421 </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>
14422 !! end
14423
14424 !! test
14425 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14426 !! wikitext
14427 * a
14428
14429 {{echo|[[Category:Foo]]
14430 [[Category:Bar]]}}
14431 [[Category:Baz]]
14432 !! html/parsoid
14433 <ul><li> a</li></ul>
14434
14435 <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">
14436 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14437 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14438 !! end
14439
14440 !! test
14441 Parsoid: Serialize link to category page with colon escape
14442 !! options
14443 parsoid
14444 !! wikitext
14445
14446 [[:Category:Foo]]
14447 [[:Category:Foo|Bar]]
14448 !! html
14449 <p>
14450 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14451 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14452 </p>
14453 !! end
14454
14455 # html2wt localizes the "Category" namespace.
14456 # XXX the <link> element needs an empty data-parsoid attribute, or
14457 # else the html2html test fails because spaces are inserted.
14458 !! test
14459 Link prefix/suffixes aren't applied to category links
14460 !! options
14461 parsoid=wt2html,wt2wt,html2html
14462 language=is
14463 !! wikitext
14464 x[[Category:Foo]]y
14465 !! html/php
14466 <p>xy
14467 </p>
14468 !! html/parsoid
14469 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14470 !! end
14471
14472 !! test
14473 Parsoid: Serialize link to file page with colon escape
14474 !! options
14475 parsoid
14476 !! wikitext
14477
14478 [[:File:Foo.png]]
14479 [[:File:Foo.png|Bar]]
14480 !! html
14481 <p>
14482 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14483 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14484 </p>
14485 !! end
14486
14487 !! test
14488 Parsoid: Serialize a genuine category link without colon escape
14489 !! options
14490 parsoid
14491 !! wikitext
14492 [[Category:Foo]]
14493 [[Category:Foo|Bar]]
14494 !! html
14495 <link rel="mw:PageProp/Category" href="./Category:Foo">
14496 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14497 !! end
14498
14499 !! test
14500 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14501 !! options
14502 parsoid=html2wt
14503 !! html/parsoid
14504 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14505 !! wikitext
14506 [[Category:Toxine bactérienne]]
14507 !! end
14508
14509 !! test
14510 Parsoid: Defaultsort
14511 !! wikitext
14512 {{DEFAULTSORT:Foo}}
14513 !! html/parsoid
14514 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14515 !! end
14516
14517 !! test
14518 Parsoid: Defaultsort (template-generated)
14519 !! wikitext
14520 {{{{echo|DEFAULTSORT}}:Foo}}
14521 !! html/parsoid
14522 <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}}]}'/>
14523 !! end
14524
14525 ###
14526 ### Inter-language links
14527 ###
14528 !! test
14529 Interlanguage links
14530 !! options
14531 ill
14532 !! wikitext
14533 [[es:Alimento]]
14534 [[fr:Nourriture]]
14535 [[zh:食品]]
14536 !! html/php
14537 es:Alimento fr:Nourriture zh:食品
14538 !! html/parsoid
14539 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14540 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14541 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14542 !! end
14543
14544 !! test
14545 Duplicate interlanguage links (bug 24502)
14546 !! options
14547 ill
14548 !! wikitext
14549 [[es:1]]
14550 [[es:2]]
14551 [[fr:1]]
14552 [[fr:2]]
14553 !! html/php
14554 es:1 fr:1
14555 !! html/parsoid
14556 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14557 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14558 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14559 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14560 !! end
14561
14562 ###
14563 ### Sections
14564 ###
14565 !! test
14566 Basic section headings
14567 !! wikitext
14568 == Headline 1 ==
14569 Some text
14570
14571 ==Headline 2==
14572 More
14573 ===Smaller headline===
14574 Blah blah
14575 !! html
14576 <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>
14577 <p>Some text
14578 </p>
14579 <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>
14580 <p>More
14581 </p>
14582 <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>
14583 <p>Blah blah
14584 </p>
14585 !! end
14586
14587 !! test
14588 Section headings with TOC
14589 !! wikitext
14590 == Headline 1 ==
14591 === Subheadline 1 ===
14592 ===== Skipping a level =====
14593 ====== Skipping a level ======
14594
14595 == Headline 2 ==
14596 Some text
14597 ===Another headline===
14598 !! html
14599 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14600 <ul>
14601 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14602 <ul>
14603 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14604 <ul>
14605 <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>
14606 <ul>
14607 <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>
14608 </ul>
14609 </li>
14610 </ul>
14611 </li>
14612 </ul>
14613 </li>
14614 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14615 <ul>
14616 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14617 </ul>
14618 </li>
14619 </ul>
14620 </div>
14621
14622 <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>
14623 <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>
14624 <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>
14625 <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>
14626 <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>
14627 <p>Some text
14628 </p>
14629 <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>
14630
14631 !! end
14632
14633 !! test
14634 TOC anchors don't collide
14635 !! wikitext
14636 __FORCETOC__
14637 == Headline 2 ==
14638 == Headline ==
14639 == Headline 2 ==
14640 == Headline ==
14641 !! html/php
14642 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14643 <ul>
14644 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14645 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14646 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14647 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14648 </ul>
14649 </div>
14650
14651 <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>
14652 <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>
14653 <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>
14654 <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>
14655
14656 !! end
14657
14658 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14659 !! test
14660 Handling of sections up to level 6 and beyond
14661 !! wikitext
14662 = Level 1 Heading=
14663 == Level 2 Heading==
14664 === Level 3 Heading===
14665 ==== Level 4 Heading====
14666 ===== Level 5 Heading=====
14667 ====== Level 6 Heading======
14668 ======= Level 7 Heading=======
14669 ======== Level 8 Heading========
14670 ========= Level 9 Heading=========
14671 ========== Level 10 Heading==========
14672 !! html
14673 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14674 <ul>
14675 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14676 <ul>
14677 <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>
14678 <ul>
14679 <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>
14680 <ul>
14681 <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>
14682 <ul>
14683 <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>
14684 <ul>
14685 <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>
14686 <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>
14687 <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>
14688 <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>
14689 <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>
14690 </ul>
14691 </li>
14692 </ul>
14693 </li>
14694 </ul>
14695 </li>
14696 </ul>
14697 </li>
14698 </ul>
14699 </li>
14700 </ul>
14701 </div>
14702
14703 <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>
14704 <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>
14705 <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>
14706 <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>
14707 <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>
14708 <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>
14709 <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>
14710 <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>
14711 <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>
14712 <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>
14713
14714 !! end
14715
14716 !! test
14717 TOC regression (T11764)
14718 !! wikitext
14719 == title 1 ==
14720 === title 1.1 ===
14721 ==== title 1.1.1 ====
14722 === title 1.2 ===
14723 == title 2 ==
14724 === title 2.1 ===
14725 !! html
14726 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14727 <ul>
14728 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14729 <ul>
14730 <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>
14731 <ul>
14732 <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>
14733 </ul>
14734 </li>
14735 <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>
14736 </ul>
14737 </li>
14738 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14739 <ul>
14740 <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>
14741 </ul>
14742 </li>
14743 </ul>
14744 </div>
14745
14746 <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>
14747 <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>
14748 <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>
14749 <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>
14750 <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>
14751 <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>
14752
14753 !! end
14754
14755 !! test
14756 TOC for heading containing <span id="..."></span> (T96153)
14757 !! wikitext
14758 __FORCETOC__
14759 ==<span id="old-anchor"></span>New title==
14760 !! html/php
14761 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14762 <ul>
14763 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14764 </ul>
14765 </div>
14766
14767 <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>
14768
14769 !! end
14770
14771 !! test
14772 TOC with wgMaxTocLevel=3 (bug 6204)
14773 !! options
14774 wgMaxTocLevel=3
14775 !! wikitext
14776 == title 1 ==
14777 === title 1.1 ===
14778 ==== title 1.1.1 ====
14779 === title 1.2 ===
14780 == title 2 ==
14781 === title 2.1 ===
14782 !! html
14783 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14784 <ul>
14785 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14786 <ul>
14787 <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>
14788 <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>
14789 </ul>
14790 </li>
14791 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14792 <ul>
14793 <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>
14794 </ul>
14795 </li>
14796 </ul>
14797 </div>
14798
14799 <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>
14800 <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>
14801 <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>
14802 <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>
14803 <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>
14804 <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>
14805
14806 !! end
14807
14808 !! test
14809 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14810 !! options
14811 wgMaxTocLevel=3
14812 !! wikitext
14813 ==Section 1==
14814 ===Section 1.1===
14815 ====Section 1.1.1====
14816 ====Section 1.1.1.1====
14817 ==Section 2==
14818 !! html
14819 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14820 <ul>
14821 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14822 <ul>
14823 <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>
14824 </ul>
14825 </li>
14826 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14827 </ul>
14828 </div>
14829
14830 <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>
14831 <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>
14832 <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>
14833 <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>
14834 <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>
14835
14836 !! end
14837
14838
14839 !! test
14840 Resolving duplicate section names
14841 !! wikitext
14842 == Foo bar ==
14843 == Foo bar ==
14844 !! html
14845 <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>
14846 <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>
14847
14848 !! end
14849
14850 !! test
14851 Resolving duplicate section names with differing case (bug 10721)
14852 !! wikitext
14853 == Foo bar ==
14854 == Foo Bar ==
14855 !! html
14856 <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>
14857 <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>
14858
14859 !! end
14860
14861 !! article
14862 Template:sections
14863 !! text
14864 ===Section 1===
14865 ==Section 2==
14866 !! endarticle
14867
14868 !! test
14869 Template with sections, __NOTOC__
14870 !! wikitext
14871 __NOTOC__
14872 ==Section 0==
14873 {{sections}}
14874 ==Section 4==
14875 !! html
14876 <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>
14877 <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>
14878 <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>
14879 <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>
14880
14881 !! end
14882
14883 !! test
14884 __NOEDITSECTION__ keyword
14885 !! wikitext
14886 __NOEDITSECTION__
14887 ==Section 1==
14888 ==Section 2==
14889 !! html
14890 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14891 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14892
14893 !! end
14894
14895 !! test
14896 Link inside a section heading
14897 !! wikitext
14898 ==Section with a [[Main Page|link]] in it==
14899 !! html
14900 <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>
14901
14902 !! end
14903
14904 !! test
14905 TOC regression (T14077)
14906 !! wikitext
14907 __TOC__
14908 == title 1 ==
14909 === title 1.1 ===
14910 == title 2 ==
14911 !! html
14912 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14913 <ul>
14914 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14915 <ul>
14916 <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>
14917 </ul>
14918 </li>
14919 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14920 </ul>
14921 </div>
14922
14923 <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>
14924 <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>
14925 <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>
14926
14927 !! end
14928
14929 !! test
14930 BUG 1219 URL next to image (good)
14931 !! wikitext
14932 http://example.com [[File:Foobar.jpg]]
14933 !! html/php
14934 <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>
14935 </p>
14936 !! html/parsoid
14937 <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>
14938 !!end
14939
14940 !! test
14941 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14942 !! wikitext
14943 ===
14944 The line above must have a trailing space!
14945 === <!--
14946 --> <!-- -->
14947 But just in case it doesn't...
14948 !! html
14949 <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>
14950 <p>The line above must have a trailing space!
14951 </p>
14952 <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>
14953 <p>But just in case it doesn't...
14954 </p>
14955 !! end
14956
14957 !! test
14958 Header with special characters (bug 25462)
14959 !! wikitext
14960 The tooltips shall not show entities to the user (ie. be double escaped)
14961
14962 == text > text ==
14963 section 1
14964
14965 == text < text ==
14966 section 2
14967
14968 == text & text ==
14969 section 3
14970
14971 == text ' text ==
14972 section 4
14973
14974 == text " text ==
14975 section 5
14976 !! html
14977 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14978 </p>
14979 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14980 <ul>
14981 <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>
14982 <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>
14983 <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>
14984 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14985 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14986 </ul>
14987 </div>
14988
14989 <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>
14990 <p>section 1
14991 </p>
14992 <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>
14993 <p>section 2
14994 </p>
14995 <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>
14996 <p>section 3
14997 </p>
14998 <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>
14999 <p>section 4
15000 </p>
15001 <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>
15002 <p>section 5
15003 </p>
15004 !! end
15005
15006 !! test
15007 Header with space, plus and underscore as entity
15008 !! wikitext
15009 Id should not contain + for spaces
15010
15011 == Space between Text ==
15012 section 1
15013
15014 == Space-Entity&#32;between&#32;Text ==
15015 section 2
15016
15017 == Plus+between+Text ==
15018 section 3
15019
15020 == Plus-Entity&#43;between&#43;Text ==
15021 section 4
15022
15023 == Underscore_between_Text ==
15024 section 5
15025
15026 == Underscore-Entity&#95;between&#95;Text ==
15027 section 6
15028
15029 [[#Space between Text]]
15030 [[#Space-Entity&#32;between&#32;Text]]
15031 [[#Plus+between+Text]]
15032 [[#Plus-Entity&#43;between&#43;Text]]
15033 [[#Underscore_between_Text]]
15034 [[#Underscore-Entity&#95;between&#95;Text]]
15035 !! html
15036 <p>Id should not contain + for spaces
15037 </p>
15038 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15039 <ul>
15040 <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>
15041 <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>
15042 <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>
15043 <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>
15044 <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>
15045 <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>
15046 </ul>
15047 </div>
15048
15049 <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>
15050 <p>section 1
15051 </p>
15052 <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>
15053 <p>section 2
15054 </p>
15055 <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>
15056 <p>section 3
15057 </p>
15058 <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>
15059 <p>section 4
15060 </p>
15061 <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>
15062 <p>section 5
15063 </p>
15064 <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>
15065 <p>section 6
15066 </p><p><a href="#Space_between_Text">#Space between Text</a>
15067 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15068 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15069 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15070 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15071 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15072 </p>
15073 !! end
15074
15075 !! test
15076 Headers with excess '=' characters
15077 (Are similar tests necessary beyond the 1st level?)
15078 !! wikitext
15079 =foo==
15080 ==foo=
15081 =''italic'' heading==
15082 ==''italic'' heading=
15083 !! html
15084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15085 <ul>
15086 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15087 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15088 <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>
15089 <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>
15090 </ul>
15091 </div>
15092
15093 <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>
15094 <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>
15095 <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>
15096 <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>
15097
15098 !! end
15099
15100 !! test
15101 HTML headers vs TOC (bug 23393)
15102 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15103 !! wikitext
15104 <h1>Header 1</h1>
15105 == Header 1.1 ==
15106 == Header 1.2 ==
15107
15108 <h1>Header 2
15109 </h1>
15110 == Header 2.1 ==
15111 == Header 2.2 ==
15112 __NOEDITSECTION__
15113 !! html
15114 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15115 <ul>
15116 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15117 <ul>
15118 <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>
15119 <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>
15120 </ul>
15121 </li>
15122 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15123 <ul>
15124 <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>
15125 <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>
15126 </ul>
15127 </li>
15128 </ul>
15129 </div>
15130
15131 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15132 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15133 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15134 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15135 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15136 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15137
15138 !! end
15139
15140 !! test
15141 Single-line or multiline-comments can follow headings
15142 !! options
15143 parsoid=wt2html,wt2wt
15144 !! wikitext
15145 ==foo==<!---->
15146 ==bar==<!--c1-->
15147 ==baz==<!--
15148 c2
15149 c3-->
15150 !! html
15151 <h2><span class="mw-headline" id="foo">foo</span></h2>
15152 <h2><span class="mw-headline" id="bar">bar</span></h2>
15153 <h2><span class="mw-headline" id="baz">baz</span></h2>
15154
15155 !! end
15156
15157 !! test
15158 BUG 1219 URL next to image (broken)
15159 !! wikitext
15160 http://example.com[[File:Foobar.jpg]]
15161 !! html/php
15162 <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>
15163 </p>
15164 !! html/parsoid
15165 <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>
15166 !!end
15167
15168 !! test
15169 Bug 1186 news: in the middle of text
15170 !! wikitext
15171 http://en.wikinews.org/wiki/Wikinews:Workplace
15172 !! html
15173 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15174 </p>
15175 !!end
15176
15177
15178 !! test
15179 Namespaced link must have a title
15180 !! wikitext
15181 [[Project:]]
15182 !! html
15183 <p>[[Project:]]
15184 </p>
15185 !!end
15186
15187 !! test
15188 Namespaced link must have a title (bad fragment version)
15189 !! wikitext
15190 [[Project:#fragment]]
15191 !! html
15192 <p>[[Project:#fragment]]
15193 </p>
15194 !!end
15195
15196
15197 ###
15198 ### HTML tags and HTML attributes
15199 ###
15200
15201 !! test
15202 div with no attributes
15203 !! wikitext
15204 <div>HTML rocks</div>
15205 !! html
15206 <div>HTML rocks</div>
15207
15208 !! end
15209
15210 !! test
15211 div with double-quoted attribute
15212 !! wikitext
15213 <div id="rock">HTML rocks</div>
15214 !! html
15215 <div id="rock">HTML rocks</div>
15216
15217 !! end
15218
15219 !! test
15220 div with single-quoted attribute
15221 !! wikitext
15222 <div id='rock'>HTML rocks</div>
15223 !! html
15224 <div id="rock">HTML rocks</div>
15225
15226 !! end
15227
15228 !! test
15229 div with unquoted attribute
15230 !! wikitext
15231 <div id=rock>HTML rocks</div>
15232 !! html
15233 <div id="rock">HTML rocks</div>
15234
15235 !! end
15236
15237 !! test
15238 div with illegal double attributes
15239 !! wikitext
15240 <div id="a" id="b">HTML rocks</div>
15241 !! html
15242 <div id="b">HTML rocks</div>
15243
15244 !!end
15245
15246 # FIXME: produce empty string instead of "class" in the PHP parser, following
15247 # the HTML5 spec.
15248 !! test
15249 div with empty attribute value, space before equals
15250 !! options
15251 parsoid
15252 !! wikitext
15253 <div class =>HTML rocks</div>
15254 !! html
15255 <div class="">HTML rocks</div>
15256
15257 !! end
15258
15259 !! test
15260 div with multiple empty attribute values
15261 !! options
15262 parsoid
15263 !! wikitext
15264 <div id= title=>HTML rocks</div>
15265 !! html
15266 <div id="" title="">HTML rocks</div>
15267
15268 !! end
15269
15270 !! test
15271 table with multiple empty attribute values
15272 !! options
15273 parsoid
15274 !! wikitext
15275 {| title= id=
15276 | hi
15277 |}
15278 !! html
15279 <table title="" id="">
15280 <tbody><tr><td> hi</td></tr>
15281 </tbody></table>
15282 !! end
15283
15284 !! test
15285 div with braces in attribute value
15286 !! wikitext
15287 <div title="{}">Foo</div>
15288 !! html/php
15289 <div title="&#123;}">Foo</div>
15290
15291 !! html/parsoid
15292 <div title="{}">Foo</div>
15293 !! end
15294
15295 # This it very inconsistent in the PHP parser: it returns
15296 # class="class" if there is a space between the name and the equal sign (see
15297 # 'div with empty attribute value, space before equals'), but strips the
15298 # attribute completely if the space is missing. We hope that not much content
15299 # depends on this, so are implementing the behavior below in Parsoid for
15300 # consistencies' sake.
15301 # FIXME: fix this behavior in the PHP parser?
15302 !! test
15303 div with empty attribute value, no space before equals
15304 !! options
15305 parsoid=wt2html,html2html
15306 !! wikitext
15307 <div class=>HTML rocks</div>
15308 !! html/php
15309 <div>HTML rocks</div>
15310
15311 !! html/parsoid
15312 <div class="">HTML rocks</div>
15313 !! end
15314
15315 !! test
15316 HTML multiple attributes correction
15317 !! wikitext
15318 <p class="error" class="awesome">Awesome!</p>
15319 !! html
15320 <p class="awesome">Awesome!</p>
15321
15322 !!end
15323
15324 !! test
15325 Table multiple attributes correction
15326 !! wikitext
15327 {|
15328 !+ class="error" class="awesome"| status
15329 |}
15330 !! html
15331 <table>
15332 <tr>
15333 <th class="awesome"> status
15334 </th></tr></table>
15335
15336 !!end
15337
15338 !! test
15339 DIV IN UPPERCASE
15340 !! wikitext
15341 <DIV ID="x">HTML ROCKS</DIV>
15342 !! html
15343 <div id="x">HTML ROCKS</div>
15344
15345 !!end
15346
15347 !! test
15348 Non-ASCII pseudo-tags are rendered as text
15349 !! wikitext
15350 <khyô>
15351 !! html
15352 <p>&lt;khyô&gt;
15353 </p>
15354 !! end
15355
15356 !! test
15357 Pseudo-tag with URL 'name' renders as url link
15358 !! wikitext
15359 <http://example.com/>
15360 !! html
15361 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15362 </p>
15363 !! end
15364
15365 !! test
15366 text with amp in the middle of nowhere
15367 !! wikitext
15368 Remember AT&T?
15369 !! html
15370 <p>Remember AT&amp;T?
15371 </p>
15372 !! end
15373
15374 !! test
15375 text with character entity: eacute
15376 !! wikitext
15377 I always thought &eacute; was a cute letter.
15378 !! html
15379 <p>I always thought &#233; was a cute letter.
15380 </p>
15381 !! html+tidy
15382 <p>I always thought é was a cute letter.</p>
15383 !! end
15384
15385 !! test
15386 text with entity-escaped character entity-like string: eacute
15387 !! wikitext
15388 I always thought &amp;eacute; was a cute letter.
15389 !! html
15390 <p>I always thought &amp;eacute; was a cute letter.
15391 </p>
15392 !! end
15393
15394 !! test
15395 text with undefined character entity: xacute
15396 !! wikitext
15397 I always thought &xacute; was a cute letter.
15398 !! html
15399 <p>I always thought &amp;xacute; was a cute letter.
15400 </p>
15401 !! end
15402
15403 !! test
15404 HTML5 tags
15405 !! wikitext
15406 <data value="5">five</data>
15407 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15408 <mark>This highlighted text</mark>
15409 !! html
15410 <p><data value="5">five</data>
15411 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15412 <mark>This highlighted text</mark>
15413 </p>
15414 !! end
15415
15416 !! test
15417 HTML tag with leading space is parsed as text
15418 !! wikitext
15419 < div>foo< /div>
15420 !! html
15421 <p>&lt; div&gt;foo&lt; /div&gt;
15422 </p>
15423 !! end
15424
15425 ###
15426 ### Nesting tests (see bug 41545, 50604, 51081)
15427 ###
15428
15429 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15430 # Note that html2wt is considerably more difficult if we use <b> in
15431 # the test case, instead of <big>
15432 !! test
15433 Ensure that HTML adoption agency algorithm is properly implemented.
15434 !! wikitext
15435 <big>X<big>Y</big>Z</big>
15436 !! html
15437 <p><big>X<big>Y</big>Z</big>
15438 </p>
15439 !! end
15440
15441 # This was bug 41545 in the PHP parser.
15442 # Note that tidy doesn't handle this correctly.
15443 !! test
15444 Nesting of <kbd>
15445 !! wikitext
15446 <kbd>X<kbd>Y</kbd>Z</kbd>
15447 !! html
15448 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15449 </p>
15450 !! end
15451
15452 # The following cases were bug 51081 in the PHP parser.
15453 # Note that there are some other nestable tags (b, i, etc) which are
15454 # not covered; see bug 51081 for discussion.
15455
15456 # Note that tidy doesn't handle this correctly.
15457 !! test
15458 Nesting of <em>
15459 !! wikitext
15460 <em>X<em>Y</em>Z</em>
15461 !! html
15462 <p><em>X<em>Y</em>Z</em>
15463 </p>
15464 !! end
15465
15466 # Note that tidy doesn't handle this correctly.
15467 !! test
15468 Nesting of <strong>
15469 !! wikitext
15470 <strong>X<strong>Y</strong>Z</strong>
15471 !! html
15472 <p><strong>X<strong>Y</strong>Z</strong>
15473 </p>
15474 !! end
15475
15476 !! test
15477 Nesting of <q>
15478 !! wikitext
15479 <q>X<q>Y</q>Z</q>
15480 !! html+tidy
15481 <p><q>X<q>Y</q>Z</q></p>
15482 !! end
15483
15484 # Note that tidy doesn't handle this correctly.
15485 !! test
15486 Nesting of <ruby>
15487 !! wikitext
15488 <ruby>X<ruby>Y</ruby>Z</ruby>
15489 !! html
15490 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15491 </p>
15492 !! end
15493
15494 # Note that tidy doesn't handle this correctly.
15495 !! test
15496 Nesting of <bdo>
15497 !! wikitext
15498 <bdo>X<bdo>Y</bdo>Z</bdo>
15499 !! html
15500 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15501 </p>
15502 !! end
15503
15504
15505 ###
15506 ### Media links
15507 ###
15508
15509 !! test
15510 Media link
15511 !! wikitext
15512 [[Media:Foobar.jpg]]
15513 !! html
15514 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15515 </p>
15516 !! end
15517
15518 !! test
15519 Media link with text
15520 !! wikitext
15521 [[Media:Foobar.jpg|A neat file to look at]]
15522 !! html
15523 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15524 </p>
15525 !! end
15526
15527 # FIXME: this is still bad HTML tag nesting
15528 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15529 !! test
15530 Media link with nasty text
15531 !! wikitext
15532 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15533 !! html
15534 <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>
15535
15536 !! html+tidy
15537 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15538 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15539 !! end
15540
15541 !! test
15542 Media link to nonexistent file (bug 1702)
15543 !! wikitext
15544 [[Media:No such.jpg]]
15545 !! html
15546 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15547 </p>
15548 !! end
15549
15550 !! test
15551 Image link to nonexistent file (bug 1850 - good)
15552 !! wikitext
15553 [[File:No_such.jpg]]
15554 !! html/php
15555 <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>
15556 </p>
15557 !! html/parsoid
15558 <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>
15559 !! end
15560
15561 !! test
15562 :Image link to nonexistent file (bug 1850 - bad)
15563 !! wikitext
15564 [[:Image:No such.jpg]]
15565 !! html/php
15566 <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>
15567 </p>
15568 !! html/parsoid
15569 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15570 !! end
15571
15572
15573
15574 !! test
15575 Character reference normalization in link text (bug 1938)
15576 !! wikitext
15577 [[Main Page|this&that]]
15578 !! html
15579 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15580 </p>
15581 !!end
15582
15583 !! article
15584 אַ
15585 !! text
15586 Test for unicode normalization
15587
15588 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15589 !! endarticle
15590
15591 !! test
15592 (bug 19451) Links should refer to the normalized form.
15593 !! wikitext
15594 [[&#xFB2E;]]
15595 [[&#x5d0;&#x5b7;]]
15596 [[&#x5d0;ַ]]
15597 [[א&#x5b7;]]
15598 [[אַ]]
15599 !! html
15600 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15601 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15602 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15603 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15604 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15605 </p>
15606 !! end
15607
15608 !! test
15609 Empty attribute crash test (bug 2067)
15610 !! wikitext
15611 <font color="">foo</font>
15612 !! html
15613 <p><font color="">foo</font>
15614 </p>
15615 !! end
15616
15617 !! test
15618 Empty attribute crash test single-quotes (bug 2067)
15619 !! wikitext
15620 <font color=''>foo</font>
15621 !! html
15622 <p><font color="">foo</font>
15623 </p>
15624 !! end
15625
15626 !! test
15627 Attribute test: equals, then nothing
15628 !! wikitext
15629 <font color=>foo</font>
15630 !! html
15631 <p><font>foo</font>
15632 </p>
15633 !! end
15634
15635 !! test
15636 Attribute test: unquoted value
15637 !! wikitext
15638 <font color=x>foo</font>
15639 !! html
15640 <p><font color="x">foo</font>
15641 </p>
15642 !! end
15643
15644 !! test
15645 Attribute test: unquoted but illegal value (hash)
15646 !! wikitext
15647 <font color=#x>foo</font>
15648 !! html
15649 <p><font color="#x">foo</font>
15650 </p>
15651 !! end
15652
15653 # Parsoid does not serialize to empty attribute syntax,
15654 # so wt2wt and html2wt cases are skipped
15655 !! test
15656 Attribute test: no value (T54330)
15657 !! options
15658 parsoid=wt2html,html2html
15659 !! wikitext
15660 <font color>foo</font>
15661 !! html/php
15662 <p><font color="">foo</font>
15663 </p>
15664 !! html/parsoid
15665 <p><font color="">foo</font></p>
15666 !! end
15667
15668 !! test
15669 Bug 2095: link with three closing brackets
15670 !! wikitext
15671 [[Main Page]]]
15672 !! html/php
15673 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15674 </p>
15675 !! html/parsoid
15676 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15677 !! end
15678
15679 !! test
15680 Bug 2095: link with pipe and three closing brackets
15681 !! wikitext
15682 [[Main Page|link]]]
15683 !! html/php
15684 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15685 </p>
15686 !! html/parsoid
15687 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15688 !! end
15689
15690 !! test
15691 Bug 2095: link with pipe and three closing brackets, version 2
15692 !! wikitext
15693 [[Main Page|[http://example.com/]]]
15694 !! html/php
15695 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15696 </p>
15697 !! html/parsoid
15698 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15699 !! end
15700
15701
15702 ###
15703 ### Safety
15704 ###
15705
15706 !! article
15707 Template:Dangerous attribute
15708 !! text
15709 " onmouseover="alert(document.cookie)
15710 !! endarticle
15711
15712 !! article
15713 Template:Dangerous style attribute
15714 !! text
15715 border-size: expression(alert(document.cookie))
15716 !! endarticle
15717
15718 !! article
15719 Template:Div style
15720 !! text
15721 <div style="float: right; {{{1}}}">Magic div</div>
15722 !! endarticle
15723
15724 !! test
15725 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15726 !! wikitext
15727 <div title="{{test}}"></div>
15728 !! html
15729 <div title="This is a test template"></div>
15730
15731 !! end
15732
15733 # Parsoid has enough context to handle this case
15734 !! test
15735 Bug 2304: HTML attribute safety (dangerous template; 2309)
15736 !! wikitext
15737 <div title="{{dangerous attribute}}"></div>
15738 !! html/php
15739 <div title=""></div>
15740
15741 !! html/parsoid
15742 <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>
15743 !! end
15744
15745 !! test
15746 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15747 !! wikitext
15748 <div style="{{dangerous style attribute}}"></div>
15749 !! html
15750 <div style="/* insecure input */"></div>
15751
15752 !! end
15753
15754 !! test
15755 Bug 2304: HTML attribute safety (safe parameter; 2309)
15756 !! wikitext
15757 {{div style|width: 200px}}
15758 !! html
15759 <div style="float: right; width: 200px">Magic div</div>
15760
15761 !! end
15762
15763 !! test
15764 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15765 !! wikitext
15766 {{div style|width: expression(alert(document.cookie))}}
15767 !! html
15768 <div style="/* insecure input */">Magic div</div>
15769
15770 !! end
15771
15772 !! test
15773 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15774 !! wikitext
15775 {{div style|"><script>alert(document.cookie)</script>}}
15776 !! html
15777 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15778
15779 !! end
15780
15781 !! test
15782 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15783 !! wikitext
15784 {{div style|" ><script>alert(document.cookie)</script>}}
15785 !! html
15786 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15787
15788 !! end
15789
15790 !! test
15791 Bug 2304: HTML attribute safety (link)
15792 !! wikitext
15793 <div title="[[Main Page]]"></div>
15794 !! html
15795 <div title="&#91;&#91;Main Page]]"></div>
15796
15797 !! end
15798
15799 !! test
15800 Bug 2304: HTML attribute safety (italics)
15801 !! wikitext
15802 <div title="''foobar''"></div>
15803 !! html
15804 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15805
15806 !! end
15807
15808 !! test
15809 Bug 2304: HTML attribute safety (bold)
15810 !! wikitext
15811 <div title="'''foobar'''"></div>
15812 !! html
15813 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15814
15815 !! end
15816
15817
15818 !! test
15819 Bug 2304: HTML attribute safety (ISBN)
15820 !! wikitext
15821 <div title="ISBN 1234567890"></div>
15822 !! html
15823 <div title="&#73;SBN 1234567890"></div>
15824
15825 !! end
15826
15827 !! test
15828 Bug 2304: HTML attribute safety (RFC)
15829 !! wikitext
15830 <div title="RFC 1234"></div>
15831 !! html
15832 <div title="&#82;FC 1234"></div>
15833
15834 !! end
15835
15836 !! test
15837 Bug 2304: HTML attribute safety (PMID)
15838 !! wikitext
15839 <div title="PMID 1234567890"></div>
15840 !! html
15841 <div title="&#80;MID 1234567890"></div>
15842
15843 !! end
15844
15845 !! test
15846 Bug 2304: HTML attribute safety (web link)
15847 !! wikitext
15848 <div title="http://example.com/"></div>
15849 !! html
15850 <div title="http&#58;//example.com/"></div>
15851
15852 !! end
15853
15854 !! test
15855 Bug 2304: HTML attribute safety (named web link)
15856 !! wikitext
15857 <div title="[http://example.com/ link]"></div>
15858 !! html
15859 <div title="&#91;http&#58;//example.com/ link]"></div>
15860
15861 !! end
15862
15863 !! test
15864 Bug 3244: HTML attribute safety (extension; safe)
15865 !! wikitext
15866 <div style="<nowiki>background:blue</nowiki>"></div>
15867 !! html
15868 <div style="background:blue"></div>
15869
15870 !! end
15871
15872 !! test
15873 Bug 3244: HTML attribute safety (extension; unsafe)
15874 !! wikitext
15875 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15876 !! html
15877 <div style="/* insecure input */"></div>
15878
15879 !! end
15880
15881 # More MSIE fun discovered by Tom Gilder
15882
15883 !! test
15884 MSIE CSS safety test: spurious slash
15885 !! wikitext
15886 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15887 !! html
15888 <div style="/* insecure input */">evil</div>
15889
15890 !! end
15891
15892 !! test
15893 MSIE CSS safety test: hex code
15894 !! wikitext
15895 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15896 !! html
15897 <div style="/* insecure input */">evil</div>
15898
15899 !! end
15900
15901 !! test
15902 MSIE CSS safety test: comment in url
15903 !! wikitext
15904 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15905 !! html
15906 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15907
15908 !! end
15909
15910 !! test
15911 MSIE CSS safety test: comment in expression
15912 !! wikitext
15913 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15914 !! html
15915 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15916
15917 !! end
15918
15919 !! test
15920 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15921 !! wikitext
15922 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15923 !! html
15924 <p style="/* invalid control char */">A</p>
15925
15926 !! end
15927
15928 !! test
15929 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15930 !! wikitext
15931 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15932 <div style="top:EXPRESSION(alert())">B</div>
15933 !! html
15934 <p style="/* insecure input */">A</p>
15935 <div style="/* insecure input */">B</div>
15936
15937 !! end
15938
15939 !! test
15940 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15941 !! wikitext
15942 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15943 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15944 !! html
15945 <div style="/* insecure input */">A</div>
15946 <p style="/* insecure input */">B</p>
15947
15948 !! end
15949
15950 !! test
15951 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15952 !! wikitext
15953 <div style="background-image:url⁽javascript:alert())">A</div>
15954 <div style="background-image:url₍javascript:alert())">B</div>
15955 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15956 !! html
15957 <div style="/* insecure input */">A</div>
15958 <div style="/* insecure input */">B</div>
15959 <p style="/* insecure input */">C</p>
15960
15961 !! end
15962
15963 # FIXME: Parsoid fails to sanitize this! See T58846.
15964 !! test
15965 Opera -o-link CSS
15966 !! wikitext
15967 <div
15968 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;"
15969 style="-o-link:attr(title);-o-link-source:current">X</div>
15970 !! html
15971 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15972
15973 !! end
15974
15975 !! test
15976 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15977 !! wikitext
15978 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15979 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15980 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15981 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15982 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15983 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15984 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15985 !! html
15986 <p style="/* insecure input */">A</p>
15987 <p style="/* insecure input */">B</p>
15988 <p style="/* insecure input */">C</p>
15989 <p style="/* insecure input */">D</p>
15990 <p style="/* insecure input */">E</p>
15991 <p style="/* insecure input */">F</p>
15992 <p style="/* insecure input */">G</p>
15993
15994 !! end
15995
15996 !! test
15997 Table attribute legitimate extension
15998 !! wikitext
15999 {|
16000 !+ style="<nowiki>color:blue</nowiki>"| status
16001 |}
16002 !! html
16003 <table>
16004 <tr>
16005 <th style="color:blue"> status
16006 </th></tr></table>
16007
16008 !!end
16009
16010 !! test
16011 Table attribute safety
16012 !! wikitext
16013 {|
16014 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16015 |}
16016 !! html
16017 <table>
16018 <tr>
16019 <th style="/* insecure input */"> status
16020 </th></tr></table>
16021
16022 !! end
16023
16024 !! test
16025 CSS line continuation 1
16026 !! wikitext
16027 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16028 !! html
16029 <div style="/* insecure input */"></div>
16030
16031 !! end
16032
16033 !! test
16034 CSS line continuation 2
16035 !! wikitext
16036 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16037 !! html
16038 <div style="/* invalid control char */"></div>
16039
16040 !! end
16041
16042 !! article
16043 Template:Identity
16044 !! text
16045 {{{1}}}
16046 !! endarticle
16047
16048 !! test
16049 Expansion of multi-line templates in attribute values (bug 6255)
16050 !! wikitext
16051 <div style="background: {{identity|#00FF00}}">-</div>
16052 !! html
16053 <div style="background: #00FF00">-</div>
16054
16055 !! end
16056
16057
16058 !! test
16059 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16060 !! wikitext
16061 <div style="background:
16062 #00FF00">-</div>
16063 !! html/php
16064 <div style="background: #00FF00">-</div>
16065
16066 !! html/parsoid
16067 <div style="background:
16068 #00FF00">-</div>
16069 !! end
16070
16071 !! test
16072 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16073 !! wikitext
16074 <div style="background: &#10;#00FF00">-</div>
16075 !! html
16076 <div style="background: &#10;#00FF00">-</div>
16077
16078 !! end
16079
16080 !! test
16081 evil <math>-wiki-tags without Extension:Math enabled
16082 !! wikitext
16083 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16084 !! html+tidy
16085 <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>
16086 !! end
16087
16088 ###
16089 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16090 ###
16091 !! test
16092 Parser hook: empty input
16093 !! wikitext
16094 <tag></tag>
16095 !! html/php
16096 <pre>
16097 ''
16098 array (
16099 )
16100 </pre>
16101
16102 !! end
16103
16104 !! test
16105 Parser hook: empty input using terminated empty elements
16106 !! wikitext
16107 <tag/>
16108 !! html/php
16109 <pre>
16110 NULL
16111 array (
16112 )
16113 </pre>
16114
16115 !! end
16116
16117 !! test
16118 Parser hook: empty input using terminated empty elements (space before)
16119 !! wikitext
16120 <tag />
16121 !! html/php
16122 <pre>
16123 NULL
16124 array (
16125 )
16126 </pre>
16127
16128 !! end
16129
16130 !! test
16131 Parser hook: basic input
16132 !! wikitext
16133 <tag>input</tag>
16134 !! html/php
16135 <pre>
16136 'input'
16137 array (
16138 )
16139 </pre>
16140
16141 !! end
16142
16143
16144 !! test
16145 Parser hook: case insensitive
16146 !! wikitext
16147 <TAG>input</TAG>
16148 !! html/php
16149 <pre>
16150 'input'
16151 array (
16152 )
16153 </pre>
16154
16155 !! end
16156
16157
16158 !! test
16159 Parser hook: case insensitive, redux
16160 !! wikitext
16161 <TaG>input</TAg>
16162 !! html/php
16163 <pre>
16164 'input'
16165 array (
16166 )
16167 </pre>
16168
16169 !! end
16170
16171 !! test
16172 Parser hook: nested tags
16173 !! options
16174 noxml
16175 !! wikitext
16176 <tag><tag></tag></tag>
16177 !! html/php
16178 <pre>
16179 '<tag>'
16180 array (
16181 )
16182 </pre>&lt;/tag&gt;
16183
16184 !! end
16185
16186 !! test
16187 Parser hook: basic arguments
16188 !! wikitext
16189 <tag width=200 height = "100" depth = '50' square></tag>
16190 !! html/php
16191 <pre>
16192 ''
16193 array (
16194 'width' => '200',
16195 'height' => '100',
16196 'depth' => '50',
16197 'square' => '',
16198 )
16199 </pre>
16200
16201 !! end
16202
16203 !! test
16204 Parser hook: argument containing a forward slash (bug 5344)
16205 !! wikitext
16206 <tag filename='/tmp/bla'></tag>
16207 !! html/php
16208 <pre>
16209 ''
16210 array (
16211 'filename' => '/tmp/bla',
16212 )
16213 </pre>
16214
16215 !! end
16216
16217 !! test
16218 Parser hook: empty input using terminated empty elements (bug 2374)
16219 !! wikitext
16220 <tag foo=bar/>text
16221 !! html/php
16222 <pre>
16223 NULL
16224 array (
16225 'foo' => 'bar',
16226 )
16227 </pre>text
16228
16229 !! end
16230
16231 # </tag> should be output literally since there is no matching tag that begins it
16232 !! test
16233 Parser hook: basic arguments using terminated empty elements (bug 2374)
16234 !! wikitext
16235 <tag width=200 height = "100" depth = '50' square/>
16236 other stuff
16237 </tag>
16238 !! html/php
16239 <pre>
16240 NULL
16241 array (
16242 'width' => '200',
16243 'height' => '100',
16244 'depth' => '50',
16245 'square' => '',
16246 )
16247 </pre>
16248 <p>other stuff
16249 &lt;/tag&gt;
16250 </p>
16251 !! end
16252
16253 ###
16254 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16255 ###
16256
16257 !! test
16258 Parser hook: static parser hook not inside a comment
16259 !! wikitext
16260 <statictag>hello, world</statictag>
16261 <statictag action=flush/>
16262 !! html/php
16263 <p>hello, world
16264 </p>
16265 !! end
16266
16267
16268 !! test
16269 Parser hook: static parser hook inside a comment
16270 !! wikitext
16271 <!-- <statictag>hello, world</statictag> -->
16272 <statictag action=flush/>
16273 !! html/php
16274 <p><br />
16275 </p>
16276 !! end
16277
16278 # Nested template calls; this case was broken by Parser.php rev 1.506,
16279 # since reverted.
16280
16281 !! article
16282 Template:One-parameter
16283 !! text
16284 (My parameter is: {{{1}}})
16285 !! endarticle
16286
16287 !! article
16288 Template:Map-one-parameter
16289 !! text
16290 {{{{{1}}}|{{{2}}}}}
16291 !! endarticle
16292
16293 !! test
16294 Nested template calls
16295 !! wikitext
16296 {{Map-one-parameter|One-parameter|param}}
16297 !! html
16298 <p>(My parameter is: param)
16299 </p>
16300 !! end
16301
16302
16303 ###
16304 ### Sanitizer
16305 ###
16306
16307 # HTML+Tidy effectively strips out the empty tags completely
16308 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16309 # which Tidy would have done for the PHP parser had there been content inside it.
16310 !! test
16311 Sanitizer: Closing of open tags
16312 !! wikitext
16313 <s></s><table></table>
16314 !! html
16315 <s></s><table></table>
16316
16317 !! html/parsoid
16318 <p><s></s></p><table></table>
16319 !! end
16320
16321 !! test
16322 Sanitizer: Closing of open but not closed tags
16323 !! wikitext
16324 <s>foo
16325 !! html
16326 <p><s>foo</s>
16327 </p>
16328 !! end
16329
16330 !! test
16331 Sanitizer: Closing of closed but not open tags
16332 !! options
16333 parsoid=wt2html
16334 !! wikitext
16335 </s>
16336 !! html/php+tidy
16337 !! html/parsoid
16338 !! end
16339
16340 !! test
16341 Sanitizer: Closing of closed but not open table tags
16342 !! options
16343 parsoid=wt2html
16344 !! wikitext
16345 Table not started</td></tr></table>
16346 !! html/php+tidy
16347 <p>Table not started</p>
16348 !! html/parsoid
16349 <p>Table not started</p>
16350 !! end
16351
16352 !! test
16353 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16354 !! wikitext
16355 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16356 !! html
16357 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16358 </p>
16359 !! end
16360
16361 # In HTML5, the restrictions are that id must contain at least one character,
16362 # and must not contain any space characters.
16363 !! test
16364 Sanitizer: Validating the contents of the id attribute (bug 4515)
16365 !! options
16366 disabled
16367 !! wikitext
16368 <br id="" /><br id="a space" />
16369 !! html
16370 Something ...
16371 !! end
16372
16373 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16374 !! test
16375 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16376 !! options
16377 disabled
16378 !! wikitext
16379 <br id="foo" /><br id="foo" />
16380 !! html
16381 Something need to be done. foo-2 ?
16382 !! end
16383
16384 !! test
16385 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16386 !! wikitext
16387 <div itemscope>
16388 <meta itemprop="hello" content="world">
16389 <meta http-equiv="refresh" content="5">
16390 <meta itemprop="hello" http-equiv="refresh" content="5">
16391 <link itemprop="hello" href="{{SERVER}}">
16392 <link rel="stylesheet" href="{{SERVER}}">
16393 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16394 </div>
16395 !! html
16396 <div itemscope="">
16397 <p> <meta itemprop="hello" content="world" />
16398 &lt;meta http-equiv="refresh" content="5"&gt;
16399 <meta itemprop="hello" content="5" />
16400 </p>
16401 <link itemprop="hello" href="http&#58;//example.org" />
16402 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16403 <link itemprop="hello" href="http&#58;//example.org" />
16404 </div>
16405
16406 !! end
16407
16408 !! test
16409 Language converter: output gets cut off unexpectedly (bug 5757)
16410 !! options
16411 language=zh
16412 !! wikitext
16413 this bit is safe: }-
16414
16415 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16416
16417 then we get cut off here: }-
16418
16419 all additional text is vanished
16420 !! html
16421 <p>this bit is safe: }-
16422 </p><p>but if we add a conversion instance: xxx
16423 </p><p>then we get cut off here: }-
16424 </p><p>all additional text is vanished
16425 </p>
16426 !! end
16427
16428 !! test
16429 Self closed html pairs (bug 5487)
16430 !! options
16431 !! wikitext
16432 <center><font id="bug" />Centered text</center>
16433 <div><font id="bug2" />In div text</div>
16434 !! html
16435 <center>&lt;font id="bug" /&gt;Centered text</center>
16436 <div>&lt;font id="bug2" /&gt;In div text</div>
16437
16438 !! end
16439
16440 #
16441 #
16442 #
16443
16444 !! test
16445 Punctuation: nbsp before exclamation
16446 !! wikitext
16447 C'est grave !
16448 !! html
16449 <p>C'est grave&#160;!
16450 </p>
16451 !! end
16452
16453 !! test
16454 Punctuation: CSS !important (bug 11874)
16455 !! wikitext
16456 <div style="width:50% !important">important</div>
16457 !! html
16458 <div style="width:50% !important">important</div>
16459
16460 !!end
16461
16462 !! test
16463 Punctuation: CSS ! important (bug 11874; with space after)
16464 !! wikitext
16465 <div style="width:50% ! important">important</div>
16466 !! html
16467 <div style="width:50% ! important">important</div>
16468
16469 !!end
16470
16471 !! test
16472 HTML bullet list, closed tags (bug 5497)
16473 !! wikitext
16474 <ul>
16475 <li>One</li>
16476 <li>Two</li>
16477 </ul>
16478 !! html/php
16479 <ul>
16480 <li>One</li>
16481 <li>Two</li>
16482 </ul>
16483
16484 !! html/parsoid
16485 <ul data-parsoid='{"stx":"html"}'>
16486 <li data-parsoid='{"stx":"html"}'>One</li>
16487 <li data-parsoid='{"stx":"html"}'>Two</li>
16488 </ul>
16489
16490 !! end
16491
16492 !! test
16493 HTML bullet list, unclosed tags (bug 5497)
16494 !! wikitext
16495 <ul>
16496 <li>One
16497 <li>Two
16498 </ul>
16499 !! html/php+tidy
16500 <ul>
16501 <li>One</li>
16502 <li>Two</li>
16503 </ul>
16504 !! html/parsoid
16505 <ul data-parsoid='{"stx":"html"}'>
16506 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16507 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16508 </ul>
16509
16510 !! end
16511
16512 !! test
16513 HTML ordered list, closed tags (bug 5497)
16514 !! wikitext
16515 <ol>
16516 <li>One</li>
16517 <li>Two</li>
16518 </ol>
16519 !! html/php
16520 <ol>
16521 <li>One</li>
16522 <li>Two</li>
16523 </ol>
16524
16525 !! html/parsoid
16526 <ol data-parsoid='{"stx":"html"}'>
16527 <li data-parsoid='{"stx":"html"}'>One</li>
16528 <li data-parsoid='{"stx":"html"}'>Two</li>
16529 </ol>
16530
16531 !! end
16532
16533 !! test
16534 HTML ordered list, unclosed tags (bug 5497)
16535 !! options
16536 !! wikitext
16537 <ol>
16538 <li>One
16539 <li>Two
16540 </ol>
16541 !! html/php+tidy
16542 <ol>
16543 <li>One</li>
16544 <li>Two</li>
16545 </ol>
16546 !! html/parsoid
16547 <ol data-parsoid='{"stx":"html"}'>
16548 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16549 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16550 </ol>
16551
16552 !! end
16553
16554 !! test
16555 HTML nested bullet list, closed tags (bug 5497)
16556 !! wikitext
16557 <ul>
16558 <li>One</li>
16559 <li>Two:
16560 <ul>
16561 <li>Sub-one</li>
16562 <li>Sub-two</li>
16563 </ul>
16564 </li>
16565 </ul>
16566 !! html
16567 <ul>
16568 <li>One</li>
16569 <li>Two:
16570 <ul>
16571 <li>Sub-one</li>
16572 <li>Sub-two</li>
16573 </ul>
16574 </li>
16575 </ul>
16576
16577 !! end
16578
16579 !! test
16580 HTML nested bullet list, open tags (bug 5497)
16581 !! wikitext
16582 <ul>
16583 <li>One
16584 <li>Two:
16585 <ul>
16586 <li>Sub-one
16587 <li>Sub-two
16588 </ul>
16589 </ul>
16590 !! html/php+tidy
16591 <ul>
16592 <li>One</li>
16593 <li>Two:
16594 <ul>
16595 <li>Sub-one</li>
16596 <li>Sub-two</li>
16597 </ul>
16598 </li>
16599 </ul>
16600 !! html/parsoid
16601 <ul>
16602 <li>One
16603 </li>
16604 <li>Two:
16605 <ul>
16606 <li>Sub-one
16607 </li>
16608 <li>Sub-two
16609 </li>
16610 </ul>
16611 </li>
16612 </ul>
16613
16614 !! end
16615
16616 !! test
16617 HTML nested ordered list, closed tags (bug 5497)
16618 !! wikitext
16619 <ol>
16620 <li>One</li>
16621 <li>Two:
16622 <ol>
16623 <li>Sub-one</li>
16624 <li>Sub-two</li>
16625 </ol>
16626 </li>
16627 </ol>
16628 !! html
16629 <ol>
16630 <li>One</li>
16631 <li>Two:
16632 <ol>
16633 <li>Sub-one</li>
16634 <li>Sub-two</li>
16635 </ol>
16636 </li>
16637 </ol>
16638
16639 !! end
16640
16641 !! test
16642 HTML nested ordered list, open tags (bug 5497)
16643 !! wikitext
16644 <ol>
16645 <li>One
16646 <li>Two:
16647 <ol>
16648 <li>Sub-one
16649 <li>Sub-two
16650 </ol>
16651 </ol>
16652 !! html/php
16653 <ol>
16654 <li>One
16655 <li>Two:
16656 <ol>
16657 <li>Sub-one
16658 <li>Sub-two
16659 </ol>
16660 </ol>
16661
16662 !! html/parsoid
16663 <ol>
16664 <li>One
16665 </li>
16666 <li>Two:
16667 <ol>
16668 <li>Sub-one
16669 </li>
16670 <li>Sub-two
16671 </li>
16672 </ol>
16673 </li>
16674 </ol>
16675
16676 !! end
16677
16678 !! test
16679 HTML ordered list item with parameters oddity
16680 !! wikitext
16681 <ol><li id="fragment">One</li>
16682 </ol>
16683 !! html
16684 <ol><li id="fragment">One</li>
16685 </ol>
16686
16687 !! end
16688
16689 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16690 !!test
16691 bug 5918: autonumbering
16692 !! wikitext
16693 [http://first/] [http://second] [ftp://ftp]
16694
16695 ftp://inlineftp
16696
16697 [mailto:enclosed@mail.tld With target]
16698
16699 [mailto:enclosed@mail.tld]
16700
16701 mailto:inline@mail.tld
16702 !! html/php
16703 <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>
16704 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16705 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16706 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16707 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16708 </p>
16709 !! html/parsoid
16710 <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>
16711 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16712 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16713 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16714 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16715 !! end
16716
16717
16718 #
16719 # Security and HTML correctness
16720 # From Nick Jenkins' fuzz testing
16721 #
16722
16723 !! test
16724 Fuzz testing: Parser13
16725 !! wikitext
16726 {|
16727 | http://a|
16728 !! html
16729 <table>
16730 <tr>
16731 <td>
16732 </td>
16733 </tr>
16734 </table>
16735
16736 !! end
16737
16738 !! test
16739 Fuzz testing: Parser14
16740 !! wikitext
16741 == onmouseover= ==
16742 http://__TOC__
16743 !! html
16744 <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>
16745 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16746 <ul>
16747 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16748 </ul>
16749 </div>
16750
16751
16752 !! html+tidy
16753 <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>
16754 <p>http://</p>
16755 <div id="toc" class="toc">
16756 <div id="toctitle">
16757 <h2>Contents</h2>
16758 </div>
16759 <ul>
16760 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16761 </ul>
16762 </div>
16763 <p></p>
16764 !! end
16765
16766 !! test
16767 Fuzz testing: Parser14-table
16768 !! wikitext
16769 ==a==
16770 {| STYLE=__TOC__
16771 !! html
16772 <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>
16773 <table style="&#95;_TOC&#95;_">
16774 <tr><td></td></tr>
16775 </table>
16776
16777 !! html+tidy
16778 <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>
16779 <table style="__TOC__">
16780 <tr>
16781 <td></td>
16782 </tr>
16783 </table>
16784 !! end
16785
16786 # Known to produce bogus xml (extra </td>)
16787 !! test
16788 Fuzz testing: Parser16
16789 !! options
16790 noxml
16791 !! wikitext
16792 {|
16793 !https://||||||
16794 !! html
16795 <table>
16796 <tr>
16797 <th>https://</th>
16798 <th></th>
16799 <th></th>
16800 <th>
16801 </td>
16802 </tr>
16803 </table>
16804
16805 !! html+tidy
16806 <table>
16807 <tr>
16808 <th>https://</th>
16809 <th></th>
16810 <th></th>
16811 <th></th>
16812 </tr>
16813 </table>
16814 !! end
16815
16816 !! test
16817 Fuzz testing: Parser21
16818 !! wikitext
16819 {|
16820 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16821 |
16822 !! html
16823 <table>
16824 <tr>
16825 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16826 </th>
16827 <td>
16828 </td>
16829 </tr>
16830 </table>
16831
16832 !! end
16833
16834 !! test
16835 Fuzz testing: Parser22
16836 !! wikitext
16837 http://===r:::https://b
16838
16839 {|
16840 !! html
16841 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16842 </p>
16843 <table>
16844 <tr><td></td></tr>
16845 </table>
16846
16847 !! end
16848
16849 # Known to produce bad XML for now
16850 !! test
16851 Fuzz testing: Parser24
16852 !! options
16853 noxml
16854 !! wikitext
16855 {|
16856 {{{|
16857 <u CLASS=
16858 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16859 <br style="onmouseover='alert(document.cookie);' " />
16860
16861 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16862 |
16863 !! html
16864 <table>
16865 {{{|
16866 <u class="&#124;">}}}} &gt;
16867 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16868
16869 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16870 <tr>
16871 <td></u>
16872 </td>
16873 </tr>
16874 </table>
16875
16876 !! end
16877
16878 # Note: the current result listed for this is not what the original one was,
16879 # but the original bug was JavaScript injection, which is fixed in any case.
16880 # It's not clear that the original result listed was any more correct than the
16881 # current one. Original result:
16882 # <p>{{{|
16883 # </p>
16884 # <li class="&#124;&#124;">
16885 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16886 !!test
16887 Fuzz testing: Parser25 (bug 6055)
16888 !! wikitext
16889 {{{
16890 |
16891 <LI CLASS=||
16892 >
16893 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16894 !! html
16895 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16896 </p>
16897 !! end
16898
16899 !!test
16900 Fuzz testing: URL adjacent extension (with space, clean)
16901 !! wikitext
16902 http://example.com <nowiki>junk</nowiki>
16903 !! html/php
16904 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16905 </p>
16906 !! html/parsoid
16907 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16908 !! end
16909
16910 !!test
16911 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16912 !! wikitext
16913 http://example.com<nowiki>junk</nowiki>
16914 !! html/php
16915 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16916 </p>
16917 !! html/parsoid
16918 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16919 !! end
16920
16921 !!test
16922 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16923 !! wikitext
16924 http://example.com<pre>junk</pre>
16925 !! html/php
16926 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16927
16928 !! html/php+tidy
16929 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16930 <pre>
16931 junk
16932 </pre>
16933 !! html/parsoid
16934 <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>
16935 !!end
16936
16937 !!test
16938 Fuzz testing: image with bogus manual thumbnail
16939 !! wikitext
16940 [[Image:foobar.jpg|thumbnail= ]]
16941 !! html/php
16942 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16943
16944 !! html/parsoid
16945 <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>
16946 !!end
16947
16948 !! test
16949 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16950 !! wikitext
16951 <pre dir="&#10;"></pre>
16952 !! html
16953 <pre dir="&#10;"></pre>
16954
16955 !! end
16956
16957 !! test
16958 Parsing optional HTML elements (Bug 6171)
16959 !! options
16960 !! wikitext
16961 <table>
16962 <tr>
16963 <td> Some tabular data</td>
16964 <td> More tabular data ...
16965 <td> And yet som tabular data</td>
16966 </tr>
16967 </table>
16968 !! html
16969 <table>
16970 <tr>
16971 <td> Some tabular data</td>
16972 <td> More tabular data ...
16973 </td><td> And yet som tabular data</td>
16974 </tr>
16975 </table>
16976
16977 !! end
16978
16979 !! test
16980 Correct handling of <td>, <tr> (Bug 6171)
16981 !! options
16982 !! wikitext
16983 <table>
16984 <tr>
16985 <td> Some tabular data</td>
16986 <td> More tabular data ...</td>
16987 <td> And yet som tabular data</td>
16988 </tr>
16989 </table>
16990 !! html
16991 <table>
16992 <tr>
16993 <td> Some tabular data</td>
16994 <td> More tabular data ...</td>
16995 <td> And yet som tabular data</td>
16996 </tr>
16997 </table>
16998
16999 !! end
17000
17001
17002 !! test
17003 Parsing crashing regression (fr:JavaScript)
17004 !! wikitext
17005 </body></x>
17006 !! html
17007 <p>&lt;/body&gt;&lt;/x&gt;
17008 </p>
17009 !! end
17010
17011 !! test
17012 Inline wiki vs wiki block nesting
17013 !! wikitext
17014 '''Bold paragraph
17015
17016 New wiki paragraph
17017 !! html
17018 <p><b>Bold paragraph</b>
17019 </p><p>New wiki paragraph
17020 </p>
17021 !! end
17022
17023 # FIXME: The current php output is documented
17024 # and desired output is the parsoid target.
17025 !! test
17026 Inline HTML vs wiki block nesting
17027 !! wikitext
17028 <b>Bold paragraph
17029
17030 New wiki paragraph
17031 !! html/php
17032 <p><b>Bold paragraph
17033 </p><p>New wiki paragraph</b>
17034 </p>
17035 !! html/parsoid
17036 <p><b>Bold paragraph</b>
17037 </p><p>New wiki paragraph
17038 </p>
17039 !! end
17040
17041 # Original result was this:
17042 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17043 # </p>
17044 # While that might be marginally more intuitive, maybe, the six-apostrophe
17045 # construct is clearly pathological and the result stated here (which is what
17046 # the parser actually does) is about as reasonable as anything.
17047 !!test
17048 Mixing markup for italics and bold
17049 !! options
17050 !! wikitext
17051 '''bold''''''bold''bolditalics'''''
17052 !! html
17053 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17054 </p>
17055 !! end
17056
17057
17058 !! article
17059 Xyzzyx
17060 !! text
17061 Article for special page transclusion test
17062 !! endarticle
17063
17064 !! test
17065 Special page transclusion
17066 !! options
17067 !! wikitext
17068 {{Special:Prefixindex/Xyzzyx}}
17069 !! html
17070 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17071
17072 !! end
17073
17074 !! test
17075 Special page transclusion twice (bug 5021)
17076 !! options
17077 !! wikitext
17078 {{Special:Prefixindex/Xyzzyx}}
17079 {{Special:Prefixindex/Xyzzyx}}
17080 !! html
17081 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17082 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17083
17084 !! end
17085
17086 !! test
17087 Transclusion of default MediaWiki message
17088 !! wikitext
17089 {{MediaWiki:Mainpage}}
17090 !! html
17091 <p>Main Page
17092 </p>
17093 !! end
17094
17095 !! test
17096 Transclusion of nonexistent MediaWiki message
17097 !! wikitext
17098 {{MediaWiki:Mainpagexxx}}
17099 !! html
17100 <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>
17101 </p>
17102 !! end
17103
17104 !! test
17105 Transclusion of MediaWiki message with underscore
17106 !! wikitext
17107 {{MediaWiki:history_short}}
17108 !! html
17109 <p>History
17110 </p>
17111 !! end
17112
17113 !! test
17114 Transclusion of MediaWiki message with space
17115 !! wikitext
17116 {{MediaWiki:history short}}
17117 !! html
17118 <p>History
17119 </p>
17120 !! end
17121
17122 !! test
17123 Invalid header with following text
17124 !! wikitext
17125 = x = y
17126 !! html
17127 <p>= x = y
17128 </p>
17129 !! end
17130
17131
17132 !! test
17133 Section extraction test (section 0)
17134 !! options
17135 section=0
17136 !! wikitext
17137 start
17138 ==a==
17139 ===aa===
17140 ====aaa====
17141 ==b==
17142 ===ba===
17143 ===bb===
17144 ====bba====
17145 ===bc===
17146 ==c==
17147 ===ca===
17148 !! html/php
17149 start
17150 !! end
17151
17152 !! test
17153 Section extraction test (section 1)
17154 !! options
17155 section=1
17156 !! wikitext
17157 start
17158 ==a==
17159 ===aa===
17160 ====aaa====
17161 ==b==
17162 ===ba===
17163 ===bb===
17164 ====bba====
17165 ===bc===
17166 ==c==
17167 ===ca===
17168 !! html/php
17169 ==a==
17170 ===aa===
17171 ====aaa====
17172 !! end
17173
17174 !! test
17175 Section extraction test (section 2)
17176 !! options
17177 section=2
17178 !! wikitext
17179 start
17180 ==a==
17181 ===aa===
17182 ====aaa====
17183 ==b==
17184 ===ba===
17185 ===bb===
17186 ====bba====
17187 ===bc===
17188 ==c==
17189 ===ca===
17190 !! html/php
17191 ===aa===
17192 ====aaa====
17193 !! end
17194
17195 !! test
17196 Section extraction test (section 3)
17197 !! options
17198 section=3
17199 !! wikitext
17200 start
17201 ==a==
17202 ===aa===
17203 ====aaa====
17204 ==b==
17205 ===ba===
17206 ===bb===
17207 ====bba====
17208 ===bc===
17209 ==c==
17210 ===ca===
17211 !! html/php
17212 ====aaa====
17213 !! end
17214
17215 !! test
17216 Section extraction test (section 4)
17217 !! options
17218 section=4
17219 !! wikitext
17220 start
17221 ==a==
17222 ===aa===
17223 ====aaa====
17224 ==b==
17225 ===ba===
17226 ===bb===
17227 ====bba====
17228 ===bc===
17229 ==c==
17230 ===ca===
17231 !! html/php
17232 ==b==
17233 ===ba===
17234 ===bb===
17235 ====bba====
17236 ===bc===
17237 !! end
17238
17239 !! test
17240 Section extraction test (section 5)
17241 !! options
17242 section=5
17243 !! wikitext
17244 start
17245 ==a==
17246 ===aa===
17247 ====aaa====
17248 ==b==
17249 ===ba===
17250 ===bb===
17251 ====bba====
17252 ===bc===
17253 ==c==
17254 ===ca===
17255 !! html/php
17256 ===ba===
17257 !! end
17258
17259 !! test
17260 Section extraction test (section 6)
17261 !! options
17262 section=6
17263 !! wikitext
17264 start
17265 ==a==
17266 ===aa===
17267 ====aaa====
17268 ==b==
17269 ===ba===
17270 ===bb===
17271 ====bba====
17272 ===bc===
17273 ==c==
17274 ===ca===
17275 !! html/php
17276 ===bb===
17277 ====bba====
17278 !! end
17279
17280 !! test
17281 Section extraction test (section 7)
17282 !! options
17283 section=7
17284 !! wikitext
17285 start
17286 ==a==
17287 ===aa===
17288 ====aaa====
17289 ==b==
17290 ===ba===
17291 ===bb===
17292 ====bba====
17293 ===bc===
17294 ==c==
17295 ===ca===
17296 !! html/php
17297 ====bba====
17298 !! end
17299
17300 !! test
17301 Section extraction test (section 8)
17302 !! options
17303 section=8
17304 !! wikitext
17305 start
17306 ==a==
17307 ===aa===
17308 ====aaa====
17309 ==b==
17310 ===ba===
17311 ===bb===
17312 ====bba====
17313 ===bc===
17314 ==c==
17315 ===ca===
17316 !! html/php
17317 ===bc===
17318 !! end
17319
17320 !! test
17321 Section extraction test (section 9)
17322 !! options
17323 section=9
17324 !! wikitext
17325 start
17326 ==a==
17327 ===aa===
17328 ====aaa====
17329 ==b==
17330 ===ba===
17331 ===bb===
17332 ====bba====
17333 ===bc===
17334 ==c==
17335 ===ca===
17336 !! html/php
17337 ==c==
17338 ===ca===
17339 !! end
17340
17341 !! test
17342 Section extraction test (section 10)
17343 !! options
17344 section=10
17345 !! wikitext
17346 start
17347 ==a==
17348 ===aa===
17349 ====aaa====
17350 ==b==
17351 ===ba===
17352 ===bb===
17353 ====bba====
17354 ===bc===
17355 ==c==
17356 ===ca===
17357 !! html/php
17358 ===ca===
17359 !! end
17360
17361 !! test
17362 Section extraction test (nonexistent section 11)
17363 !! options
17364 section=11
17365 !! wikitext
17366 start
17367 ==a==
17368 ===aa===
17369 ====aaa====
17370 ==b==
17371 ===ba===
17372 ===bb===
17373 ====bba====
17374 ===bc===
17375 ==c==
17376 ===ca===
17377 !! html/php
17378 !! end
17379
17380 !! test
17381 Section extraction test with bogus heading (section 1)
17382 !! options
17383 section=1
17384 !! wikitext
17385 ==a==
17386 ==bogus== not a legal section
17387 ==b==
17388 !! html/php
17389 ==a==
17390 ==bogus== not a legal section
17391 !! end
17392
17393 !! test
17394 Section extraction test with bogus heading (section 2)
17395 !! options
17396 section=2
17397 !! wikitext
17398 ==a==
17399 ==bogus== not a legal section
17400 ==b==
17401 !! html/php
17402 ==b==
17403 !! end
17404
17405 !! test
17406 Section extraction test with comment after heading (section 1)
17407 !! options
17408 section=1
17409 !! wikitext
17410 ==a==
17411 ==b== <!-- -->
17412 ==c==
17413 !! html/php
17414 ==a==
17415 !! end
17416
17417 !! test
17418 Section extraction test with comment after heading (section 2)
17419 !! options
17420 section=2
17421 !! wikitext
17422 ==a==
17423 ==b== <!-- -->
17424 ==c==
17425 !! html/php
17426 ==b== <!-- -->
17427 !! end
17428
17429 !! test
17430 Section extraction test with bogus <nowiki> heading (section 1)
17431 !! options
17432 section=1
17433 !! wikitext
17434 ==a==
17435 ==bogus== <nowiki>not a legal section</nowiki>
17436 ==b==
17437 !! html/php
17438 ==a==
17439 ==bogus== <nowiki>not a legal section</nowiki>
17440 !! end
17441
17442 !! test
17443 Section extraction test with bogus <nowiki> heading (section 2)
17444 !! options
17445 section=2
17446 !! wikitext
17447 ==a==
17448 ==bogus== <nowiki>not a legal section</nowiki>
17449 ==b==
17450 !! html/php
17451 ==b==
17452 !! end
17453
17454 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17455 # instead of respecting commented sections
17456 !! test
17457 Section extraction prefixed by comment (section 1)
17458 !! options
17459 section=1
17460 !! wikitext
17461 <!-- -->==sec1==
17462 ==sec2==
17463 !! html/php
17464 ==sec2==
17465 !!end
17466
17467 !! test
17468 Section extraction prefixed by comment (section 2)
17469 !! options
17470 section=2
17471 !! wikitext
17472 <!-- -->==sec1==
17473 ==sec2==
17474 !! html/php
17475
17476 !!end
17477
17478 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17479 # instead of respecting HTML-style headings
17480 !! test
17481 Section extraction, mixed wiki and html (section 1)
17482 !! options
17483 section=1
17484 !! wikitext
17485 <h2>unmarked</h2>
17486 unmarked
17487 ==1==
17488 one
17489 ==2==
17490 two
17491 !! html/php
17492 ==1==
17493 one
17494 !! end
17495
17496 !! test
17497 Section extraction, mixed wiki and html (section 2)
17498 !! options
17499 section=2
17500 !! wikitext
17501 <h2>unmarked</h2>
17502 unmarked
17503 ==1==
17504 one
17505 ==2==
17506 two
17507 !! html/php
17508 ==2==
17509 two
17510 !! end
17511
17512
17513 # Formerly testing for bug 3342
17514 !! test
17515 Section extraction, heading surrounded by <noinclude>
17516 !! options
17517 section=1
17518 !! wikitext
17519 <noinclude>==unmarked==</noinclude>
17520 ==marked==
17521 !! html/php
17522 ==marked==
17523 !!end
17524
17525 # Test behavior of bug 19910
17526 !! test
17527 Sectiion with all-equals
17528 !! options
17529 section=2
17530 !! wikitext
17531 ===
17532 The line above must have a trailing space
17533 === <!--
17534 --> <!-- -->
17535 But just in case it doesn't...
17536 !! html/php
17537 === <!--
17538 --> <!-- -->
17539 But just in case it doesn't...
17540 !! end
17541
17542 !! test
17543 Section replacement test (section 0)
17544 !! options
17545 replace=0,"xxx"
17546 !! wikitext
17547 start
17548 ==a==
17549 ===aa===
17550 ====aaa====
17551 ==b==
17552 ===ba===
17553 ===bb===
17554 ====bba====
17555 ===bc===
17556 ==c==
17557 ===ca===
17558 !! html/php
17559 xxx
17560
17561 ==a==
17562 ===aa===
17563 ====aaa====
17564 ==b==
17565 ===ba===
17566 ===bb===
17567 ====bba====
17568 ===bc===
17569 ==c==
17570 ===ca===
17571 !! end
17572
17573 !! test
17574 Section replacement test (section 1)
17575 !! options
17576 replace=1,"xxx"
17577 !! wikitext
17578 start
17579 ==a==
17580 ===aa===
17581 ====aaa====
17582 ==b==
17583 ===ba===
17584 ===bb===
17585 ====bba====
17586 ===bc===
17587 ==c==
17588 ===ca===
17589 !! html/php
17590 start
17591 xxx
17592
17593 ==b==
17594 ===ba===
17595 ===bb===
17596 ====bba====
17597 ===bc===
17598 ==c==
17599 ===ca===
17600 !! end
17601
17602 !! test
17603 Section replacement test (section 2)
17604 !! options
17605 replace=2,"xxx"
17606 !! wikitext
17607 start
17608 ==a==
17609 ===aa===
17610 ====aaa====
17611 ==b==
17612 ===ba===
17613 ===bb===
17614 ====bba====
17615 ===bc===
17616 ==c==
17617 ===ca===
17618 !! html/php
17619 start
17620 ==a==
17621 xxx
17622
17623 ==b==
17624 ===ba===
17625 ===bb===
17626 ====bba====
17627 ===bc===
17628 ==c==
17629 ===ca===
17630 !! end
17631
17632 !! test
17633 Section replacement test (section 3)
17634 !! options
17635 replace=3,"xxx"
17636 !! wikitext
17637 start
17638 ==a==
17639 ===aa===
17640 ====aaa====
17641 ==b==
17642 ===ba===
17643 ===bb===
17644 ====bba====
17645 ===bc===
17646 ==c==
17647 ===ca===
17648 !! html/php
17649 start
17650 ==a==
17651 ===aa===
17652 xxx
17653
17654 ==b==
17655 ===ba===
17656 ===bb===
17657 ====bba====
17658 ===bc===
17659 ==c==
17660 ===ca===
17661 !! end
17662
17663 !! test
17664 Section replacement test (section 4)
17665 !! options
17666 replace=4,"xxx"
17667 !! wikitext
17668 start
17669 ==a==
17670 ===aa===
17671 ====aaa====
17672 ==b==
17673 ===ba===
17674 ===bb===
17675 ====bba====
17676 ===bc===
17677 ==c==
17678 ===ca===
17679 !! html/php
17680 start
17681 ==a==
17682 ===aa===
17683 ====aaa====
17684 xxx
17685
17686 ==c==
17687 ===ca===
17688 !! end
17689
17690 !! test
17691 Section replacement test (section 5)
17692 !! options
17693 replace=5,"xxx"
17694 !! wikitext
17695 start
17696 ==a==
17697 ===aa===
17698 ====aaa====
17699 ==b==
17700 ===ba===
17701 ===bb===
17702 ====bba====
17703 ===bc===
17704 ==c==
17705 ===ca===
17706 !! html/php
17707 start
17708 ==a==
17709 ===aa===
17710 ====aaa====
17711 ==b==
17712 xxx
17713
17714 ===bb===
17715 ====bba====
17716 ===bc===
17717 ==c==
17718 ===ca===
17719 !! end
17720
17721 !! test
17722 Section replacement test (section 6)
17723 !! options
17724 replace=6,"xxx"
17725 !! wikitext
17726 start
17727 ==a==
17728 ===aa===
17729 ====aaa====
17730 ==b==
17731 ===ba===
17732 ===bb===
17733 ====bba====
17734 ===bc===
17735 ==c==
17736 ===ca===
17737 !! html/php
17738 start
17739 ==a==
17740 ===aa===
17741 ====aaa====
17742 ==b==
17743 ===ba===
17744 xxx
17745
17746 ===bc===
17747 ==c==
17748 ===ca===
17749 !! end
17750
17751 !! test
17752 Section replacement test (section 7)
17753 !! options
17754 replace=7,"xxx"
17755 !! wikitext
17756 start
17757 ==a==
17758 ===aa===
17759 ====aaa====
17760 ==b==
17761 ===ba===
17762 ===bb===
17763 ====bba====
17764 ===bc===
17765 ==c==
17766 ===ca===
17767 !! html/php
17768 start
17769 ==a==
17770 ===aa===
17771 ====aaa====
17772 ==b==
17773 ===ba===
17774 ===bb===
17775 xxx
17776
17777 ===bc===
17778 ==c==
17779 ===ca===
17780 !! end
17781
17782 !! test
17783 Section replacement test (section 8)
17784 !! options
17785 replace=8,"xxx"
17786 !! wikitext
17787 start
17788 ==a==
17789 ===aa===
17790 ====aaa====
17791 ==b==
17792 ===ba===
17793 ===bb===
17794 ====bba====
17795 ===bc===
17796 ==c==
17797 ===ca===
17798 !! html/php
17799 start
17800 ==a==
17801 ===aa===
17802 ====aaa====
17803 ==b==
17804 ===ba===
17805 ===bb===
17806 ====bba====
17807 xxx
17808
17809 ==c==
17810 ===ca===
17811 !!end
17812
17813 !! test
17814 Section replacement test (section 9)
17815 !! options
17816 replace=9,"xxx"
17817 !! wikitext
17818 start
17819 ==a==
17820 ===aa===
17821 ====aaa====
17822 ==b==
17823 ===ba===
17824 ===bb===
17825 ====bba====
17826 ===bc===
17827 ==c==
17828 ===ca===
17829 !! html/php
17830 start
17831 ==a==
17832 ===aa===
17833 ====aaa====
17834 ==b==
17835 ===ba===
17836 ===bb===
17837 ====bba====
17838 ===bc===
17839 xxx
17840 !! end
17841
17842 !! test
17843 Section replacement test (section 10)
17844 !! options
17845 replace=10,"xxx"
17846 !! wikitext
17847 start
17848 ==a==
17849 ===aa===
17850 ====aaa====
17851 ==b==
17852 ===ba===
17853 ===bb===
17854 ====bba====
17855 ===bc===
17856 ==c==
17857 ===ca===
17858 !! html/php
17859 start
17860 ==a==
17861 ===aa===
17862 ====aaa====
17863 ==b==
17864 ===ba===
17865 ===bb===
17866 ====bba====
17867 ===bc===
17868 ==c==
17869 xxx
17870 !! end
17871
17872 !! test
17873 Section replacement test with initial whitespace (bug 13728)
17874 !! options
17875 replace=2,"xxx"
17876 !! wikitext
17877 Preformatted initial line
17878 ==a==
17879 ===a===
17880 !! html/php
17881 Preformatted initial line
17882 ==a==
17883 xxx
17884 !! end
17885
17886
17887 !! test
17888 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17889 !! options
17890 section=1
17891 !! wikitext
17892 ==a==
17893 a
17894 !! html/php
17895 ==a==
17896 a
17897 !! end
17898
17899 !! test
17900 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17901 !! options
17902 section=1
17903 !! wikitext
17904 ==a==
17905 a
17906 !! html/php
17907 ==a==
17908 a
17909 !! end
17910
17911
17912 !! test
17913 Section extraction, <pre> around bogus header (bug 10309)
17914 !! options
17915 noxml section=2
17916 !! wikitext
17917 == Section One ==
17918 <pre>
17919 =======
17920 </pre>
17921
17922 == Section Two ==
17923 stuff
17924 !! html/php
17925 == Section Two ==
17926 stuff
17927 !! end
17928
17929 !! test
17930 Section replacement, <pre> around bogus header (bug 10309)
17931 !! options
17932 noxml replace=2,"xxx"
17933 !! wikitext
17934 == Section One ==
17935 <pre>
17936 =======
17937 </pre>
17938
17939 == Section Two ==
17940 stuff
17941 !! html/php
17942 == Section One ==
17943 <pre>
17944 =======
17945 </pre>
17946
17947 xxx
17948 !! end
17949
17950
17951 !! test
17952 Handling of &#x0A; in URLs
17953 !! wikitext
17954 ** irc://&#x0A;a
17955 !! html/php
17956 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17957
17958 !! html/parsoid
17959 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17960 a">irc://
17961 a</a></li></ul></li></ul>
17962 !! end
17963
17964 !! test
17965 Handling of %0A in URLs
17966 !! wikitext
17967 ** irc://%0Aa
17968 !! html/php
17969 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17970
17971 !! html/parsoid
17972 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17973 !! end
17974
17975
17976 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17977 !! test
17978 5 quotes, code coverage +1 line
17979 !! options
17980 parsoid=wt2html
17981 !! wikitext
17982 '''''
17983 !! html/php
17984 !! html/parsoid
17985 <p><b><i></i></b></p>
17986 !! end
17987
17988 # same html as previous, but wikitext adjusted to match parsoid html2wt
17989 # note that wt2html and html2html will put the <i> before the <b>
17990 !! test
17991 5 quotes, code coverage +1 line w/ nowiki (1)
17992 !! options
17993 parsoid=wt2wt,html2wt
17994 !! wikitext
17995 '''''<nowiki/>'''''
17996 !! html/php
17997 <p><i></i>
17998 </p>
17999 !! html/parsoid
18000 <p><b><i></i></b></p>
18001 !! end
18002
18003 # same as previous, just swapping the <i> and <b>
18004 !! test
18005 5 quotes, code coverage +1 line w/ nowiki (2)
18006 !! wikitext
18007 '''''<nowiki/>'''''
18008 !! html/php
18009 <p><i></i>
18010 </p>
18011 !! html/parsoid
18012 <p><i><b></b></i></p>
18013 !! end
18014
18015 !! test
18016 Special:Search page linking.
18017 !! wikitext
18018 {{Special:search}}
18019 !! html
18020 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18021 </p>
18022 !! end
18023
18024 !! test
18025 {{!}} is a magic word
18026 !! wikitext
18027 {{!}} is a magic word there and {{!}} is still a magic word here
18028 | is not a magic word here but {{!}} is still a magic word here
18029 !! html/php
18030 <p>| is a magic word there and | is still a magic word here
18031 | is not a magic word here but | is still a magic word here
18032 </p>
18033 !! html/parsoid
18034 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18035 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18036
18037 !! end
18038
18039 !! test
18040 Say the magic word
18041 !! options
18042 title=[[Parser test]]
18043 !! wikitext
18044 * {{PAGENAME}}
18045 * {{PAGENAMEE}}
18046 * {{FULLPAGENAME}}
18047 * {{FULLPAGENAMEE}}
18048 * {{BASEPAGENAME}}
18049 * {{BASEPAGENAMEE}}
18050 * {{SUBPAGENAME}}
18051 * {{SUBPAGENAMEE}}
18052 * {{ROOTPAGENAME}}
18053 * {{ROOTPAGENAMEE}}
18054 * {{TALKPAGENAME}}
18055 * {{TALKPAGENAMEE}}
18056 * {{SUBJECTPAGENAME}}
18057 * {{SUBJECTPAGENAMEE}}
18058 * {{NAMESPACEE}}
18059 * {{NAMESPACE}}
18060 * {{NAMESPACENUMBER}}
18061 * {{TALKSPACE}}
18062 * {{TALKSPACEE}}
18063 * {{SUBJECTSPACE}}
18064 * {{SUBJECTSPACEE}}
18065 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18066 !! html
18067 <ul><li> Parser test</li>
18068 <li> Parser_test</li>
18069 <li> Parser test</li>
18070 <li> Parser_test</li>
18071 <li> Parser test</li>
18072 <li> Parser_test</li>
18073 <li> Parser test</li>
18074 <li> Parser_test</li>
18075 <li> Parser test</li>
18076 <li> Parser_test</li>
18077 <li> Talk:Parser test</li>
18078 <li> Talk:Parser_test</li>
18079 <li> Parser test</li>
18080 <li> Parser_test</li>
18081 <li> </li>
18082 <li> </li>
18083 <li> 0</li>
18084 <li> Talk</li>
18085 <li> Talk</li>
18086 <li> </li>
18087 <li> </li>
18088 <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>
18089
18090 !! end
18091 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18092
18093 !! test
18094 Gallery
18095 !! wikitext
18096 <gallery>
18097 image1.png |
18098 image2.gif|||||
18099
18100 image3|
18101 image4 |300px| centre
18102 image5.svg| http://///////
18103 [[x|xx]]]]
18104 * image6
18105 </gallery>
18106 !! html
18107 <ul class="gallery mw-gallery-traditional">
18108 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18109 <div class="thumb" style="height: 150px;">Image1.png</div>
18110 <div class="gallerytext">
18111 </div>
18112 </div></li>
18113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18114 <div class="thumb" style="height: 150px;">Image2.gif</div>
18115 <div class="gallerytext">
18116 <p>||||
18117 </p>
18118 </div>
18119 </div></li>
18120 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18121 <div class="thumb" style="height: 150px;">Image3</div>
18122 <div class="gallerytext">
18123 </div>
18124 </div></li>
18125 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18126 <div class="thumb" style="height: 150px;">Image4</div>
18127 <div class="gallerytext">
18128 <p>300px| centre
18129 </p>
18130 </div>
18131 </div></li>
18132 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18133 <div class="thumb" style="height: 150px;">Image5.svg</div>
18134 <div class="gallerytext">
18135 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18136 </p>
18137 </div>
18138 </div></li>
18139 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18140 <div class="thumb" style="height: 150px;">* image6</div>
18141 <div class="gallerytext">
18142 </div>
18143 </div></li>
18144 </ul>
18145
18146 !! end
18147
18148 !! test
18149 Gallery (with options)
18150 !! wikitext
18151 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18152 File:Nonexistent.jpg|caption
18153 File:Nonexistent.jpg
18154 image:foobar.jpg|some '''caption''' [[Main Page]]
18155 image:foobar.jpg
18156 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18157 </gallery>
18158 !! html
18159 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18160 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18161 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18162 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18163 <div class="gallerytext">
18164 <p>caption
18165 </p>
18166 </div>
18167 </div></li>
18168 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18169 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18170 <div class="gallerytext">
18171 </div>
18172 </div></li>
18173 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18174 <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>
18175 <div class="gallerytext">
18176 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18177 </p>
18178 </div>
18179 </div></li>
18180 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18181 <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>
18182 <div class="gallerytext">
18183 </div>
18184 </div></li>
18185 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18186 <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>
18187 <div class="gallerytext">
18188 <p>Blabla|blabla.
18189 </p>
18190 </div>
18191 </div></li>
18192 </ul>
18193
18194 !! end
18195
18196 !! test
18197 Gallery with link that has fragment
18198 !! wikitext
18199 <gallery>
18200 image:foobar.jpg|link=Main_Page
18201 image:foobar.jpg|link=Main_Page#section
18202 image:foobar.jpg|link=Main Page#section|caption
18203 </gallery>
18204 !! html
18205 <ul class="gallery mw-gallery-traditional">
18206 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18207 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18208 <div class="gallerytext">
18209 </div>
18210 </div></li>
18211 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18212 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18213 <div class="gallerytext">
18214 </div>
18215 </div></li>
18216 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18217 <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>
18218 <div class="gallerytext">
18219 <p>caption
18220 </p>
18221 </div>
18222 </div></li>
18223 </ul>
18224
18225 !! end
18226
18227 !! test
18228 Gallery with wikitext inside caption
18229 !! wikitext
18230 <gallery>
18231 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18232 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18233 </gallery>
18234 !! html
18235 <ul class="gallery mw-gallery-traditional">
18236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18237 <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>
18238 <div class="gallerytext">
18239 <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>
18240 </p>
18241 </div>
18242 </div></li>
18243 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18244 <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>
18245 <div class="gallerytext">
18246 <p>This is a test template
18247 </p>
18248 </div>
18249 </div></li>
18250 </ul>
18251
18252 !! end
18253
18254 !! test
18255 gallery (with showfilename option)
18256 !! wikitext
18257 <gallery showfilename>
18258 File:Nonexistent.jpg|caption
18259 File:Nonexistent.jpg
18260 image:foobar.jpg|some '''caption''' [[Main Page]]
18261 File:Foobar.jpg
18262 </gallery>
18263 !! html
18264 <ul class="gallery mw-gallery-traditional">
18265 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18266 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18267 <div class="gallerytext">
18268 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18269 caption
18270 </p>
18271 </div>
18272 </div></li>
18273 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18274 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18275 <div class="gallerytext">
18276 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18277 </p>
18278 </div>
18279 </div></li>
18280 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18281 <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>
18282 <div class="gallerytext">
18283 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18284 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18285 </p>
18286 </div>
18287 </div></li>
18288 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18289 <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>
18290 <div class="gallerytext">
18291 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18292 </p>
18293 </div>
18294 </div></li>
18295 </ul>
18296
18297 !! end
18298
18299 !! test
18300 Gallery (with namespace-less filenames)
18301 !! wikitext
18302 <gallery>
18303 File:Nonexistent.jpg
18304 Nonexistent.jpg
18305 image:foobar.jpg
18306 foobar.jpg
18307 </gallery>
18308 !! html
18309 <ul class="gallery mw-gallery-traditional">
18310 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18311 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18312 <div class="gallerytext">
18313 </div>
18314 </div></li>
18315 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18316 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18317 <div class="gallerytext">
18318 </div>
18319 </div></li>
18320 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18321 <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>
18322 <div class="gallerytext">
18323 </div>
18324 </div></li>
18325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18326 <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>
18327 <div class="gallerytext">
18328 </div>
18329 </div></li>
18330 </ul>
18331
18332 !! end
18333
18334 !! test
18335 HTML Hex character encoding (spells the word "JavaScript")
18336 !! options
18337 parsoid=wt2html,wt2wt,html2html
18338 !! wikitext
18339 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18340 !! html/php
18341 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18342 </p>
18343 !! html/php+tidy
18344 <p>JavaScript</p>
18345 !! html/parsoid
18346 <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>
18347 !! end
18348
18349 !! test
18350 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18351 !! wikitext
18352 &#xsee;&#XSEE;
18353 !! html/php
18354 <p>&amp;#xsee;&amp;#XSEE;
18355 </p>
18356 !! html/parsoid
18357 <p>&amp;#xsee;&amp;#XSEE;</p>
18358 !! end
18359
18360 !! test
18361 HTML Hex character encoding mixed case
18362 !! options
18363 parsoid=wt2html,wt2wt,html2html
18364 !! wikitext
18365 &#xEE;&#Xee;
18366 !! html/php
18367 <p>&#xee;&#xee;
18368 </p>
18369 !! html/php+tidy
18370 <p>îî</p>
18371 !! html/parsoid
18372 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18373 !! end
18374
18375 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18376 # Note that U+000C (form feed) is not a valid XML character, so
18377 # it is banned even though allowed in HTML5.
18378 !! test
18379 Illegal character references (T106578)
18380 !! wikitext
18381 ; Null: &#00;
18382 ; FF: &#xC;
18383 ; CR: &#xD;
18384 ; Control (low): &#8;
18385 ; Control (high): &#x7F; &#x9F;
18386 ; Surrogate: &#xD83D;&#xDCA9;
18387 ; This is an okay astral character: &#x1F4A9;
18388 !! html+tidy
18389 <dl>
18390 <dt>Null</dt>
18391 <dd>&amp;#00;</dd>
18392 <dt>FF</dt>
18393 <dd>&amp;#xC;</dd>
18394 <dt>CR</dt>
18395 <dd>&amp;#xD;</dd>
18396 <dt>Control (low)</dt>
18397 <dd>&amp;#8;</dd>
18398 <dt>Control (high)</dt>
18399 <dd>&amp;#x7F; &amp;#x9F;</dd>
18400 <dt>Surrogate</dt>
18401 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18402 <dt>This is an okay astral character</dt>
18403 <dd>💩</dd>
18404 </dl>
18405 !! end
18406
18407 !! test
18408 __FORCETOC__ override
18409 !! wikitext
18410 __NEWSECTIONLINK__
18411 __FORCETOC__
18412 !! html/php
18413 <p><br />
18414 </p>
18415 !! end
18416
18417 !! test
18418 ISBN code coverage
18419 !! wikitext
18420 ISBN 978-0-1234-56&#x20;789
18421 !! html
18422 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18423 </p>
18424 !! html+tidy
18425 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18426 !! html/parsoid
18427 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18428 !! end
18429
18430 !! test
18431 ISBN followed by 5 spaces
18432 !! wikitext
18433 ISBN
18434 !! html
18435 <p>ISBN
18436 </p>
18437 !! end
18438
18439 !! test
18440 Double ISBN
18441 !! wikitext
18442 ISBN ISBN 1234567890
18443 !! html/php
18444 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18445 </p>
18446 !! html/parsoid
18447 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18448 !! end
18449
18450 # Uppercase X and lowercase x as well
18451 !! test
18452 ISBN with an X
18453 !! wikitext
18454 ISBN 3-462-04561-X
18455 ISBN 3-462-04561-x
18456 ISBN 080442957X
18457 ISBN 080442957x
18458 ISBN 978080442957X
18459 ISBN 978080442957x
18460 !! html/php
18461 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18462 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18463 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18464 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18465 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18466 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18467 </p>
18468 !! html/parsoid
18469 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18470 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18471 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18472 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18473 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18474 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18475 !! end
18476
18477 !! test
18478 ISBN with empty prefix (parsoid test)
18479 !! wikitext
18480 ISBN 1234567890
18481 !! html/php
18482 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18483 </p>
18484 !! html/parsoid
18485 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18486 !! end
18487
18488 !! test
18489 Bug 22905: <abbr> followed by ISBN followed by </a>
18490 !! wikitext
18491 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18492 !! html/php
18493 <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>
18494 </p>
18495 !! html/parsoid
18496 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18497 !! end
18498
18499 !! test
18500 Double RFC
18501 !! wikitext
18502 RFC RFC 1234
18503 !! html
18504 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18505 </p>
18506 !! end
18507
18508 !! test
18509 Double RFC with a wiki link
18510 !! wikitext
18511 RFC [[RFC 1234]]
18512 !! html
18513 <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>
18514 </p>
18515 !! end
18516
18517 !! test
18518 RFC code coverage
18519 !! wikitext
18520 RFC 983&#x20;987
18521 !! html
18522 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18523 </p>
18524 !! html+tidy
18525 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18526 !! end
18527
18528 !! test
18529 Centre-aligned image
18530 !! wikitext
18531 [[Image:foobar.jpg|centre]]
18532 !! html
18533 <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>
18534
18535 !!end
18536
18537 !! test
18538 None-aligned image
18539 !! wikitext
18540 [[Image:foobar.jpg|none]]
18541 !! html
18542 <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>
18543
18544 !!end
18545
18546 !! test
18547 Width + Height sized image (using px) (height is ignored)
18548 !! wikitext
18549 [[Image:foobar.jpg|640x480px]]
18550 !! html
18551 <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>
18552 </p>
18553 !!end
18554
18555 !! test
18556 Width-sized image (using px, no following whitespace)
18557 !! wikitext
18558 [[Image:foobar.jpg|640px]]
18559 !! html
18560 <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>
18561 </p>
18562 !!end
18563
18564 !! test
18565 Width-sized image (using px, with following whitespace - test regression from r39467)
18566 !! wikitext
18567 [[Image:foobar.jpg|640px ]]
18568 !! html
18569 <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>
18570 </p>
18571 !!end
18572
18573 !! test
18574 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18575 !! wikitext
18576 [[Image:foobar.jpg| 640px]]
18577 !! html
18578 <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>
18579 </p>
18580 !!end
18581
18582 !! test
18583 Image with page parameter
18584 !! options
18585 djvu
18586 !! wikitext
18587 [[File:LoremIpsum.djvu|page=2]]
18588 !! html/php
18589 <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>
18590 </p>
18591 !! html/parsoid
18592 <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>
18593 !! end
18594
18595 !! test
18596 Another italics / bold test
18597 !! wikitext
18598 ''' ''x'
18599 !! html
18600 <pre>'<i> </i>x'
18601 </pre>
18602 !!end
18603
18604 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18605 !! test
18606 dt/dd/dl test
18607 !! wikitext
18608 :;;;::
18609 !! html/php
18610 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18611
18612 !! html/parsoid
18613 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18614
18615 !!end
18616
18617
18618 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18619 !! test
18620 Images with the "|" character in the comment
18621 !! wikitext
18622 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18623 !! html/php
18624 <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>
18625
18626 !! html/parsoid
18627 <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>
18628 !! end
18629
18630 !! test
18631 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18632 !! wikitext
18633 <html><script>alert(1);</script></html>
18634 !! html
18635 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18636 </p>
18637 !! end
18638
18639 !! test
18640 HTML with raw HTML ($wgRawHtml==true)
18641 !! options
18642 wgRawHtml=1
18643 !! wikitext
18644 <html><script>alert(1);</script></html>
18645 !! html
18646 <p><script>alert(1);</script>
18647 </p>
18648 !! end
18649
18650 !! test
18651 Parents of subpages, one level up
18652 !! options
18653 subpage title=[[Subpage test/L1/L2/L3]]
18654 !! wikitext
18655 [[../|L2]]
18656 !! html
18657 <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>
18658 </p>
18659 !! end
18660
18661
18662 !! test
18663 Parents of subpages, one level up, not named
18664 !! options
18665 subpage title=[[Subpage test/L1/L2/L3]]
18666 !! wikitext
18667 [[../]]
18668 !! html
18669 <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>
18670 </p>
18671 !! end
18672
18673
18674
18675 !! test
18676 Parents of subpages, two levels up
18677 !! options
18678 subpage title=[[Subpage test/L1/L2/L3]]
18679 !! wikitext
18680 [[../../|L1]]2
18681
18682 [[../../|L1]]l
18683 !! html
18684 <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
18685 </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>
18686 </p>
18687 !! end
18688
18689 !! test
18690 Parents of subpages, two levels up, without trailing slash or name.
18691 !! options
18692 subpage title=[[Subpage test/L1/L2/L3]]
18693 !! wikitext
18694 [[../..]]
18695 !! html
18696 <p>[[../..]]
18697 </p>
18698 !! end
18699
18700 !! test
18701 Parents of subpages, two levels up, with lots of extra trailing slashes.
18702 !! options
18703 subpage title=[[Subpage test/L1/L2/L3]]
18704 !! wikitext
18705 [[../../////]]
18706 !! html
18707 <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>
18708 </p>
18709 !! end
18710
18711 !! article
18712 Subpage test/L1/L2/L3Sibling
18713 !! text
18714 Sibling article
18715 !! endarticle
18716
18717 !! test
18718 Transclusion of a sibling page (one level up)
18719 !! options
18720 subpage title=[[Subpage test/L1/L2/L3]]
18721 !! wikitext
18722 {{../L3Sibling}}
18723 !! html
18724 <p>Sibling article
18725 </p>
18726 !! end
18727
18728 !! test
18729 Transclusion of a child page
18730 !! options
18731 subpage title=[[Subpage test/L1/L2]]
18732 !! wikitext
18733 {{/L3Sibling}}
18734 !! html
18735 <p>Sibling article
18736 </p>
18737 !! end
18738
18739 !! test
18740 Non-transclusion because of too many up levels
18741 !! options
18742 subpage title=[[Subpage test/L1/L2/L3]]
18743 !! wikitext
18744 {{../../../../More than parent}}
18745 !! html
18746 <p>{{../../../../More than parent}}
18747 </p>
18748 !! end
18749
18750 !! test
18751 Definition list code coverage
18752 !! wikitext
18753 ; title : def
18754 ; title : def
18755 ;title: def
18756 !! html/php
18757 <dl><dt> title &#160;</dt>
18758 <dd> def</dd>
18759 <dt> title&#160;</dt>
18760 <dd> def</dd>
18761 <dt>title</dt>
18762 <dd> def</dd></dl>
18763
18764 !! html/parsoid
18765 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18766 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18767 <dt>title</dt><dd> def</dd></dl>
18768 !! end
18769
18770 !! test
18771 Don't fall for the self-closing div
18772 !! wikitext
18773 <div>hello world</div/>
18774 !! html
18775 <div>hello world</div>
18776
18777 !! end
18778
18779 !! test
18780 MSGNW magic word
18781 !! wikitext
18782 {{MSGNW:msg}}
18783 !! html/php
18784 <p>&#91;&#91;:Template:Msg&#93;&#93;
18785 </p>
18786 !! end
18787
18788 !! test
18789 RAW magic word
18790 !! wikitext
18791 {{RAW:QUERTY}}
18792 !! html
18793 <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>
18794 </p>
18795 !! end
18796
18797 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18798 !! test
18799 Always escape literal '>' in output, not just after '<'
18800 !! wikitext
18801 ><>
18802 !! html
18803 <p>&gt;&lt;&gt;
18804 </p>
18805 !! end
18806
18807 !! test
18808 Template caching
18809 !! wikitext
18810 {{Test}}
18811 {{Test}}
18812 !! html
18813 <p>This is a test template
18814 This is a test template
18815 </p>
18816 !! end
18817
18818
18819 !! article
18820 MediaWiki:Fake
18821 !! text
18822 ==header==
18823 !! endarticle
18824
18825 !! test
18826 Inclusion of !userCanEdit() content
18827 !! wikitext
18828 {{MediaWiki:Fake}}
18829 !! html
18830 <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>
18831
18832 !! end
18833
18834
18835 !! test
18836 Out-of-order TOC heading levels
18837 !! wikitext
18838 ==2==
18839 ======6======
18840 ===3===
18841 =1=
18842 =====5=====
18843 ==2==
18844 !! html
18845 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18846 <ul>
18847 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18848 <ul>
18849 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18850 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18851 </ul>
18852 </li>
18853 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18854 <ul>
18855 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18856 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18857 </ul>
18858 </li>
18859 </ul>
18860 </div>
18861
18862 <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>
18863 <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>
18864 <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>
18865 <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>
18866 <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>
18867 <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>
18868
18869 !! end
18870
18871
18872 !! test
18873 ISBN with a dummy number
18874 !! wikitext
18875 ISBN ---
18876 !! html
18877 <p>ISBN ---
18878 </p>
18879 !! end
18880
18881
18882 !! test
18883 ISBN with space-delimited number
18884 !! wikitext
18885 ISBN 92 9017 032 8
18886 !! html
18887 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18888 </p>
18889 !! end
18890
18891
18892 !! test
18893 ISBN with multiple spaces, no number
18894 !! wikitext
18895 ISBN foo
18896 !! html
18897 <p>ISBN foo
18898 </p>
18899 !! end
18900
18901
18902 !! test
18903 ISBN length
18904 !! wikitext
18905 ISBN 123456789
18906
18907 ISBN 1234567890
18908
18909 ISBN 12345678901
18910 !! html
18911 <p>ISBN 123456789
18912 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18913 </p><p>ISBN 12345678901
18914 </p>
18915 !! end
18916
18917
18918 !! test
18919 ISBN with trailing year (bug 8110)
18920 !! wikitext
18921 ISBN 1-234-56789-0 - 2006
18922
18923 ISBN 1 234 56789 0 - 2006
18924 !! html
18925 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18926 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18927 </p>
18928 !! end
18929
18930
18931 !! test
18932 anchorencode
18933 !! wikitext
18934 {{anchorencode:foo bar©#%n}}
18935 !! html
18936 <p>foo_bar.C2.A9.23.25n
18937 </p>
18938 !! end
18939
18940 !! test
18941 anchorencode trims spaces
18942 !! wikitext
18943 {{anchorencode: __pretty__please__}}
18944 !! html
18945 <p>pretty_please
18946 </p>
18947 !! end
18948
18949 !! test
18950 anchorencode deals with links
18951 !! wikitext
18952 {{anchorencode: [[hello|world]] [[hi]]}}
18953 !! html
18954 <p>world_hi
18955 </p>
18956 !! end
18957
18958 !! test
18959 anchorencode deals with templates
18960 !! wikitext
18961 {{anchorencode: {{Foo}} }}
18962 !! html
18963 <p>FOO
18964 </p>
18965 !! end
18966
18967 !! test
18968 anchorencode encodes like the TOC generator: (bug 18431)
18969 !! wikitext
18970 === _ +:.3A%3A&&amp;]] ===
18971 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18972 __NOEDITSECTION__
18973 !! html
18974 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18975 <p>.2B:.3A.253A.26.26.5D.5D
18976 </p>
18977 !! end
18978
18979 !! test
18980 Bug 6200: blockquotes and paragraph formatting
18981 !! wikitext
18982 <blockquote>
18983 foo
18984 </blockquote>
18985
18986 bar
18987
18988 baz
18989 !! html
18990 <blockquote>
18991 <p>foo
18992 </p>
18993 </blockquote>
18994 <p>bar
18995 </p>
18996 <pre>baz
18997 </pre>
18998 !! end
18999
19000 !! test
19001 Bug 8293: Use of center tag ruins paragraph formatting
19002 !! wikitext
19003 <center>
19004 foo
19005 </center>
19006
19007 bar
19008
19009 baz
19010 !! html
19011 <center>
19012 <p>foo
19013 </p>
19014 </center>
19015 <p>bar
19016 </p>
19017 <pre>baz
19018 </pre>
19019 !! end
19020
19021 !!test
19022 Parsing of overlapping (improperly nested) inline html tags
19023 !! wikitext
19024 <span><s>x</span></s>
19025 !! html/php
19026 <p><span><s>x&lt;/span&gt;</s></span>
19027 </p>
19028 !! html/parsoid
19029 <p><span><s>x</s></span>
19030 </p>
19031 !!end
19032
19033 ###
19034 ### Language variants related tests
19035 ###
19036 !! test
19037 Self-link in language variants
19038 !! options
19039 title=[[Dunav]] language=sr
19040 !! wikitext
19041 Both [[Dunav]] and [[Дунав]] are names for this river.
19042 !! html
19043 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19044 </p>
19045 !!end
19046
19047 !! article
19048 Дуна
19049 !! text
19050 content
19051 !! endarticle
19052
19053 !! test
19054 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19055 !! options
19056 title=[[Duna]] language=sr
19057 !! wikitext
19058 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19059 !! html
19060 <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.
19061 </p>
19062 !! end
19063
19064 !! test
19065 Link to a section of a variant of this title shouldn't be parsed as self-link
19066 !! options
19067 title=[[Duna]] language=sr
19068 !! wikitext
19069 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19070 !! html
19071 <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.
19072 </p>
19073 !! end
19074
19075 !! test
19076 Link to pages in language variants
19077 !! options
19078 language=sr
19079 !! wikitext
19080 Main Page can be written as [[Маин Паге]]
19081 !! html
19082 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19083 </p>
19084 !!end
19085
19086
19087 !! test
19088 Multiple links to pages in language variants
19089 !! options
19090 language=sr
19091 !! wikitext
19092 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19093 !! html
19094 <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>.
19095 </p>
19096 !!end
19097
19098
19099 !! test
19100 Simple template in language variants
19101 !! options
19102 language=sr
19103 !! wikitext
19104 {{тест}}
19105 !! html
19106 <p>This is a test template
19107 </p>
19108 !! end
19109
19110
19111 !! test
19112 Template with explicit namespace in language variants
19113 !! options
19114 language=sr
19115 !! wikitext
19116 {{Template:тест}}
19117 !! html
19118 <p>This is a test template
19119 </p>
19120 !! end
19121
19122
19123 !! test
19124 Basic test for template parameter in language variants
19125 !! options
19126 language=sr
19127 !! wikitext
19128 {{парамтест|param=foo}}
19129 !! html
19130 <p>This is a test template with parameter foo
19131 </p>
19132 !! end
19133
19134
19135 !! test
19136 Simple category in language variants
19137 !! options
19138 language=sr cat
19139 !! wikitext
19140 [[Category:МедиаWики Усер'с Гуиде]]
19141 !! html
19142 <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>
19143 !! end
19144
19145
19146 !! article
19147 Category:分类
19148 !! text
19149 blah
19150 !! endarticle
19151
19152 !! article
19153 Category:分類
19154 !! text
19155 blah
19156 !! endarticle
19157
19158 !! test
19159 Don't convert blue categorylinks to another variant (bug 33210)
19160 !! options
19161 language=zh cat
19162 !! wikitext
19163 [[A]][[Category:分类]]
19164 !! html
19165 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19166 !! end
19167
19168
19169 !! test
19170 Stripping -{}- tags (language variants)
19171 !! options
19172 language=sr
19173 !! wikitext
19174 Latin proverb: -{Ne nuntium necare}-
19175 !! html
19176 <p>Latin proverb: Ne nuntium necare
19177 </p>
19178 !! end
19179
19180
19181 !! test
19182 Prevent conversion with -{}- tags (language variants)
19183 !! options
19184 language=sr variant=sr-ec
19185 !! wikitext
19186 Latinski: -{Ne nuntium necare}-
19187 !! html
19188 <p>Латински: Ne nuntium necare
19189 </p>
19190 !! end
19191
19192
19193 !! test
19194 Prevent conversion of text with -{}- tags (language variants)
19195 !! options
19196 language=sr variant=sr-ec
19197 !! wikitext
19198 Latinski: -{Ne nuntium necare}-
19199 !! html
19200 <p>Латински: Ne nuntium necare
19201 </p>
19202 !! end
19203
19204
19205 !! test
19206 Prevent conversion of links with -{}- tags (language variants)
19207 !! options
19208 language=sr variant=sr-ec
19209 !! wikitext
19210 -{[[Main Page]]}-
19211 !! html
19212 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19213 </p>
19214 !! end
19215
19216
19217 !! test
19218 -{}- tags within headlines (within html for parserConvert())
19219 !! options
19220 language=sr variant=sr-ec
19221 !! wikitext
19222 == -{Naslov}- ==
19223 !! html
19224 <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>
19225
19226 !! end
19227
19228
19229 !! test
19230 Explicit definition of language variant alternatives
19231 !! options
19232 language=zh variant=zh-tw
19233 !! wikitext
19234 -{zh:China;zh-tw:Taiwan}-, not China
19235 !! html
19236 <p>Taiwan, not China
19237 </p>
19238 !! end
19239
19240
19241 !! test
19242 Conversion around HTML tags
19243 !! options
19244 language=sr variant=sr-ec
19245 !! wikitext
19246 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19247 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19248 !! html
19249 <p>
19250 <span title="ЛаCтин">ски</span>
19251 </p>
19252 !! end
19253
19254
19255 !! test
19256 Explicit session-wise language variant mapping (A flag and - flag)
19257 !! options
19258 language=zh variant=zh-tw
19259 !! wikitext
19260 Taiwan is not China.
19261 But -{A|zh:China;zh-tw:Taiwan}- is China,
19262 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19263 and -{China}- is China.
19264 !! html
19265 <p>Taiwan is not China.
19266 But Taiwan is Taiwan,
19267 (This should be stripped!)
19268 and China is China.
19269 </p>
19270 !! end
19271
19272 !! test
19273 Explicit session-wise language variant mapping (H flag for hide)
19274 !! options
19275 language=zh variant=zh-tw
19276 !! wikitext
19277 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19278 Taiwan is China.
19279 !! html
19280 <p>(This should be stripped!)
19281 Taiwan is Taiwan.
19282 </p>
19283 !! end
19284
19285 !! test
19286 Adding explicit conversion rule for title (T flag)
19287 !! options
19288 language=zh variant=zh-tw showtitle
19289 !! wikitext
19290 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19291 !! html
19292 Taiwan
19293 <p>Should be stripped!
19294 </p>
19295 !! end
19296
19297 !! test
19298 Testing that changing the language variant here in the tests actually works
19299 !! options
19300 language=zh variant=zh showtitle
19301 !! wikitext
19302 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19303 !! html
19304 China
19305 <p>Should be stripped!
19306 </p>
19307 !! end
19308
19309 !! test
19310 Recursive conversion of alt and title attrs shouldn't clear converter state
19311 !! options
19312 language=zh variant=zh-cn showtitle
19313 !! wikitext
19314 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19315 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19316 !! html
19317 China
19318 <p>
19319 Should be stripped<span title="Exclamation">!</span>
19320 </p>
19321 !! end
19322
19323 !! test
19324 Bug 24072: more test on conversion rule for title
19325 !! options
19326 language=zh variant=zh-tw showtitle
19327 !! wikitext
19328 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19329 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19330 !! html
19331 Taiwan
19332 <p>This should be stripped!
19333 This won't take interferes with the title rule.
19334 </p>
19335 !! end
19336
19337 !! test
19338 Partly disable title conversion if variant == main language code
19339 !! options
19340 language=zh variant=zh title=[[ZH]] showtitle
19341 !! wikitext
19342 -{T|zh-cn:CN;zh-tw:TW}-
19343 !! html
19344 ZH
19345 <p>
19346 </p>
19347 !! end
19348
19349 !! test
19350 Partly disable title conversion if variant == main language code, more
19351 !! options
19352 language=zh variant=zh title=[[ZH]] showtitle
19353 !! wikitext
19354 -{T|TW}-
19355 !! html
19356 ZH
19357 <p>
19358 </p>
19359 !! end
19360
19361 !! test
19362 Raw output of variant escape tags (R flag)
19363 !! options
19364 language=zh variant=zh-tw
19365 !! wikitext
19366 Raw: -{R|zh:China;zh-tw:Taiwan}-
19367 !! html
19368 <p>Raw: zh:China;zh-tw:Taiwan
19369 </p>
19370 !! end
19371
19372 !! test
19373 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19374 !! options
19375 language=zh variant=zh-cn
19376 !! input
19377 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19378 !! result
19379 <p>0
19380 </p>
19381 !! end
19382
19383 !! test
19384 Conversion rules from [numeric-only string] to [something else] (T48634)
19385 !! options
19386 language=zh variant=zh-cn
19387 !! input
19388 -{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
19389 !! result
19390 <p>D12345EE12345
19391 </p>
19392 !! end
19393
19394 !! test
19395 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19396 !! options
19397 language=zh variant=zh-cn
19398 !! input
19399 -{H|zh-cn:foo;zh-tw:;}-foobar
19400 !! result
19401 <p>foobar
19402 </p>
19403 !! end
19404
19405 !! test
19406 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19407 !! options
19408 language=zh variant=zh-cn
19409 !! input
19410 -{H|=>zh-cn:foo;}-foobar
19411 !! result
19412 <p>foobar
19413 </p>
19414 !! end
19415
19416 !! test
19417 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19418 !! options
19419 language=zh variant=zh-cn
19420 !! input
19421 -{H|}-foobar
19422 !! result
19423 <p>foobar
19424 </p>
19425 !! end
19426
19427 !! test
19428 Nested using of manual convert syntax
19429 !! options
19430 language=zh variant=zh-hk
19431 !! wikitext
19432 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19433 !! html
19434 <p>Nested: Hello Hong Kong!
19435 </p>
19436 !! end
19437
19438 !! test
19439 Proper conversion of text in external links
19440 !! options
19441 language=sr variant=sr-ec
19442 !! wikitext
19443 http://www.google.com
19444 gopher://www.google.com
19445 [http://www.google.com http://www.google.com]
19446 [gopher://www.google.com gopher://www.google.com]
19447 [https://www.google.com irc://www.google.com]
19448 [ftp://www.google.com www.google.com/ftp://dir]
19449 [//www.google.com www.google.com]
19450 !! html
19451 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19452 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19453 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19454 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19455 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19456 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19457 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19458 </p>
19459 !! end
19460
19461 !! test
19462 Do not convert roman numbers to language variants
19463 !! options
19464 language=sr variant=sr-ec
19465 !! wikitext
19466 Fridrih IV je car.
19467 !! html
19468 <p>Фридрих IV је цар.
19469 </p>
19470 !! end
19471
19472 !! test
19473 Unclosed language converter markup "-{"
19474 !! options
19475 language=sr
19476 !! wikitext
19477 -{T|hello
19478 !! html
19479 <p>-{T|hello
19480 </p>
19481 !! end
19482
19483 !! test
19484 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19485 !! options
19486 language=sr
19487 !! wikitext
19488 -{R|=&gt;}-
19489 !! html
19490 <p>=&gt;
19491 </p>
19492 !!end
19493
19494 !! test
19495 Don't break link parsing if language converter markup is in the caption.
19496 !! options
19497 language=sr variant=sr-ec
19498 !! wikitext
19499 [[Main Page|-{R|main page}-]]
19500 !! html
19501 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19502 </p>
19503 !! end
19504
19505 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19506 !! test
19507 Don't break image parsing if language converter markup is in the caption.
19508 !! options
19509 language=sr
19510 !! wikitext
19511 [[File:Foobar.jpg|-{R|caption}-]]
19512 !! html/parsoid
19513 <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>
19514 </p>
19515 !! end
19516
19517 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19518 !! test
19519 Don't break list handling if language converter markup is in the item.
19520 !! options
19521 language=zh variant=zh-cn
19522 !! wikitext
19523 ;-{zh-cn:AAA;zh-tw:BBB}-
19524 !! html/php
19525 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19526
19527 !! html/parsoid
19528 <dl><dt>AAA
19529 </dt></dl>
19530 !! end
19531
19532 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19533 !! test
19534 Don't break table handling if language converter markup is in the cell.
19535 !! options
19536 language=sr variant=sr-ec
19537 !! wikitext
19538 {|
19539 |-
19540 | -{R|B}-
19541 |}
19542 !! html/php
19543 <table>
19544
19545 <tr>
19546 <td>Б}-
19547 </td></tr></table>
19548
19549 !! html/parsoid
19550 <table>
19551
19552 <tr>
19553 <td> B
19554 </td></tr></table>
19555
19556 !! end
19557
19558 !! test
19559 Bug 529: Uncovered bullet
19560 !! wikitext
19561 * Foo {{bullet}}
19562 !! html
19563 <ul><li> Foo </li>
19564 <li> Bar</li></ul>
19565
19566 !! end
19567
19568 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19569 # Templates in Wikipedia rely on this behavior, as tidy has always been
19570 # enabled there. These tests are normally run *without* tidy, so specify the
19571 # full output here.
19572 # To test realistic parsing behavior, apply a tidy-like transformation to both
19573 # the expected output and your parser's output.
19574 !! test
19575 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19576 !! wikitext
19577 ******* Foo {{bullet}}
19578 !! html
19579 <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>
19580 <li> Bar</li></ul>
19581
19582 !! end
19583
19584 !! test
19585 Bug 529: Uncovered table already at line-start
19586 !! wikitext
19587 x
19588
19589 {{table}}
19590 y
19591 !! html
19592 <p>x
19593 </p>
19594 <table>
19595 <tr>
19596 <td> 1 </td>
19597 <td> 2
19598 </td></tr>
19599 <tr>
19600 <td> 3 </td>
19601 <td> 4
19602 </td></tr></table>
19603 <p>y
19604 </p>
19605 !! end
19606
19607 !! test
19608 Bug 529: Uncovered bullet in parser function result
19609 !! wikitext
19610 * Foo {{lc:{{bullet}} }}
19611 !! html
19612 <ul><li> Foo </li>
19613 <li> bar</li></ul>
19614
19615 !! end
19616
19617 !! test
19618 Bug 5678: Double-parsed template argument
19619 !! wikitext
19620 {{lc:{{{1}}}|hello}}
19621 !! html
19622 <p>{{{1}}}
19623 </p>
19624 !! end
19625
19626 !! test
19627 Bug 5678: Double-parsed template invocation
19628 !! wikitext
19629 {{lc:{{paramtest {{!}} param = hello }} }}
19630 !! html
19631 <p>{{paramtest | param = hello }}
19632 </p>
19633 !! end
19634
19635 !! test
19636 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19637 !! options
19638 language=cs
19639 title=[[Main Page]]
19640 !! wikitext
19641 {{PRVNÍVELKÉ:ěščř}}
19642 {{prvnívelké:ěščř}}
19643 {{PRVNÍMALÉ:ěščř}}
19644 {{prvnímalé:ěščř}}
19645 {{MALÁ:ěščř}}
19646 {{malá:ěščř}}
19647 {{VELKÁ:ěščř}}
19648 {{velká:ěščř}}
19649 !! html
19650 <p>Ěščř
19651 Ěščř
19652 ěščř
19653 ěščř
19654 ěščř
19655 ěščř
19656 ĚŠČŘ
19657 ĚŠČŘ
19658 </p>
19659 !! end
19660
19661 !! test
19662 Morwen/13: Unclosed link followed by heading
19663 !! wikitext
19664 [[link
19665 ==heading==
19666 !! html
19667 <p>[[link
19668 </p>
19669 <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>
19670
19671 !! end
19672
19673 !! test
19674 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19675 !! wikitext
19676 {{foo|
19677 =heading=
19678 !! html
19679 <p>{{foo|
19680 </p>
19681 <h1><span class="mw-headline" id="heading">heading</span></h1>
19682
19683 !! end
19684
19685 !! test
19686 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19687 !! wikitext
19688 {{foo|
19689 ==heading==
19690 !! html
19691 <p>{{foo|
19692 </p>
19693 <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>
19694
19695 !! end
19696
19697 !! test
19698 Tildes in comments
19699 !! options
19700 pst
19701 !! wikitext
19702 <!-- ~~~~ -->
19703 !! html
19704 <!-- ~~~~ -->
19705 !! end
19706
19707 !! test
19708 Paragraphs inside divs (no extra line breaks)
19709 !! wikitext
19710 <div>Line one
19711
19712 Line two</div>
19713 !! html
19714 <div>Line one
19715 Line two</div>
19716
19717 !! end
19718
19719 !! test
19720 Paragraphs inside divs (extra line break on open)
19721 !! wikitext
19722 <div>
19723 Line one
19724
19725 Line two</div>
19726 !! html
19727 <div>
19728 <p>Line one
19729 </p>
19730 Line two</div>
19731
19732 !! end
19733
19734 !! test
19735 Paragraphs inside divs (extra line break on close)
19736 !! wikitext
19737 <div>Line one
19738
19739 Line two
19740 </div>
19741 !! html
19742 <div>Line one
19743 <p>Line two
19744 </p>
19745 </div>
19746
19747 !! end
19748
19749 !! test
19750 Paragraphs inside divs (extra line break on open and close)
19751 !! wikitext
19752 <div>
19753 Line one
19754
19755 Line two
19756 </div>
19757 !! html
19758 <div>
19759 <p>Line one
19760 </p><p>Line two
19761 </p>
19762 </div>
19763
19764 !! end
19765
19766 !! test
19767 Nesting tags, paragraphs on lines which begin with <div>
19768 !! wikitext
19769 <div></div><strong>A
19770 B</strong>
19771 !! html/php+tidy
19772 <p><strong>A</strong></p>
19773 <p><strong>B</strong></p>
19774 !! html/parsoid
19775 <div></div>
19776 <p><strong>A
19777 B</strong>
19778 </p>
19779 !! end
19780
19781 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19782 !! test
19783 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19784 !! wikitext
19785 <blockquote>Line one
19786
19787 Line two</blockquote>
19788 !! html
19789 <blockquote>Line one
19790 Line two</blockquote>
19791
19792 !! html+tidy
19793 <blockquote>
19794 <p>Line one Line two</p>
19795 </blockquote>
19796 !! end
19797
19798 !! test
19799 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19800 !! wikitext
19801 <blockquote>
19802 Line one
19803
19804 Line two</blockquote>
19805 !! html
19806 <blockquote>
19807 <p>Line one
19808 </p>
19809 Line two</blockquote>
19810
19811 !! html+tidy
19812 <blockquote>
19813 <p>Line one</p>
19814 Line two</blockquote>
19815 !! end
19816
19817 !! test
19818 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19819 !! wikitext
19820 <blockquote>Line one
19821
19822 Line two
19823 </blockquote>
19824 !! html
19825 <blockquote>Line one
19826 <p>Line two
19827 </p>
19828 </blockquote>
19829
19830 !! html+tidy
19831 <blockquote>
19832 <p>Line one</p>
19833 <p>Line two</p>
19834 </blockquote>
19835 !! end
19836
19837 !! test
19838 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19839 !! wikitext
19840 <blockquote>
19841 Line one
19842
19843 Line two
19844 </blockquote>
19845 !! html
19846 <blockquote>
19847 <p>Line one
19848 </p><p>Line two
19849 </p>
19850 </blockquote>
19851
19852 !! html+tidy
19853 <blockquote>
19854 <p>Line one</p>
19855 <p>Line two</p>
19856 </blockquote>
19857 !! end
19858
19859 !! test
19860 Paragraphs inside blockquotes/divs (no extra line breaks)
19861 !! wikitext
19862 <blockquote><div>Line one
19863
19864 Line two</div></blockquote>
19865 !! html
19866 <blockquote><div>Line one
19867 Line two</div></blockquote>
19868
19869 !! end
19870
19871 !! test
19872 Paragraphs inside blockquotes/divs (extra line break on open)
19873 !! wikitext
19874 <blockquote><div>
19875 Line one
19876
19877 Line two</div></blockquote>
19878 !! html
19879 <blockquote><div>
19880 <p>Line one
19881 </p>
19882 Line two</div></blockquote>
19883
19884 !! end
19885
19886 !! test
19887 Paragraphs inside blockquotes/divs (extra line break on close)
19888 !! wikitext
19889 <blockquote><div>Line one
19890
19891 Line two
19892 </div></blockquote>
19893 !! html
19894 <blockquote><div>Line one
19895 <p>Line two
19896 </p>
19897 </div></blockquote>
19898
19899 !! end
19900
19901 !! test
19902 Paragraphs inside blockquotes/divs (extra line break on open and close)
19903 !! wikitext
19904 <blockquote><div>
19905 Line one
19906
19907 Line two
19908 </div></blockquote>
19909 !! html
19910 <blockquote><div>
19911 <p>Line one
19912 </p><p>Line two
19913 </p>
19914 </div></blockquote>
19915
19916 !! end
19917
19918 !! test
19919 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19920 !! options
19921 wgLinkHolderBatchSize=0
19922 !! wikitext
19923 [[meatball:1]]
19924 [[meatball:2]]
19925 [[meatball:3]]
19926 !! html
19927 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19928 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19929 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19930 </p>
19931 !! end
19932
19933 !! test
19934 Free external link invading image caption
19935 !! wikitext
19936 [[Image:Foobar.jpg|thumb|http://x|hello]]
19937 !! html
19938 <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>
19939
19940 !! end
19941
19942 !! test
19943 Bug 15196: localised external link numbers
19944 !! options
19945 language=fa
19946 !! wikitext
19947 [http://en.wikipedia.org/]
19948 !! html/php
19949 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19950 </p>
19951 !! html/parsoid
19952 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19953 !! end
19954
19955 !! test
19956 Multibyte character in padleft
19957 !! wikitext
19958 {{padleft:-Hello|7|Æ}}
19959 !! html
19960 <p>Æ-Hello
19961 </p>
19962 !! end
19963
19964 !! test
19965 Multibyte character in padright
19966 !! wikitext
19967 {{padright:Hello-|7|Æ}}
19968 !! html
19969 <p>Hello-Æ
19970 </p>
19971 !! end
19972
19973 !!test
19974 formatdate parser function
19975 !! wikitext
19976 {{#formatdate:2009-03-24}}
19977 !! html
19978 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19979 </p>
19980 !! end
19981
19982 !!test
19983 formatdate parser function, with default format
19984 !! wikitext
19985 {{#formatdate:2009-03-24|mdy}}
19986 !! html
19987 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19988 </p>
19989 !! end
19990
19991 !! test
19992 Spacing of numbers in formatted dates
19993 !! wikitext
19994 {{#formatdate:January 15}}
19995 !! html
19996 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19997 </p>
19998 !! end
19999
20000 !! test
20001 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
20002 !! options
20003 language=nl title=[[MediaWiki:Common.css]]
20004 !! wikitext
20005 {{#formatdate:2009-03-24|dmy}}
20006 !! html
20007 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20008 </p>
20009 !! end
20010
20011 #
20012 #
20013 #
20014
20015 #
20016 # Edit comments
20017 #
20018
20019 !! test
20020 Edit comment with link
20021 !! options
20022 comment
20023 !! wikitext
20024 I like the [[Main Page]] a lot
20025 !! html
20026 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20027 !!end
20028
20029 !! test
20030 Edit comment with link and link text
20031 !! options
20032 comment
20033 !! wikitext
20034 I like the [[Main Page|best pages]] a lot
20035 !! html
20036 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20037 !!end
20038
20039 !! test
20040 Edit comment with link and link text with suffix
20041 !! options
20042 comment
20043 !! wikitext
20044 I like the [[Main Page|best page]]s a lot
20045 !! html
20046 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20047 !!end
20048
20049 !! test
20050 Edit comment with section link (non-local, eg in history list)
20051 !! options
20052 comment title=[[Main Page]]
20053 !! wikitext
20054 /* External links */ removed bogus entries
20055 !! html
20056 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20057 !!end
20058
20059 !! test
20060 Edit comment with section link and text before it (non-local, eg in history list)
20061 !! options
20062 comment title=[[Main Page]]
20063 !! wikitext
20064 pre-comment text /* External links */ removed bogus entries
20065 !! html
20066 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>
20067 !!end
20068
20069 !! test
20070 Edit comment with section link (local, eg in diff view)
20071 !! options
20072 comment local title=[[Main Page]]
20073 !! wikitext
20074 /* External links */ removed bogus entries
20075 !! html
20076 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20077 !!end
20078
20079 !! test
20080 Edit comment with subpage link (bug 14080)
20081 !! options
20082 comment
20083 subpage
20084 title=[[Subpage test]]
20085 !! wikitext
20086 Poked at a [[/subpage]] here...
20087 !! html
20088 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20089 !!end
20090
20091 !! test
20092 Edit comment with subpage link and link text (bug 14080)
20093 !! options
20094 comment
20095 subpage
20096 title=[[Subpage test]]
20097 !! wikitext
20098 Poked at a [[/subpage|neat little page]] here...
20099 !! html
20100 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20101 !!end
20102
20103 !! test
20104 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20105 !! options
20106 comment
20107 title=[[Subpage test]]
20108 !! wikitext
20109 Poked at a [[/subpage]] here...
20110 !! html
20111 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...
20112 !!end
20113
20114 !! test
20115 Edit comment with bare anchor link (local, as on diff)
20116 !! options
20117 comment
20118 local
20119 title=[[Main Page]]
20120 !! wikitext
20121 [[#section]]
20122 !! html
20123 <a href="#section">#section</a>
20124 !! end
20125
20126 !! test
20127 Edit comment with bare anchor link (non-local, as on history)
20128 !! options
20129 comment
20130 title=[[Main Page]]
20131 !! wikitext
20132 [[#section]]
20133 !! html
20134 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20135 !! end
20136
20137 !! test
20138 Anchor starting with underscore
20139 !! wikitext
20140 [[#_ref|One]]
20141 !! html
20142 <p><a href="#_ref">One</a>
20143 </p>
20144 !! end
20145
20146 !! test
20147 Id starting with underscore
20148 !! wikitext
20149 <div id="_ref"></div>
20150 !! html
20151 <div id="_ref"></div>
20152
20153 !! end
20154
20155 !! test
20156 Space normalisation on autocomment (bug 22784)
20157 !! options
20158 comment
20159 title=[[Main Page]]
20160 !! wikitext
20161 /* __hello__world__ */
20162 !! html
20163 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20164 !! end
20165
20166 !! test
20167 percent-encoding and + signs in comments (Bug 26410)
20168 !! options
20169 comment
20170 !! wikitext
20171 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20172 !! html/php
20173 <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>
20174 !! end
20175
20176 # Parsoid doesn't support this yet: see bug 73581
20177 # but it *should* omit the 'src' attribute if the image is bad.
20178 # PHP side of tests was disabled in
20179 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20180 # because of issues in the PHP parserTests infrastructure
20181 # (but the output below is indeed what the PHP side emits)
20182 !! test
20183 Bad images - basic functionality
20184 !! wikitext
20185 [[File:Bad.jpg]]
20186 !! DISABLED/html/php
20187 !! html/parsoid
20188 <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>
20189 !! end
20190
20191 !! test
20192 Bad images - bug 16039: text after bad image disappears
20193 !! wikitext
20194 Foo bar
20195 [[File:Bad.jpg]]
20196 Bar foo
20197 !! DISABLED/html/php
20198 <p>Foo bar
20199 </p><p>Bar foo
20200 </p>
20201 !! html/parsoid
20202 <p>Foo bar
20203 <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>
20204 Bar foo</p>
20205 !! end
20206
20207 !! test
20208 Verify that displaytitle works (bug #22501) no displaytitle
20209 !! options
20210 showtitle
20211 !! config
20212 wgAllowDisplayTitle=true
20213 wgRestrictDisplayTitle=false
20214 !! wikitext
20215 this is not the the title
20216 !! html/php
20217 Parser test
20218 <p>this is not the the title
20219 </p>
20220 !! end
20221
20222 !! test
20223 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20224 !! options
20225 showtitle
20226 title=[[Screen]]
20227 !! config
20228 wgAllowDisplayTitle=true
20229 wgRestrictDisplayTitle=false
20230 !! wikitext
20231 this is not the the title
20232 {{DISPLAYTITLE:whatever}}
20233 !! html/php
20234 whatever
20235 <p>this is not the the title
20236 </p>
20237 !! end
20238
20239 !! test
20240 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20241 !! options
20242 showtitle
20243 title=[[Screen]]
20244 !! config
20245 wgAllowDisplayTitle=true
20246 wgRestrictDisplayTitle=true
20247 !! wikitext
20248 this is not the the title
20249 {{DISPLAYTITLE:whatever}}
20250 !! html/php
20251 Screen
20252 <p>this is not the the title
20253 </p>
20254 !! end
20255
20256 !! test
20257 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20258 !! options
20259 showtitle
20260 title=[[Screen]]
20261 !! config
20262 wgAllowDisplayTitle=true
20263 wgRestrictDisplayTitle=true
20264 !! wikitext
20265 this is not the the title
20266 {{DISPLAYTITLE:screen}}
20267 !! html/php
20268 screen
20269 <p>this is not the the title
20270 </p>
20271 !! end
20272
20273 !! test
20274 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20275 !! options
20276 showtitle
20277 title=[[Screen]]
20278 !! config
20279 wgAllowDisplayTitle=false
20280 !! wikitext
20281 this is not the the title
20282 {{DISPLAYTITLE:screen}}
20283 !! html/php
20284 Screen
20285 <p>this is not the the title
20286 <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>
20287 </p>
20288 !! end
20289
20290 !! test
20291 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20292 !! options
20293 showtitle
20294 title=[[Screen]]
20295 !! config
20296 wgAllowDisplayTitle=false
20297 !! wikitext
20298 this is not the the title
20299 !! html/php
20300 Screen
20301 <p>this is not the the title
20302 </p>
20303 !! end
20304
20305 !! test
20306 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20307 !! options
20308 showtitle
20309 title=[[Screen]]
20310 !! config
20311 wgAllowDisplayTitle=true
20312 wgRestrictDisplayTitle=true
20313 !! wikitext
20314 this is not the the title
20315 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20316 !! html/php
20317 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20318 <p>this is not the the title
20319 </p>
20320 !! end
20321
20322 !! test
20323 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20324 !! options
20325 showtitle
20326 title=[[Screen]]
20327 !! config
20328 wgAllowDisplayTitle=true
20329 wgRestrictDisplayTitle=true
20330 !! wikitext
20331 this is not the the title
20332 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20333 !! html/php
20334 <span style="color: red;">s</span>creen
20335 <p>this is not the the title
20336 </p>
20337 !! end
20338
20339 !! test
20340 Page status indicators: Empty name is invalid
20341 !! options
20342 showindicators
20343 !! wikitext
20344 <indicator name=" "></indicator>
20345 <indicator></indicator>
20346 !! html
20347 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20348 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20349 </p>
20350 !! end
20351
20352 !! test
20353 Page status indicators: Weird syntaxes that are okay
20354 !! options
20355 showindicators
20356 !! wikitext
20357 <indicator name="empty" />
20358 <indicator name="name"></indicator>
20359 !! html
20360 empty=
20361 name=
20362 <p><br />
20363 </p>
20364 !! end
20365
20366 !! test
20367 Page status indicators: Torture test
20368 !! options
20369 showindicators
20370 !! wikitext
20371 <indicator name="01">hello world</indicator>
20372 <indicator name="02">[[Main Page]]</indicator>
20373 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20374 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20375 <indicator name="05">* foo
20376 * bar</indicator>
20377 <indicator name="06"><nowiki>foo</nowiki></indicator>
20378 <indicator name="07"> Preformatted</indicator>
20379 <indicator name="08"><div>Broken tag</indicator>
20380 <indicator name="09">{| class=wikitable
20381 | cell
20382 |}</indicator>
20383 <indicator name="10">Two
20384
20385 paragraphs</indicator>
20386 !! html
20387 01=hello world
20388 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20389 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" />
20390 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>
20391 05=<ul><li> foo</li>
20392 <li> bar</li></ul>
20393
20394 06=foo
20395 07=<pre>Preformatted
20396 </pre>
20397 08=<div>Broken tag</div>
20398
20399 09=<table class="wikitable">
20400 <tr>
20401 <td> cell
20402 </td></tr></table>
20403
20404 10=<p>Two
20405 </p><p>paragraphs
20406 </p>
20407 <p><br />
20408 </p><p><br />
20409 </p><p><br />
20410 </p><p><br />
20411 </p><p><br />
20412 </p>
20413 !! end
20414
20415 !! test
20416 preload: check <noinclude> and <includeonly>
20417 !! options
20418 preload
20419 !! wikitext
20420 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20421 !! html/php
20422 Hello kind world.
20423 !! end
20424
20425 !! test
20426 preload: check <onlyinclude>
20427 !! options
20428 preload
20429 !! wikitext
20430 Goodbye <onlyinclude>Hello world</onlyinclude>
20431 !! html/php
20432 Hello world
20433 !! end
20434
20435 !! test
20436 preload: can pass tags through if we want to
20437 !! options
20438 preload
20439 !! wikitext
20440 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20441 !! html/php
20442 <includeonly>Hello world</includeonly>
20443 !! end
20444
20445 !! test
20446 preload: check that it doesn't try to do tricks
20447 !! options
20448 preload
20449 !! wikitext
20450 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20451 !! html/php
20452 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20453 !! end
20454
20455 !! test
20456 Play a bit with r67090 and bug 3158
20457 !! wikitext
20458 <div style="width:50% !important">&nbsp;</div>
20459 <div style="width:50%&nbsp;!important">&nbsp;</div>
20460 <div style="width:50%&#160;!important">&nbsp;</div>
20461 <div style="border : solid;">&nbsp;</div>
20462 !! html/php
20463 <div style="width:50% !important">&#160;</div>
20464 <div style="width:50% !important">&#160;</div>
20465 <div style="width:50% !important">&#160;</div>
20466 <div style="border&#160;: solid;">&#160;</div>
20467
20468 !! html/parsoid
20469 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20470 <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>
20471 <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>
20472 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20473
20474 !! end
20475
20476 !! test
20477 HTML5 data attributes
20478 !! wikitext
20479 <span data-foo="bar">Baz</span>
20480 <p data-abc-def_hij="">Quuz</p>
20481 !! html
20482 <p><span data-foo="bar">Baz</span>
20483 </p>
20484 <p data-abc-def_hij="">Quuz</p>
20485
20486 !! end
20487
20488 !! test
20489 percent-encoding and + signs in internal links (Bug 26410)
20490 !! wikitext
20491 [[User:+%]] [[Page+title%]]
20492 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20493 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20494 [[%33%45]] [[%33%45+]]
20495 !! html/php
20496 <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>
20497 <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>
20498 <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>
20499 <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>
20500 </p>
20501 !! html/parsoid
20502 <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>
20503 <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>
20504 <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>
20505 <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>
20506 !! end
20507
20508 !! test
20509 Special characters in embedded file links (bug 27679)
20510 !! wikitext
20511 [[File:Contains & ampersand.jpg]]
20512 [[File:Does not exist.jpg|Title with & ampersand]]
20513 !! html/php
20514 <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>
20515 <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>
20516 </p>
20517 !! html/parsoid
20518 <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>
20519 <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>
20520 !! end
20521
20522 !! test
20523 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20524 !! wikitext
20525 Text&apos;s been normalized?
20526 !! html
20527 <p>Text&#39;s been normalized?
20528 </p>
20529 !! end
20530
20531 !! test
20532 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20533 !! wikitext
20534 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20535 !! html
20536 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20537 </p>
20538 !! end
20539
20540 !! test
20541 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20542 !! wikitext
20543 [http://www.example.org/ ideograms]
20544 !! html
20545 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20546 </p>
20547 !! end
20548
20549 !! test
20550 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20551 !! wikitext
20552 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20553 !! html
20554 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20555 </p>
20556 !! end
20557
20558 !! article
20559 Mediawiki:loop1
20560 !! text
20561 {{Identical|A}}
20562 !! endarticle
20563
20564 !! article
20565 Mediawiki:loop2
20566 !! text
20567 {{Identical|B}}
20568 !! endarticle
20569
20570 !! article
20571 Template:Identical
20572 !! text
20573 {{int:loop1}}
20574 {{int:loop2}}
20575 !! endarticle
20576
20577 !! test
20578 Bug 31098 Template which includes system messages which includes the template
20579 !! wikitext
20580 {{Identical}}
20581 !! html
20582 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20583 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20584 </p>
20585 !! end
20586
20587 !! test
20588 Bug31490 Turkish: ucfirst 'blah'
20589 !! options
20590 language=tr
20591 !! wikitext
20592 {{ucfirst:blah}}
20593 !! html
20594 <p>Blah
20595 </p>
20596 !! end
20597
20598 !! test
20599 Bug31490 Turkish: ucfirst 'ix'
20600 !! options
20601 language=tr
20602 !! wikitext
20603 {{ucfirst:ix}}
20604 !! html
20605 <p>İx
20606 </p>
20607 !! end
20608
20609 !! test
20610 Bug31490 Turkish: lcfirst 'BLAH'
20611 !! options
20612 language=tr
20613 !! wikitext
20614 {{lcfirst:BLAH}}
20615 !! html
20616 <p>bLAH
20617 </p>
20618 !! end
20619
20620 !! test
20621 Bug31490 Turkish: ucfırst (with a dotless i)
20622 !! options
20623 language=tr
20624 !! wikitext
20625 {{ucfırst:blah}}
20626 !! html
20627 <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>
20628 </p>
20629 !! end
20630
20631 !! test
20632 Bug31490 ucfırst (with a dotless i) with English language
20633 !! options
20634 language=en
20635 !! wikitext
20636 {{ucfırst:blah}}
20637 !! html
20638 <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>
20639 </p>
20640 !! end
20641
20642 !! test
20643 Bug 26375: TOC with italics
20644 !! options
20645 title=[[Main Page]]
20646 !! wikitext
20647 __TOC__
20648 == ''Lost'' episodes ==
20649 !! html
20650 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20651 <ul>
20652 <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>
20653 </ul>
20654 </div>
20655
20656 <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>
20657
20658 !! end
20659
20660 !! test
20661 Bug 26375: TOC with bold
20662 !! options
20663 title=[[Main Page]]
20664 !! wikitext
20665 __TOC__
20666 == '''should be bold''' then normal text ==
20667 !! html
20668 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20669 <ul>
20670 <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>
20671 </ul>
20672 </div>
20673
20674 <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>
20675
20676 !! end
20677
20678 !! test
20679 Bug 33845: Headings become cursive in TOC when they contain an image
20680 !! options
20681 title=[[Main Page]]
20682 !! wikitext
20683 __TOC__
20684 == Image [[Image:foobar.jpg]] ==
20685 !! html
20686 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20687 <ul>
20688 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20689 </ul>
20690 </div>
20691
20692 <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>
20693
20694 !! end
20695
20696 !! test
20697 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20698 !! options
20699 title=[[Main Page]]
20700 !! wikitext
20701 __TOC__
20702 == <blockquote>Quote</blockquote> ==
20703 !! html
20704 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20705 <ul>
20706 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20707 </ul>
20708 </div>
20709
20710 <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>
20711
20712 !! html+tidy
20713 <p></p>
20714 <div id="toc" class="toc">
20715 <div id="toctitle">
20716 <h2>Contents</h2>
20717 </div>
20718 <ul>
20719 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20720 </ul>
20721 </div>
20722 <p></p>
20723 <h2><span class="mw-headline" id="Quote"></span></h2>
20724 <blockquote>
20725 <p><span class="mw-headline" id="Quote">Quote</span></p>
20726 </blockquote>
20727 <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>
20728 !! end
20729
20730 !! test
20731 Unclosed tags in TOC
20732 !! options
20733 title=[[Main Page]]
20734 !! wikitext
20735 __TOC__
20736 == Proof: 2 < 3 ==
20737 <small>Hanc marginis exiguitas non caperet.</small>
20738 QED
20739 !! html
20740 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20741 <ul>
20742 <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>
20743 </ul>
20744 </div>
20745
20746 <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>
20747 <p><small>Hanc marginis exiguitas non caperet.</small>
20748 QED
20749 </p>
20750 !! end
20751
20752 !! test
20753 Multiple tags in TOC
20754 !! wikitext
20755 __TOC__
20756 == <i>Foo</i> <b>Bar</b> ==
20757
20758 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20759 !! html
20760 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20761 <ul>
20762 <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>
20763 <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>
20764 </ul>
20765 </div>
20766
20767 <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>
20768 <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>
20769
20770 !! html+tidy
20771 <p></p>
20772 <div id="toc" class="toc">
20773 <div id="toctitle">
20774 <h2>Contents</h2>
20775 </div>
20776 <ul>
20777 <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>
20778 <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>
20779 </ul>
20780 </div>
20781 <p></p>
20782 <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>
20783 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20784 <blockquote>
20785 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20786 </blockquote>
20787 <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>
20788 !! end
20789
20790 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20791 # html5 tag parsing.
20792 !! test
20793 Tags with parameters in TOC
20794 !! options
20795 parsoid=wt2html
20796 !! wikitext
20797 __TOC__
20798 == <sup class="in-h2">Hello</sup> ==
20799
20800 == <sup class="a > b">Evilbye</sup> ==
20801 !! html/php
20802 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20803 <ul>
20804 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20805 <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>
20806 </ul>
20807 </div>
20808
20809 <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>
20810 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20811
20812 !! html/parsoid
20813 <meta property="mw:PageProp/toc" />
20814 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
20815
20816 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
20817 !! end
20818
20819 !! test
20820 span tags with directionality in TOC
20821 !! wikitext
20822 __TOC__
20823 == <span dir="ltr">C++</span> ==
20824
20825 == <span dir="rtl">זבנג!</span> ==
20826
20827 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20828
20829 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20830
20831 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20832 !! html
20833 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20834 <ul>
20835 <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>
20836 <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>
20837 <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>
20838 <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>
20839 <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>
20840 </ul>
20841 </div>
20842
20843 <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>
20844 <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>
20845 <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>
20846 <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>
20847 <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>
20848
20849 !! end
20850
20851 !! test
20852 Bug 72884: bdi element in ToC
20853 !! wikitext
20854 __TOC__
20855 == <bdi>test</bdi> ==
20856 !! html
20857 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20858 <ul>
20859 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20860 </ul>
20861 </div>
20862
20863 <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>
20864
20865 !! end
20866
20867 # Note that the html output does not have the <p></p>, but the
20868 # html+tidy output *does*. This is because the empty <p></p> is
20869 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20870 !! test
20871 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20872 !! wikitext
20873 __TOC__
20874 == x ==
20875 !! html
20876 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20877 <ul>
20878 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20879 </ul>
20880 </div>
20881
20882 <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>
20883
20884 !! html+tidy
20885 <p></p>
20886 <div id="toc" class="toc">
20887 <div id="toctitle">
20888 <h2>Contents</h2>
20889 </div>
20890 <ul>
20891 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20892 </ul>
20893 </div>
20894 <p></p>
20895 <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>
20896 !! end
20897
20898 !! article
20899 MediaWiki:Bug32057
20900 !! text
20901 == {{int:headline_sample}} ==
20902 !! endarticle
20903
20904 !! test
20905 Bug 32057: Title needed when expanding <h> nodes.
20906 !! options
20907 title=[[Main Page]]
20908 !! wikitext
20909 {{int:Bug32057}}
20910 !! html
20911 <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>
20912
20913 !! end
20914
20915 !! test
20916 Strip marker in urlencode
20917 !! wikitext
20918 {{urlencode:x<nowiki/>y}}
20919 {{urlencode:x<nowiki/>y|wiki}}
20920 {{urlencode:x<nowiki/>y|path}}
20921 {{urlencode:x<pre id="one">two</pre>y}}
20922 !! html
20923 <p>xy
20924 xy
20925 xy
20926 xy
20927 </p>
20928 !! end
20929
20930 !! test
20931 Strip marker in lc
20932 !! wikitext
20933 {{lc:x<nowiki/>y}}
20934 !! html
20935 <p>xy
20936 </p>
20937 !! end
20938
20939 !! test
20940 Strip marker in uc
20941 !! wikitext
20942 {{uc:x<nowiki/>y}}
20943 !! html
20944 <p>XY
20945 </p>
20946 !! end
20947
20948 !! test
20949 Strip marker in formatNum
20950 !! wikitext
20951 {{formatnum:1<nowiki/>2}}
20952 {{formatnum:1<nowiki/>2|R}}
20953 !! html
20954 <p>12
20955 12
20956 </p>
20957 !! end
20958
20959 !! test
20960 Check noCommafy in formatNum
20961 !! options
20962 language=be-tarask
20963 !! wikitext
20964 {{formatnum:123456.78}}
20965 {{formatnum:123456.78|NOSEP}}
20966 !! html
20967 <p>123 456,78
20968 123456.78
20969 </p>
20970 !! end
20971
20972 !! test
20973 Wrong option for formatNum (bug 56199)
20974 !! wikitext
20975 {{formatnum:1,234.56|Random}}
20976 {{formatnum:1,234.56|EVERYTHING}}
20977 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20978 !! html
20979 <p>1,234.56
20980 1,234.56
20981 1,234.56
20982 </p>
20983 !! end
20984
20985 !! test
20986 Strip marker in grammar
20987 !! options
20988 language=fi
20989 !! wikitext
20990 {{grammar:elative|foo<nowiki/>bar}}
20991 !! html
20992 <p>foobarista
20993 </p>
20994 !! end
20995
20996 !! test
20997 Strip marker in padleft
20998 !! wikitext
20999 {{padleft:|2|x<nowiki/>y}}
21000 !! html
21001 <p>xy
21002 </p>
21003 !! end
21004
21005 !! test
21006 Strip marker in padright
21007 !! wikitext
21008 {{padright:|2|x<nowiki/>y}}
21009 !! html
21010 <p>xy
21011 </p>
21012 !! end
21013
21014 !! test
21015 Strip marker in anchorencode
21016 !! wikitext
21017 {{anchorencode:x<nowiki/>y}}
21018 !! html
21019 <p>xy
21020 </p>
21021 !! end
21022
21023 !! test
21024 nowiki inside link inside heading (bug 18295)
21025 !! wikitext
21026 ==[[foo|x<nowiki>y</nowiki>z]]==
21027 !! html
21028 <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>
21029
21030 !! end
21031
21032 !! test
21033 new support for bdi element (bug 31817)
21034 !! wikitext
21035 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21036 !! html
21037 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21038
21039 !!end
21040
21041 !! test
21042 Ignore pipe between table row attributes
21043 !! wikitext
21044 {|
21045 | quux
21046 |- id=foo | style='color: red'
21047 | bar
21048 |}
21049 !! html
21050 <table>
21051 <tr>
21052 <td> quux
21053 </td></tr>
21054 <tr id="foo" style="color: red">
21055 <td> bar
21056 </td></tr></table>
21057
21058 !! end
21059
21060 !!test
21061 Gallery override link with WikiLink (bug 34852)
21062 !! wikitext
21063 <gallery>
21064 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21065 </gallery>
21066 !! html
21067 <ul class="gallery mw-gallery-traditional">
21068 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21069 <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>
21070 <div class="gallerytext">
21071 <p>caption
21072 </p>
21073 </div>
21074 </div></li>
21075 </ul>
21076
21077 !! end
21078
21079 !!test
21080 Gallery override link with absolute external link (bug 34852)
21081 !! wikitext
21082 <gallery>
21083 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21084 </gallery>
21085 !! html
21086 <ul class="gallery mw-gallery-traditional">
21087 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21088 <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>
21089 <div class="gallerytext">
21090 <p>caption
21091 </p>
21092 </div>
21093 </div></li>
21094 </ul>
21095
21096 !! end
21097
21098 !!test
21099 Gallery override link with malicious javascript (bug 34852)
21100 !! wikitext
21101 <gallery>
21102 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21103 </gallery>
21104 !! html
21105 <ul class="gallery mw-gallery-traditional">
21106 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21107 <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>
21108 <div class="gallerytext">
21109 <p>caption
21110 </p>
21111 </div>
21112 </div></li>
21113 </ul>
21114
21115 !! end
21116
21117 !!test
21118 Gallery with invalid title as link (bug 43964)
21119 !! wikitext
21120 <gallery>
21121 File:foobar.jpg|link=<
21122 </gallery>
21123 !! html
21124 <ul class="gallery mw-gallery-traditional">
21125 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21126 <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>
21127 <div class="gallerytext">
21128 </div>
21129 </div></li>
21130 </ul>
21131
21132 !! end
21133
21134 !!test
21135 Language parser function
21136 !! wikitext
21137 {{#language:ar}}
21138 !! html
21139 <p>العربية
21140 </p>
21141 !! end
21142
21143 !!test
21144 Padleft and padright as substr
21145 !! wikitext
21146 {{padleft:|3|abcde}}
21147 {{padright:|3|abcde}}
21148 !! html
21149 <p>abc
21150 abc
21151 </p>
21152 !! end
21153
21154 !!test
21155 Special parser function
21156 !! wikitext
21157 {{#special:RandomPage}}
21158 {{#special:BaDtItLe}}
21159 {{#special:Foobar}}
21160 !! html
21161 <p>Special:Random
21162 Special:Badtitle
21163 Special:Foobar
21164 </p>
21165 !! end
21166
21167 !!test
21168 Bug 34939 - Case insensitive link parsing ([HttP://])
21169 !! wikitext
21170 [HttP://MediaWiki.Org/]
21171 !! html/php
21172 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21173 </p>
21174 !! html/parsoid
21175 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21176 !! end
21177
21178 !!test
21179 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21180 !! wikitext
21181 [HttP://MediaWiki.Org/ MediaWiki]
21182 !! html
21183 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21184 </p>
21185 !! end
21186
21187 !!test
21188 Bug 34939 - Case insensitive link parsing (HttP://)
21189 !! wikitext
21190 HttP://MediaWiki.Org/
21191 !! html/php
21192 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21193 </p>
21194 !! html/parsoid
21195 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21196 !! end
21197
21198 !!test
21199 Disable TOC
21200 !! options
21201 notoc
21202 !! wikitext
21203 Lead
21204 == Section 1 ==
21205 == Section 2 ==
21206 == Section 3 ==
21207 == Section 4 ==
21208 == Section 5 ==
21209 !! html
21210 <p>Lead
21211 </p>
21212
21213 <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>
21214 <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>
21215 <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>
21216 <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>
21217 <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>
21218
21219 !! end
21220
21221
21222 ###
21223 ### Parsoid-specific tests
21224 ### Parsoid-PHP parser incompatibilities
21225 ###
21226 !!test
21227 1. SOL-sensitive wikitext tokens as template-args
21228 !!options
21229 parsoid=wt2html,wt2wt
21230 !! wikitext
21231 {{echo|*a}}
21232 {{echo|#a}}
21233 {{echo|:a}}
21234 !! html
21235 <span about="#mwt1" typeof="mw:Transclusion">
21236 </span><ul about="#mwt1"><li>a</li>
21237 </ul>
21238 <span about="#mwt2" typeof="mw:Transclusion">
21239 </span><ol about="#mwt2"><li>a</li>
21240 </ol>
21241 <span about="#mwt3" typeof="mw:Transclusion">
21242 </span><dl about="#mwt3"><dd>a</dd>
21243 </dl>
21244 !!end
21245
21246 #### -----------------------------------------------------------------
21247 #### Parsoid-specific functionality tests
21248 #### -----------------------------------------------------------------
21249
21250 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21251 # We know wt2wt will fail, but we expect selser to pass.
21252 # Due to the nature of our testing, wt2wt and selser tests will enter the
21253 # blacklist and we'll catch selser regressions based on changes to the
21254 # blacklist entries for selser tests.
21255 !! test
21256 1. Bad treebuilder fixup of formatting elt is cleaned up
21257 !! options
21258 parsoid=wt2html,wt2wt
21259 !! wikitext
21260 {|
21261 |
21262 <small>
21263 [[Image:Foobar.jpg|right|Test]]
21264 </small>
21265 |}
21266 !! html/parsoid
21267 <table>
21268 <tbody><tr><td>
21269 <small>
21270 <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>
21271 </small>
21272 </td></tr>
21273 </tbody></table>
21274 !! end
21275
21276 !! test
21277 2. Bad treebuilder fixup of formatting elt is cleaned up
21278 !! options
21279 parsoid=wt2html,wt2wt
21280 !! wikitext
21281 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21282
21283 <small>[[Image:Foobar.jpg|right|300px]]</small>
21284 !! html/parsoid
21285
21286 <p><b>foo</b></p>
21287 <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>
21288 <p><b>bar</b></p>
21289 <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>
21290 !! end
21291
21292 !! test
21293 3. Bad treebuilder fixup of formatting elt is cleaned up
21294 !! options
21295 parsoid=wt2html,wt2wt
21296 !! wikitext
21297 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21298 !! html/parsoid
21299 <p><small><b>foo</b></small></p>
21300 <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>
21301 <p><small><b>bar</b></small></p>
21302 !! end
21303
21304 !! test
21305 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21306 !! options
21307 parsoid=wt2html,wt2wt
21308 !! wikitext
21309 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21310 !! html/parsoid
21311 <p><b><small></small></b></p>
21312 <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>
21313 <p></p>
21314 !! end
21315
21316 #### ----------------------------------------------------------------
21317 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21318 #### tags. Parsoid's output for these tags differs from that of the
21319 #### PHP parser.
21320 #### ----------------------------------------------------------------
21321
21322 !!test
21323 Ref: 1. ref-location should be replaced with an index span
21324 !!options
21325 parsoid
21326 !! wikitext
21327 A <ref>foo</ref>
21328 B <ref name="x">foo</ref>
21329 C <ref name="y" />
21330 <references />
21331 !! html
21332 <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>
21333 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>
21334 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>
21335 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21336 <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>
21337 <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>
21338 <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>
21339 </ol>
21340 !!end
21341
21342 !!test
21343 Ref: 2. ref-tags with identical names should all get the same index
21344 !!options
21345 parsoid
21346 !! wikitext
21347 A <ref name="x">foo</ref>
21348 B <ref name="x" />
21349 <references />
21350 !! html
21351 <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>
21352 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>
21353 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21354 <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>
21355 </ol>
21356 !!end
21357
21358 !!test
21359 Ref: 3. spaces in ref-names should be ignored
21360 !!options
21361 parsoid
21362 !! wikitext
21363 A <ref name="x">foo</ref>
21364 B <ref name=" x " />
21365 C <ref name= x />
21366 <references />
21367 !! html
21368 <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>
21369 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>
21370 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>
21371 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21372 <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>
21373 </ol>
21374 !!end
21375
21376 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21377 !!test
21378 Ref: 4. 'constructor' should be accepted as a valid ref-name
21379 !!options
21380 parsoid
21381 !! wikitext
21382 A <ref name="constructor">foo</ref>
21383 <references />
21384 !! html
21385 <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>
21386 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21387 <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>
21388 </ol>
21389 !!end
21390
21391 !!test
21392 Ref: 5. body should accept generic wikitext
21393 !!options
21394 parsoid
21395 !! wikitext
21396 A <ref>
21397 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21398 </ref>
21399
21400 <references />
21401 !! html
21402 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21403
21404 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21405 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">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>
21406 </span></li>
21407 </ol>
21408 !!end
21409
21410 !!test
21411 Ref: 6. indent-pres should not be output in ref-body
21412 !!options
21413 parsoid
21414 !! wikitext
21415 A <ref>
21416 foo
21417 bar
21418 baz
21419 </ref>
21420
21421 <references />
21422 !! html
21423 <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>
21424
21425 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21426 <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
21427 bar
21428 baz
21429 </span></li>
21430 </ol>
21431 !!end
21432
21433 !!test
21434 Ref: 7. No p-wrapping in ref-body
21435 !!options
21436 parsoid
21437 !! wikitext
21438 A <ref>
21439 foo
21440
21441 bar
21442
21443
21444 baz
21445
21446
21447
21448 booz
21449 </ref>
21450
21451 <references />
21452 !! html
21453 <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>
21454
21455 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21456 <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
21457
21458 bar
21459
21460
21461 baz
21462
21463
21464
21465 booz
21466 </span></li>
21467 </ol>
21468 !!end
21469
21470 !!test
21471 Ref: 8. transclusion wikitext has lower precedence
21472 !!options
21473 parsoid
21474 !! wikitext
21475 A <ref> foo {{echo|</ref> B C}}
21476
21477 <references />
21478 !! html
21479 <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>
21480 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21481 <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>
21482 </ol>
21483 !!end
21484
21485 !!test
21486 Ref: 9. unclosed comments should not leak out of ref-body
21487 !!options
21488 parsoid
21489 !! wikitext
21490 A <ref> foo <!--</ref> B C
21491 <references />
21492 !! html
21493 <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>
21494 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21495 <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>
21496 </ol>
21497 !!end
21498
21499 !!test
21500 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21501 !!options
21502 parsoid
21503 !! wikitext
21504 A <ref> <b> foo </ref> B C
21505
21506 <references />
21507 !! html
21508 <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>
21509
21510
21511 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21512 <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>
21513 </ol>
21514 !!end
21515
21516 !!test
21517 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21518 !!options
21519 parsoid
21520 !! wikitext
21521 A <ref>foo</ref> B
21522 C <ref>bar</ref> D
21523 <references />
21524 !! html
21525 <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
21526 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>
21527 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21528 <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>
21529 <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>
21530 </ol>
21531 !!end
21532
21533 !!test
21534 Ref: 12. ref-tags act as trailing newline migration barrier
21535 !! wikitext
21536 <!--the newline at the end of this line moves out of the p tag-->a
21537
21538 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21539 <ref />
21540
21541 c
21542 <references />
21543 !! html/parsoid
21544 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21545
21546
21547 <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>
21548 <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>
21549
21550 <p>c</p>
21551 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21552 <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>
21553 <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>
21554 !!end
21555
21556 !!test
21557 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21558 !!options
21559 parsoid
21560 !! wikitext
21561 <ref>foo</ref> A
21562 <ref>bar
21563 </ref> B
21564 <references />
21565 !! html
21566 <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
21567 <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>
21568 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21569 <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>
21570 <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
21571 </span></li>
21572 </ol>
21573 !!end
21574
21575 !!test
21576 Ref: 14. A nested ref-tag should be emitted as plain text
21577 !!options
21578 parsoid
21579 !! wikitext
21580 <ref>foo <ref>bar</ref> baz</ref>
21581
21582 <references />
21583 !! html
21584 <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>
21585 </p>
21586 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21587 <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>
21588 </ol>
21589 !!end
21590
21591 !!test
21592 Ref: 15. ref-tags with identical names should get identical indexes
21593 !!options
21594 parsoid
21595 !! wikitext
21596 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21597 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21598
21599 <references />
21600 !! html
21601 <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>
21602 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>
21603
21604 <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>
21605 </ol>
21606 !!end
21607
21608 ## We don't bother wt2wt-ing non-standard whitespace
21609 !!test
21610 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21611 !!options
21612 parsoid=wt2html
21613 !! wikitext
21614 A <ref >foo</ref >
21615
21616 <references />
21617 !! html
21618 <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>
21619 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21620 <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>
21621 !!end
21622
21623 !!test
21624 Ref: 17. Generate valid HTML5 id/about attributes
21625 !!options
21626 parsoid
21627 !!wikitext
21628 <ref name="a b">foo</ref>
21629
21630 <references />
21631 !!html
21632 <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>
21633 </p>
21634
21635 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21636 <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>
21637 </ol>
21638 !!end
21639
21640 !!test
21641 Ref: 18. T58916: Extension attributes should be parsed as plain text
21642 !!options
21643 parsoid
21644 !!wikitext
21645 <ref name="{{echo|a}}">foo</ref>
21646
21647 <references />
21648 !!html
21649 <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>
21650 </p>
21651
21652 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21653 <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>
21654 </ol>
21655 !!end
21656
21657 !!test
21658 Ref: 19. ref-tags with identical name encodings should get identical indexes
21659 !!options
21660 parsoid
21661 !! wikitext
21662 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21663
21664 <references />
21665 !! html
21666 <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>
21667 </p>
21668 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21669 <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>
21670 </ol>
21671 !!end
21672
21673 !!test
21674 Ref: 20. ref-tags with identical names but different content should keep it
21675 !!options
21676 parsoid
21677 !! wikitext
21678 A <ref name="foo">Foo one</ref>
21679 B <ref name="foo">Foo two</ref>
21680 C <ref name="foo" />
21681
21682 <references />
21683 !! html
21684 <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>
21685 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>
21686 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>
21687
21688 <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>
21689 </ol>
21690 !!end
21691
21692 !!test
21693 References: 1. references tag without any refs should be handled properly
21694 !! wikitext
21695 <references />
21696 !! html/parsoid
21697 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21698 !!end
21699
21700 !!test
21701 References: 2. references tag with group only outputs references from that group
21702 !! wikitext
21703 A <ref group="a">foo</ref>
21704 B <ref group="b">bar</ref>
21705 C <ref>baz</ref>
21706
21707 <references group="a" />
21708 <references />
21709 <references group="b" />
21710 !! html/parsoid
21711 <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>
21712 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>
21713 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>
21714
21715 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21716 <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>
21717 </ol>
21718 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21719 <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>
21720 </ol>
21721 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21722 <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>
21723 </ol>
21724 !!end
21725
21726 !!test
21727 References: 3. ref list should be cleared after processing references
21728 !! wikitext
21729 A <ref>foo</ref>
21730
21731 <references />
21732
21733 B <ref>bar</ref>
21734
21735 <references />
21736 !! html/parsoid
21737 <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>
21738
21739 <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>
21740 </ol>
21741
21742 <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>
21743
21744 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21745 <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>
21746 </ol>
21747 !!end
21748
21749 !!test
21750 References: 4. only referenced group should be cleared after processing references
21751 !! wikitext
21752 A <ref group="a">afoo</ref>
21753 B <ref>bfoo</ref>
21754
21755 <references group="a" />
21756
21757 C <ref>cfoo</ref>
21758
21759 <references />
21760 !! html/parsoid
21761 <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>
21762 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>
21763
21764 <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>
21765 </ol>
21766
21767 <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>
21768
21769 <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>
21770 </ol>
21771 !!end
21772
21773 !!test
21774 References: 5. ref tags in references should be processed while ignoring all other content
21775 !! wikitext
21776 A <ref name="a" />
21777 B <ref name="b">bar</ref>
21778
21779 <references>
21780 <ref name="a">foo</ref>
21781 This should just get lost.
21782 </references>
21783 !! html/parsoid
21784 <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>
21785 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>
21786
21787
21788 <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>
21789 </ol>
21790 !!end
21791
21792 !!test
21793 References: 6. <references /> from a transclusion
21794 !! wikitext
21795 <ref>Foo</ref> {{echo|<references />}}
21796 !! html/parsoid
21797 <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>
21798 </ol>
21799 !!end
21800
21801 !! test
21802 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21803 !! wikitext
21804 A <ref>foo bar for a</ref>
21805 B <ref group="X" name="b" />
21806
21807 <references />
21808
21809 <references group="X">
21810 <ref name="b">foo</ref>
21811 </references>
21812 !! html/parsoid
21813 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21814 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>
21815 </p>
21816
21817 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21818 <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>
21819 </ol>
21820
21821 <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"}}'>
21822 <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>
21823 </ol>
21824 !! end
21825
21826 !! test
21827 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21828 !! wikitext
21829 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21830 <references />
21831 !! html/parsoid
21832 <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>
21833 <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>
21834 </ol>
21835 !!end
21836
21837 # This test only works in wt2html now as the <references /> are always generated
21838 # unless selser is active. Once T72722 is fixed, we should add a changes test
21839 # here to ensure that unrelated changes don't add the new <references /> in
21840 # wt2wt.
21841 !! test
21842 References: 9. Generate missing references list at the end
21843 !! wikitext
21844 A <ref>foo</ref>
21845 B <ref group="inexistent">bar</ref>
21846 !! html/parsoid
21847 <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>
21848 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21849 <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>
21850 </ol>
21851 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21852 <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>
21853 </ol>
21854 !! end
21855
21856 !! test
21857 References: 10. New <references/> shouldn't be added for unrelated edits.
21858 !! options
21859 parsoid={
21860 "modes": ["selser"],
21861 "changes": [["#x", "remove"]],
21862 "selser": "noauto"
21863 }
21864 !! wikitext
21865 Unrelated text<span id="x"> that's going to disappear</span>.
21866 A <ref>foo</ref>
21867 !! wikitext/edited
21868 Unrelated text.
21869 A <ref>foo</ref>
21870 !!end
21871
21872 !! test
21873 Entities in ref name
21874 !! wikitext
21875 <ref name="test &amp; me">hi</ref>
21876 <references />
21877 !! html/parsoid
21878 <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>
21879 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21880 <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>
21881 </ol>
21882 !! end
21883
21884 # This test is wt2html only because we're permitting the serializer to produce
21885 # dirty diffs, normalizing the unclosed references to the self-closed version.
21886 !! test
21887 Generate references for unclosed references tag
21888 !! options
21889 parsoid=wt2html
21890 !! wikitext
21891 a<ref>foo</ref>
21892
21893 <references>
21894 !! html/parsoid
21895 <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>
21896 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21897 <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>
21898 !! end
21899
21900 !! test
21901 New reference serializes on its own line
21902 !! options
21903 parsoid=wt2wt,html2wt
21904 !! wikitext
21905 foo
21906 <references />
21907 !! html/parsoid
21908 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21909 !! end
21910
21911 #### ----------------------------------------------------------------
21912 #### Parsoid-only testing of Parsoid's impl of LST
21913 #### Not implemented yet, see
21914 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21915 #### ----------------------------------------------------------------
21916
21917 !!test
21918 LST Sections: 1. Simple section start and end
21919 !! wikitext
21920 <section begin="2011-05-16" />
21921 <section end="2014-04-10 (MW 1.23wmf22)" />
21922 !! html/parsoid
21923 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21924 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21925 !! end
21926
21927 #--------- Test stripping of empty nodes in template content ----------
21928 !!test
21929 Empty LI and TR nodes should be stripped from template content
21930 !!wikitext
21931 {{EmptyLITest}}
21932 {{EmptyTRTest}}
21933 !!html/parsoid
21934 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21935 <li>a</li>
21936 <li>b</li>
21937 </ul>
21938 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21939 <tbody>
21940 <tr>
21941 <td>foo</td>
21942 </tr>
21943 <tr>
21944 <td>bar</td>
21945 </tr>
21946 </tbody>
21947 </table>
21948 !!end
21949
21950 !!test
21951 Empty LI and TR nodes should not be stripped from top-level content
21952 !!wikitext
21953 * a
21954 *
21955 * b
21956 {|
21957 |-
21958 |-
21959 |foo
21960 |}
21961 !!html/parsoid
21962 <ul>
21963 <li> a</li>
21964 <li></li>
21965 <li> b</li>
21966 </ul>
21967 <table>
21968 <tbody>
21969 <tr></tr>
21970 <tr>
21971 <td>foo</td>
21972 </tr>
21973 </tbody>
21974 </table>
21975 !!end
21976
21977 !!test
21978 Empty TR nodes should not be stripped if they have any attributes set
21979 !!wikitext
21980 {{EmptyTRWithHTMLAttrTest}}
21981 !!html/parsoid
21982 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21983 <tr align="center"></tr>
21984 <tr><td>foo</td></tr>
21985 <tr align="center"></tr>
21986 <tr><td>bar</td></tr>
21987 </table>
21988 !!end
21989
21990 #### ----------------------------------------------------------------
21991 #### The following section of tests are primarily to test
21992 #### wikitext escaping capabilities of Parsoid. Given that
21993 #### escaping can be done any number of ways, the wikitext (input)
21994 #### is always adjusted to reflect how Parsoid adds nowiki
21995 #### escape tags.
21996 ####
21997 #### We are marking several tests as parsoid-only since the
21998 #### HTML in the result section is different from what the
21999 #### PHP parser generates for it.
22000 #### ----------------------------------------------------------------
22001
22002
22003 #### --------------- Headings ---------------
22004 #### 0. Unnested
22005 #### 1. Nested inside html <h1>=foo=</h1>
22006 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22007 #### 3. Nested inside html with wikitext split by html tags
22008 #### 4. No escape needed
22009 #### 5. Empty headings <h1></h1>
22010 #### 6. Heading chars in SOL context
22011 #### ----------------------------------------
22012 !! test
22013 Headings: 0. Unnested
22014 !! options
22015 parsoid=html2wt
22016 !! html/parsoid
22017 <p>=foo=</p>
22018
22019 <p> =foo=
22020 <!--cmt-->
22021 =foo=</p>
22022
22023 <p>=foo<i>a</i>=</p>
22024 !! wikitext
22025 <nowiki>=foo=</nowiki>
22026
22027 <nowiki> </nowiki>=foo=
22028 <!--cmt-->
22029 <nowiki>=foo=</nowiki>
22030
22031 =foo''a''<nowiki>=</nowiki>
22032 !!end
22033
22034 # New headings and existing headings are handled differently
22035 !! test
22036 Headings: 1. Nested inside html
22037 !! options
22038 parsoid=html2wt
22039 !! html/parsoid
22040 <h1>=foo=</h1>
22041 <h2>=foo=</h2>
22042 <h3>=foo=</h3>
22043
22044 <h1 data-parsoid=''>=foo=</h1>
22045 <h2 data-parsoid=''>=foo=</h2>
22046 <h3 data-parsoid=''>=foo=</h3>
22047 <h4 data-parsoid=''>=foo=</h4>
22048 <h5 data-parsoid=''>=foo=</h5>
22049 <h6 data-parsoid=''>=foo=</h6>
22050 !! wikitext
22051 = =foo= =
22052
22053 == =foo= ==
22054
22055 === =foo= ===
22056
22057 =<nowiki>=foo=</nowiki>=
22058 ==<nowiki>=foo=</nowiki>==
22059 ===<nowiki>=foo=</nowiki>===
22060 ====<nowiki>=foo=</nowiki>====
22061 =====<nowiki>=foo=</nowiki>=====
22062 ======<nowiki>=foo=</nowiki>======
22063
22064 !!end
22065
22066 !! test
22067 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22068 !! options
22069 parsoid=html2wt
22070 !! html/parsoid
22071 <h1>foo</h1>*bar
22072 <h1>foo</h1>=bar
22073 <h1>foo</h1>=bar=
22074 !! wikitext
22075 = foo =
22076 <nowiki>*</nowiki>bar
22077
22078 = foo =
22079 =bar
22080
22081 = foo =
22082 <nowiki>=bar=</nowiki>
22083 !!end
22084
22085 !! test
22086 Headings: 3. Nested inside html with wikitext split by html tags
22087 !! options
22088 parsoid=html2wt
22089 !! html/parsoid
22090 <h1>=<b>bold</b>foo=</h1>
22091 !! wikitext
22092 = ='''bold'''<nowiki>foo=</nowiki> =
22093 !!end
22094
22095 !! test
22096 Headings: 4a. No escaping needed (testing just h1 and h2)
22097 !! options
22098 parsoid=html2wt
22099 !! html/parsoid
22100 <h1>=foo</h1>
22101 <h1>foo=</h1>
22102 <h1> =foo= </h1>
22103 <h1>=foo= bar</h1>
22104 <h2>=foo</h2>
22105 <h2>foo=</h2>
22106 <h1>=</h1>
22107 <h1><i>=</i>foo=</h1>
22108 !! wikitext
22109 = =foo =
22110
22111 = foo= =
22112
22113 = =foo= =
22114
22115 = =foo= bar =
22116
22117 == =foo ==
22118
22119 == foo= ==
22120
22121 = = =
22122
22123 = ''=''foo= =
22124 !!end
22125
22126 !! test
22127 Headings: 4b. No escaping needed (inside p-tags)
22128 !! options
22129 parsoid=html2wt
22130 !! html/parsoid
22131 <p>===
22132 =foo= x
22133 =foo= <s></s>
22134 </p>
22135 !! wikitext
22136 ===
22137 =foo= x
22138 =foo= <s></s>
22139 !!end
22140
22141 !! test
22142 Headings: 5. Empty headings
22143 !! options
22144 parsoid=html2wt
22145 !! html/parsoid
22146 <h1 data-parsoid='{}'></h1>
22147
22148 <h2 data-parsoid='{}'></h2>
22149
22150 <h3 data-parsoid='{}'></h3>
22151
22152 <h4 data-parsoid='{}'></h4>
22153
22154 <h5 data-parsoid='{}'></h5>
22155
22156 <h6 data-parsoid='{}'></h6>
22157 !! wikitext
22158 =<nowiki/>=
22159
22160 ==<nowiki/>==
22161
22162 ===<nowiki/>===
22163
22164 ====<nowiki/>====
22165
22166 =====<nowiki/>=====
22167
22168 ======<nowiki/>======
22169 !!end
22170
22171 !! test
22172 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22173 !! options
22174 parsoid=html2wt
22175 !! html/parsoid
22176 <p>=a=</p>
22177
22178 <p>=a=</p>
22179
22180 <p>=a=</p>
22181 !! wikitext
22182 <nowiki>=a=</nowiki>
22183
22184 <nowiki>=a=</nowiki>
22185
22186 <nowiki>=a=</nowiki>
22187 !!end
22188
22189 !! test
22190 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22191 !! options
22192 parsoid=html2wt
22193 !! html/parsoid
22194 <p>=a=
22195 b</p>
22196
22197 <p>=a=
22198 b</p>
22199
22200 <p>=a=
22201 b</p>
22202 !! wikitext
22203 <nowiki>=a=</nowiki>
22204 b
22205
22206 <nowiki>=a=</nowiki>
22207 b
22208
22209 <nowiki>=a=</nowiki>
22210 b
22211 !!end
22212
22213 !! test
22214 Headings: 6c. Heading chars in SOL context (leading newline break)
22215 !! options
22216 parsoid=html2wt
22217 !! html/parsoid
22218 <p>a
22219 =b=</p>
22220 !! wikitext
22221 a
22222 <nowiki>=b=</nowiki>
22223 !!end
22224
22225 !! test
22226 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22227 !! options
22228 parsoid=html2wt
22229 !! html/parsoid
22230 <!--c0--><p>=a=</p>
22231
22232 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22233 !! wikitext
22234 <!--c0--><nowiki>=a=</nowiki>
22235
22236 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22237 !!end
22238
22239 !! test
22240 Headings: 6d. Heading chars in SOL context (No escaping needed)
22241 !! options
22242 parsoid=html2wt
22243 !! html/parsoid
22244 =a=<div>b</div>
22245 !! wikitext
22246 =a=<div>b</div>
22247 !!end
22248
22249 !! test
22250 Headings: 7. Insert a newline between new content and headings
22251 !! options
22252 parsoid=html2wt
22253 !! html/parsoid
22254 <h2>NEW</h2>
22255 <p>new</p>
22256 <h2 data-parsoid='{}'>A</h2>
22257 <p data-parsoid='{}'>a</p>
22258 !! wikitext
22259 == NEW ==
22260 new
22261
22262 ==A==
22263 a
22264
22265 !! end
22266
22267 #### --------------- Lists ---------------
22268 #### 0. Outside nests (*foo, etc.)
22269 #### 1. Nested inside html <ul><li>*foo</li></ul>
22270 #### 2. Inside definition lists
22271 #### 3. Only bullets at start should be escaped
22272 #### 4. No escapes needed
22273 #### 5. No unnecessary escapes
22274 #### 6. Escape bullets in SOL position
22275 #### 7. Escape bullets in a multi-line context
22276 #### ----------------------------------------
22277
22278 !! test
22279 Lists: 0. Outside nests
22280 !! options
22281 parsoid=html2wt
22282 !! html/parsoid
22283 <p>*foo</p>
22284
22285 <p>#foo</p>
22286
22287 <p>;Foo:bar</p>
22288 !! wikitext
22289 <nowiki>*</nowiki>foo
22290
22291 <nowiki>#</nowiki>foo
22292
22293 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22294 !!end
22295
22296 !! test
22297 Lists: 1. Nested inside html
22298 !! options
22299 parsoid=html2wt
22300 !! html/parsoid
22301 <ul><li>*foo</li></ul>
22302 <ul><li>#foo</li></ul>
22303 <ul><li>:foo</li></ul>
22304 <ul><li>;foo</li></ul>
22305 <ol><li>*foo</li></ol>
22306 <ol><li>#foo</li></ol>
22307 <ol><li>:foo</li></ol>
22308 <ol><li>;foo</li></ol>
22309
22310 !! wikitext
22311 *<nowiki>*foo</nowiki>
22312
22313 *<nowiki>#foo</nowiki>
22314
22315 *<nowiki>:foo</nowiki>
22316
22317 *<nowiki>;foo</nowiki>
22318
22319 #<nowiki>*foo</nowiki>
22320
22321 #<nowiki>#foo</nowiki>
22322
22323 #<nowiki>:foo</nowiki>
22324
22325 #<nowiki>;foo</nowiki>
22326 !!end
22327
22328 !! test
22329 Lists: 2. Inside definition lists
22330 !! options
22331 parsoid=html2wt
22332 !! html/parsoid
22333 <dl><dt>;foo</dt></dl>
22334 <dl><dt>:foo</dt></dl>
22335 <dl><dt>:foo</dt>
22336 <dd>bar</dd></dl>
22337 <dl><dd>:foo</dd></dl>
22338
22339 !! wikitext
22340 ;<nowiki>;foo</nowiki>
22341
22342 ;<nowiki>:foo</nowiki>
22343
22344 ;<nowiki>:foo</nowiki>
22345 :bar
22346
22347 :<nowiki>:foo</nowiki>
22348 !!end
22349
22350 !! test
22351 Lists: 3. Only bullets at start of text should be escaped
22352 !! options
22353 parsoid=html2wt
22354 !! html/parsoid
22355 <ul><li>*foo*bar</li></ul>
22356 <ul><li>*foo<i>it</i>*bar</li></ul>
22357
22358 !! wikitext
22359 *<nowiki>*foo*bar</nowiki>
22360
22361 *<nowiki>*foo</nowiki>''it''*bar
22362 !!end
22363
22364 !! test
22365 Lists: 4. No escapes needed
22366 !! options
22367 parsoid=html2wt
22368 !! html/parsoid
22369 <ul>
22370 <li>foo*bar
22371 </li>
22372 </ul>
22373 <ul>
22374 <li><i>foo</i>*bar
22375 </li>
22376 </ul>
22377 <ul>
22378 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22379 </li>
22380 </ul>
22381 <ul>
22382 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22383 </li>
22384 </ul>
22385 !! wikitext
22386 *foo*bar
22387
22388 *''foo''*bar
22389
22390 *[[Foo]]: bar
22391
22392 *[[Foo]]*bar
22393 !!end
22394
22395 !! test
22396 Lists: 5. No unnecessary escapes
22397 !! options
22398 parsoid=html2wt
22399 !! html/parsoid
22400 <ul><li> bar <span>[[foo]]</span></li></ul>
22401 <ul><li> =bar <span>[[foo]]</span></li></ul>
22402 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22403 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22404 <ul><li> =bar <span>foo]]</span>=</li></ul>
22405 <ul><li> <s></s>: a</li></ul>
22406 <ul><li> <i>* foo</i></li></ul>
22407
22408 !! wikitext
22409 * bar <span><nowiki>[[foo]]</nowiki></span>
22410
22411 * =bar <span><nowiki>[[foo]]</nowiki></span>
22412
22413 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22414
22415 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22416
22417 * =bar <span>foo]]</span>=
22418
22419 * <s></s>: a
22420
22421 * ''* foo''
22422 !!end
22423
22424 !! test
22425 Lists: 6. Escape bullets in SOL position
22426 !! options
22427 parsoid=html2wt
22428 !! html/parsoid
22429 <p><!--cmt-->*foo</p>
22430 !! wikitext
22431 <!--cmt--><nowiki>*</nowiki>foo
22432 !!end
22433
22434 !! test
22435 Lists: 7. Escape bullets in a multi-line context
22436 !! options
22437 parsoid=html2wt
22438 !! html/parsoid
22439 <p>a
22440 *b
22441 </p>
22442 !! wikitext
22443 a
22444 <nowiki>*</nowiki>b
22445 !!end
22446
22447 !! test
22448 Lists: 8. Escape colons only if not present in tags
22449 !! options
22450 parsoid=html2wt
22451 !! html/parsoid
22452 <dl><dt>a:b<i>c:d</i></dt></dl>
22453 !! wikitext
22454 ; <nowiki>a:b</nowiki>''c:d''
22455 !! end
22456
22457 #### --------------- HRs ---------------
22458 #### 1. Single line
22459 #### -----------------------------------
22460
22461 !! test
22462 HRs: 1. Single line
22463 !! options
22464 parsoid=html2wt
22465 !! html/parsoid
22466 <hr />----
22467 <hr />=foo=
22468 <hr />*foo
22469 !! wikitext
22470 ----<nowiki>----</nowiki>
22471 ----=foo=
22472 ----*foo
22473 !! end
22474
22475 #### --------------- Tables ---------------
22476 #### 1a. Simple example
22477 #### 1b. No escaping needed (!foo)
22478 #### 1c. No escaping needed (|foo)
22479 #### 1d. No escaping needed (|}foo)
22480 ####
22481 #### 2a. Nested in td (<td>foo|bar</td>)
22482 #### 2b. Nested in td (<td>foo||bar</td>)
22483 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22484 ####
22485 #### 3a. Nested in th (<th>foo!bar</th>)
22486 #### 3b. Nested in th (<th>foo!!bar</th>)
22487 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22488 ####
22489 #### 4a. Escape -
22490 #### 4b. Escape +
22491 #### 4c. No escaping needed
22492 #### --------------------------------------
22493
22494 !! test
22495 Tables: 1a. Simple example
22496 !! options
22497 parsoid=html2wt
22498 !! html/parsoid
22499 <p>{|
22500 |}
22501 </p>
22502 !! wikitext
22503 <nowiki>{|</nowiki>
22504 |}
22505 !! end
22506
22507 !! test
22508 Tables: 1b. No escaping needed
22509 !! options
22510 parsoid=html2wt
22511 !! html/parsoid
22512 <p>!foo
22513 </p>
22514 !! wikitext
22515 !foo
22516 !! end
22517
22518 !! test
22519 Tables: 1c. No escaping needed
22520 !! options
22521 parsoid=html2wt
22522 !! html/parsoid
22523 <p>|foo
22524 </p>
22525 !! wikitext
22526 |foo
22527 !! end
22528
22529 !! test
22530 Tables: 1d. No escaping needed
22531 !! options
22532 parsoid=html2wt
22533 !! html/parsoid
22534 <p>|}foo
22535 </p>
22536 !! wikitext
22537 |}foo
22538 !! end
22539
22540 !! test
22541 Tables: 2a. Nested in td
22542 !! options
22543 parsoid=html2wt
22544 !! html/parsoid
22545 <table><tbody><tr>
22546 <td>foo|bar</td></tr>
22547 <tr><td>x<div>a|b</div></td>
22548 </tbody></table>
22549 !! wikitext
22550 {|
22551 |<nowiki>foo|bar</nowiki>
22552 |-
22553 |x<div><nowiki>a|b</nowiki></div>
22554 |}
22555 !! html/php+tidy
22556 <table>
22557 <tr>
22558 <td>foo|bar</td>
22559 </tr>
22560 <tr>
22561 <td>x
22562 <div>a|b</div>
22563 </td>
22564 </tr>
22565 </table>
22566 !! end
22567
22568 !! test
22569 Tables: 2b. Nested in td
22570 !! options
22571 parsoid=html2wt
22572 !! html/parsoid
22573 <table><tbody><tr>
22574 <td>foo||bar</td>
22575 <td>a<i>b||c</i></td>
22576 <td>a<i><div>b||c</div></i></td>
22577 </tr></tbody></table>
22578 !! wikitext
22579 {|
22580 |<nowiki>foo||bar</nowiki>
22581 |a''<nowiki>b||c</nowiki>''
22582 |a''<div><nowiki>b||c</nowiki></div>''
22583 |}
22584 !! html/php
22585 <table>
22586 <tr>
22587 <td>foo||bar
22588 </td>
22589 <td>a<i>b||c</i>
22590 </td>
22591 <td>a<i><div>b||c</div></i>
22592 </td></tr></table>
22593
22594 !! end
22595
22596 !! test
22597 Tables: 2c. Nested in td -- no escaping needed
22598 !! options
22599 parsoid=html2wt
22600 !! html/*
22601 <table>
22602
22603 <tr>
22604 <td>foo!!bar
22605 </td></tr></table>
22606
22607 !! wikitext
22608 {|
22609
22610 |foo!!bar
22611 |}
22612 !! end
22613
22614 !! test
22615 Tables: 3a. Nested in th
22616 !! options
22617 parsoid=html2wt
22618 !! html/*
22619 <table>
22620
22621 <tr>
22622 <th>foo!bar
22623 </th></tr></table>
22624
22625 !! wikitext
22626 {|
22627
22628 !foo!bar
22629 |}
22630 !! end
22631
22632 !! test
22633 Tables: 3b. Nested in th
22634 !! options
22635 parsoid=html2wt
22636 !! html/parsoid
22637 <table><tbody>
22638 <tr><th>foo!!bar</th>
22639 <th><i>foo|bar</i></th>
22640 <th><i>foo!!bar</i></th>
22641 <th><i><span>foo!!bar</span></i></th>
22642 </tr></tbody></table>
22643 !! wikitext
22644 {|
22645 !<nowiki>foo!!bar</nowiki>
22646 !''<nowiki>foo|bar</nowiki>''
22647 !''<nowiki>foo!!bar</nowiki>''
22648 !''<span><nowiki>foo!!bar</nowiki></span>''
22649 |}
22650 !! html/php
22651 <table>
22652 <tr>
22653 <th>foo!!bar
22654 </th>
22655 <th><i>foo|bar</i>
22656 </th>
22657 <th><i>foo!!bar</i>
22658 </th>
22659 <th><i><span>foo!!bar</span></i>
22660 </th></tr></table>
22661
22662 !! end
22663
22664 !! test
22665 Tables: 3c. Nested in th
22666 !! options
22667 parsoid=html2wt
22668 !! html/parsoid
22669 <table><tbody>
22670 <tr><th>foo||bar</th>
22671 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22672 </tr></tbody></table>
22673 !! wikitext
22674 {|
22675 !<nowiki>foo||bar</nowiki>
22676 !<nowiki>foo||bar</nowiki>
22677 |}
22678 !! html/php
22679 <table>
22680 <tr>
22681 <th>foo||bar
22682 </th>
22683 <th>foo||bar
22684 </th></tr></table>
22685
22686 !! end
22687
22688 !! test
22689 Tables: 4a. Escape -
22690 !! options
22691 parsoid=html2wt
22692 !! html/*
22693 <table>
22694
22695 <tr>
22696 <th>-bar
22697 </th></tr>
22698 <tr>
22699 <td>-bar
22700 </td></tr></table>
22701
22702 !! wikitext
22703 {|
22704
22705 !-bar
22706
22707 |-
22708 |<nowiki>-bar</nowiki>
22709 |}
22710 !! end
22711
22712 !! test
22713 Tables: 4b. Escape +
22714 !! options
22715 parsoid=html2wt
22716 !! html/*
22717 <table>
22718
22719 <tr>
22720 <th>+bar
22721 </th></tr>
22722 <tr>
22723 <td>+bar
22724 </td></tr></table>
22725
22726 !! wikitext
22727 {|
22728
22729 !+bar
22730
22731 |-
22732 |<nowiki>+bar</nowiki>
22733 |}
22734 !! end
22735
22736 !! test
22737 Tables: 4c. No escaping needed
22738 !! options
22739 parsoid=html2wt
22740 !! html/parsoid
22741 <table><tbody>
22742 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22743 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22744 <tr><td>foo
22745 <p>bar|baz
22746 +bar
22747 -bar</p></td></tr>
22748 <tr><td>x
22749 <div>a|b</div></td>
22750 </tbody></table>
22751 !! wikitext
22752 {|
22753 |foo-bar
22754 |foo+bar
22755 |-
22756 |''foo''-bar
22757 |''foo''+bar
22758 |-
22759 |foo
22760 bar|baz
22761 +bar
22762 -bar
22763 |-
22764 |x
22765 <div>a|b</div>
22766 |}
22767 !! html/php
22768 <table>
22769 <tr>
22770 <td>foo-bar
22771 </td>
22772 <td>foo+bar
22773 </td></tr>
22774 <tr>
22775 <td><i>foo</i>-bar
22776 </td>
22777 <td><i>foo</i>+bar
22778 </td></tr>
22779 <tr>
22780 <td>foo
22781 <p>bar|baz
22782 +bar
22783 -bar
22784 </p>
22785 </td></tr>
22786 <tr>
22787 <td>x
22788 <div>a|b</div>
22789 </td></tr></table>
22790
22791 !! end
22792
22793 !! test
22794 Tables: 4d. No escaping needed
22795 !! options
22796 parsoid=html2wt
22797 !! html/parsoid
22798 <table>
22799 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22800 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22801 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22802 </tbody></table>
22803 !! wikitext
22804 {|
22805 |[[Foo]]-bar
22806 ||+1
22807 ||-2
22808 |}
22809 !! html/php
22810 <table>
22811 <tr>
22812 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22813 </td>
22814 <td>+1
22815 </td>
22816 <td>-2
22817 </td></tr></table>
22818
22819 !! end
22820
22821 !! test
22822 T97430: Don't emit empty nowiki pairs around marker meta tags
22823 !! options
22824 parsoid=html2wt
22825 !! html/parsoid
22826 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22827 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22828 !! wikitext
22829 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22830 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22831 !! end
22832
22833 !! test
22834 Unclosed xmlish element in table line shouldn't eat end delimiters
22835 !! options
22836 parsoid=html2wt
22837 !! html/parsoid
22838 <table>
22839 <tbody><tr><td> &lt;foo</td>
22840 <td> bar></td></tr>
22841 </tbody></table>
22842 !! wikitext
22843 {|
22844 | <foo
22845 | bar>
22846 |}
22847 !! html/php
22848 <table>
22849 <tr>
22850 <td> &lt;foo
22851 </td>
22852 <td> bar&gt;
22853 </td></tr></table>
22854
22855 !! end
22856
22857 #### --------------- Links ----------------
22858 #### 1. Quote marks in link text
22859 #### 2. Wikilinks: Escapes needed
22860 #### 3. Wikilinks: No escapes needed
22861 #### 4. Extlinks: Escapes needed
22862 #### 5. Extlinks: No escapes needed
22863 #### --------------------------------------
22864 !! test
22865 Links 1. WikiLinks: No escapes needed
22866 !! options
22867 parsoid=html2wt
22868 !! html/parsoid
22869 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22870 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22871 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22872 !! wikitext
22873 [[Foo|Foo''boo'']]
22874 [[Foo|[Foobar]]]
22875 [[Foo|x [Foobar] x]]
22876 !! html/php
22877 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22878 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22879 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22880 </p>
22881 !! end
22882
22883 !! test
22884 Links 2. WikiLinks: Escapes needed
22885 !! options
22886 parsoid=html2wt
22887 !! html/parsoid
22888 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22889 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22890 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22891 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22892 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22893 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22894 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22895 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22896 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22897 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22898 !! wikitext
22899 [[Foo|<nowiki>Foobar]</nowiki>]]
22900 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22901 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22902 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22903 [[Foo|<nowiki>|Bar</nowiki>]]
22904 [[Foo|<nowiki>]]bar</nowiki>]]
22905 [[Foo|<nowiki>[[bar</nowiki>]]
22906 [[Foo|<nowiki>x [[ y</nowiki>]]
22907 [[Foo|<nowiki>x ]] y</nowiki>]]
22908 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22909 !! html/php
22910 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22911 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22912 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22913 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22914 <a href="/wiki/Foo" title="Foo">|Bar</a>
22915 <a href="/wiki/Foo" title="Foo">]]bar</a>
22916 <a href="/wiki/Foo" title="Foo">[[bar</a>
22917 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22918 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22919 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22920 </p>
22921 !! end
22922
22923 !! test
22924 Links 3. WikiLinks: No escapes needed
22925 !! options
22926 parsoid=html2wt
22927 !! html/parsoid
22928 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22929 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22930 !! wikitext
22931 [[Foo|[Foobar]]
22932 [[Foo|foo|bar]]
22933 !! html/php
22934 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22935 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22936 </p>
22937 !! end
22938
22939 !! test
22940 Links 4. ExtLinks: Escapes needed
22941 !! options
22942 parsoid=html2wt
22943 !! html/parsoid
22944 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22945 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22946 <p>[http://google.com]</p>
22947 <p>[http://google.com google]</p>
22948 !! wikitext
22949 [http://google.com <nowiki>[google]</nowiki>]
22950 [http://google.com <nowiki>google]</nowiki>]
22951
22952 <nowiki>[http://google.com]</nowiki>
22953
22954 <nowiki>[http://google.com google]</nowiki>
22955
22956 !! html/php
22957 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22958 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22959 </p><p>[http://google.com]
22960 </p><p>[http://google.com google]
22961 </p>
22962 !! end
22963
22964 !! test
22965 Links 5. ExtLinks: No escapes needed
22966 !! options
22967 parsoid=html2wt
22968 !! html/parsoid
22969 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22970 !! wikitext
22971 [http://google.com [google]
22972 !! html/php
22973 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22974 </p>
22975 !! end
22976
22977 !! test
22978 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22979 !! options
22980 parsoid=html2wt
22981 !! html/parsoid
22982 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22983 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22984 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22985 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22986 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22987 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22988 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22989 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22990 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22991 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22992 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22993 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22994 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22995 </p>
22996 !! wikitext
22997 x<nowiki/>http://example.com<nowiki/>y
22998 http://example.com<nowiki/>?x
22999 http://example.com<nowiki/>&x
23000 http://example.com<nowiki/>'x
23001 http://example.com<nowiki/>,x
23002 http://example.com<nowiki/>.x
23003 http://example.com<nowiki/>;x
23004 http://example.com<nowiki/>:x
23005 http://example.com<nowiki/>;x
23006 http://example.com<nowiki/>!x
23007 http://example.com<nowiki/>=x
23008 http://example.com<nowiki/>(x)
23009 http://example.com(x<nowiki/>)
23010 !! end
23011
23012 !! test
23013 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23014 !! options
23015 parsoid=html2wt
23016 !! html/parsoid
23017 <p>x
23018 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23019 y
23020 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23021 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23022 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23023 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23024 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23025 </p>
23026 !! wikitext
23027 x
23028 http://example.com
23029 y
23030 "http://example.com"
23031 (http://example.com)
23032 (http://example.com) foo
23033 http://example.com,
23034 http://example.com, foo
23035 !! html/php
23036 <p>x
23037 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23038 y
23039 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23040 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23041 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23042 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23043 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23044 </p>
23045 !! end
23046
23047 !! test
23048 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23049 !! options
23050 parsoid=html2wt
23051 !! html/parsoid
23052 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23053 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23054 !! wikitext
23055 http://example.com.,;:!?\
23056 -http://example.com:
23057 !! html/php
23058 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23059 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23060 </p>
23061 !! end
23062
23063 !! test
23064 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23065 !! options
23066 parsoid=html2wt
23067 !! html/parsoid
23068 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23069 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23070 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23071 !! wikitext
23072 RFC 123<nowiki/>4
23073 RFC 123<nowiki/>y
23074 X<nowiki/>RFC 123<nowiki/>y
23075 !! end
23076
23077 !! test
23078 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23079 !! options
23080 parsoid=html2wt
23081 !! html/parsoid
23082 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23083 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23084 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23085 </p>
23086 !! wikitext
23087 RFC 123?foo
23088 RFC 123&foo
23089 -RFC 123-
23090 !! html/php
23091 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23092 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23093 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23094 </p>
23095 !! end
23096
23097 !! test
23098 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23099 !! options
23100 parsoid=html2wt
23101 !! html/parsoid
23102 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23103 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23104 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23105 !! wikitext
23106 PMID 123<nowiki/>4
23107 PMID 123<nowiki/>y
23108 X<nowiki/>PMID 123<nowiki/>y
23109 !! end
23110
23111 !! test
23112 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23113 !! options
23114 parsoid=html2wt
23115 !! html/parsoid
23116 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23117 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23118 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23119 </p>
23120 !! wikitext
23121 PMID 123?foo
23122 PMID 123&foo
23123 -PMID 123-
23124 !! html/php
23125 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23126 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23127 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23128 </p>
23129 !! end
23130
23131 !! test
23132 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23133 !! options
23134 parsoid=html2wt
23135 !! html/parsoid
23136 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23137 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23138 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23139 </p>
23140 !! wikitext
23141 ISBN 1234567890<nowiki/>1
23142 ISBN 1234567890<nowiki/>x
23143 a<nowiki/>ISBN 1234567890<nowiki/>b
23144 !! end
23145
23146 !! test
23147 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23148 !! options
23149 parsoid=html2wt
23150 !! html/parsoid
23151 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23152 !! wikitext
23153 -ISBN 1234567890's
23154 !! html/php
23155 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23156 </p>
23157 !! end
23158
23159 !! test
23160 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23161 !! options
23162 parsoid=html2wt
23163 !! html/*
23164 <p>this is not a link: http://example.com
23165 </p>
23166 !! wikitext
23167 <nowiki>this is not a link: http://example.com</nowiki>
23168 !! end
23169
23170 !! test
23171 Links 15. Link trails can't become link prefixes.
23172 !! options
23173 language=is
23174 parsoid=html2wt
23175 !! html/parsoid
23176 <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>
23177 !! wikitext
23178 [[Söfnuður]]-[[00]]
23179 !! html/php
23180 <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>
23181 </p>
23182 !! end
23183
23184 #### --------------- Quotes ---------------
23185 #### 1. Quotes inside <b> and <i>
23186 #### 2. Link fragments separated by <i> and <b> tags
23187 #### 3. Link fragments inside <i> and <b>
23188 #### 4. No escaping needed
23189 #### --------------------------------------
23190 !! test
23191 1a. Quotes inside <b> and <i>
23192 !! options
23193 parsoid=html2wt
23194 !! html/*
23195 <p><i>'foo'</i>
23196 <i>''foo''</i>
23197 <i>'''foo'''</i>
23198 <i>foo</i>'s
23199 <b>'foo'</b>
23200 <b>''foo''</b>
23201 <b>'''foo'''</b>
23202 <b>foo'<i>bar'</i>baz</b>
23203 <b>foo</b>'s
23204 '<i>foo</i>
23205 <i>foo</i>'
23206 <i>foo'</i>'
23207 '<i>foo</i>'
23208 '<b>foo</b>
23209 <b>foo</b>'
23210 '<b>foo</b>'
23211 <i>fools'<span> errand</span></i>
23212 <i><span>fool</span>'s errand</i>
23213 '<i>foo</i> bar '<i>baz</i>
23214 a|!*#-:;+-~[]{}b'<i>x</i>
23215 </p>
23216 !! wikitext
23217 ''<nowiki/>'foo'''
23218 ''<nowiki>''foo''</nowiki>''
23219 ''<nowiki>'''foo'''</nowiki>''
23220 ''foo''<nowiki/>'s
23221 '''<nowiki/>'foo''''
23222 '''<nowiki>''foo''</nowiki>'''
23223 '''<nowiki>'''foo'''</nowiki>'''
23224 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23225 '''foo'''<nowiki/>'s
23226 '''foo''
23227 ''foo''<nowiki/>'
23228 ''foo'''<nowiki/>'
23229 '''foo''<nowiki/>'
23230 ''''foo'''
23231 '''foo'''<nowiki/>'
23232 ''''foo'''<nowiki/>'
23233 ''fools'<span> errand</span>''
23234 ''<span>fool</span>'s errand''
23235 '<nowiki/>''foo'' bar '''baz''
23236 a|!*#-:;+-~[]{}b'''x''
23237 !! end
23238
23239 !! test
23240 1b. Quotes inside <b> and <i> with other tags on same line
23241 !! options
23242 parsoid=html2wt
23243 !! html/parsoid
23244 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23245 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23246 <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>
23247 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23248 '<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>
23249 '<i>foo</i> <div title="name">test</div>
23250 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23251 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23252 <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>
23253 </ol>
23254 !! wikitext
23255 '''a'' foo ''[[bar]]''
23256 ''a''' foo ''[[bar]]''
23257 ''a''' foo '''{{echo|[[bar]]}}'''
23258 [[foo]] x'''[[bar]]''
23259 '''foo'' <ref>test</ref>
23260 '''foo'' <div title="name">test</div>
23261 '''foo'' and <br> bar
23262 <references />
23263 !! end
23264
23265 !! test
23266 2. Link fragments separated by <i> and <b> tags
23267 !! options
23268 parsoid=html2wt
23269 !! html/parsoid
23270 <p>[[<i>foo</i>hello]]</p>
23271 <p>[[<b>foo</b>hello]]</p>
23272 !! wikitext
23273 [[''foo''<nowiki>hello]]</nowiki>
23274
23275 [['''foo'''<nowiki>hello]]</nowiki>
23276 !! end
23277
23278 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23279 # this is one of the shortcomings of this format
23280 !! test
23281 3. Link fragments inside <i> and <b>
23282 !! options
23283 parsoid=html2wt
23284 !! html/parsoid
23285 <p><i>[[foo</i>]]</p>
23286 <p><b>[[foo</b>]]</p>
23287 !! wikitext
23288 ''[[foo''<nowiki>]]</nowiki>
23289
23290 '''[[foo'''<nowiki>]]</nowiki>
23291 !! end
23292
23293 !! test
23294 4. No escaping needed
23295 !! options
23296 options=html2wt
23297 !! html/parsoid
23298 <p>'<span><i>bar</i></span>'
23299 '<span><b>bar</b></span>'
23300 'a:b'foo
23301 </p>
23302 !! wikitext
23303 '<span>''bar''</span>'
23304 '<span>'''bar'''</span>'
23305 'a:b'foo
23306 !! end
23307
23308 #### ----------- Paragraphs ---------------
23309 #### 1. No unnecessary escapes
23310 #### --------------------------------------
23311
23312 !! test
23313 1. No unnecessary escapes
23314 !! options
23315 parsoid=html2wt
23316 !! html/parsoid
23317 <p>bar <span>[[foo]]</span>
23318 </p><p>=bar <span>[[foo]]</span>
23319 </p><p>[[bar <span>[[foo]]</span>
23320 </p><p>]]bar <span>[[foo]]</span>
23321 </p><p>=bar <span>foo]]</span>=
23322 </p>
23323 !! wikitext
23324 bar <span><nowiki>[[foo]]</nowiki></span>
23325
23326 =bar <span><nowiki>[[foo]]</nowiki></span>
23327
23328 [[bar <span><nowiki>[[foo]]</nowiki></span>
23329
23330 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23331
23332 =bar <span>foo]]</span><nowiki>=</nowiki>
23333 !!end
23334
23335 #### ----------------------- PRE --------------------------
23336 #### 1. Leading whitespace in SOL context should be escaped
23337 #### ------------------------------------------------------
23338 !! test
23339 1. Leading whitespace in SOL context should be escaped
23340 !! options
23341 parsoid=html2wt
23342 !! html/parsoid
23343 <p> a</p>
23344
23345 <p> a</p>
23346
23347 <p> a(tab)</p>
23348
23349 <p> a
23350 <!--cmt-->
23351 a</p>
23352
23353 <p>a
23354 b</p>
23355
23356 <p>a
23357 b</p>
23358
23359 <p>a
23360 b</p>
23361 !! wikitext
23362 <nowiki> </nowiki>a
23363
23364 <nowiki> </nowiki> a
23365
23366 a(tab)
23367
23368 <nowiki> </nowiki> a
23369 <!--cmt-->
23370 <nowiki> </nowiki>a
23371
23372 a
23373 <nowiki> </nowiki>b
23374
23375 a
23376 b
23377
23378 a
23379 b
23380 !! html/php
23381 <p> a
23382 </p><p> a
23383 </p><p> a(tab)
23384 </p><p> a
23385 a
23386 </p><p>a
23387 b
23388 </p><p>a
23389 b
23390 </p><p>a
23391 b
23392 </p>
23393 !! end
23394
23395 !! test
23396 2. Leading whitespace in non-indent-pre contexts should not be escaped
23397 !! options
23398 parsoid=htm2wt
23399 !! html/parsoid
23400 <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>
23401 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23402 <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>
23403 b</span></li>
23404 </ol>
23405 !! wikitext
23406 foo <ref>''a''
23407 b</ref>
23408 <references />
23409 !! end
23410
23411 !! test
23412 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23413 !! options
23414 parsoid=html2wt
23415 !! html/parsoid
23416 <blockquote>
23417 <p>
23418 a
23419 <span>b</span>
23420 c</p>
23421 </blockquote>
23422 !! wikitext
23423 <blockquote>
23424 a
23425 <span>b</span>
23426 c
23427 </blockquote>
23428 !! end
23429
23430 !! test
23431 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23432 !! options
23433 options=html2wt
23434 !! html/parsoid
23435 <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>
23436 !! wikitext
23437 [[File:Foobar.jpg|thumb|caption]]
23438 !! end
23439
23440 !! test
23441 5. Nowiki escaping should account for indent-pres
23442 !! options
23443 parsoid=html2wt
23444 !! html/parsoid
23445 <pre>==foo==</pre>
23446 !! wikitext
23447 ==foo==
23448 !! end
23449
23450 !!test
23451 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23452 !! options
23453 parsoid=html2wt
23454 !! html/parsoid
23455 <pre>
23456 * foo
23457 * bar
23458 </pre>
23459 !! wikitext
23460 * foo
23461 * bar
23462 !! end
23463
23464 #### --------------- Behavior Switches --------------------
23465
23466 !! test
23467 1. Valid behavior switches should be escaped
23468 !! options
23469 parsoid=html2wt
23470 !! html/parsoid
23471 __TOC__
23472 <i>__TOC__</i>
23473 !! wikitext
23474 <nowiki>__TOC__</nowiki>
23475 ''<nowiki>__TOC__</nowiki>''
23476 !! end
23477
23478 !! test
23479 2. Invalid behavior switches should not be escaped
23480 !! options
23481 parsoid=html2wt
23482 !! html/parsoid
23483 __TOO__
23484 __|__
23485 !! wikitext
23486 __TOO__
23487 __|__
23488 !! end
23489
23490 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23491 !! test
23492 Behavior switches should be SOL-transparent
23493 !! options
23494 parsoid=html2wt
23495 !! html/parsoid
23496 <meta property="mw:PageProp/toc" />
23497
23498 <!-- this one's bogus -->
23499 <pre>__TOO__</pre>
23500
23501 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23502
23503 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23504 !! wikitext
23505 __TOC__
23506
23507 <!-- this one's bogus -->
23508 __TOO__
23509
23510 __TOC__ foo
23511
23512 __TOC__ bar
23513 !! end
23514
23515 #### --------------- HTML tags ---------------
23516 #### 1. a tags
23517 #### 2. other tags
23518 #### 3. multi-line html tag
23519 #### 4. extension tags
23520 #### -----------------------------------------
23521 !! test
23522 1. a tags
23523 !! options
23524 parsoid=html2wt
23525 !! html/parsoid
23526 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23527 !! wikitext
23528 <a href="http://google.com">google</a>
23529 !! end
23530
23531 !! test
23532 2. other tags
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23537 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23538 <li> &lt;td&gt;</li></ul>
23539
23540 !! wikitext
23541 * <nowiki><div>foo</div></nowiki>
23542 * <nowiki><div style="color:red">foo</div></nowiki>
23543 * <nowiki><td></nowiki>
23544 !! end
23545
23546 !! test
23547 3. multi-line html tag
23548 !! options
23549 parsoid=html2wt
23550 !! html/parsoid
23551 <p>&lt;div
23552 &gt;foo&lt;/div
23553 &gt;
23554 </p>
23555 !! wikitext
23556 <nowiki><div
23557 >foo</div
23558 ></nowiki>
23559 !! end
23560
23561 !! test
23562 4. extension tags
23563 !! options
23564 parsoid=html2wt
23565 !! html/parsoid
23566 <p>&lt;ref&gt;foo&lt;/ref&gt;
23567 </p><p>&lt;ref&gt;bar
23568 </p><p>baz&lt;/ref&gt;
23569 </p>
23570 !! wikitext
23571 <nowiki><ref>foo</ref></nowiki>
23572
23573 <nowiki><ref>bar</nowiki>
23574
23575 baz<nowiki></ref></nowiki>
23576 !! end
23577
23578 #### --------------- Others ---------------
23579 !! test
23580 Escaping nowikis
23581 !! options
23582 parsoid=html2wt
23583 !! html/parsoid
23584 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23585 </p>
23586 !! wikitext
23587 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23588 !! end
23589
23590 ## The quote-char in the input is necessary for triggering the bug
23591 !! test
23592 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23593 !! options
23594 parsoid=html2wt
23595 !! html/parsoid
23596 <p>foo's bar :</p>
23597 !! wikitext
23598 foo's bar :
23599 !! end
23600
23601 #----------- End of wikitext escaping tests --------------
23602
23603 !! test
23604
23605 Tag-like HTML structures are passed through as text
23606 !! wikitext
23607 <x y>
23608
23609 <x.y>
23610
23611 <x-y>
23612
23613 1>2
23614
23615 x<y
23616
23617 a>b
23618
23619 1<d e>f
23620 !! html
23621 <p>&lt;x y&gt;
23622 </p><p>&lt;x.y&gt;
23623 </p><p>&lt;x-y&gt;
23624 </p><p>1&gt;2
23625 </p><p>x&lt;y
23626 </p><p>a&gt;b
23627 </p><p>1&lt;d e&gt;f
23628 </p>
23629 !! end
23630
23631 !! test
23632 HTML tag with necessary entities in attributes
23633 !! wikitext
23634 <span title="&amp;amp;">foo</span>
23635 !! html
23636 <p><span title="&amp;amp;">foo</span>
23637 </p>
23638 !! end
23639
23640 !! test
23641 HTML tag with 'unnecessary' entity encoding in attributes
23642 !! wikitext
23643 <span title="&amp;">foo</span>
23644 !! html
23645 <p><span title="&amp;">foo</span>
23646 </p>
23647 !! end
23648
23649 !! test
23650 HTML tag with broken attribute value quoting
23651 !! wikitext
23652 <span title="Hello world>Foo</span>
23653 !! html/php
23654 <p><span title="Hello world">Foo</span>
23655 </p>
23656 !! html/parsoid
23657 <p><span title="Hello world">Foo</span>
23658 </p>
23659 !! end
23660
23661 !! test
23662 Table with broken attribute value quoting
23663 !! wikitext
23664 {|
23665 | title="Hello world|Foo
23666 |}
23667 !! html/php
23668 <table>
23669 <tr>
23670 <td title="Hello world">Foo
23671 </td></tr></table>
23672
23673 !! html/parsoid
23674 <table>
23675 <tr>
23676 <td title="Hello world">Foo
23677 </td></tr></table>
23678
23679 !! end
23680
23681 !! test
23682 Table with broken attribute value quoting on consecutive lines
23683 !! wikitext
23684 {|
23685 | title="Hello world|Foo
23686 | style="color:red|Bar
23687 |}
23688 !! html/php
23689 <table>
23690 <tr>
23691 <td title="Hello world">Foo
23692 </td>
23693 <td style="color:red">Bar
23694 </td></tr></table>
23695
23696 !! html/parsoid
23697 <table><tbody>
23698 <tr>
23699 <td title="Hello world">Foo
23700 </td><td style="color: red">Bar
23701 </td></tr></tbody></table>
23702
23703 !! end
23704
23705 !! test
23706 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23707 !! options
23708 parsoid
23709 !! wikitext
23710 {{}}
23711 !! html
23712 {{}}
23713 !! end
23714
23715 !! test
23716 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23717 !! options
23718 parsoid
23719 !! wikitext
23720 }}{{
23721 !! html
23722 }}{{
23723 !! end
23724
23725 !!test
23726 Accept empty td cell attribute
23727 !! wikitext
23728 {|
23729 | align="center" | foo || |
23730 |}
23731 !! html
23732 <table>
23733 <tr>
23734 <td align="center"> foo </td>
23735 <td>
23736 </td></tr></table>
23737
23738 !!end
23739
23740 !!test
23741 Non-empty attributes in th-cells
23742 !! wikitext
23743 {|
23744 ! Foo !! style="color: red" | Bar
23745 |}
23746 !! html
23747 <table>
23748 <tr>
23749 <th> Foo </th>
23750 <th style="color: red"> Bar
23751 </th></tr></table>
23752
23753 !!end
23754
23755 !!test
23756 Accept empty attributes in th-cells
23757 !! wikitext
23758 {|
23759 !| foo !!| bar
23760 |}
23761 !! html
23762 <table>
23763 <tr>
23764 <th> foo </th>
23765 <th> bar
23766 </th></tr></table>
23767
23768 !!end
23769
23770 !!test
23771 Empty table rows go away
23772 !! wikitext
23773 {|
23774 | Hello
23775 | there
23776 |- class="foo"
23777 |-
23778 |}
23779 !! html
23780 <table>
23781 <tr>
23782 <td> Hello
23783 </td>
23784 <td> there
23785 </td></tr>
23786
23787 </table>
23788
23789 !! end
23790
23791 ###
23792 ### Parsoid-centric tests for testing RTing of inter-element separators
23793 ### Edge cases not tested by existing parser tests and specific to
23794 ### Parsoid-specific serialization strategies.
23795 ###
23796
23797 !!test
23798 RT-ed inter-element separators should be valid separators
23799 !! wikitext
23800 {|
23801 |- [[foo]]
23802 |}
23803 !! html/php
23804 <table>
23805
23806 </table>
23807
23808 !! html/parsoid
23809 <table>
23810 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
23811 </tbody></table>
23812 !!end
23813
23814 # Parsoid-only since PHP parser relies on Tidy for correct output
23815 !!test
23816 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23817 !!options
23818 parsoid
23819 !! wikitext
23820 {|
23821 |<small>foo
23822 bar
23823 |}
23824
23825 {|
23826 |<small>foo<small>
23827 |}
23828 !! html
23829 <table>
23830 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23831 <p>bar</p></small></td></tr>
23832 </tbody></table>
23833
23834 <table>
23835 <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>
23836 </tbody></table>
23837 !!end
23838
23839 # Note that the "style" attribute is really a template parameter here.
23840 # The = would have to be {{=}} if you wanted the literal.
23841 !!test
23842 Empty TD followed by TD with tpl-generated attribute
23843 !! wikitext
23844 {|
23845 |-
23846 |
23847 |{{echo|style='color:red'}}|foo
23848 |}
23849 !! html
23850 <table>
23851
23852 <tr>
23853 <td>
23854 </td>
23855 <td>foo
23856 </td></tr></table>
23857
23858 !!end
23859
23860 !!test
23861 Indented table with an empty td
23862 !! wikitext
23863 {|
23864 |-
23865 |
23866 |foo
23867 |}
23868 !! html
23869 <table>
23870
23871 <tr>
23872 <td>
23873 </td>
23874 <td>foo
23875 </td></tr></table>
23876
23877 !!end
23878
23879 ## We have some newline diffs RT-ing this edge case
23880 ## and it is not important enough -- we seem to be emitting
23881 ## at most 2 newlines after a </tr> and this is unrelated to
23882 ## the issue from T85627 that this is testing.
23883 !!test
23884 Indented table with blank lines in between (T85627)
23885 !! options
23886 parsoid=wt2html
23887 !! wikitext
23888 {|
23889 |foo
23890
23891
23892 |}
23893 !! html
23894 <table>
23895
23896 <tr>
23897 <td>foo
23898 </td></tr></table>
23899
23900 !!end
23901
23902 !!test
23903 Indented block & table
23904 !! wikitext
23905 <div>foo</div>
23906 {|
23907 |foo
23908 |}
23909 !! html/php
23910 <div>foo</div>
23911 <table>
23912 <tr>
23913 <td>foo
23914 </td></tr></table>
23915
23916 !! html/parsoid
23917 <div data-parsoid='{"stx":"html"}'>foo</div>
23918 <table><tbody>
23919 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23920 </tbody></table>
23921 !!end
23922
23923 !! test
23924 Indent and comment before table row
23925 !! wikitext
23926 {|
23927 <!--hi-->|-
23928 | there
23929 |}
23930 !! html/php
23931 <table>
23932
23933 <tr>
23934 <td> there
23935 </td></tr></table>
23936
23937 !! html/parsoid
23938 <table>
23939 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23940 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23941 </tbody></table>
23942 !! end
23943
23944 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23945 !!test
23946 Empty TR followed by a template-generated TR
23947 !!options
23948 parsoid
23949 !! wikitext
23950 {|
23951 |-
23952 {{echo|<tr><td>foo</td></tr>}}
23953 |}
23954 !! html
23955 <table>
23956 <tbody>
23957 <tr></tr>
23958 <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}}]}'>
23959 <td>foo</td></tr>
23960 </tbody></table>
23961 !!end
23962
23963 ## PHP and parsoid output differ for this, and since this is primarily
23964 ## for testing Parsoid's serializer, marking this Parsoid only
23965 !!test
23966 Empty TR followed by mixed-ws-comment line should RT correctly
23967 !!options
23968 parsoid
23969 !! wikitext
23970 {|
23971 |-
23972 <!--c-->
23973 |-
23974 <!--c--> <!--d-->
23975 |}
23976 !! html
23977 <table>
23978 <tbody>
23979 <tr></tr>
23980 <!--c-->
23981 <tr>
23982 <!--c--> </tr><!--d-->
23983 </tbody></table>
23984
23985 !!end
23986
23987 !!test
23988 Multi-line image caption generated by templates with/without trailing newlines
23989 !! wikitext
23990 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23991 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23992 !! html/parsoid
23993 <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>
23994 <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>
23995 !!end
23996
23997 !! test
23998 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23999 !! options
24000 parsoid=html2wt
24001 !! html/parsoid
24002 <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>
24003
24004 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24005 !! wikitext
24006 <includeonly>foo</includeonly>
24007 new para
24008
24009 [[Category:Foo]]
24010
24011 = new heading =
24012 !! end
24013
24014 ## PHP emits broken html for this, and since this is primarily
24015 ## a Parsoid serializer test, marking this Parsoid only
24016 !!test
24017 Improperly nested inline or quotes tags with whitespace in between
24018 !! wikitext
24019 <span> <s>x</span> </s>
24020 ''' ''x''' ''
24021 !! html/parsoid
24022 <p><span> <s>x</s></span><s> </s>
24023 <b> <i>x</i></b><i> </i>
24024 </p>
24025 !!end
24026
24027 !!test
24028 Encapsulate protected attributes from wt
24029 !! wikitext
24030 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24031 !! html/parsoid
24032 <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>
24033 </body>
24034 !!end
24035
24036 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24037 ## Having nested or stray pre tags results in the attempt to add duplicates,
24038 ## causing an assertion fail. This test tries to prevent that situation.
24039 !!test
24040 Ensure ParagraphWrapper can deal with stray closing pre tags
24041 !!options
24042 parsoid=wt2html
24043 !! wikitext
24044 plain text</pre>
24045 !! html/parsoid
24046 plain text
24047 !!end
24048
24049 !!test
24050 1. Ensure fostered text content is wrapped in element nodes
24051 !!options
24052 parsoid=wt2html
24053 !! wikitext
24054 <table>hi</table><table>ho</table>
24055 !! html/parsoid
24056 <p>hi</p>
24057 <table></table>
24058 <p>ho</p>
24059 <table></table>
24060 !!end
24061
24062 !!test
24063 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24064 !!options
24065 parsoid=wt2html,wt2wt
24066 !! wikitext
24067 <table>
24068 <tr> || ||
24069 <td> a
24070 </table>
24071 !! html/parsoid
24072 <p> || ||
24073 </p><table>
24074 <tbody><tr><td> a</td></tr>
24075 </tbody></table>
24076 !!end
24077
24078 !!test
24079 Encapsulation properly handles null DSR information from foster box
24080 !!options
24081 parsoid=wt2html,wt2wt
24082 !! wikitext
24083 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24084 !! html/parsoid
24085 <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>
24086 !!end
24087
24088 !!test
24089 1. Encapsulate foster-parented transclusion content
24090 !!options
24091 parsoid=wt2wt,wt2html
24092 !! wikitext
24093 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24094 !! html/parsoid
24095 <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>
24096 <tbody>
24097 <tr>
24098 <td>bar</td>
24099 </tr>
24100 </tbody>
24101 </table>
24102 !!end
24103
24104 !!test
24105 2. Encapsulate foster-parented transclusion content
24106 !!options
24107 parsoid=wt2wt,wt2html
24108 !! wikitext
24109 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24110 !! html/parsoid
24111 <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>
24112 <table>
24113 <tbody>
24114 <tr>
24115 <td>bar</td>
24116 </tr>
24117 </tbody>
24118 </table>
24119 !!end
24120
24121 !!test
24122 3. Encapsulate foster-parented transclusion content
24123 !!options
24124 parsoid=wt2wt,wt2html
24125 !! wikitext
24126 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24127 !! html/parsoid
24128 <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;]}">
24129 <p>foo</p>
24130 </div>
24131 <table>
24132 <tbody>
24133 <tr>
24134 <td>bar</td>
24135 </tr>
24136 </tbody>
24137 </table>
24138 !!end
24139
24140 !!test
24141 4. Encapsulate foster-parented transclusion content
24142 !!options
24143 parsoid=wt2wt,wt2html
24144 !! wikitext
24145 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24146 !! html/parsoid
24147 <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;]}">
24148 <p>foo</p>
24149 </div>
24150 <table>
24151 <tbody>
24152 <tr>
24153 <td>bar</td>
24154 </tr>
24155 </tbody>
24156 </table>
24157 !!end
24158
24159 !!test
24160 5. Encapsulate foster-parented transclusion content
24161 !!options
24162 parsoid=wt2wt,wt2html
24163 !! wikitext
24164 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24165 !! html/parsoid
24166 <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>
24167 <table>
24168 <tbody>
24169 <tr>
24170 <td>
24171 <div>
24172 <p>foo</p>
24173 </div>
24174 </td>
24175 </tr>
24176 </tbody>
24177 </table>
24178 !!end
24179
24180 !!test
24181 6. Encapsulate foster-parented transclusion content
24182 !!options
24183 parsoid=wt2wt,wt2html
24184 !! wikitext
24185 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24186 !! html/parsoid
24187 <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>
24188 <table>
24189 <tbody>
24190 <tr>
24191 <td>
24192 <div>
24193 <p>foo</p>
24194 </div>
24195 </td>
24196 </tr>
24197 </tbody>
24198 </table>
24199 <p>ok</p>
24200 !!end
24201
24202 !!test
24203 7. Encapsulate foster-parented transclusion content
24204 !!options
24205 parsoid=wt2wt,wt2html
24206 !! wikitext
24207 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24208 !! html/parsoid
24209 <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>
24210 <table>
24211 <tbody>
24212 <tr>
24213 <td>bar</td>
24214 </tr>
24215 </tbody>
24216 </table>
24217 !!end
24218
24219 # Note that the wt is broken on purpose: the = should be {{=}} if you
24220 # don't want it to be a template parameter key.
24221 !!test
24222 8. Encapsulate foster-parented transclusion content
24223 !!options
24224 parsoid=wt2wt,wt2html
24225 !! wikitext
24226 {{echo|a
24227 }}{|{{echo|style='color:red'}}
24228 |-
24229 |b
24230 |}
24231 !! html/parsoid
24232 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24233 <span> </span>
24234 <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>
24235 <table>
24236 <tbody>
24237 <tr>
24238 <td>b</td>
24239 </tr>
24240 </tbody>
24241 </table>
24242 !!end
24243
24244 !!test
24245 9. Encapsulate foster-parented transclusion content
24246 !!options
24247 parsoid=wt2wt,wt2html
24248 !! wikitext
24249 <table>{{echo|hi</table>hello}}
24250 !! html/parsoid
24251 <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>
24252 !!end
24253
24254 !!test
24255 Table in fosterable position
24256 !!options
24257 parsoid=wt2html,wt2wt
24258 !! wikitext
24259 {{OpenTable}}
24260 <div>
24261 {|
24262 |}
24263 </div>
24264 |}
24265 !! html/parsoid
24266 <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">
24267 </span>
24268 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24269
24270 <table>
24271 </table>
24272 !!end
24273
24274 # Parsoid only for bug 64747
24275 !! test
24276 Properly encapsulate empty-content transclusions in fosterable positions
24277 !! wikitext
24278 <table>
24279 {{#if:|
24280 <td>foo</td>
24281 }}
24282 </table>
24283 !! html/parsoid
24284 <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":["","","",""]}]]}'>
24285
24286 </table>
24287 !! end
24288
24289 !!test
24290 Support <object> element with .data attribute
24291 !!options
24292 parsoid=html2wt
24293 !! html/parsoid
24294 <object data="test.swf"></object>
24295 !! wikitext
24296 <object data="test.swf"></object>
24297 !!end
24298
24299 !! test
24300 Don't block XML namespace declaration
24301 !! wikitext
24302 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24303 !! html/php
24304 <p><span>MediaWiki</span>
24305 </p>
24306 !! html/parsoid
24307 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24308 !! end
24309
24310 # -----------------------------------------------------------------
24311 # The following section of tests are primarily to spec requirements
24312 # around serialization of new/edited content.
24313 #
24314 # All these tests are marked Parsoid html2wt and html2html only
24315 # ----------------------------------------------------------------
24316
24317 # 'mi' is a localinterwiki prefix as well as a language
24318 !! test
24319 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24320 !! options
24321 parsoid=html2wt
24322 !! html/parsoid
24323 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24324 !! wikitext
24325 [[Foo]]
24326 !! end
24327
24328 # See T93839
24329 !! test
24330 New wikilinks should be serialized properly
24331 !! options
24332 parsoid=html2wt
24333 !! html/parsoid
24334 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24335 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24336 !! wikitext
24337 [[Foo]]
24338 [[Foo]]
24339 !! end
24340
24341 !! test
24342 New wiki links (href variations)
24343 !! options
24344 parsoid=html2wt
24345 !! html/parsoid
24346 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24347 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24348 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24349 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24350 !! wikitext
24351 [[Foo_bar]]
24352 [[Foo_bar]]
24353 [[Foo_bar]]
24354 [[Toxine bactérienne]]
24355 !! end
24356
24357 !! test
24358 New wiki links (content string variations)
24359 !! options
24360 parsoid=html2wt
24361 !! html/parsoid
24362 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24363 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24364 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24365 !! wikitext
24366 [[Foo_bar]]
24367 [[Foo bar]]
24368 [[Foo_bar|./Foo_bar]]
24369 !! end
24370
24371 !! test
24372 New category links (href variations)
24373 !! options
24374 parsoid=html2wt
24375 !! html/parsoid
24376 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24377 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24378 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24379 !! wikitext
24380 [[Category:Toxine bactérienne]]
24381 [[Category:Toxine bactérienne]]
24382 [[Category:Toxine bactérienne]]
24383 !! end
24384
24385 !! test
24386 New sol transparent links don't need indent-pre nowiki protection
24387 !! options
24388 parsoid=html2wt
24389 language=de
24390 !! html/parsoid
24391 <link rel="mw:PageProp/redirect" href="./Main_Page">
24392 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24393 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24394 !! wikitext
24395 #WEITERLEITUNG [[Main Page]]
24396 <!-- this is good --> [[Category:Good]]
24397 <!-- this is great --> [[Kategorie:Great]]
24398 !! end
24399
24400 !! test
24401 New interlanguage links (href variations)
24402 !! options
24403 parsoid=html2wt
24404 !! html/parsoid
24405 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24406 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24407 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24408 !! wikitext
24409 [[es:Toxine bactérienne]]
24410 [[es:Toxine_bactérienne]]
24411 [[es:Toxine_bactérienne]]
24412 !! end
24413
24414 !! test
24415 Image: Modifying size of an image (1)
24416 !! options
24417 parsoid={
24418 "modes": ["wt2wt"],
24419 "changes": [
24420 ["img[height]", "attr", "height", "22"],
24421 ["img[width]", "attr", "width", "200"]
24422 ]
24423 }
24424 !! wikitext
24425 [[Image:Foobar.jpg|230x230px]]
24426 !! wikitext/edited
24427 [[Image:Foobar.jpg|200x200px]]
24428 !!end
24429
24430 !! test
24431 Image: Modifying size of an image (2)
24432 !! options
24433 parsoid={
24434 "modes": ["wt2wt"],
24435 "changes": [
24436 ["img[height]", "attr", "height", "100"],
24437 ["img[width]", "attr", "width", "500"]
24438 ]
24439 }
24440 !! wikitext
24441 [[Image:Foobar.jpg|230x230px]]
24442 !! wikitext/edited
24443 [[Image:Foobar.jpg|500x500px]]
24444 !!end
24445
24446 # Change in size is ignored so long as class='mw-default-size'
24447 !! test
24448 Image: Modifying size of an image (3)
24449 !! options
24450 parsoid={
24451 "modes": ["wt2wt"],
24452 "changes": [
24453 ["figure[class]", "removeClass", "mw-default-size"],
24454 ["figure img", "attr", "height", "19"],
24455 ["figure img", "attr", "width", "170"]
24456 ]
24457 }
24458 !! wikitext
24459 [[Image:Foobar.jpg|thumb]]
24460 !! wikitext/edited
24461 [[Image:Foobar.jpg|thumb|170x170px]]
24462 !!end
24463
24464 !! test
24465 Image: Modifying alignment of an image (bug 48665)
24466 !! options
24467 parsoid={
24468 "modes": ["wt2wt"],
24469 "changes": [
24470 ["figure[class]", "removeClass", "mw-halign-right"],
24471 ["figure[class]", "addClass", "mw-halign-left"]
24472 ]
24473 }
24474 !! wikitext
24475 [[Image:Foobar.jpg|thumb|caption|right]]
24476 !! wikitext/edited
24477 [[Image:Foobar.jpg|thumb|caption|left]]
24478 !! end
24479
24480 !! test
24481 Image: Modifying mw-default-size of an frameless image (bug 62805)
24482 !! options
24483 parsoid={
24484 "modes": ["wt2wt"],
24485 "changes": [
24486 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24487 ]
24488 }
24489 !! wikitext
24490 [[Image:Foobar.jpg|frameless|right]]
24491 !! wikitext/edited
24492 [[Image:Foobar.jpg|frameless|right|220x220px]]
24493 !! end
24494
24495 !! test
24496 Image: Modifying valign of an image (bug 49221)
24497 !! options
24498 parsoid={
24499 "modes": ["wt2wt"],
24500 "changes": [
24501 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24502 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24503 ]
24504 }
24505 !! wikitext
24506 [[File:Foobar.jpg|20px|middle]]
24507 !! wikitext/edited
24508 [[File:Foobar.jpg|20px|text-top]]
24509 !! end
24510
24511 !! test
24512 Image: Modifying alt attribute of an image (bug 56400)
24513 !! options
24514 parsoid={
24515 "modes": ["wt2wt"],
24516 "changes": [
24517 ["img[alt]", "attr", "alt", "some alternate edited text"]
24518 ]
24519 }
24520 !! wikitext
24521 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24522 !! wikitext/edited
24523 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24524 !!end
24525
24526 !! test
24527 Image: Modifying caption of an image
24528 !! options
24529 parsoid={
24530 "modes": ["wt2wt"],
24531 "changes": [
24532 ["figcaption", "text", "new caption"]
24533 ]
24534 }
24535 !! wikitext
24536 [[Image:Foobar.jpg|thumb|original caption]]
24537 !! wikitext/edited
24538 [[Image:Foobar.jpg|thumb|new caption]]
24539 !!end
24540
24541 !! test
24542 Image: empty alt attribute (bug 48924)
24543 !! options
24544 parsoid
24545 !! wikitext
24546 [[File:Foobar.jpg|thumb|alt=|bar]]
24547 !! html
24548 <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>
24549 !! end
24550
24551 !! test
24552 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24553 !! options
24554 parsoid=html2wt
24555 language=ar
24556 disabled
24557 !! html/parsoid
24558 <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>
24559 !! wikitext
24560 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24561 !! end
24562
24563 !! test
24564 Image: Block level image should have \n before and after
24565 !! wikitext
24566 123
24567 [[File:Foobar.jpg|right|thumb|150x150px]]
24568 456
24569 !! html/parsoid
24570 <p>123</p>
24571 <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>
24572 <p>456</p>
24573 !!end
24574
24575 !! test
24576 Image: New block level image should have \n before and after (existing content)
24577 !! wikitext
24578 123
24579 [[File:Foobar.jpg|right|thumb|150x150px]]
24580 456
24581 !! html/parsoid
24582 <p>123</p>
24583 <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>
24584 <p>456</p>
24585 !!end
24586
24587 !! test
24588 Image: upright option (parsoid)
24589 !! wikitext
24590 [[File:Foobar.jpg|thumb|upright|caption]]
24591 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24592 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24593 !! html/parsoid
24594 <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>
24595 <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>
24596 <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>
24597 !!end
24598
24599 !! test
24600 Image: upright option is ignored on inline and frame images (parsoid)
24601 !! wikitext
24602 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24603 !! html/parsoid
24604 <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>
24605 !!end
24606
24607 !! test
24608 Image: from basic HTML (1)
24609 !! options
24610 parsoid=html2wt
24611 !! html/parsoid
24612 <span typeof="mw:Image">
24613 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24614 </span>
24615 !! wikitext
24616 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24617 !! end
24618
24619 !! test
24620 Image: from basic HTML (2)
24621 !! options
24622 parsoid=html2wt
24623 !! html/parsoid
24624 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24625 !! wikitext
24626 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24627 !! end
24628
24629 !! test
24630 Image: from basic HTML (3)
24631 !! options
24632 parsoid=html2wt
24633 !! html/parsoid
24634 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24635 !! wikitext
24636 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24637 !! end
24638
24639 !! test
24640 Image: from basic HTML (4)
24641 !! options
24642 parsoid=html2wt
24643 !! html/parsoid
24644 <img src="./File:Foobar.jpg">
24645 !! wikitext
24646 [[File:Foobar.jpg|link=]]
24647 !! end
24648
24649 !! test
24650 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24651 !! options
24652 parsoid=html2wt
24653 !! html/parsoid
24654 <ul>
24655 <li><p>foo</p></li>
24656 </ul>
24657 !! wikitext
24658 * foo
24659 !! end
24660
24661 !! test
24662 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24663 !! options
24664 parsoid=html2wt
24665 !! html/parsoid
24666 <ul> <li>foo</li></ul>
24667 !! wikitext
24668 * foo
24669 !! end
24670
24671 !! test
24672 Don't strip leading whitespace when handling indent-pre suppressing tags
24673 !! options
24674 parsoid=html2wt
24675 !! html/parsoid
24676 <table>
24677 <tr><td> indented row</td></tr>
24678 </table>
24679 <blockquote><p>
24680 <b>This is very bold of you!</b>
24681 </p>
24682 <table><tr><td>
24683 indented cell (no pre-wrapping!)
24684 </td></tr></table>
24685 </blockquote>
24686 <p>foo</p>
24687 <div>bar</div>
24688 !! wikitext
24689 {|
24690 | indented row
24691 |}
24692 <blockquote>
24693 '''This is very bold of you!'''
24694
24695 {|
24696 |
24697 indented cell (no pre-wrapping!)
24698 |}
24699 </blockquote>
24700 foo
24701 <div>bar</div>
24702 !! end
24703
24704 !! test
24705 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24706 !! options
24707 parsoid=html2wt
24708 !! html/parsoid
24709 <p>foo</p>
24710 <span>bar</span>
24711
24712 <span>foo2
24713 </span>bar2
24714
24715 <div>foo</div>
24716 <span>bar</span>
24717
24718 <div>
24719 <span>foo</span>
24720 </div>
24721 !! wikitext
24722 foo
24723 <nowiki> </nowiki><span>bar</span>
24724
24725 <span>foo2
24726 <nowiki> </nowiki></span>bar2
24727
24728 <div>foo</div>
24729 <nowiki> </nowiki><span>bar</span>
24730
24731 <div>
24732 <nowiki> </nowiki><span>foo</span>
24733 </div>
24734 !! end
24735
24736 !! test
24737 Lists: Dont insert newlines in a serialized list item.
24738 !! options
24739 parsoid=html2wt
24740 !! html/parsoid
24741 <ul><li>a<br>b</li><li>c</li></ul>
24742 !! wikitext
24743 * a<br>b
24744 * c
24745 !! end
24746
24747 !! test
24748 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24749 !! options
24750 parsoid={
24751 "modes": ["html2wt"],
24752 "scrubWikitext": false
24753 }
24754 !! html/parsoid
24755 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24756 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24757
24758 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24759 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24760
24761 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24762
24763 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24764 !! wikitext
24765 == hello there [[Category:A1]] ==
24766
24767 == [[Category:A2]] hi pal ==
24768
24769 == <!--foo--> [[Category:A3]] how goes it ==
24770
24771 == it goes well [[Category:A4]] <!--bar--> ==
24772
24773 ==howdy [[Category:A5]] ==
24774
24775 == __TOC__ ok ==
24776 !! end
24777
24778 !! test
24779 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24780 !! options
24781 parsoid={
24782 "modes": ["html2wt"],
24783 "scrubWikitext": true
24784 }
24785 !! html/parsoid
24786 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24787 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24788
24789 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24790 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24791
24792 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24793 !! wikitext
24794 == hello there ==
24795 [[Category:A1]]
24796 [[Category:A2]]
24797
24798 == hi pal ==
24799
24800 <!--foo--> [[Category:A3]]
24801
24802 == how goes it ==
24803
24804 == it goes well ==
24805 [[Category:A4]] <!--bar-->
24806
24807 __TOC__
24808
24809 == ok ==
24810 !! end
24811
24812 !! test
24813 Headings: Don't hoist metas that come from templates
24814 !! options
24815 parsoid={
24816 "modes": ["html2wt"],
24817 "scrubWikitext": true
24818 }
24819 !! html/parsoid
24820 <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>
24821 !! wikitext
24822 == {{echo|foo [[Category:Foo]]}} ==
24823 !! end
24824
24825 !! test
24826 Headings: Category in ref isn't hoisted
24827 !! options
24828 parsoid={
24829 "modes": ["html2wt"],
24830 "scrubWikitext": true
24831 }
24832 !! html/parsoid
24833 <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>
24834
24835 <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>
24836 !! wikitext
24837 == foo <ref>bar
24838 [[Category:Baz]] </ref> ==
24839
24840 <references />
24841 !! end
24842
24843 !! test
24844 Parsoid: Serialize positional parameters with = in them as named parameter
24845 !! options
24846 parsoid=html2wt
24847 !! html/parsoid
24848 <p about="#mwt1" typeof="mw:Transclusion"
24849 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24850
24851 <p about="#mwt1" typeof="mw:Transclusion"
24852 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24853
24854 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24855 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24856 <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>
24857 !! wikitext
24858 {{echo|1 = f=oo}}
24859
24860 {{echo|1 = f=oo|2 = bar}}
24861
24862 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24863 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24864 {{echo|<nowiki>f=oo</nowiki>|bar}}
24865 !! end
24866
24867 !! test
24868 Parsoid: Serialize positional parameters with = in extlink as named parameter
24869 !! options
24870 parsoid=html2wt
24871 !! html/parsoid
24872 <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>
24873 !! wikitext
24874 {{echo|1 = http://stuff?is=ok}}
24875 !! end
24876
24877 !! test
24878 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24879 !! options
24880 parsoid=html2wt
24881 !! html/parsoid
24882 <div>a<p>b</p></div>
24883 <div>a
24884 <p>b</p></div>
24885 <div>
24886 a
24887 <p>b</p></div>
24888 !! wikitext
24889 <div>a
24890 b
24891 </div>
24892 <div>a
24893 b
24894 </div>
24895 <div>
24896 a
24897
24898 b
24899 </div>
24900 !! end
24901
24902 !! test
24903 Substrings resembling wikitext in hrefs should not get nowiki escapes
24904 !! options
24905 parsoid=html2wt
24906 !! html/parsoid
24907 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24908 !! wikitext
24909 [[Foo''bar''baz]]
24910 !! end
24911
24912 !! test
24913 Enforce single-line context in the serializer
24914 !! options
24915 parsoid=html2wt
24916 !! html/parsoid
24917 <h2>testing
24918 123</h2>
24919
24920 <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">
24921 </span><span about="#mwt1">you</span> </h2>
24922
24923 <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>
24924
24925 <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
24926 there</span></li></ol>
24927
24928 <ul><li>asd
24929 sdf</li></ul>
24930
24931 <ul><li>foo
24932 bar
24933 baz</li>
24934 <li>foo <b>bar</b>
24935 baz</li></ul>
24936
24937 <dl><dt>hi
24938 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24939 ho</dd></dl>
24940
24941 <dl><dd> <table>
24942 <tbody><tr><td> ha
24943 ha
24944 ha</td></tr>
24945 </tbody></table></dd></dl>
24946 !! wikitext
24947 == testing 123 ==
24948
24949 == hi {{bogus|there
24950 you}} ==
24951
24952 == foo <ref>hello
24953 there</ref> ==
24954
24955 <references />
24956
24957 * asd sdf
24958
24959 * foo bar baz
24960 * foo '''bar''' baz
24961
24962 ; hi ho : hi ho
24963
24964 : {|
24965 | ha
24966 ha
24967 ha
24968 |}
24969 !! end
24970
24971 !! test
24972 Serialize new placeholder space without spans
24973 !! options
24974 parsoid=html2wt
24975 !! html/parsoid
24976 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24977
24978 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24979
24980 <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>
24981 !! wikitext
24982 foo : bar
24983
24984 foo : bar
24985
24986 <ref>foo : bar</ref>ok
24987 !! end
24988
24989
24990 #-----------------------
24991 # Tag minimization tests
24992 #-----------------------
24993
24994 !! test
24995 1. I/B quote minimization: wikitext-only tags should be combined
24996 !! options
24997 parsoid=html2wt
24998 !! html/parsoid
24999 <p><i>A</i><i>B</i></p>
25000 <p><b>A</b><b>B</b></p>
25001 <p><i>A</i><b><i>B</i></b></p>
25002 <p><b>A</b><i><b>B</b></i></p>
25003 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25004 <p><i><b>A</b></i><i><b>B</b></i></p>
25005 <p><i><b>A</b></i><b><i>B</i></b></p>
25006 <p><b><i>A</i></b><i><b>B</b></i></p>
25007 !! wikitext
25008 ''AB''
25009
25010 '''AB'''
25011
25012 ''A'''B'''''
25013
25014 '''A''B'''''
25015
25016 '''A''BC''D'''
25017
25018 '''''AB'''''
25019
25020 '''''AB'''''
25021
25022 '''''AB'''''
25023 !! end
25024
25025 !! test
25026 2. I/B quote minimization: wikitext and html tags should not be combined
25027 !! options
25028 parsoid=html2wt
25029 !! html/parsoid
25030 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25031 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25032 !! wikitext
25033 ''A''<i>B</i>
25034
25035 ''A''<nowiki/>'''<i>B</i>'''
25036 !! end
25037
25038 !! test
25039 3. I/B quote minimization: templated content stops minimization
25040 !! options
25041 parsoid=html2wt
25042 !! html/parsoid
25043 <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>
25044 <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>
25045 !! wikitext
25046 ''A''{{echo|''B''}}
25047
25048 ''A''{{echo|'''''B'''''}}
25049 !! end
25050
25051 !! test
25052 4. I/B quote minimization: new content should be mimimized with adjacent old content
25053 !! options
25054 parsoid=html2wt
25055 !! html/parsoid
25056 <p><i>A</i><i>B</i></p>
25057 <p><b>A</b><b>B</b></p>
25058 <p><i>A</i><b><i>B</i></b></p>
25059 !! wikitext
25060 ''AB''
25061
25062 '''AB'''
25063
25064 ''A'''B'''''
25065 !! end
25066
25067 !! test
25068 5a. Merge adjacent quote nodes if they've been edited
25069 !! options
25070 parsoid={
25071 "modes": ["wt2wt", "selser"],
25072 "changes": [
25073 ["p", "contents", "remove", ":contains('b')"]
25074 ]
25075 }
25076 !! wikitext
25077 ''a''b''c''
25078 !! wikitext/edited
25079 ''ac''
25080 !! end
25081
25082 !! test
25083 5b. Merge adjacent quote nodes if they've been edited
25084 !! options
25085 parsoid={
25086 "modes": ["wt2wt", "selser"],
25087 "changes": [
25088 ["#x", "remove"]
25089 ]
25090 }
25091 !! wikitext
25092 ''a''<span id="x">b</span>''c''
25093 !! wikitext/edited
25094 ''ac''
25095 !! end
25096
25097 !! test
25098 1. Merge adjacent link nodes as long as at least one element is new
25099 !! options
25100 parsoid={
25101 "modes": ["html2wt"],
25102 "scrubWikitext": true
25103 }
25104 !! html/parsoid
25105 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25106 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25107 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25108 !! wikitext
25109 [[Football]]
25110 [[Football]]
25111 [[Football|Foot]][[Football|ball]]
25112 !! end
25113
25114 !! test
25115 2. Merge adjacent link nodes and enable additional normalizations
25116 !! options
25117 parsoid={
25118 "modes": ["html2wt"],
25119 "scrubWikitext": true
25120 }
25121 !! html/parsoid
25122 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25123 !! wikitext
25124 [[Football|''Football'']]
25125 !! end
25126
25127 !! test
25128 3. Don't merge adjacent link nodes if scrubWikitext is false
25129 !! options
25130 parsoid={
25131 "modes": ["html2wt"],
25132 "scrubWikitext": false
25133 }
25134 !! html/parsoid
25135 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25136 !! wikitext
25137 [[Football|Foot]][[Football|ball]]
25138 !! end
25139
25140 #------------------------------
25141 # End of tag minimization tests
25142 #------------------------------
25143
25144 !!test
25145 Bug 54262: New entities
25146 !! options
25147 parsoid=html2wt
25148 !! html/parsoid
25149 <span typeof="mw:Entity">&nbsp;</span>
25150 !! wikitext
25151 &nbsp;
25152 !! end
25153
25154 ## Note that there is no wikitext output for 'unknownproperty' ##
25155 ## Unknown magic words are silently dropped ##
25156
25157 !! test
25158 Magic words
25159 !! options
25160 parsoid=html2wt
25161 !! html/parsoid
25162 <meta property='mw:PageProp/toc' />
25163 <meta property='mw:PageProp/notoc' />
25164 <meta property='mw:PageProp/forcetoc' />
25165 <meta property='mw:PageProp/index' />
25166 <meta property='mw:PageProp/noindex' />
25167 <meta property='mw:PageProp/nogallery' />
25168 <meta property='mw:PageProp/noeditsection' />
25169 <meta property='mw:PageProp/notitleconvert' />
25170 <meta property='mw:PageProp/nocontentconvert' />
25171 <meta property='mw:PageProp/unknownproperty' />
25172 !! wikitext
25173 __TOC__
25174 __NOTOC__
25175 __FORCETOC__
25176 __INDEX__
25177 __NOINDEX__
25178 __NOGALLERY__
25179 __NOEDITSECTION__
25180 __NOTITLECONVERT__
25181 __NOCONTENTCONVERT__
25182 !! end
25183
25184 !! test
25185 Consecutive <pre>s should not get merged
25186 !! options
25187 parsoid=html2wt,html2html
25188 !! html/parsoid
25189 <pre>a</pre><pre>b</pre>
25190
25191 <pre>c
25192 </pre><pre>
25193 d</pre>
25194
25195 <pre>e
25196
25197 </pre><pre>
25198
25199 f</pre>
25200 !! wikitext
25201 a
25202
25203 b
25204
25205 c
25206
25207 d
25208
25209 e
25210
25211
25212
25213 f
25214 !! end
25215
25216 !! test
25217 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25218 !! options
25219 parsoid=html2wt
25220 !! html/parsoid
25221 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25222 !! wikitext
25223 [[Special:BookSources/1234567890|ISBN 1234567895]]
25224 !! end
25225
25226 !! test
25227 Edited RFC links not serializable as RFC links should serialize as extlinks
25228 !! options
25229 parsoid=html2wt
25230 !! html/parsoid
25231 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25232 !! wikitext
25233 [//tools.ietf.org/html/rfc123 New RFC]
25234 !! end
25235
25236 !! test
25237 Edited PMID links not serializable as PMID links should serialize as extlinks
25238 !! options
25239 parsoid=html2wt
25240 !! html/parsoid
25241 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25242 !! wikitext
25243 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25244 !! end
25245
25246 !! test
25247 WTS of autolinks with trailing/surrounding context
25248 !! options
25249 parsoid=html2wt
25250 !! html/parsoid
25251 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25252 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25253 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25254 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25255 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25256 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25257 !! wikitext
25258 http://cscott.net<nowiki/>'''foo'''
25259
25260 http://cscott.net<b>foo</b>
25261
25262 '''http://cscott.net<nowiki/>'''
25263
25264 '''http://cscott.net '''
25265
25266 '''http://cscott.net<nowiki/>x'''
25267
25268 http://cscott.net<nowiki/>x
25269 !! end
25270
25271 !! test
25272 WTS of autolinks with nowikis (round-trip)
25273 !! wikitext
25274 x<nowiki/>http://cscott.net<nowiki/>x
25275 !! html/parsoid
25276 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25277 !! end
25278
25279 # this is the "easy" test because it leaves in place all the
25280 # data-parsoid information indicating this is an autolink
25281 !! test
25282 WTS of autolinks with escapes (editing)
25283 !! options
25284 parsoid={
25285 "modes": ["wt2wt"],
25286 "changes": [
25287 [ "meta", "remove" ]
25288 ]
25289 }
25290 !! wikitext
25291 x<nowiki/>http://cscott.net<nowiki/>x
25292 !! wikitext/edited
25293 x<nowiki/>http://cscott.net<nowiki/>x
25294 !! end
25295
25296 !! test
25297 WTS of edited autolink-like text (T103364)
25298 !! options
25299 parsoid={
25300 "modes": ["wt2wt"],
25301 "changes": [
25302 [ "span[typeof]", "removeAttr", "typeof" ]
25303 ]
25304 }
25305 !! wikitext
25306 Not a link: <nowiki>http://example.com</nowiki>.
25307 !! wikitext/edited
25308 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25309 !! end
25310
25311 !! test
25312 WTS of newly-authored autolink-like text (T103364)
25313 !! options
25314 parsoid=html2wt
25315 !! html/parsoid
25316 <p>http://example.com is not a link.</p>
25317 !! wikitext
25318 <nowiki>http://example.com is not a link.</nowiki>
25319 !! end
25320
25321 !! test
25322 WTS of autolink-like text after an autolink (T108563)
25323 !! options
25324 parsoid=html2wt
25325 !! html/parsoid
25326 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25327 !! wikitext
25328 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25329 !! end
25330
25331 !! test
25332 Magic links inside links (not autolinked)
25333 !! wikitext
25334 [[Foo|http://example.com]]
25335 [[Foo|RFC 1234]]
25336 [[Foo|PMID 1234]]
25337 [[Foo|ISBN 123456789x]]
25338
25339 [http://foo.com http://example.com]
25340 [http://foo.com RFC 1234]
25341 [http://foo.com PMID 1234]
25342 [http://foo.com ISBN 123456789x]
25343 !! html+tidy
25344 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25345 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25346 !! html/parsoid
25347 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25348 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25349 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25350 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25351
25352 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25353 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25354 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25355 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25356 !! end
25357
25358 !! test
25359 Magic links inside image captions (autolinked)
25360 !! wikitext
25361 [[File:Foobar.jpg|thumb|http://example.com]]
25362 [[File:Foobar.jpg|thumb|RFC 1234]]
25363 [[File:Foobar.jpg|thumb|PMID 1234]]
25364 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25365 !! html+tidy
25366 <div class="thumb tright">
25367 <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>
25368 <div class="thumbcaption">
25369 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25370 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25371 </div>
25372 </div>
25373 <div class="thumb tright">
25374 <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>
25375 <div class="thumbcaption">
25376 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25377 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25378 </div>
25379 </div>
25380 <div class="thumb tright">
25381 <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>
25382 <div class="thumbcaption">
25383 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25384 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25385 </div>
25386 </div>
25387 <div class="thumb tright">
25388 <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>
25389 <div class="thumbcaption">
25390 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25391 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25392 </div>
25393 </div>
25394 !! html/parsoid
25395 <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>
25396 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25397 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25398 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25399 !! end
25400
25401 !! test
25402 WTS of magic word text (T109371)
25403 !! options
25404 parsoid=html2wt
25405 !! html/parsoid
25406 <p>RFC 1234</p>
25407 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25408 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25409 !! wikitext
25410 <nowiki>RFC 1234</nowiki>
25411
25412 [http://foo.com RFC 1234]
25413
25414 [[Foo|RFC 1234]]
25415 !! end
25416
25417 !! test
25418 Edited Redirect link should emit a non-piped wikitext link
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25423 !! wikitext
25424 #REDIRECT [[Bar]]
25425 !! end
25426
25427 !! test
25428 T75121: Infer extension name from typeOf if data-mw is not present
25429 !! options
25430 parsoid=html2wt
25431 !! html/parsoid
25432 <div typeOf="mw:Extension/foo"></div>
25433 !! wikitext
25434 <foo />
25435 !! end
25436
25437 # Note that the <p> wrapping isn't present in PHP parser output
25438 # The important thing for this test is that P-wrapping doesn't
25439 # interfere with the <nowiki> protection for leading - in <td>
25440 # (which isn't necessary for <th>).
25441 !! test
25442 T88318: p-wrapped dash in table.
25443 !! options
25444 parsoid=html2wt,wt2wt
25445 !! html/parsoid
25446 <table><tbody>
25447 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25448 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25449 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25450 </tbody></table>
25451 !! wikitext
25452 {|
25453 !-
25454 !-
25455 |-
25456 |<nowiki>-</nowiki>
25457 |<nowiki>- </nowiki>
25458 |-
25459 |<small>-</small>
25460 |<br>
25461 -
25462 |<br>
25463 -
25464 |}
25465 !! html/php+tidy
25466 <table>
25467 <tr>
25468 <th>-</th>
25469 <th>-</th>
25470 </tr>
25471 <tr>
25472 <td>-</td>
25473 <td>-</td>
25474 </tr>
25475 <tr>
25476 <td><small>-</small></td>
25477 <td><br />
25478 <p>-</p>
25479 </td>
25480 <td><br />
25481 <p>-</p>
25482 </td>
25483 </tr>
25484 </table>
25485 !! end
25486
25487 !! test
25488 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25489 !! options
25490 parsoid=html2wt
25491 !! html/parsoid
25492 <table id='mwAb'>
25493 <td id='mwAc'>foo</td>
25494 <td id='serialize-this'>bar</td>
25495 </table>
25496 !! wikitext
25497 {|
25498 |foo
25499 | id="serialize-this" |bar
25500 |}
25501 !! end
25502
25503 !! test
25504 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25505 !! options
25506 parsoid=html2wt
25507 !! html/parsoid
25508 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25509 !! wikitext
25510 <div id="hello">ok</div>
25511 !! end
25512
25513 !! test
25514 WTS change modes
25515 !! options
25516 parsoid={
25517 "modes": ["wt2wt"],
25518 "changes": [
25519 [ "#xyz", "before", "<b>before</b> stuff " ],
25520 [ "#xyz", "after", " stuff <i>after</i>" ],
25521 [ "#xyz", "html", "x <b>y</b> z" ]
25522 ]
25523 }
25524 !! wikitext
25525 <span id="xyz">hello</span>
25526 !! wikitext/edited
25527 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25528 !! end
25529
25530 !! test
25531 Never serialize a-tag as html, regardless of what data-parsoid has to say
25532 !! options
25533 parsoid=html2wt
25534 !! html/parsoid
25535 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25536 !! wikitext
25537 [[Foo]]
25538 !! end
25539
25540 ## SSS FIXME: This is broken output nevertheless.
25541 ## What might be a reasonable non-broken output for this?
25542 ## This is an edge case unlikely to be seen in production
25543 ## that I am not wasting more time on this right now.
25544 !! test
25545 Never serialize a-tag as html, no matter what attributes it has
25546 !! options
25547 parsoid=html2wt
25548 !! html/parsoid
25549 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25550 !! wikitext
25551 [http://boo.org http://boohoo.org]
25552 !! end
25553
25554 # Misnested is an indication that selser can reuse the source but these have
25555 # shown to sneak through on occasion. See T101768.
25556 # The original wikitext here is: [http://test.com [[one]] two three]
25557 !! test
25558 Strip span tags added to mark as misnested
25559 !! options
25560 parsoid=html2wt
25561 !! html/parsoid
25562 <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>
25563 !! wikitext
25564 [http://test.com][[one]] two three
25565 !! end
25566
25567 # --------------------------------------------
25568 # Tests spec'ing wikitext serialization norms |
25569 # --------------------------------------------
25570
25571 !! test
25572 Lists: Add space after bullets
25573 !! options
25574 parsoid=html2wt
25575 !! html/parsoid
25576 <ul>
25577 <li>foo</li>
25578 <li> bar</li>
25579 <li><span> baz</span></li>
25580 </ul>
25581 !! wikitext
25582 * foo
25583 * bar
25584 * <span> baz</span>
25585 !! end
25586
25587 !! test
25588 1. Headings: Add space before/after == (T53744)
25589 !! options
25590 parsoid=html2wt
25591 !! html/parsoid
25592 <h2>foo</h2>
25593 <h2> bar</h2>
25594 <h2>baz </h2>
25595 <h2><span> baz</span></h2>
25596 !! wikitext
25597 == foo ==
25598
25599 == bar ==
25600
25601 == baz ==
25602
25603 == <span> baz</span> ==
25604 !! end
25605
25606 !! test
25607 2. Headings: Add space before/after == even after hoisted content
25608 !! options
25609 parsoid={
25610 "modes": ["html2wt"],
25611 "scrubWikitext": true
25612 }
25613 !! html/parsoid
25614 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25615 !! wikitext
25616 [[Category:A2]]
25617
25618 == ok ==
25619 !! end
25620
25621 !! test
25622 1. Headings: suppress newly created empty headings
25623 !! options
25624 parsoid={
25625 "modes": ["html2wt"],
25626 "scrubWikitext": true
25627 }
25628 !! html/parsoid
25629 <h2></h2>
25630 !! wikitext
25631 !! end
25632
25633 !! test
25634 2. Headings: don't suppress empty headings if scrubWikitext is false
25635 !! options
25636 parsoid=html2wt
25637 !! html/parsoid
25638 <h2></h2>
25639 !! wikitext
25640 ==<nowiki/>==
25641 !! end
25642
25643 !! test
25644 3. Headings: suppress empty headings on edits
25645 !! options
25646 parsoid={
25647 "modes": ["selser"],
25648 "scrubWikitext": true,
25649 "changes": [
25650 [ "#x", "remove"]
25651 ]
25652 }
25653 !! wikitext
25654 ==<span id="x">foo</span>==
25655 !! wikitext/edited
25656 !! end
25657
25658 !! test
25659 1. WT Quote Tags: suppress newly created empty style tags
25660 !! options
25661 parsoid={
25662 "modes": ["html2wt"],
25663 "scrubWikitext": true
25664 }
25665 !! html/parsoid
25666 <i></i><b></b>
25667 !! wikitext
25668 !! end
25669
25670 !! test
25671 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25672 !! options
25673 parsoid=html2wt
25674 !! html/parsoid
25675 <i></i><b></b>
25676 !! wikitext
25677 ''<nowiki/>'''''<nowiki/>'''
25678 !! end
25679
25680 !! test
25681 3. WT Quote Tags: suppress empty style tags on edits
25682 !! options
25683 parsoid={
25684 "modes": ["selser"],
25685 "scrubWikitext": true,
25686 "changes": [
25687 [ "#x", "remove"]
25688 ]
25689 }
25690 !! wikitext
25691 '''<span id="x">foo</span>'''
25692 !! wikitext/edited
25693 !! end
25694
25695 !! test
25696 1. Anchors: suppress newly created empty anchors
25697 !! options
25698 parsoid={
25699 "modes": ["html2wt"],
25700 "scrubWikitext": true
25701 }
25702 !! html/parsoid
25703 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25704 !! wikitext
25705 !! end
25706
25707 !! test
25708 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25709 !! options
25710 parsoid={
25711 "modes": ["html2wt"],
25712 "scrubWikitext": false
25713 }
25714 !! html/parsoid
25715 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25716 !! wikitext
25717 [[Test|<nowiki/>]]
25718 !! end
25719
25720 !! test
25721 3. Anchors: suppress empty anchors on edits
25722 !! options
25723 parsoid={
25724 "modes": ["selser"],
25725 "scrubWikitext": true,
25726 "changes": [
25727 [ "#x", "remove"]
25728 ]
25729 }
25730 !! wikitext
25731 [[Test|<span id="x">foo</span>]]
25732 !! wikitext/edited
25733 !! end
25734
25735 !! test
25736 3a. Anchors: do not suppress numbered extlinks
25737 !! options
25738 parsoid={
25739 "modes": ["wt2wt"],
25740 "scrubWikitext": true
25741 }
25742 !! wikitext
25743 [http://foo.com]
25744 !! html/parsoid
25745 <a rel="mw:ExtLink" href="http://foo.com"></a>
25746 !! end
25747
25748 !! test
25749 3b. Anchors: do not suppress numbered extlinks
25750 !! options
25751 parsoid={
25752 "modes": ["wt2wt"],
25753 "scrubWikitext": true,
25754 "changes": [
25755 [ "#x", "remove"]
25756 ]
25757 }
25758 !! wikitext
25759 [http://foo.com <span id="x">foo</span>]
25760 !! wikitext/edited
25761 [http://foo.com]
25762 !! end
25763
25764 !!test
25765 Normalizations should be restricted to edited content
25766 !!options
25767 parsoid={
25768 "modes": ["selser"],
25769 "scrubWikitext": true,
25770 "changes": [
25771 [ "h1", "before", "<i></i>"]
25772 ]
25773 }
25774 !!wikitext
25775 a
25776 = =
25777 b
25778 !!wikitext/edited
25779 a
25780 = =
25781 b
25782 !!end
25783
25784 !! test
25785 1. Multiple normalizations (html2wt)
25786 !! options
25787 parsoid={
25788 "modes": ["html2wt"],
25789 "scrubWikitext": true
25790 }
25791 !! html
25792 <h2><i></i></h2>
25793 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25794 </a><b><i></i></b>x</p>
25795 !! wikitext
25796
25797 [[foo]]
25798 x
25799
25800 !! end
25801
25802 !! test
25803 2. Multiple normalizations (selser)
25804 !! options
25805 parsoid={
25806 "modes": ["selser"],
25807 "scrubWikitext": true,
25808 "changes": [
25809 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25810 ]
25811 }
25812 !! wikitext
25813 <span id="x">foo</span>
25814 !! wikitext/edited
25815 <span id="x">foo</span>
25816
25817 x
25818 !! end
25819
25820 !! test
25821 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25822 !! options
25823 parsoid={
25824 "modes": ["html2wt"],
25825 "scrubWikitext": true
25826 }
25827 !! html/parsoid
25828 <p> hi</p>
25829 <p> hello</p>
25830 !! wikitext
25831 hi
25832
25833 hello
25834 !! end
25835
25836 !! test
25837 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25838 !! options
25839 parsoid=html2wt
25840 !! html/parsoid
25841 <p> hi</p>
25842 <p> hello</p>
25843 !! wikitext
25844 <nowiki> </nowiki>hi
25845
25846 <nowiki> </nowiki> hello
25847 !! end
25848
25849 !! test
25850 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25851 !! options
25852 parsoid={
25853 "modes": ["html2wt"],
25854 "scrubWikitext": true
25855 }
25856 !! html/parsoid
25857 <p>Foo
25858 bar
25859 baz</p>
25860
25861 <table><tr><td>Foo
25862 bar
25863 baz bang</td></tr></table>
25864
25865 <p><!--boo--> foo
25866 bar</p>
25867
25868 <p> foo
25869 bar<span>boo</span></p>
25870 !! wikitext
25871 Foo
25872 bar
25873 baz
25874
25875 {|
25876 |Foo
25877 bar
25878 baz bang
25879 |}
25880
25881 <!--boo-->foo
25882 bar
25883
25884 foo
25885 bar<span>boo</span>
25886 !! end
25887
25888 !! test
25889 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25890 !! options
25891 parsoid={
25892 "modes": ["selser"],
25893 "scrubWikitext": true,
25894 "changes": [
25895 [ "p", "html", " a\n b" ]
25896 ]
25897 }
25898 !! wikitext
25899 xyz
25900 !! wikitext/edited
25901 a
25902 b
25903 !! end
25904
25905 !! test
25906 1. New links that end in spaces
25907 !! options
25908 parsoid={
25909 "modes": ["html2wt"],
25910 "scrubWikitext": false
25911 }
25912 !! html/parsoid
25913 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25914 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25915 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25916 !! wikitext
25917 [[Berlin ]]<nowiki/>is the capital of Germany.
25918
25919 [[Foo ]]'''bar'''
25920
25921 [[Boston ]] is a city.
25922 !! end
25923
25924 !! test
25925 2. New links that end in spaces
25926 !! options
25927 parsoid={
25928 "modes": ["html2wt"],
25929 "scrubWikitext": true
25930 }
25931 !! html/parsoid
25932 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25933 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25934 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25935 !! wikitext
25936 [[Berlin]] is the capital of Germany.
25937
25938 [[Foo]] '''bar'''
25939
25940 [[Boston]] is a city.
25941 !! end
25942
25943 !! test
25944 1. Table cells with escapable prefixes
25945 !! options
25946 parsoid={
25947 "modes": ["html2wt"],
25948 "scrubWikitext": false
25949 }
25950 !! html
25951 <table>
25952 <tr><td>a</td></tr>
25953 <tr><td>-</td></tr>
25954 <tr><td>+</td></tr>
25955 </table>
25956 !! wikitext
25957 {|
25958 |a
25959 |-
25960 |<nowiki>-</nowiki>
25961 |-
25962 |<nowiki>+</nowiki>
25963 |}
25964 !! end
25965
25966 !! test
25967 2. Table cells with escapable prefixes
25968 !! options
25969 parsoid={
25970 "modes": ["html2wt"],
25971 "scrubWikitext": true
25972 }
25973 !! html
25974 <table>
25975 <tr><td>a</td></tr>
25976 <tr><td>-</td></tr>
25977 <tr><td>+</td></tr>
25978 </table>
25979 !! wikitext
25980 {|
25981 |a
25982 |-
25983 | -
25984 |-
25985 | +
25986 |}
25987 !! end
25988
25989 !! test
25990 3a. Table cells with escapable prefixes after edits
25991 !! options
25992 parsoid={
25993 "modes": ["selser"],
25994 "scrubWikitext": true,
25995 "changes": [
25996 [ "table tbody tr:first-child td:first-child", "remove"]
25997 ]
25998 }
25999 !! wikitext
26000 {|
26001 |a||-
26002 |}
26003 !! wikitext/edited
26004 {|
26005 | -
26006 |}
26007 !! end
26008
26009 !! test
26010 3b. Table cells with escapable prefixes after edits
26011 !! options
26012 parsoid={
26013 "modes": ["selser"],
26014 "scrubWikitext": true,
26015 "changes": [
26016 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26017 [ "#x", "remove" ]
26018 ]
26019 }
26020 !! wikitext
26021 {|
26022 |pqr
26023 |<span id="x">foo</span>+
26024 |}
26025 !! wikitext/edited
26026 {|
26027 | -
26028 | +
26029 |}
26030 !! end
26031
26032 # FIXME: This test will fail because
26033 # normalization doesn't realize that the id attribute
26034 # will eliminate the escapable scenario
26035 !! test
26036 4a. Table cells without escapable prefixes after edits
26037 !! options
26038 parsoid={
26039 "modes": ["selser"],
26040 "scrubWikitext": true,
26041 "changes": [
26042 [ "#x", "html", "-" ]
26043 ]
26044 }
26045 !! wikitext
26046 {|
26047 | id="x" |abcd
26048 |}
26049 !! wikitext/edited
26050 {|
26051 | id="x" |-
26052 |}
26053 !! end
26054
26055 ## This tests normalizer's ability to discriminate between
26056 ## cells having identical content.
26057 !! test
26058 4b. Table cells without escapable prefixes after edits
26059 !! options
26060 parsoid={
26061 "modes": ["selser"],
26062 "scrubWikitext": true,
26063 "changes": [
26064 [ "td", "html", "-" ]
26065 ]
26066 }
26067 !! wikitext
26068 {|
26069 |a||b
26070 |}
26071 !! wikitext/edited
26072 {|
26073 | -||-
26074 |}
26075 !! end
26076
26077 ## This tests normalizer's ability to not be tripped by
26078 ## comments (and whitespace)
26079 !! test
26080 4c. Table cells without escapable prefixes after edits
26081 !! options
26082 parsoid={
26083 "modes": ["selser"],
26084 "scrubWikitext": true,
26085 "changes": [
26086 [ "table tbody tr td:first-child", "remove" ]
26087 ]
26088 }
26089 !! wikitext
26090 {|
26091 |-
26092 <!--foo--> |a||-
26093 |}
26094 !! wikitext/edited
26095 {|
26096 |-
26097 <!--foo--> | -
26098 |}
26099 !! end
26100
26101 ## This tests normalizer's ability to handle HTML cells
26102 !! test
26103 4d. Table cells without escapable prefixes after edits
26104 !! options
26105 parsoid={
26106 "modes": ["selser"],
26107 "scrubWikitext": true,
26108 "changes": [
26109 [ "td", "html", "-" ]
26110 ]
26111 }
26112 !! wikitext
26113 <table>
26114 <tr><td>a</td></tr>
26115 </table>
26116 !! wikitext/edited
26117 <table>
26118 <tr><td>-</td></tr>
26119 </table>
26120 !! end
26121
26122 ## T111151 Remove font elements without attributes
26123 !! test
26124 5a. font tags without attributes should be dropped in scrubWikitext mode
26125 !! options
26126 parsoid={
26127 "modes": ["html2wt"],
26128 "scrubWikitext": true
26129 }
26130 !! html
26131 <font>foo</font>
26132 <font><font>bar</font></font>
26133 <font class="x">boo</font>
26134 !! wikitext
26135 foo
26136 bar
26137 <font class="x">boo</font>
26138 !! end
26139
26140 !! test
26141 5b. font tags should not be dropped without scrubWikitext being enabled
26142 !! options
26143 parsoid={
26144 "modes": ["html2wt"],
26145 "scrubWikitext": false
26146 }
26147 !! html
26148 <font>foo</font>
26149 !! wikitext
26150 <font>foo</font>
26151 !! end
26152
26153 !! test
26154 Escape nowiki DOM elements
26155 !! options
26156 parsoid=html2wt
26157 !! html/parsoid
26158 <nowiki><i>foo</i></nowiki>
26159 !! wikitext
26160 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26161 !! end
26162
26163 # ---------------------------------------------------
26164 # End of tests spec'ing wikitext serialization norms |
26165 # ---------------------------------------------------
26166
26167 # -----------------------------------------------------------------
26168 # End of section for Parsoid-only html2wt tests for serialization
26169 # of new content
26170 # -----------------------------------------------------------------
26171
26172 # -----------------------------------------------------------------
26173 # The following section of tests are primarily to spec behavior of
26174 # the selective serializer. All these tests have manual selser
26175 # changes. The automated selser changes for all tests handle the
26176 # wide variation of changes, but these tests here capture specs
26177 # deterministically.
26178 # ----------------------------------------------------------------
26179
26180 ## T90517
26181 !! test
26182 Selser: New comments should not be lost
26183 !! options
26184 parsoid={
26185 "modes": ["selser"],
26186 "changes": [
26187 [ "#a", "after", "<!--c1-->" ],
26188 [ "#b", "before", "<!--c2-->" ]
26189 ]
26190 }
26191 !! wikitext
26192 <span id="a">a</span>
26193
26194 <span id="b">b</span>
26195 !! wikitext/edited
26196 <span id="a">a</span><!--c1-->
26197
26198 <!--c2--><span id="b">b</span>
26199 !! end
26200
26201 ## T89383
26202 !! test
26203 Selser: Check for validity of DSR before using it
26204 !! options
26205 parsoid={
26206 "modes": ["selser"],
26207 "changes": [
26208 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26209 ]
26210 }
26211 !! wikitext
26212 <span id="a">a</span>
26213 !! wikitext/edited
26214 {{DISPLAYTITLE:foo}}
26215 <span id="a">a</span>
26216 !! end
26217
26218 !! test
26219 1. DOMDiff: Changes to <ref> content should be looked up using id
26220 !! options
26221 parsoid={
26222 "modes": ["selser"],
26223 "changes": [
26224 ["#X", "after", "bar"],
26225 ["#Y", "after", "baz"]
26226 ]
26227 }
26228 !! wikitext
26229 X <ref><span id="X">foo</span></ref>
26230 Y <ref name="a" />
26231 <references>
26232 <ref name="a"><span id="Y">foo</span></ref>
26233 </references>
26234 !! wikitext/edited
26235 X <ref><span id="X">foo</span>bar</ref>
26236 Y <ref name="a" />
26237 <references>
26238 <ref name="a"><span id="Y">foo</span>baz</ref>
26239 </references>
26240 !! end
26241
26242 !! test
26243 2. DOMDiff: Changes to <ref> content should be looked up using id
26244 !! options
26245 parsoid={
26246 "modes": ["selser"],
26247 "changes": [
26248 ["#Z", "after", "bar"]
26249 ]
26250 }
26251 !! wikitext
26252 A <ref>foo bar for a</ref>
26253 B <ref group="X" name="b" />
26254
26255 <references />
26256
26257 <references group="X">
26258 <ref name="b"><span id="Z">foo</span></ref>
26259 </references>
26260 !! wikitext/edited
26261 A <ref>foo bar for a</ref>
26262 B <ref group="X" name="b" />
26263
26264 <references />
26265
26266 <references group="X">
26267 <ref name="b"><span id="Z">foo</span>bar</ref>
26268 </references>
26269 !! end