Merge "Handle revisions with different content models in EditPage"
[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 <div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
17071 </ul></div>
17072
17073 !! end
17074
17075 !! test
17076 Special page transclusion twice (bug 5021)
17077 !! options
17078 !! wikitext
17079 {{Special:Prefixindex/Xyzzyx}}
17080 {{Special:Prefixindex/Xyzzyx}}
17081 !! html
17082 <div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
17083 </ul></div>
17084 <div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
17085 </ul></div>
17086
17087 !! end
17088
17089 !! test
17090 Transclusion of default MediaWiki message
17091 !! wikitext
17092 {{MediaWiki:Mainpage}}
17093 !! html
17094 <p>Main Page
17095 </p>
17096 !! end
17097
17098 !! test
17099 Transclusion of nonexistent MediaWiki message
17100 !! wikitext
17101 {{MediaWiki:Mainpagexxx}}
17102 !! html
17103 <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>
17104 </p>
17105 !! end
17106
17107 !! test
17108 Transclusion of MediaWiki message with underscore
17109 !! wikitext
17110 {{MediaWiki:history_short}}
17111 !! html
17112 <p>History
17113 </p>
17114 !! end
17115
17116 !! test
17117 Transclusion of MediaWiki message with space
17118 !! wikitext
17119 {{MediaWiki:history short}}
17120 !! html
17121 <p>History
17122 </p>
17123 !! end
17124
17125 !! test
17126 Invalid header with following text
17127 !! wikitext
17128 = x = y
17129 !! html
17130 <p>= x = y
17131 </p>
17132 !! end
17133
17134
17135 !! test
17136 Section extraction test (section 0)
17137 !! options
17138 section=0
17139 !! wikitext
17140 start
17141 ==a==
17142 ===aa===
17143 ====aaa====
17144 ==b==
17145 ===ba===
17146 ===bb===
17147 ====bba====
17148 ===bc===
17149 ==c==
17150 ===ca===
17151 !! html/php
17152 start
17153 !! end
17154
17155 !! test
17156 Section extraction test (section 1)
17157 !! options
17158 section=1
17159 !! wikitext
17160 start
17161 ==a==
17162 ===aa===
17163 ====aaa====
17164 ==b==
17165 ===ba===
17166 ===bb===
17167 ====bba====
17168 ===bc===
17169 ==c==
17170 ===ca===
17171 !! html/php
17172 ==a==
17173 ===aa===
17174 ====aaa====
17175 !! end
17176
17177 !! test
17178 Section extraction test (section 2)
17179 !! options
17180 section=2
17181 !! wikitext
17182 start
17183 ==a==
17184 ===aa===
17185 ====aaa====
17186 ==b==
17187 ===ba===
17188 ===bb===
17189 ====bba====
17190 ===bc===
17191 ==c==
17192 ===ca===
17193 !! html/php
17194 ===aa===
17195 ====aaa====
17196 !! end
17197
17198 !! test
17199 Section extraction test (section 3)
17200 !! options
17201 section=3
17202 !! wikitext
17203 start
17204 ==a==
17205 ===aa===
17206 ====aaa====
17207 ==b==
17208 ===ba===
17209 ===bb===
17210 ====bba====
17211 ===bc===
17212 ==c==
17213 ===ca===
17214 !! html/php
17215 ====aaa====
17216 !! end
17217
17218 !! test
17219 Section extraction test (section 4)
17220 !! options
17221 section=4
17222 !! wikitext
17223 start
17224 ==a==
17225 ===aa===
17226 ====aaa====
17227 ==b==
17228 ===ba===
17229 ===bb===
17230 ====bba====
17231 ===bc===
17232 ==c==
17233 ===ca===
17234 !! html/php
17235 ==b==
17236 ===ba===
17237 ===bb===
17238 ====bba====
17239 ===bc===
17240 !! end
17241
17242 !! test
17243 Section extraction test (section 5)
17244 !! options
17245 section=5
17246 !! wikitext
17247 start
17248 ==a==
17249 ===aa===
17250 ====aaa====
17251 ==b==
17252 ===ba===
17253 ===bb===
17254 ====bba====
17255 ===bc===
17256 ==c==
17257 ===ca===
17258 !! html/php
17259 ===ba===
17260 !! end
17261
17262 !! test
17263 Section extraction test (section 6)
17264 !! options
17265 section=6
17266 !! wikitext
17267 start
17268 ==a==
17269 ===aa===
17270 ====aaa====
17271 ==b==
17272 ===ba===
17273 ===bb===
17274 ====bba====
17275 ===bc===
17276 ==c==
17277 ===ca===
17278 !! html/php
17279 ===bb===
17280 ====bba====
17281 !! end
17282
17283 !! test
17284 Section extraction test (section 7)
17285 !! options
17286 section=7
17287 !! wikitext
17288 start
17289 ==a==
17290 ===aa===
17291 ====aaa====
17292 ==b==
17293 ===ba===
17294 ===bb===
17295 ====bba====
17296 ===bc===
17297 ==c==
17298 ===ca===
17299 !! html/php
17300 ====bba====
17301 !! end
17302
17303 !! test
17304 Section extraction test (section 8)
17305 !! options
17306 section=8
17307 !! wikitext
17308 start
17309 ==a==
17310 ===aa===
17311 ====aaa====
17312 ==b==
17313 ===ba===
17314 ===bb===
17315 ====bba====
17316 ===bc===
17317 ==c==
17318 ===ca===
17319 !! html/php
17320 ===bc===
17321 !! end
17322
17323 !! test
17324 Section extraction test (section 9)
17325 !! options
17326 section=9
17327 !! wikitext
17328 start
17329 ==a==
17330 ===aa===
17331 ====aaa====
17332 ==b==
17333 ===ba===
17334 ===bb===
17335 ====bba====
17336 ===bc===
17337 ==c==
17338 ===ca===
17339 !! html/php
17340 ==c==
17341 ===ca===
17342 !! end
17343
17344 !! test
17345 Section extraction test (section 10)
17346 !! options
17347 section=10
17348 !! wikitext
17349 start
17350 ==a==
17351 ===aa===
17352 ====aaa====
17353 ==b==
17354 ===ba===
17355 ===bb===
17356 ====bba====
17357 ===bc===
17358 ==c==
17359 ===ca===
17360 !! html/php
17361 ===ca===
17362 !! end
17363
17364 !! test
17365 Section extraction test (nonexistent section 11)
17366 !! options
17367 section=11
17368 !! wikitext
17369 start
17370 ==a==
17371 ===aa===
17372 ====aaa====
17373 ==b==
17374 ===ba===
17375 ===bb===
17376 ====bba====
17377 ===bc===
17378 ==c==
17379 ===ca===
17380 !! html/php
17381 !! end
17382
17383 !! test
17384 Section extraction test with bogus heading (section 1)
17385 !! options
17386 section=1
17387 !! wikitext
17388 ==a==
17389 ==bogus== not a legal section
17390 ==b==
17391 !! html/php
17392 ==a==
17393 ==bogus== not a legal section
17394 !! end
17395
17396 !! test
17397 Section extraction test with bogus heading (section 2)
17398 !! options
17399 section=2
17400 !! wikitext
17401 ==a==
17402 ==bogus== not a legal section
17403 ==b==
17404 !! html/php
17405 ==b==
17406 !! end
17407
17408 !! test
17409 Section extraction test with comment after heading (section 1)
17410 !! options
17411 section=1
17412 !! wikitext
17413 ==a==
17414 ==b== <!-- -->
17415 ==c==
17416 !! html/php
17417 ==a==
17418 !! end
17419
17420 !! test
17421 Section extraction test with comment after heading (section 2)
17422 !! options
17423 section=2
17424 !! wikitext
17425 ==a==
17426 ==b== <!-- -->
17427 ==c==
17428 !! html/php
17429 ==b== <!-- -->
17430 !! end
17431
17432 !! test
17433 Section extraction test with bogus <nowiki> heading (section 1)
17434 !! options
17435 section=1
17436 !! wikitext
17437 ==a==
17438 ==bogus== <nowiki>not a legal section</nowiki>
17439 ==b==
17440 !! html/php
17441 ==a==
17442 ==bogus== <nowiki>not a legal section</nowiki>
17443 !! end
17444
17445 !! test
17446 Section extraction test with bogus <nowiki> heading (section 2)
17447 !! options
17448 section=2
17449 !! wikitext
17450 ==a==
17451 ==bogus== <nowiki>not a legal section</nowiki>
17452 ==b==
17453 !! html/php
17454 ==b==
17455 !! end
17456
17457 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17458 # instead of respecting commented sections
17459 !! test
17460 Section extraction prefixed by comment (section 1)
17461 !! options
17462 section=1
17463 !! wikitext
17464 <!-- -->==sec1==
17465 ==sec2==
17466 !! html/php
17467 ==sec2==
17468 !!end
17469
17470 !! test
17471 Section extraction prefixed by comment (section 2)
17472 !! options
17473 section=2
17474 !! wikitext
17475 <!-- -->==sec1==
17476 ==sec2==
17477 !! html/php
17478
17479 !!end
17480
17481 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17482 # instead of respecting HTML-style headings
17483 !! test
17484 Section extraction, mixed wiki and html (section 1)
17485 !! options
17486 section=1
17487 !! wikitext
17488 <h2>unmarked</h2>
17489 unmarked
17490 ==1==
17491 one
17492 ==2==
17493 two
17494 !! html/php
17495 ==1==
17496 one
17497 !! end
17498
17499 !! test
17500 Section extraction, mixed wiki and html (section 2)
17501 !! options
17502 section=2
17503 !! wikitext
17504 <h2>unmarked</h2>
17505 unmarked
17506 ==1==
17507 one
17508 ==2==
17509 two
17510 !! html/php
17511 ==2==
17512 two
17513 !! end
17514
17515
17516 # Formerly testing for bug 3342
17517 !! test
17518 Section extraction, heading surrounded by <noinclude>
17519 !! options
17520 section=1
17521 !! wikitext
17522 <noinclude>==unmarked==</noinclude>
17523 ==marked==
17524 !! html/php
17525 ==marked==
17526 !!end
17527
17528 # Test behavior of bug 19910
17529 !! test
17530 Sectiion with all-equals
17531 !! options
17532 section=2
17533 !! wikitext
17534 ===
17535 The line above must have a trailing space
17536 === <!--
17537 --> <!-- -->
17538 But just in case it doesn't...
17539 !! html/php
17540 === <!--
17541 --> <!-- -->
17542 But just in case it doesn't...
17543 !! end
17544
17545 !! test
17546 Section replacement test (section 0)
17547 !! options
17548 replace=0,"xxx"
17549 !! wikitext
17550 start
17551 ==a==
17552 ===aa===
17553 ====aaa====
17554 ==b==
17555 ===ba===
17556 ===bb===
17557 ====bba====
17558 ===bc===
17559 ==c==
17560 ===ca===
17561 !! html/php
17562 xxx
17563
17564 ==a==
17565 ===aa===
17566 ====aaa====
17567 ==b==
17568 ===ba===
17569 ===bb===
17570 ====bba====
17571 ===bc===
17572 ==c==
17573 ===ca===
17574 !! end
17575
17576 !! test
17577 Section replacement test (section 1)
17578 !! options
17579 replace=1,"xxx"
17580 !! wikitext
17581 start
17582 ==a==
17583 ===aa===
17584 ====aaa====
17585 ==b==
17586 ===ba===
17587 ===bb===
17588 ====bba====
17589 ===bc===
17590 ==c==
17591 ===ca===
17592 !! html/php
17593 start
17594 xxx
17595
17596 ==b==
17597 ===ba===
17598 ===bb===
17599 ====bba====
17600 ===bc===
17601 ==c==
17602 ===ca===
17603 !! end
17604
17605 !! test
17606 Section replacement test (section 2)
17607 !! options
17608 replace=2,"xxx"
17609 !! wikitext
17610 start
17611 ==a==
17612 ===aa===
17613 ====aaa====
17614 ==b==
17615 ===ba===
17616 ===bb===
17617 ====bba====
17618 ===bc===
17619 ==c==
17620 ===ca===
17621 !! html/php
17622 start
17623 ==a==
17624 xxx
17625
17626 ==b==
17627 ===ba===
17628 ===bb===
17629 ====bba====
17630 ===bc===
17631 ==c==
17632 ===ca===
17633 !! end
17634
17635 !! test
17636 Section replacement test (section 3)
17637 !! options
17638 replace=3,"xxx"
17639 !! wikitext
17640 start
17641 ==a==
17642 ===aa===
17643 ====aaa====
17644 ==b==
17645 ===ba===
17646 ===bb===
17647 ====bba====
17648 ===bc===
17649 ==c==
17650 ===ca===
17651 !! html/php
17652 start
17653 ==a==
17654 ===aa===
17655 xxx
17656
17657 ==b==
17658 ===ba===
17659 ===bb===
17660 ====bba====
17661 ===bc===
17662 ==c==
17663 ===ca===
17664 !! end
17665
17666 !! test
17667 Section replacement test (section 4)
17668 !! options
17669 replace=4,"xxx"
17670 !! wikitext
17671 start
17672 ==a==
17673 ===aa===
17674 ====aaa====
17675 ==b==
17676 ===ba===
17677 ===bb===
17678 ====bba====
17679 ===bc===
17680 ==c==
17681 ===ca===
17682 !! html/php
17683 start
17684 ==a==
17685 ===aa===
17686 ====aaa====
17687 xxx
17688
17689 ==c==
17690 ===ca===
17691 !! end
17692
17693 !! test
17694 Section replacement test (section 5)
17695 !! options
17696 replace=5,"xxx"
17697 !! wikitext
17698 start
17699 ==a==
17700 ===aa===
17701 ====aaa====
17702 ==b==
17703 ===ba===
17704 ===bb===
17705 ====bba====
17706 ===bc===
17707 ==c==
17708 ===ca===
17709 !! html/php
17710 start
17711 ==a==
17712 ===aa===
17713 ====aaa====
17714 ==b==
17715 xxx
17716
17717 ===bb===
17718 ====bba====
17719 ===bc===
17720 ==c==
17721 ===ca===
17722 !! end
17723
17724 !! test
17725 Section replacement test (section 6)
17726 !! options
17727 replace=6,"xxx"
17728 !! wikitext
17729 start
17730 ==a==
17731 ===aa===
17732 ====aaa====
17733 ==b==
17734 ===ba===
17735 ===bb===
17736 ====bba====
17737 ===bc===
17738 ==c==
17739 ===ca===
17740 !! html/php
17741 start
17742 ==a==
17743 ===aa===
17744 ====aaa====
17745 ==b==
17746 ===ba===
17747 xxx
17748
17749 ===bc===
17750 ==c==
17751 ===ca===
17752 !! end
17753
17754 !! test
17755 Section replacement test (section 7)
17756 !! options
17757 replace=7,"xxx"
17758 !! wikitext
17759 start
17760 ==a==
17761 ===aa===
17762 ====aaa====
17763 ==b==
17764 ===ba===
17765 ===bb===
17766 ====bba====
17767 ===bc===
17768 ==c==
17769 ===ca===
17770 !! html/php
17771 start
17772 ==a==
17773 ===aa===
17774 ====aaa====
17775 ==b==
17776 ===ba===
17777 ===bb===
17778 xxx
17779
17780 ===bc===
17781 ==c==
17782 ===ca===
17783 !! end
17784
17785 !! test
17786 Section replacement test (section 8)
17787 !! options
17788 replace=8,"xxx"
17789 !! wikitext
17790 start
17791 ==a==
17792 ===aa===
17793 ====aaa====
17794 ==b==
17795 ===ba===
17796 ===bb===
17797 ====bba====
17798 ===bc===
17799 ==c==
17800 ===ca===
17801 !! html/php
17802 start
17803 ==a==
17804 ===aa===
17805 ====aaa====
17806 ==b==
17807 ===ba===
17808 ===bb===
17809 ====bba====
17810 xxx
17811
17812 ==c==
17813 ===ca===
17814 !!end
17815
17816 !! test
17817 Section replacement test (section 9)
17818 !! options
17819 replace=9,"xxx"
17820 !! wikitext
17821 start
17822 ==a==
17823 ===aa===
17824 ====aaa====
17825 ==b==
17826 ===ba===
17827 ===bb===
17828 ====bba====
17829 ===bc===
17830 ==c==
17831 ===ca===
17832 !! html/php
17833 start
17834 ==a==
17835 ===aa===
17836 ====aaa====
17837 ==b==
17838 ===ba===
17839 ===bb===
17840 ====bba====
17841 ===bc===
17842 xxx
17843 !! end
17844
17845 !! test
17846 Section replacement test (section 10)
17847 !! options
17848 replace=10,"xxx"
17849 !! wikitext
17850 start
17851 ==a==
17852 ===aa===
17853 ====aaa====
17854 ==b==
17855 ===ba===
17856 ===bb===
17857 ====bba====
17858 ===bc===
17859 ==c==
17860 ===ca===
17861 !! html/php
17862 start
17863 ==a==
17864 ===aa===
17865 ====aaa====
17866 ==b==
17867 ===ba===
17868 ===bb===
17869 ====bba====
17870 ===bc===
17871 ==c==
17872 xxx
17873 !! end
17874
17875 !! test
17876 Section replacement test with initial whitespace (bug 13728)
17877 !! options
17878 replace=2,"xxx"
17879 !! wikitext
17880 Preformatted initial line
17881 ==a==
17882 ===a===
17883 !! html/php
17884 Preformatted initial line
17885 ==a==
17886 xxx
17887 !! end
17888
17889
17890 !! test
17891 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17892 !! options
17893 section=1
17894 !! wikitext
17895 ==a==
17896 a
17897 !! html/php
17898 ==a==
17899 a
17900 !! end
17901
17902 !! test
17903 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17904 !! options
17905 section=1
17906 !! wikitext
17907 ==a==
17908 a
17909 !! html/php
17910 ==a==
17911 a
17912 !! end
17913
17914
17915 !! test
17916 Section extraction, <pre> around bogus header (bug 10309)
17917 !! options
17918 noxml section=2
17919 !! wikitext
17920 == Section One ==
17921 <pre>
17922 =======
17923 </pre>
17924
17925 == Section Two ==
17926 stuff
17927 !! html/php
17928 == Section Two ==
17929 stuff
17930 !! end
17931
17932 !! test
17933 Section replacement, <pre> around bogus header (bug 10309)
17934 !! options
17935 noxml replace=2,"xxx"
17936 !! wikitext
17937 == Section One ==
17938 <pre>
17939 =======
17940 </pre>
17941
17942 == Section Two ==
17943 stuff
17944 !! html/php
17945 == Section One ==
17946 <pre>
17947 =======
17948 </pre>
17949
17950 xxx
17951 !! end
17952
17953
17954 !! test
17955 Handling of &#x0A; in URLs
17956 !! wikitext
17957 ** irc://&#x0A;a
17958 !! html/php
17959 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17960
17961 !! html/parsoid
17962 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17963 a">irc://
17964 a</a></li></ul></li></ul>
17965 !! end
17966
17967 !! test
17968 Handling of %0A in URLs
17969 !! wikitext
17970 ** irc://%0Aa
17971 !! html/php
17972 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17973
17974 !! html/parsoid
17975 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17976 !! end
17977
17978
17979 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17980 !! test
17981 5 quotes, code coverage +1 line
17982 !! options
17983 parsoid=wt2html
17984 !! wikitext
17985 '''''
17986 !! html/php
17987 !! html/parsoid
17988 <p><b><i></i></b></p>
17989 !! end
17990
17991 # same html as previous, but wikitext adjusted to match parsoid html2wt
17992 # note that wt2html and html2html will put the <i> before the <b>
17993 !! test
17994 5 quotes, code coverage +1 line w/ nowiki (1)
17995 !! options
17996 parsoid=wt2wt,html2wt
17997 !! wikitext
17998 '''''<nowiki/>'''''
17999 !! html/php
18000 <p><i></i>
18001 </p>
18002 !! html/parsoid
18003 <p><b><i></i></b></p>
18004 !! end
18005
18006 # same as previous, just swapping the <i> and <b>
18007 !! test
18008 5 quotes, code coverage +1 line w/ nowiki (2)
18009 !! wikitext
18010 '''''<nowiki/>'''''
18011 !! html/php
18012 <p><i></i>
18013 </p>
18014 !! html/parsoid
18015 <p><i><b></b></i></p>
18016 !! end
18017
18018 !! test
18019 Special:Search page linking.
18020 !! wikitext
18021 {{Special:search}}
18022 !! html
18023 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18024 </p>
18025 !! end
18026
18027 !! test
18028 {{!}} is a magic word
18029 !! wikitext
18030 {{!}} 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 !! html/php
18033 <p>| is a magic word there and | is still a magic word here
18034 | is not a magic word here but | is still a magic word here
18035 </p>
18036 !! html/parsoid
18037 <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
18038 | 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>
18039
18040 !! end
18041
18042 !! test
18043 Say the magic word
18044 !! options
18045 title=[[Parser test]]
18046 !! wikitext
18047 * {{PAGENAME}}
18048 * {{PAGENAMEE}}
18049 * {{FULLPAGENAME}}
18050 * {{FULLPAGENAMEE}}
18051 * {{BASEPAGENAME}}
18052 * {{BASEPAGENAMEE}}
18053 * {{SUBPAGENAME}}
18054 * {{SUBPAGENAMEE}}
18055 * {{ROOTPAGENAME}}
18056 * {{ROOTPAGENAMEE}}
18057 * {{TALKPAGENAME}}
18058 * {{TALKPAGENAMEE}}
18059 * {{SUBJECTPAGENAME}}
18060 * {{SUBJECTPAGENAMEE}}
18061 * {{NAMESPACEE}}
18062 * {{NAMESPACE}}
18063 * {{NAMESPACENUMBER}}
18064 * {{TALKSPACE}}
18065 * {{TALKSPACEE}}
18066 * {{SUBJECTSPACE}}
18067 * {{SUBJECTSPACEE}}
18068 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18069 !! html
18070 <ul><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> Parser_test</li>
18078 <li> Parser test</li>
18079 <li> Parser_test</li>
18080 <li> Talk:Parser test</li>
18081 <li> Talk:Parser_test</li>
18082 <li> Parser test</li>
18083 <li> Parser_test</li>
18084 <li> </li>
18085 <li> </li>
18086 <li> 0</li>
18087 <li> Talk</li>
18088 <li> Talk</li>
18089 <li> </li>
18090 <li> </li>
18091 <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>
18092
18093 !! end
18094 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18095
18096 !! test
18097 Gallery
18098 !! wikitext
18099 <gallery>
18100 image1.png |
18101 image2.gif|||||
18102
18103 image3|
18104 image4 |300px| centre
18105 image5.svg| http://///////
18106 [[x|xx]]]]
18107 * image6
18108 </gallery>
18109 !! html
18110 <ul class="gallery mw-gallery-traditional">
18111 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18112 <div class="thumb" style="height: 150px;">Image1.png</div>
18113 <div class="gallerytext">
18114 </div>
18115 </div></li>
18116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18117 <div class="thumb" style="height: 150px;">Image2.gif</div>
18118 <div class="gallerytext">
18119 <p>||||
18120 </p>
18121 </div>
18122 </div></li>
18123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18124 <div class="thumb" style="height: 150px;">Image3</div>
18125 <div class="gallerytext">
18126 </div>
18127 </div></li>
18128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18129 <div class="thumb" style="height: 150px;">Image4</div>
18130 <div class="gallerytext">
18131 <p>300px| centre
18132 </p>
18133 </div>
18134 </div></li>
18135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18136 <div class="thumb" style="height: 150px;">Image5.svg</div>
18137 <div class="gallerytext">
18138 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18139 </p>
18140 </div>
18141 </div></li>
18142 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18143 <div class="thumb" style="height: 150px;">* image6</div>
18144 <div class="gallerytext">
18145 </div>
18146 </div></li>
18147 </ul>
18148
18149 !! end
18150
18151 !! test
18152 Gallery (with options)
18153 !! wikitext
18154 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18155 File:Nonexistent.jpg|caption
18156 File:Nonexistent.jpg
18157 image:foobar.jpg|some '''caption''' [[Main Page]]
18158 image:foobar.jpg
18159 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18160 </gallery>
18161 !! html
18162 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18163 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18164 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18165 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18166 <div class="gallerytext">
18167 <p>caption
18168 </p>
18169 </div>
18170 </div></li>
18171 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18172 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18173 <div class="gallerytext">
18174 </div>
18175 </div></li>
18176 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18177 <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>
18178 <div class="gallerytext">
18179 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18180 </p>
18181 </div>
18182 </div></li>
18183 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18184 <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>
18185 <div class="gallerytext">
18186 </div>
18187 </div></li>
18188 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18189 <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>
18190 <div class="gallerytext">
18191 <p>Blabla|blabla.
18192 </p>
18193 </div>
18194 </div></li>
18195 </ul>
18196
18197 !! end
18198
18199 !! test
18200 Gallery with link that has fragment
18201 !! wikitext
18202 <gallery>
18203 image:foobar.jpg|link=Main_Page
18204 image:foobar.jpg|link=Main_Page#section
18205 image:foobar.jpg|link=Main Page#section|caption
18206 </gallery>
18207 !! html
18208 <ul class="gallery mw-gallery-traditional">
18209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18210 <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>
18211 <div class="gallerytext">
18212 </div>
18213 </div></li>
18214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18215 <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>
18216 <div class="gallerytext">
18217 </div>
18218 </div></li>
18219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18220 <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>
18221 <div class="gallerytext">
18222 <p>caption
18223 </p>
18224 </div>
18225 </div></li>
18226 </ul>
18227
18228 !! end
18229
18230 !! test
18231 Gallery with wikitext inside caption
18232 !! wikitext
18233 <gallery>
18234 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18235 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18236 </gallery>
18237 !! html
18238 <ul class="gallery mw-gallery-traditional">
18239 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18240 <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>
18241 <div class="gallerytext">
18242 <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>
18243 </p>
18244 </div>
18245 </div></li>
18246 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18247 <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>
18248 <div class="gallerytext">
18249 <p>This is a test template
18250 </p>
18251 </div>
18252 </div></li>
18253 </ul>
18254
18255 !! end
18256
18257 !! test
18258 gallery (with showfilename option)
18259 !! wikitext
18260 <gallery showfilename>
18261 File:Nonexistent.jpg|caption
18262 File:Nonexistent.jpg
18263 image:foobar.jpg|some '''caption''' [[Main Page]]
18264 File:Foobar.jpg
18265 </gallery>
18266 !! html
18267 <ul class="gallery mw-gallery-traditional">
18268 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18269 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18270 <div class="gallerytext">
18271 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18272 caption
18273 </p>
18274 </div>
18275 </div></li>
18276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18277 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18278 <div class="gallerytext">
18279 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18280 </p>
18281 </div>
18282 </div></li>
18283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18284 <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>
18285 <div class="gallerytext">
18286 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18287 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18288 </p>
18289 </div>
18290 </div></li>
18291 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18292 <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>
18293 <div class="gallerytext">
18294 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18295 </p>
18296 </div>
18297 </div></li>
18298 </ul>
18299
18300 !! end
18301
18302 !! test
18303 Gallery (with namespace-less filenames)
18304 !! wikitext
18305 <gallery>
18306 File:Nonexistent.jpg
18307 Nonexistent.jpg
18308 image:foobar.jpg
18309 foobar.jpg
18310 </gallery>
18311 !! html
18312 <ul class="gallery mw-gallery-traditional">
18313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18314 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18315 <div class="gallerytext">
18316 </div>
18317 </div></li>
18318 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18319 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18320 <div class="gallerytext">
18321 </div>
18322 </div></li>
18323 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18324 <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>
18325 <div class="gallerytext">
18326 </div>
18327 </div></li>
18328 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18329 <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>
18330 <div class="gallerytext">
18331 </div>
18332 </div></li>
18333 </ul>
18334
18335 !! end
18336
18337 !! test
18338 HTML Hex character encoding (spells the word "JavaScript")
18339 !! options
18340 parsoid=wt2html,wt2wt,html2html
18341 !! wikitext
18342 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18343 !! html/php
18344 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18345 </p>
18346 !! html/php+tidy
18347 <p>JavaScript</p>
18348 !! html/parsoid
18349 <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>
18350 !! end
18351
18352 !! test
18353 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18354 !! wikitext
18355 &#xsee;&#XSEE;
18356 !! html/php
18357 <p>&amp;#xsee;&amp;#XSEE;
18358 </p>
18359 !! html/parsoid
18360 <p>&amp;#xsee;&amp;#XSEE;</p>
18361 !! end
18362
18363 !! test
18364 HTML Hex character encoding mixed case
18365 !! options
18366 parsoid=wt2html,wt2wt,html2html
18367 !! wikitext
18368 &#xEE;&#Xee;
18369 !! html/php
18370 <p>&#xee;&#xee;
18371 </p>
18372 !! html/php+tidy
18373 <p>îî</p>
18374 !! html/parsoid
18375 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18376 !! end
18377
18378 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18379 # Note that U+000C (form feed) is not a valid XML character, so
18380 # it is banned even though allowed in HTML5.
18381 !! test
18382 Illegal character references (T106578)
18383 !! wikitext
18384 ; Null: &#00;
18385 ; FF: &#xC;
18386 ; CR: &#xD;
18387 ; Control (low): &#8;
18388 ; Control (high): &#x7F; &#x9F;
18389 ; Surrogate: &#xD83D;&#xDCA9;
18390 ; This is an okay astral character: &#x1F4A9;
18391 !! html+tidy
18392 <dl>
18393 <dt>Null</dt>
18394 <dd>&amp;#00;</dd>
18395 <dt>FF</dt>
18396 <dd>&amp;#xC;</dd>
18397 <dt>CR</dt>
18398 <dd>&amp;#xD;</dd>
18399 <dt>Control (low)</dt>
18400 <dd>&amp;#8;</dd>
18401 <dt>Control (high)</dt>
18402 <dd>&amp;#x7F; &amp;#x9F;</dd>
18403 <dt>Surrogate</dt>
18404 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18405 <dt>This is an okay astral character</dt>
18406 <dd>💩</dd>
18407 </dl>
18408 !! end
18409
18410 !! test
18411 __FORCETOC__ override
18412 !! wikitext
18413 __NEWSECTIONLINK__
18414 __FORCETOC__
18415 !! html/php
18416 <p><br />
18417 </p>
18418 !! end
18419
18420 !! test
18421 ISBN code coverage
18422 !! wikitext
18423 ISBN 978-0-1234-56&#x20;789
18424 !! html
18425 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18426 </p>
18427 !! html+tidy
18428 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18429 !! html/parsoid
18430 <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>
18431 !! end
18432
18433 !! test
18434 ISBN followed by 5 spaces
18435 !! wikitext
18436 ISBN
18437 !! html
18438 <p>ISBN
18439 </p>
18440 !! end
18441
18442 !! test
18443 Double ISBN
18444 !! wikitext
18445 ISBN ISBN 1234567890
18446 !! html/php
18447 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18448 </p>
18449 !! html/parsoid
18450 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18451 !! end
18452
18453 # Uppercase X and lowercase x as well
18454 !! test
18455 ISBN with an X
18456 !! wikitext
18457 ISBN 3-462-04561-X
18458 ISBN 3-462-04561-x
18459 ISBN 080442957X
18460 ISBN 080442957x
18461 ISBN 978080442957X
18462 ISBN 978080442957x
18463 !! html/php
18464 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18465 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18466 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18467 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18468 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18469 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18470 </p>
18471 !! html/parsoid
18472 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18473 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18474 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18475 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18476 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18477 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18478 !! end
18479
18480 !! test
18481 ISBN with empty prefix (parsoid test)
18482 !! wikitext
18483 ISBN 1234567890
18484 !! html/php
18485 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18486 </p>
18487 !! html/parsoid
18488 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18489 !! end
18490
18491 !! test
18492 Bug 22905: <abbr> followed by ISBN followed by </a>
18493 !! wikitext
18494 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18495 !! html/php
18496 <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>
18497 </p>
18498 !! html/parsoid
18499 <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>
18500 !! end
18501
18502 !! test
18503 Double RFC
18504 !! wikitext
18505 RFC RFC 1234
18506 !! html
18507 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18508 </p>
18509 !! end
18510
18511 !! test
18512 Double RFC with a wiki link
18513 !! wikitext
18514 RFC [[RFC 1234]]
18515 !! html
18516 <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>
18517 </p>
18518 !! end
18519
18520 !! test
18521 RFC code coverage
18522 !! wikitext
18523 RFC 983&#x20;987
18524 !! html
18525 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18526 </p>
18527 !! html+tidy
18528 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18529 !! end
18530
18531 !! test
18532 Centre-aligned image
18533 !! wikitext
18534 [[Image:foobar.jpg|centre]]
18535 !! html
18536 <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>
18537
18538 !!end
18539
18540 !! test
18541 None-aligned image
18542 !! wikitext
18543 [[Image:foobar.jpg|none]]
18544 !! html
18545 <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>
18546
18547 !!end
18548
18549 !! test
18550 Width + Height sized image (using px) (height is ignored)
18551 !! wikitext
18552 [[Image:foobar.jpg|640x480px]]
18553 !! html
18554 <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>
18555 </p>
18556 !!end
18557
18558 !! test
18559 Width-sized image (using px, no following whitespace)
18560 !! wikitext
18561 [[Image:foobar.jpg|640px]]
18562 !! html
18563 <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>
18564 </p>
18565 !!end
18566
18567 !! test
18568 Width-sized image (using px, with following whitespace - test regression from r39467)
18569 !! wikitext
18570 [[Image:foobar.jpg|640px ]]
18571 !! html
18572 <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>
18573 </p>
18574 !!end
18575
18576 !! test
18577 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18578 !! wikitext
18579 [[Image:foobar.jpg| 640px]]
18580 !! html
18581 <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>
18582 </p>
18583 !!end
18584
18585 !! test
18586 Image with page parameter
18587 !! options
18588 djvu
18589 !! wikitext
18590 [[File:LoremIpsum.djvu|page=2]]
18591 !! html/php
18592 <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>
18593 </p>
18594 !! html/parsoid
18595 <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>
18596 !! end
18597
18598 !! test
18599 Another italics / bold test
18600 !! wikitext
18601 ''' ''x'
18602 !! html
18603 <pre>'<i> </i>x'
18604 </pre>
18605 !!end
18606
18607 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18608 !! test
18609 dt/dd/dl test
18610 !! wikitext
18611 :;;;::
18612 !! html/php
18613 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18614
18615 !! html/parsoid
18616 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18617
18618 !!end
18619
18620
18621 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18622 !! test
18623 Images with the "|" character in the comment
18624 !! wikitext
18625 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18626 !! html/php
18627 <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>
18628
18629 !! html/parsoid
18630 <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>
18631 !! end
18632
18633 !! test
18634 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18635 !! wikitext
18636 <html><script>alert(1);</script></html>
18637 !! html
18638 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18639 </p>
18640 !! end
18641
18642 !! test
18643 HTML with raw HTML ($wgRawHtml==true)
18644 !! options
18645 wgRawHtml=1
18646 !! wikitext
18647 <html><script>alert(1);</script></html>
18648 !! html
18649 <p><script>alert(1);</script>
18650 </p>
18651 !! end
18652
18653 !! test
18654 Parents of subpages, one level up
18655 !! options
18656 subpage title=[[Subpage test/L1/L2/L3]]
18657 !! wikitext
18658 [[../|L2]]
18659 !! html
18660 <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>
18661 </p>
18662 !! end
18663
18664
18665 !! test
18666 Parents of subpages, one level up, not named
18667 !! options
18668 subpage title=[[Subpage test/L1/L2/L3]]
18669 !! wikitext
18670 [[../]]
18671 !! html
18672 <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>
18673 </p>
18674 !! end
18675
18676
18677
18678 !! test
18679 Parents of subpages, two levels up
18680 !! options
18681 subpage title=[[Subpage test/L1/L2/L3]]
18682 !! wikitext
18683 [[../../|L1]]2
18684
18685 [[../../|L1]]l
18686 !! html
18687 <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
18688 </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>
18689 </p>
18690 !! end
18691
18692 !! test
18693 Parents of subpages, two levels up, without trailing slash or name.
18694 !! options
18695 subpage title=[[Subpage test/L1/L2/L3]]
18696 !! wikitext
18697 [[../..]]
18698 !! html
18699 <p>[[../..]]
18700 </p>
18701 !! end
18702
18703 !! test
18704 Parents of subpages, two levels up, with lots of extra trailing slashes.
18705 !! options
18706 subpage title=[[Subpage test/L1/L2/L3]]
18707 !! wikitext
18708 [[../../////]]
18709 !! html
18710 <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>
18711 </p>
18712 !! end
18713
18714 !! article
18715 Subpage test/L1/L2/L3Sibling
18716 !! text
18717 Sibling article
18718 !! endarticle
18719
18720 !! test
18721 Transclusion of a sibling page (one level up)
18722 !! options
18723 subpage title=[[Subpage test/L1/L2/L3]]
18724 !! wikitext
18725 {{../L3Sibling}}
18726 !! html
18727 <p>Sibling article
18728 </p>
18729 !! end
18730
18731 !! test
18732 Transclusion of a child page
18733 !! options
18734 subpage title=[[Subpage test/L1/L2]]
18735 !! wikitext
18736 {{/L3Sibling}}
18737 !! html
18738 <p>Sibling article
18739 </p>
18740 !! end
18741
18742 !! test
18743 Non-transclusion because of too many up levels
18744 !! options
18745 subpage title=[[Subpage test/L1/L2/L3]]
18746 !! wikitext
18747 {{../../../../More than parent}}
18748 !! html
18749 <p>{{../../../../More than parent}}
18750 </p>
18751 !! end
18752
18753 !! test
18754 Definition list code coverage
18755 !! wikitext
18756 ; title : def
18757 ; title : def
18758 ;title: def
18759 !! html/php
18760 <dl><dt> title &#160;</dt>
18761 <dd> def</dd>
18762 <dt> title&#160;</dt>
18763 <dd> def</dd>
18764 <dt>title</dt>
18765 <dd> def</dd></dl>
18766
18767 !! html/parsoid
18768 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18769 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18770 <dt>title</dt><dd> def</dd></dl>
18771 !! end
18772
18773 !! test
18774 Don't fall for the self-closing div
18775 !! wikitext
18776 <div>hello world</div/>
18777 !! html
18778 <div>hello world</div>
18779
18780 !! end
18781
18782 !! test
18783 MSGNW magic word
18784 !! wikitext
18785 {{MSGNW:msg}}
18786 !! html/php
18787 <p>&#91;&#91;:Template:Msg&#93;&#93;
18788 </p>
18789 !! end
18790
18791 !! test
18792 RAW magic word
18793 !! wikitext
18794 {{RAW:QUERTY}}
18795 !! html
18796 <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>
18797 </p>
18798 !! end
18799
18800 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18801 !! test
18802 Always escape literal '>' in output, not just after '<'
18803 !! wikitext
18804 ><>
18805 !! html
18806 <p>&gt;&lt;&gt;
18807 </p>
18808 !! end
18809
18810 !! test
18811 Template caching
18812 !! wikitext
18813 {{Test}}
18814 {{Test}}
18815 !! html
18816 <p>This is a test template
18817 This is a test template
18818 </p>
18819 !! end
18820
18821
18822 !! article
18823 MediaWiki:Fake
18824 !! text
18825 ==header==
18826 !! endarticle
18827
18828 !! test
18829 Inclusion of !userCanEdit() content
18830 !! wikitext
18831 {{MediaWiki:Fake}}
18832 !! html
18833 <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>
18834
18835 !! end
18836
18837
18838 !! test
18839 Out-of-order TOC heading levels
18840 !! wikitext
18841 ==2==
18842 ======6======
18843 ===3===
18844 =1=
18845 =====5=====
18846 ==2==
18847 !! html
18848 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18849 <ul>
18850 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18851 <ul>
18852 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18853 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18854 </ul>
18855 </li>
18856 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18857 <ul>
18858 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18859 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18860 </ul>
18861 </li>
18862 </ul>
18863 </div>
18864
18865 <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>
18866 <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>
18867 <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>
18868 <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>
18869 <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>
18870 <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>
18871
18872 !! end
18873
18874
18875 !! test
18876 ISBN with a dummy number
18877 !! wikitext
18878 ISBN ---
18879 !! html
18880 <p>ISBN ---
18881 </p>
18882 !! end
18883
18884
18885 !! test
18886 ISBN with space-delimited number
18887 !! wikitext
18888 ISBN 92 9017 032 8
18889 !! html
18890 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18891 </p>
18892 !! end
18893
18894
18895 !! test
18896 ISBN with multiple spaces, no number
18897 !! wikitext
18898 ISBN foo
18899 !! html
18900 <p>ISBN foo
18901 </p>
18902 !! end
18903
18904
18905 !! test
18906 ISBN length
18907 !! wikitext
18908 ISBN 123456789
18909
18910 ISBN 1234567890
18911
18912 ISBN 12345678901
18913 !! html
18914 <p>ISBN 123456789
18915 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18916 </p><p>ISBN 12345678901
18917 </p>
18918 !! end
18919
18920
18921 !! test
18922 ISBN with trailing year (bug 8110)
18923 !! wikitext
18924 ISBN 1-234-56789-0 - 2006
18925
18926 ISBN 1 234 56789 0 - 2006
18927 !! html
18928 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18929 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18930 </p>
18931 !! end
18932
18933
18934 !! test
18935 anchorencode
18936 !! wikitext
18937 {{anchorencode:foo bar©#%n}}
18938 !! html
18939 <p>foo_bar.C2.A9.23.25n
18940 </p>
18941 !! end
18942
18943 !! test
18944 anchorencode trims spaces
18945 !! wikitext
18946 {{anchorencode: __pretty__please__}}
18947 !! html
18948 <p>pretty_please
18949 </p>
18950 !! end
18951
18952 !! test
18953 anchorencode deals with links
18954 !! wikitext
18955 {{anchorencode: [[hello|world]] [[hi]]}}
18956 !! html
18957 <p>world_hi
18958 </p>
18959 !! end
18960
18961 !! test
18962 anchorencode deals with templates
18963 !! wikitext
18964 {{anchorencode: {{Foo}} }}
18965 !! html
18966 <p>FOO
18967 </p>
18968 !! end
18969
18970 !! test
18971 anchorencode encodes like the TOC generator: (bug 18431)
18972 !! wikitext
18973 === _ +:.3A%3A&&amp;]] ===
18974 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18975 __NOEDITSECTION__
18976 !! html
18977 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18978 <p>.2B:.3A.253A.26.26.5D.5D
18979 </p>
18980 !! end
18981
18982 !! test
18983 Bug 6200: blockquotes and paragraph formatting
18984 !! wikitext
18985 <blockquote>
18986 foo
18987 </blockquote>
18988
18989 bar
18990
18991 baz
18992 !! html
18993 <blockquote>
18994 <p>foo
18995 </p>
18996 </blockquote>
18997 <p>bar
18998 </p>
18999 <pre>baz
19000 </pre>
19001 !! end
19002
19003 !! test
19004 Bug 8293: Use of center tag ruins paragraph formatting
19005 !! wikitext
19006 <center>
19007 foo
19008 </center>
19009
19010 bar
19011
19012 baz
19013 !! html
19014 <center>
19015 <p>foo
19016 </p>
19017 </center>
19018 <p>bar
19019 </p>
19020 <pre>baz
19021 </pre>
19022 !! end
19023
19024 !!test
19025 Parsing of overlapping (improperly nested) inline html tags
19026 !! wikitext
19027 <span><s>x</span></s>
19028 !! html/php
19029 <p><span><s>x&lt;/span&gt;</s></span>
19030 </p>
19031 !! html/parsoid
19032 <p><span><s>x</s></span>
19033 </p>
19034 !!end
19035
19036 ###
19037 ### Language variants related tests
19038 ###
19039 !! test
19040 Self-link in language variants
19041 !! options
19042 title=[[Dunav]] language=sr
19043 !! wikitext
19044 Both [[Dunav]] and [[Дунав]] are names for this river.
19045 !! html
19046 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19047 </p>
19048 !!end
19049
19050 !! article
19051 Дуна
19052 !! text
19053 content
19054 !! endarticle
19055
19056 !! test
19057 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19058 !! options
19059 title=[[Duna]] language=sr
19060 !! wikitext
19061 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19062 !! html
19063 <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.
19064 </p>
19065 !! end
19066
19067 !! test
19068 Link to a section of a variant of this title shouldn't be parsed as self-link
19069 !! options
19070 title=[[Duna]] language=sr
19071 !! wikitext
19072 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19073 !! html
19074 <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.
19075 </p>
19076 !! end
19077
19078 !! test
19079 Link to pages in language variants
19080 !! options
19081 language=sr
19082 !! wikitext
19083 Main Page can be written as [[Маин Паге]]
19084 !! html
19085 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19086 </p>
19087 !!end
19088
19089
19090 !! test
19091 Multiple links to pages in language variants
19092 !! options
19093 language=sr
19094 !! wikitext
19095 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19096 !! html
19097 <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>.
19098 </p>
19099 !!end
19100
19101
19102 !! test
19103 Simple template in language variants
19104 !! options
19105 language=sr
19106 !! wikitext
19107 {{тест}}
19108 !! html
19109 <p>This is a test template
19110 </p>
19111 !! end
19112
19113
19114 !! test
19115 Template with explicit namespace in language variants
19116 !! options
19117 language=sr
19118 !! wikitext
19119 {{Template:тест}}
19120 !! html
19121 <p>This is a test template
19122 </p>
19123 !! end
19124
19125
19126 !! test
19127 Basic test for template parameter in language variants
19128 !! options
19129 language=sr
19130 !! wikitext
19131 {{парамтест|param=foo}}
19132 !! html
19133 <p>This is a test template with parameter foo
19134 </p>
19135 !! end
19136
19137
19138 !! test
19139 Simple category in language variants
19140 !! options
19141 language=sr cat
19142 !! wikitext
19143 [[Category:МедиаWики Усер'с Гуиде]]
19144 !! html
19145 <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>
19146 !! end
19147
19148
19149 !! article
19150 Category:分类
19151 !! text
19152 blah
19153 !! endarticle
19154
19155 !! article
19156 Category:分類
19157 !! text
19158 blah
19159 !! endarticle
19160
19161 !! test
19162 Don't convert blue categorylinks to another variant (bug 33210)
19163 !! options
19164 language=zh cat
19165 !! wikitext
19166 [[A]][[Category:分类]]
19167 !! html
19168 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19169 !! end
19170
19171
19172 !! test
19173 Stripping -{}- tags (language variants)
19174 !! options
19175 language=sr
19176 !! wikitext
19177 Latin proverb: -{Ne nuntium necare}-
19178 !! html
19179 <p>Latin proverb: Ne nuntium necare
19180 </p>
19181 !! end
19182
19183
19184 !! test
19185 Prevent conversion with -{}- tags (language variants)
19186 !! options
19187 language=sr variant=sr-ec
19188 !! wikitext
19189 Latinski: -{Ne nuntium necare}-
19190 !! html
19191 <p>Латински: Ne nuntium necare
19192 </p>
19193 !! end
19194
19195
19196 !! test
19197 Prevent conversion of text with -{}- tags (language variants)
19198 !! options
19199 language=sr variant=sr-ec
19200 !! wikitext
19201 Latinski: -{Ne nuntium necare}-
19202 !! html
19203 <p>Латински: Ne nuntium necare
19204 </p>
19205 !! end
19206
19207
19208 !! test
19209 Prevent conversion of links with -{}- tags (language variants)
19210 !! options
19211 language=sr variant=sr-ec
19212 !! wikitext
19213 -{[[Main Page]]}-
19214 !! html
19215 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19216 </p>
19217 !! end
19218
19219
19220 !! test
19221 -{}- tags within headlines (within html for parserConvert())
19222 !! options
19223 language=sr variant=sr-ec
19224 !! wikitext
19225 == -{Naslov}- ==
19226 !! html
19227 <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>
19228
19229 !! end
19230
19231
19232 !! test
19233 Explicit definition of language variant alternatives
19234 !! options
19235 language=zh variant=zh-tw
19236 !! wikitext
19237 -{zh:China;zh-tw:Taiwan}-, not China
19238 !! html
19239 <p>Taiwan, not China
19240 </p>
19241 !! end
19242
19243
19244 !! test
19245 Conversion around HTML tags
19246 !! options
19247 language=sr variant=sr-ec
19248 !! wikitext
19249 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19250 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19251 !! html
19252 <p>
19253 <span title="ЛаCтин">ски</span>
19254 </p>
19255 !! end
19256
19257
19258 !! test
19259 Explicit session-wise language variant mapping (A flag and - flag)
19260 !! options
19261 language=zh variant=zh-tw
19262 !! wikitext
19263 Taiwan is not China.
19264 But -{A|zh:China;zh-tw:Taiwan}- is China,
19265 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19266 and -{China}- is China.
19267 !! html
19268 <p>Taiwan is not China.
19269 But Taiwan is Taiwan,
19270 (This should be stripped!)
19271 and China is China.
19272 </p>
19273 !! end
19274
19275 !! test
19276 Explicit session-wise language variant mapping (H flag for hide)
19277 !! options
19278 language=zh variant=zh-tw
19279 !! wikitext
19280 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19281 Taiwan is China.
19282 !! html
19283 <p>(This should be stripped!)
19284 Taiwan is Taiwan.
19285 </p>
19286 !! end
19287
19288 !! test
19289 Adding explicit conversion rule for title (T flag)
19290 !! options
19291 language=zh variant=zh-tw showtitle
19292 !! wikitext
19293 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19294 !! html
19295 Taiwan
19296 <p>Should be stripped!
19297 </p>
19298 !! end
19299
19300 !! test
19301 Testing that changing the language variant here in the tests actually works
19302 !! options
19303 language=zh variant=zh showtitle
19304 !! wikitext
19305 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19306 !! html
19307 China
19308 <p>Should be stripped!
19309 </p>
19310 !! end
19311
19312 !! test
19313 Recursive conversion of alt and title attrs shouldn't clear converter state
19314 !! options
19315 language=zh variant=zh-cn showtitle
19316 !! wikitext
19317 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19318 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19319 !! html
19320 China
19321 <p>
19322 Should be stripped<span title="Exclamation">!</span>
19323 </p>
19324 !! end
19325
19326 !! test
19327 Bug 24072: more test on conversion rule for title
19328 !! options
19329 language=zh variant=zh-tw showtitle
19330 !! wikitext
19331 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19332 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19333 !! html
19334 Taiwan
19335 <p>This should be stripped!
19336 This won't take interferes with the title rule.
19337 </p>
19338 !! end
19339
19340 !! test
19341 Partly disable title conversion if variant == main language code
19342 !! options
19343 language=zh variant=zh title=[[ZH]] showtitle
19344 !! wikitext
19345 -{T|zh-cn:CN;zh-tw:TW}-
19346 !! html
19347 ZH
19348 <p>
19349 </p>
19350 !! end
19351
19352 !! test
19353 Partly disable title conversion if variant == main language code, more
19354 !! options
19355 language=zh variant=zh title=[[ZH]] showtitle
19356 !! wikitext
19357 -{T|TW}-
19358 !! html
19359 ZH
19360 <p>
19361 </p>
19362 !! end
19363
19364 !! test
19365 Raw output of variant escape tags (R flag)
19366 !! options
19367 language=zh variant=zh-tw
19368 !! wikitext
19369 Raw: -{R|zh:China;zh-tw:Taiwan}-
19370 !! html
19371 <p>Raw: zh:China;zh-tw:Taiwan
19372 </p>
19373 !! end
19374
19375 !! test
19376 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19377 !! options
19378 language=zh variant=zh-cn
19379 !! input
19380 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19381 !! result
19382 <p>0
19383 </p>
19384 !! end
19385
19386 !! test
19387 Conversion rules from [numeric-only string] to [something else] (T48634)
19388 !! options
19389 language=zh variant=zh-cn
19390 !! input
19391 -{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
19392 !! result
19393 <p>D12345EE12345
19394 </p>
19395 !! end
19396
19397 !! test
19398 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19399 !! options
19400 language=zh variant=zh-cn
19401 !! input
19402 -{H|zh-cn:foo;zh-tw:;}-foobar
19403 !! result
19404 <p>foobar
19405 </p>
19406 !! end
19407
19408 !! test
19409 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19410 !! options
19411 language=zh variant=zh-cn
19412 !! input
19413 -{H|=>zh-cn:foo;}-foobar
19414 !! result
19415 <p>foobar
19416 </p>
19417 !! end
19418
19419 !! test
19420 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19421 !! options
19422 language=zh variant=zh-cn
19423 !! input
19424 -{H|}-foobar
19425 !! result
19426 <p>foobar
19427 </p>
19428 !! end
19429
19430 !! test
19431 Nested using of manual convert syntax
19432 !! options
19433 language=zh variant=zh-hk
19434 !! wikitext
19435 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19436 !! html
19437 <p>Nested: Hello Hong Kong!
19438 </p>
19439 !! end
19440
19441 !! test
19442 Proper conversion of text in external links
19443 !! options
19444 language=sr variant=sr-ec
19445 !! wikitext
19446 http://www.google.com
19447 gopher://www.google.com
19448 [http://www.google.com http://www.google.com]
19449 [gopher://www.google.com gopher://www.google.com]
19450 [https://www.google.com irc://www.google.com]
19451 [ftp://www.google.com www.google.com/ftp://dir]
19452 [//www.google.com www.google.com]
19453 !! html
19454 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19455 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19456 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19457 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19458 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19459 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19460 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19461 </p>
19462 !! end
19463
19464 !! test
19465 Do not convert roman numbers to language variants
19466 !! options
19467 language=sr variant=sr-ec
19468 !! wikitext
19469 Fridrih IV je car.
19470 !! html
19471 <p>Фридрих IV је цар.
19472 </p>
19473 !! end
19474
19475 !! test
19476 Unclosed language converter markup "-{"
19477 !! options
19478 language=sr
19479 !! wikitext
19480 -{T|hello
19481 !! html
19482 <p>-{T|hello
19483 </p>
19484 !! end
19485
19486 !! test
19487 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19488 !! options
19489 language=sr
19490 !! wikitext
19491 -{R|=&gt;}-
19492 !! html
19493 <p>=&gt;
19494 </p>
19495 !!end
19496
19497 !! test
19498 Don't break link parsing if language converter markup is in the caption.
19499 !! options
19500 language=sr variant=sr-ec
19501 !! wikitext
19502 [[Main Page|-{R|main page}-]]
19503 !! html
19504 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19505 </p>
19506 !! end
19507
19508 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19509 !! test
19510 Don't break image parsing if language converter markup is in the caption.
19511 !! options
19512 language=sr
19513 !! wikitext
19514 [[File:Foobar.jpg|-{R|caption}-]]
19515 !! html/parsoid
19516 <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>
19517 </p>
19518 !! end
19519
19520 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19521 !! test
19522 Don't break list handling if language converter markup is in the item.
19523 !! options
19524 language=zh variant=zh-cn
19525 !! wikitext
19526 ;-{zh-cn:AAA;zh-tw:BBB}-
19527 !! html/php
19528 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19529
19530 !! html/parsoid
19531 <dl><dt>AAA
19532 </dt></dl>
19533 !! end
19534
19535 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19536 !! test
19537 Don't break table handling if language converter markup is in the cell.
19538 !! options
19539 language=sr variant=sr-ec
19540 !! wikitext
19541 {|
19542 |-
19543 | -{R|B}-
19544 |}
19545 !! html/php
19546 <table>
19547
19548 <tr>
19549 <td>Б}-
19550 </td></tr></table>
19551
19552 !! html/parsoid
19553 <table>
19554
19555 <tr>
19556 <td> B
19557 </td></tr></table>
19558
19559 !! end
19560
19561 !! test
19562 Bug 529: Uncovered bullet
19563 !! wikitext
19564 * Foo {{bullet}}
19565 !! html
19566 <ul><li> Foo </li>
19567 <li> Bar</li></ul>
19568
19569 !! end
19570
19571 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19572 # Templates in Wikipedia rely on this behavior, as tidy has always been
19573 # enabled there. These tests are normally run *without* tidy, so specify the
19574 # full output here.
19575 # To test realistic parsing behavior, apply a tidy-like transformation to both
19576 # the expected output and your parser's output.
19577 !! test
19578 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19579 !! wikitext
19580 ******* Foo {{bullet}}
19581 !! html
19582 <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>
19583 <li> Bar</li></ul>
19584
19585 !! end
19586
19587 !! test
19588 Bug 529: Uncovered table already at line-start
19589 !! wikitext
19590 x
19591
19592 {{table}}
19593 y
19594 !! html
19595 <p>x
19596 </p>
19597 <table>
19598 <tr>
19599 <td> 1 </td>
19600 <td> 2
19601 </td></tr>
19602 <tr>
19603 <td> 3 </td>
19604 <td> 4
19605 </td></tr></table>
19606 <p>y
19607 </p>
19608 !! end
19609
19610 !! test
19611 Bug 529: Uncovered bullet in parser function result
19612 !! wikitext
19613 * Foo {{lc:{{bullet}} }}
19614 !! html
19615 <ul><li> Foo </li>
19616 <li> bar</li></ul>
19617
19618 !! end
19619
19620 !! test
19621 Bug 5678: Double-parsed template argument
19622 !! wikitext
19623 {{lc:{{{1}}}|hello}}
19624 !! html
19625 <p>{{{1}}}
19626 </p>
19627 !! end
19628
19629 !! test
19630 Bug 5678: Double-parsed template invocation
19631 !! wikitext
19632 {{lc:{{paramtest {{!}} param = hello }} }}
19633 !! html
19634 <p>{{paramtest | param = hello }}
19635 </p>
19636 !! end
19637
19638 !! test
19639 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19640 !! options
19641 language=cs
19642 title=[[Main Page]]
19643 !! wikitext
19644 {{PRVNÍVELKÉ:ěščř}}
19645 {{prvnívelké:ěščř}}
19646 {{PRVNÍMALÉ:ěščř}}
19647 {{prvnímalé:ěščř}}
19648 {{MALÁ:ěščř}}
19649 {{malá:ěščř}}
19650 {{VELKÁ:ěščř}}
19651 {{velká:ěščř}}
19652 !! html
19653 <p>Ěščř
19654 Ěščř
19655 ěščř
19656 ěščř
19657 ěščř
19658 ěščř
19659 ĚŠČŘ
19660 ĚŠČŘ
19661 </p>
19662 !! end
19663
19664 !! test
19665 Morwen/13: Unclosed link followed by heading
19666 !! wikitext
19667 [[link
19668 ==heading==
19669 !! html
19670 <p>[[link
19671 </p>
19672 <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>
19673
19674 !! end
19675
19676 !! test
19677 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19678 !! wikitext
19679 {{foo|
19680 =heading=
19681 !! html
19682 <p>{{foo|
19683 </p>
19684 <h1><span class="mw-headline" id="heading">heading</span></h1>
19685
19686 !! end
19687
19688 !! test
19689 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19690 !! wikitext
19691 {{foo|
19692 ==heading==
19693 !! html
19694 <p>{{foo|
19695 </p>
19696 <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>
19697
19698 !! end
19699
19700 !! test
19701 Tildes in comments
19702 !! options
19703 pst
19704 !! wikitext
19705 <!-- ~~~~ -->
19706 !! html
19707 <!-- ~~~~ -->
19708 !! end
19709
19710 !! test
19711 Paragraphs inside divs (no extra line breaks)
19712 !! wikitext
19713 <div>Line one
19714
19715 Line two</div>
19716 !! html
19717 <div>Line one
19718 Line two</div>
19719
19720 !! end
19721
19722 !! test
19723 Paragraphs inside divs (extra line break on open)
19724 !! wikitext
19725 <div>
19726 Line one
19727
19728 Line two</div>
19729 !! html
19730 <div>
19731 <p>Line one
19732 </p>
19733 Line two</div>
19734
19735 !! end
19736
19737 !! test
19738 Paragraphs inside divs (extra line break on close)
19739 !! wikitext
19740 <div>Line one
19741
19742 Line two
19743 </div>
19744 !! html
19745 <div>Line one
19746 <p>Line two
19747 </p>
19748 </div>
19749
19750 !! end
19751
19752 !! test
19753 Paragraphs inside divs (extra line break on open and close)
19754 !! wikitext
19755 <div>
19756 Line one
19757
19758 Line two
19759 </div>
19760 !! html
19761 <div>
19762 <p>Line one
19763 </p><p>Line two
19764 </p>
19765 </div>
19766
19767 !! end
19768
19769 !! test
19770 Nesting tags, paragraphs on lines which begin with <div>
19771 !! wikitext
19772 <div></div><strong>A
19773 B</strong>
19774 !! html/php+tidy
19775 <p><strong>A</strong></p>
19776 <p><strong>B</strong></p>
19777 !! html/parsoid
19778 <div></div>
19779 <p><strong>A
19780 B</strong>
19781 </p>
19782 !! end
19783
19784 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19785 !! test
19786 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19787 !! wikitext
19788 <blockquote>Line one
19789
19790 Line two</blockquote>
19791 !! html
19792 <blockquote>Line one
19793 Line two</blockquote>
19794
19795 !! html+tidy
19796 <blockquote>
19797 <p>Line one Line two</p>
19798 </blockquote>
19799 !! end
19800
19801 !! test
19802 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19803 !! wikitext
19804 <blockquote>
19805 Line one
19806
19807 Line two</blockquote>
19808 !! html
19809 <blockquote>
19810 <p>Line one
19811 </p>
19812 Line two</blockquote>
19813
19814 !! html+tidy
19815 <blockquote>
19816 <p>Line one</p>
19817 Line two</blockquote>
19818 !! end
19819
19820 !! test
19821 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19822 !! wikitext
19823 <blockquote>Line one
19824
19825 Line two
19826 </blockquote>
19827 !! html
19828 <blockquote>Line one
19829 <p>Line two
19830 </p>
19831 </blockquote>
19832
19833 !! html+tidy
19834 <blockquote>
19835 <p>Line one</p>
19836 <p>Line two</p>
19837 </blockquote>
19838 !! end
19839
19840 !! test
19841 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19842 !! wikitext
19843 <blockquote>
19844 Line one
19845
19846 Line two
19847 </blockquote>
19848 !! html
19849 <blockquote>
19850 <p>Line one
19851 </p><p>Line two
19852 </p>
19853 </blockquote>
19854
19855 !! html+tidy
19856 <blockquote>
19857 <p>Line one</p>
19858 <p>Line two</p>
19859 </blockquote>
19860 !! end
19861
19862 !! test
19863 Paragraphs inside blockquotes/divs (no extra line breaks)
19864 !! wikitext
19865 <blockquote><div>Line one
19866
19867 Line two</div></blockquote>
19868 !! html
19869 <blockquote><div>Line one
19870 Line two</div></blockquote>
19871
19872 !! end
19873
19874 !! test
19875 Paragraphs inside blockquotes/divs (extra line break on open)
19876 !! wikitext
19877 <blockquote><div>
19878 Line one
19879
19880 Line two</div></blockquote>
19881 !! html
19882 <blockquote><div>
19883 <p>Line one
19884 </p>
19885 Line two</div></blockquote>
19886
19887 !! end
19888
19889 !! test
19890 Paragraphs inside blockquotes/divs (extra line break on close)
19891 !! wikitext
19892 <blockquote><div>Line one
19893
19894 Line two
19895 </div></blockquote>
19896 !! html
19897 <blockquote><div>Line one
19898 <p>Line two
19899 </p>
19900 </div></blockquote>
19901
19902 !! end
19903
19904 !! test
19905 Paragraphs inside blockquotes/divs (extra line break on open and close)
19906 !! wikitext
19907 <blockquote><div>
19908 Line one
19909
19910 Line two
19911 </div></blockquote>
19912 !! html
19913 <blockquote><div>
19914 <p>Line one
19915 </p><p>Line two
19916 </p>
19917 </div></blockquote>
19918
19919 !! end
19920
19921 !! test
19922 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19923 !! options
19924 wgLinkHolderBatchSize=0
19925 !! wikitext
19926 [[meatball:1]]
19927 [[meatball:2]]
19928 [[meatball:3]]
19929 !! html
19930 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19931 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19932 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19933 </p>
19934 !! end
19935
19936 !! test
19937 Free external link invading image caption
19938 !! wikitext
19939 [[Image:Foobar.jpg|thumb|http://x|hello]]
19940 !! html
19941 <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>
19942
19943 !! end
19944
19945 !! test
19946 Bug 15196: localised external link numbers
19947 !! options
19948 language=fa
19949 !! wikitext
19950 [http://en.wikipedia.org/]
19951 !! html/php
19952 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19953 </p>
19954 !! html/parsoid
19955 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19956 !! end
19957
19958 !! test
19959 Multibyte character in padleft
19960 !! wikitext
19961 {{padleft:-Hello|7|Æ}}
19962 !! html
19963 <p>Æ-Hello
19964 </p>
19965 !! end
19966
19967 !! test
19968 Multibyte character in padright
19969 !! wikitext
19970 {{padright:Hello-|7|Æ}}
19971 !! html
19972 <p>Hello-Æ
19973 </p>
19974 !! end
19975
19976 !!test
19977 formatdate parser function
19978 !! wikitext
19979 {{#formatdate:2009-03-24}}
19980 !! html
19981 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19982 </p>
19983 !! end
19984
19985 !!test
19986 formatdate parser function, with default format
19987 !! wikitext
19988 {{#formatdate:2009-03-24|mdy}}
19989 !! html
19990 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19991 </p>
19992 !! end
19993
19994 !! test
19995 Spacing of numbers in formatted dates
19996 !! wikitext
19997 {{#formatdate:January 15}}
19998 !! html
19999 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20000 </p>
20001 !! end
20002
20003 !! test
20004 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
20005 !! options
20006 language=nl title=[[MediaWiki:Common.css]]
20007 !! wikitext
20008 {{#formatdate:2009-03-24|dmy}}
20009 !! html
20010 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20011 </p>
20012 !! end
20013
20014 #
20015 #
20016 #
20017
20018 #
20019 # Edit comments
20020 #
20021
20022 !! test
20023 Edit comment with link
20024 !! options
20025 comment
20026 !! wikitext
20027 I like the [[Main Page]] a lot
20028 !! html
20029 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20030 !!end
20031
20032 !! test
20033 Edit comment with link and link text
20034 !! options
20035 comment
20036 !! wikitext
20037 I like the [[Main Page|best pages]] a lot
20038 !! html
20039 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20040 !!end
20041
20042 !! test
20043 Edit comment with link and link text with suffix
20044 !! options
20045 comment
20046 !! wikitext
20047 I like the [[Main Page|best page]]s a lot
20048 !! html
20049 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20050 !!end
20051
20052 !! test
20053 Edit comment with section link (non-local, eg in history list)
20054 !! options
20055 comment title=[[Main Page]]
20056 !! wikitext
20057 /* External links */ removed bogus entries
20058 !! html
20059 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20060 !!end
20061
20062 !! test
20063 Edit comment with section link and text before it (non-local, eg in history list)
20064 !! options
20065 comment title=[[Main Page]]
20066 !! wikitext
20067 pre-comment text /* External links */ removed bogus entries
20068 !! html
20069 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>
20070 !!end
20071
20072 !! test
20073 Edit comment with section link (local, eg in diff view)
20074 !! options
20075 comment local title=[[Main Page]]
20076 !! wikitext
20077 /* External links */ removed bogus entries
20078 !! html
20079 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20080 !!end
20081
20082 !! test
20083 Edit comment with subpage link (bug 14080)
20084 !! options
20085 comment
20086 subpage
20087 title=[[Subpage test]]
20088 !! wikitext
20089 Poked at a [[/subpage]] here...
20090 !! html
20091 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20092 !!end
20093
20094 !! test
20095 Edit comment with subpage link and link text (bug 14080)
20096 !! options
20097 comment
20098 subpage
20099 title=[[Subpage test]]
20100 !! wikitext
20101 Poked at a [[/subpage|neat little page]] here...
20102 !! html
20103 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20104 !!end
20105
20106 !! test
20107 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20108 !! options
20109 comment
20110 title=[[Subpage test]]
20111 !! wikitext
20112 Poked at a [[/subpage]] here...
20113 !! html
20114 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...
20115 !!end
20116
20117 !! test
20118 Edit comment with bare anchor link (local, as on diff)
20119 !! options
20120 comment
20121 local
20122 title=[[Main Page]]
20123 !! wikitext
20124 [[#section]]
20125 !! html
20126 <a href="#section">#section</a>
20127 !! end
20128
20129 !! test
20130 Edit comment with bare anchor link (non-local, as on history)
20131 !! options
20132 comment
20133 title=[[Main Page]]
20134 !! wikitext
20135 [[#section]]
20136 !! html
20137 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20138 !! end
20139
20140 !! test
20141 Anchor starting with underscore
20142 !! wikitext
20143 [[#_ref|One]]
20144 !! html
20145 <p><a href="#_ref">One</a>
20146 </p>
20147 !! end
20148
20149 !! test
20150 Id starting with underscore
20151 !! wikitext
20152 <div id="_ref"></div>
20153 !! html
20154 <div id="_ref"></div>
20155
20156 !! end
20157
20158 !! test
20159 Space normalisation on autocomment (bug 22784)
20160 !! options
20161 comment
20162 title=[[Main Page]]
20163 !! wikitext
20164 /* __hello__world__ */
20165 !! html
20166 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20167 !! end
20168
20169 !! test
20170 percent-encoding and + signs in comments (Bug 26410)
20171 !! options
20172 comment
20173 !! wikitext
20174 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20175 !! html/php
20176 <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>
20177 !! end
20178
20179 # Parsoid doesn't support this yet: see bug 73581
20180 # but it *should* omit the 'src' attribute if the image is bad.
20181 # PHP side of tests was disabled in
20182 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20183 # because of issues in the PHP parserTests infrastructure
20184 # (but the output below is indeed what the PHP side emits)
20185 !! test
20186 Bad images - basic functionality
20187 !! wikitext
20188 [[File:Bad.jpg]]
20189 !! DISABLED/html/php
20190 !! html/parsoid
20191 <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>
20192 !! end
20193
20194 !! test
20195 Bad images - bug 16039: text after bad image disappears
20196 !! wikitext
20197 Foo bar
20198 [[File:Bad.jpg]]
20199 Bar foo
20200 !! DISABLED/html/php
20201 <p>Foo bar
20202 </p><p>Bar foo
20203 </p>
20204 !! html/parsoid
20205 <p>Foo bar
20206 <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>
20207 Bar foo</p>
20208 !! end
20209
20210 !! test
20211 Verify that displaytitle works (bug #22501) no displaytitle
20212 !! options
20213 showtitle
20214 !! config
20215 wgAllowDisplayTitle=true
20216 wgRestrictDisplayTitle=false
20217 !! wikitext
20218 this is not the the title
20219 !! html/php
20220 Parser test
20221 <p>this is not the the title
20222 </p>
20223 !! end
20224
20225 !! test
20226 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20227 !! options
20228 showtitle
20229 title=[[Screen]]
20230 !! config
20231 wgAllowDisplayTitle=true
20232 wgRestrictDisplayTitle=false
20233 !! wikitext
20234 this is not the the title
20235 {{DISPLAYTITLE:whatever}}
20236 !! html/php
20237 whatever
20238 <p>this is not the the title
20239 </p>
20240 !! end
20241
20242 !! test
20243 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20244 !! options
20245 showtitle
20246 title=[[Screen]]
20247 !! config
20248 wgAllowDisplayTitle=true
20249 wgRestrictDisplayTitle=true
20250 !! wikitext
20251 this is not the the title
20252 {{DISPLAYTITLE:whatever}}
20253 !! html/php
20254 Screen
20255 <p>this is not the the title
20256 </p>
20257 !! end
20258
20259 !! test
20260 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20261 !! options
20262 showtitle
20263 title=[[Screen]]
20264 !! config
20265 wgAllowDisplayTitle=true
20266 wgRestrictDisplayTitle=true
20267 !! wikitext
20268 this is not the the title
20269 {{DISPLAYTITLE:screen}}
20270 !! html/php
20271 screen
20272 <p>this is not the the title
20273 </p>
20274 !! end
20275
20276 !! test
20277 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20278 !! options
20279 showtitle
20280 title=[[Screen]]
20281 !! config
20282 wgAllowDisplayTitle=false
20283 !! wikitext
20284 this is not the the title
20285 {{DISPLAYTITLE:screen}}
20286 !! html/php
20287 Screen
20288 <p>this is not the the title
20289 <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>
20290 </p>
20291 !! end
20292
20293 !! test
20294 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20295 !! options
20296 showtitle
20297 title=[[Screen]]
20298 !! config
20299 wgAllowDisplayTitle=false
20300 !! wikitext
20301 this is not the the title
20302 !! html/php
20303 Screen
20304 <p>this is not the the title
20305 </p>
20306 !! end
20307
20308 !! test
20309 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20310 !! options
20311 showtitle
20312 title=[[Screen]]
20313 !! config
20314 wgAllowDisplayTitle=true
20315 wgRestrictDisplayTitle=true
20316 !! wikitext
20317 this is not the the title
20318 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20319 !! html/php
20320 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20321 <p>this is not the the title
20322 </p>
20323 !! end
20324
20325 !! test
20326 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20327 !! options
20328 showtitle
20329 title=[[Screen]]
20330 !! config
20331 wgAllowDisplayTitle=true
20332 wgRestrictDisplayTitle=true
20333 !! wikitext
20334 this is not the the title
20335 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20336 !! html/php
20337 <span style="color: red;">s</span>creen
20338 <p>this is not the the title
20339 </p>
20340 !! end
20341
20342 !! test
20343 Page status indicators: Empty name is invalid
20344 !! options
20345 showindicators
20346 !! wikitext
20347 <indicator name=" "></indicator>
20348 <indicator></indicator>
20349 !! html
20350 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20351 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20352 </p>
20353 !! end
20354
20355 !! test
20356 Page status indicators: Weird syntaxes that are okay
20357 !! options
20358 showindicators
20359 !! wikitext
20360 <indicator name="empty" />
20361 <indicator name="name"></indicator>
20362 !! html
20363 empty=
20364 name=
20365 <p><br />
20366 </p>
20367 !! end
20368
20369 !! test
20370 Page status indicators: Torture test
20371 !! options
20372 showindicators
20373 !! wikitext
20374 <indicator name="01">hello world</indicator>
20375 <indicator name="02">[[Main Page]]</indicator>
20376 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20377 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20378 <indicator name="05">* foo
20379 * bar</indicator>
20380 <indicator name="06"><nowiki>foo</nowiki></indicator>
20381 <indicator name="07"> Preformatted</indicator>
20382 <indicator name="08"><div>Broken tag</indicator>
20383 <indicator name="09">{| class=wikitable
20384 | cell
20385 |}</indicator>
20386 <indicator name="10">Two
20387
20388 paragraphs</indicator>
20389 !! html
20390 01=hello world
20391 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20392 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" />
20393 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>
20394 05=<ul><li> foo</li>
20395 <li> bar</li></ul>
20396
20397 06=foo
20398 07=<pre>Preformatted
20399 </pre>
20400 08=<div>Broken tag</div>
20401
20402 09=<table class="wikitable">
20403 <tr>
20404 <td> cell
20405 </td></tr></table>
20406
20407 10=<p>Two
20408 </p><p>paragraphs
20409 </p>
20410 <p><br />
20411 </p><p><br />
20412 </p><p><br />
20413 </p><p><br />
20414 </p><p><br />
20415 </p>
20416 !! end
20417
20418 !! test
20419 preload: check <noinclude> and <includeonly>
20420 !! options
20421 preload
20422 !! wikitext
20423 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20424 !! html/php
20425 Hello kind world.
20426 !! end
20427
20428 !! test
20429 preload: check <onlyinclude>
20430 !! options
20431 preload
20432 !! wikitext
20433 Goodbye <onlyinclude>Hello world</onlyinclude>
20434 !! html/php
20435 Hello world
20436 !! end
20437
20438 !! test
20439 preload: can pass tags through if we want to
20440 !! options
20441 preload
20442 !! wikitext
20443 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20444 !! html/php
20445 <includeonly>Hello world</includeonly>
20446 !! end
20447
20448 !! test
20449 preload: check that it doesn't try to do tricks
20450 !! options
20451 preload
20452 !! wikitext
20453 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20454 !! html/php
20455 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20456 !! end
20457
20458 !! test
20459 Play a bit with r67090 and bug 3158
20460 !! wikitext
20461 <div style="width:50% !important">&nbsp;</div>
20462 <div style="width:50%&nbsp;!important">&nbsp;</div>
20463 <div style="width:50%&#160;!important">&nbsp;</div>
20464 <div style="border : solid;">&nbsp;</div>
20465 !! html/php
20466 <div style="width:50% !important">&#160;</div>
20467 <div style="width:50% !important">&#160;</div>
20468 <div style="width:50% !important">&#160;</div>
20469 <div style="border&#160;: solid;">&#160;</div>
20470
20471 !! html/parsoid
20472 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20473 <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>
20474 <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>
20475 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20476
20477 !! end
20478
20479 !! test
20480 HTML5 data attributes
20481 !! wikitext
20482 <span data-foo="bar">Baz</span>
20483 <p data-abc-def_hij="">Quuz</p>
20484 !! html
20485 <p><span data-foo="bar">Baz</span>
20486 </p>
20487 <p data-abc-def_hij="">Quuz</p>
20488
20489 !! end
20490
20491 !! test
20492 percent-encoding and + signs in internal links (Bug 26410)
20493 !! wikitext
20494 [[User:+%]] [[Page+title%]]
20495 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20496 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20497 [[%33%45]] [[%33%45+]]
20498 !! html/php
20499 <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>
20500 <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>
20501 <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>
20502 <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>
20503 </p>
20504 !! html/parsoid
20505 <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>
20506 <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>
20507 <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>
20508 <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>
20509 !! end
20510
20511 !! test
20512 Special characters in embedded file links (bug 27679)
20513 !! wikitext
20514 [[File:Contains & ampersand.jpg]]
20515 [[File:Does not exist.jpg|Title with & ampersand]]
20516 !! html/php
20517 <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>
20518 <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>
20519 </p>
20520 !! html/parsoid
20521 <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>
20522 <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>
20523 !! end
20524
20525 !! test
20526 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20527 !! wikitext
20528 Text&apos;s been normalized?
20529 !! html
20530 <p>Text&#39;s been normalized?
20531 </p>
20532 !! end
20533
20534 !! test
20535 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20536 !! wikitext
20537 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20538 !! html
20539 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20540 </p>
20541 !! end
20542
20543 !! test
20544 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20545 !! wikitext
20546 [http://www.example.org/ ideograms]
20547 !! html
20548 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20549 </p>
20550 !! end
20551
20552 !! test
20553 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20554 !! wikitext
20555 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20556 !! html
20557 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20558 </p>
20559 !! end
20560
20561 !! article
20562 Mediawiki:loop1
20563 !! text
20564 {{Identical|A}}
20565 !! endarticle
20566
20567 !! article
20568 Mediawiki:loop2
20569 !! text
20570 {{Identical|B}}
20571 !! endarticle
20572
20573 !! article
20574 Template:Identical
20575 !! text
20576 {{int:loop1}}
20577 {{int:loop2}}
20578 !! endarticle
20579
20580 !! test
20581 Bug 31098 Template which includes system messages which includes the template
20582 !! wikitext
20583 {{Identical}}
20584 !! html
20585 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20586 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20587 </p>
20588 !! end
20589
20590 !! test
20591 Bug31490 Turkish: ucfirst 'blah'
20592 !! options
20593 language=tr
20594 !! wikitext
20595 {{ucfirst:blah}}
20596 !! html
20597 <p>Blah
20598 </p>
20599 !! end
20600
20601 !! test
20602 Bug31490 Turkish: ucfirst 'ix'
20603 !! options
20604 language=tr
20605 !! wikitext
20606 {{ucfirst:ix}}
20607 !! html
20608 <p>İx
20609 </p>
20610 !! end
20611
20612 !! test
20613 Bug31490 Turkish: lcfirst 'BLAH'
20614 !! options
20615 language=tr
20616 !! wikitext
20617 {{lcfirst:BLAH}}
20618 !! html
20619 <p>bLAH
20620 </p>
20621 !! end
20622
20623 !! test
20624 Bug31490 Turkish: ucfırst (with a dotless i)
20625 !! options
20626 language=tr
20627 !! wikitext
20628 {{ucfırst:blah}}
20629 !! html
20630 <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>
20631 </p>
20632 !! end
20633
20634 !! test
20635 Bug31490 ucfırst (with a dotless i) with English language
20636 !! options
20637 language=en
20638 !! wikitext
20639 {{ucfırst:blah}}
20640 !! html
20641 <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>
20642 </p>
20643 !! end
20644
20645 !! test
20646 Bug 26375: TOC with italics
20647 !! options
20648 title=[[Main Page]]
20649 !! wikitext
20650 __TOC__
20651 == ''Lost'' episodes ==
20652 !! html
20653 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20654 <ul>
20655 <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>
20656 </ul>
20657 </div>
20658
20659 <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>
20660
20661 !! end
20662
20663 !! test
20664 Bug 26375: TOC with bold
20665 !! options
20666 title=[[Main Page]]
20667 !! wikitext
20668 __TOC__
20669 == '''should be bold''' then normal text ==
20670 !! html
20671 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20672 <ul>
20673 <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>
20674 </ul>
20675 </div>
20676
20677 <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>
20678
20679 !! end
20680
20681 !! test
20682 Bug 33845: Headings become cursive in TOC when they contain an image
20683 !! options
20684 title=[[Main Page]]
20685 !! wikitext
20686 __TOC__
20687 == Image [[Image:foobar.jpg]] ==
20688 !! html
20689 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20690 <ul>
20691 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20692 </ul>
20693 </div>
20694
20695 <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>
20696
20697 !! end
20698
20699 !! test
20700 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20701 !! options
20702 title=[[Main Page]]
20703 !! wikitext
20704 __TOC__
20705 == <blockquote>Quote</blockquote> ==
20706 !! html
20707 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20708 <ul>
20709 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20710 </ul>
20711 </div>
20712
20713 <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>
20714
20715 !! html+tidy
20716 <p></p>
20717 <div id="toc" class="toc">
20718 <div id="toctitle">
20719 <h2>Contents</h2>
20720 </div>
20721 <ul>
20722 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20723 </ul>
20724 </div>
20725 <p></p>
20726 <h2><span class="mw-headline" id="Quote"></span></h2>
20727 <blockquote>
20728 <p><span class="mw-headline" id="Quote">Quote</span></p>
20729 </blockquote>
20730 <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>
20731 !! end
20732
20733 !! test
20734 Unclosed tags in TOC
20735 !! options
20736 title=[[Main Page]]
20737 !! wikitext
20738 __TOC__
20739 == Proof: 2 < 3 ==
20740 <small>Hanc marginis exiguitas non caperet.</small>
20741 QED
20742 !! html
20743 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20744 <ul>
20745 <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>
20746 </ul>
20747 </div>
20748
20749 <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>
20750 <p><small>Hanc marginis exiguitas non caperet.</small>
20751 QED
20752 </p>
20753 !! end
20754
20755 !! test
20756 Multiple tags in TOC
20757 !! wikitext
20758 __TOC__
20759 == <i>Foo</i> <b>Bar</b> ==
20760
20761 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20762 !! html
20763 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20764 <ul>
20765 <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>
20766 <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>
20767 </ul>
20768 </div>
20769
20770 <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>
20771 <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>
20772
20773 !! html+tidy
20774 <p></p>
20775 <div id="toc" class="toc">
20776 <div id="toctitle">
20777 <h2>Contents</h2>
20778 </div>
20779 <ul>
20780 <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>
20781 <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>
20782 </ul>
20783 </div>
20784 <p></p>
20785 <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>
20786 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20787 <blockquote>
20788 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20789 </blockquote>
20790 <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>
20791 !! end
20792
20793 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20794 # html5 tag parsing.
20795 !! test
20796 Tags with parameters in TOC
20797 !! options
20798 parsoid=wt2html
20799 !! wikitext
20800 __TOC__
20801 == <sup class="in-h2">Hello</sup> ==
20802
20803 == <sup class="a > b">Evilbye</sup> ==
20804 !! html/php
20805 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20806 <ul>
20807 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20808 <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>
20809 </ul>
20810 </div>
20811
20812 <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>
20813 <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>
20814
20815 !! html/parsoid
20816 <meta property="mw:PageProp/toc" />
20817 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
20818
20819 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
20820 !! end
20821
20822 !! test
20823 span tags with directionality in TOC
20824 !! wikitext
20825 __TOC__
20826 == <span dir="ltr">C++</span> ==
20827
20828 == <span dir="rtl">זבנג!</span> ==
20829
20830 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20831
20832 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20833
20834 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20835 !! html
20836 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20837 <ul>
20838 <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>
20839 <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>
20840 <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>
20841 <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>
20842 <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>
20843 </ul>
20844 </div>
20845
20846 <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>
20847 <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>
20848 <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>
20849 <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>
20850 <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>
20851
20852 !! end
20853
20854 !! test
20855 Bug 72884: bdi element in ToC
20856 !! wikitext
20857 __TOC__
20858 == <bdi>test</bdi> ==
20859 !! html
20860 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20861 <ul>
20862 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20863 </ul>
20864 </div>
20865
20866 <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>
20867
20868 !! end
20869
20870 # Note that the html output does not have the <p></p>, but the
20871 # html+tidy output *does*. This is because the empty <p></p> is
20872 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20873 !! test
20874 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20875 !! wikitext
20876 __TOC__
20877 == x ==
20878 !! html
20879 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20880 <ul>
20881 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20882 </ul>
20883 </div>
20884
20885 <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>
20886
20887 !! html+tidy
20888 <p></p>
20889 <div id="toc" class="toc">
20890 <div id="toctitle">
20891 <h2>Contents</h2>
20892 </div>
20893 <ul>
20894 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20895 </ul>
20896 </div>
20897 <p></p>
20898 <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>
20899 !! end
20900
20901 !! article
20902 MediaWiki:Bug32057
20903 !! text
20904 == {{int:headline_sample}} ==
20905 !! endarticle
20906
20907 !! test
20908 Bug 32057: Title needed when expanding <h> nodes.
20909 !! options
20910 title=[[Main Page]]
20911 !! wikitext
20912 {{int:Bug32057}}
20913 !! html
20914 <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>
20915
20916 !! end
20917
20918 !! test
20919 Strip marker in urlencode
20920 !! wikitext
20921 {{urlencode:x<nowiki/>y}}
20922 {{urlencode:x<nowiki/>y|wiki}}
20923 {{urlencode:x<nowiki/>y|path}}
20924 {{urlencode:x<pre id="one">two</pre>y}}
20925 !! html
20926 <p>xy
20927 xy
20928 xy
20929 xy
20930 </p>
20931 !! end
20932
20933 !! test
20934 Strip marker in lc
20935 !! wikitext
20936 {{lc:x<nowiki/>y}}
20937 !! html
20938 <p>xy
20939 </p>
20940 !! end
20941
20942 !! test
20943 Strip marker in uc
20944 !! wikitext
20945 {{uc:x<nowiki/>y}}
20946 !! html
20947 <p>XY
20948 </p>
20949 !! end
20950
20951 !! test
20952 Strip marker in formatNum
20953 !! wikitext
20954 {{formatnum:1<nowiki/>2}}
20955 {{formatnum:1<nowiki/>2|R}}
20956 !! html
20957 <p>12
20958 12
20959 </p>
20960 !! end
20961
20962 !! test
20963 Check noCommafy in formatNum
20964 !! options
20965 language=be-tarask
20966 !! wikitext
20967 {{formatnum:123456.78}}
20968 {{formatnum:123456.78|NOSEP}}
20969 !! html
20970 <p>123 456,78
20971 123456.78
20972 </p>
20973 !! end
20974
20975 !! test
20976 Wrong option for formatNum (bug 56199)
20977 !! wikitext
20978 {{formatnum:1,234.56|Random}}
20979 {{formatnum:1,234.56|EVERYTHING}}
20980 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20981 !! html
20982 <p>1,234.56
20983 1,234.56
20984 1,234.56
20985 </p>
20986 !! end
20987
20988 !! test
20989 Strip marker in grammar
20990 !! options
20991 language=fi
20992 !! wikitext
20993 {{grammar:elative|foo<nowiki/>bar}}
20994 !! html
20995 <p>foobarista
20996 </p>
20997 !! end
20998
20999 !! test
21000 Strip marker in padleft
21001 !! wikitext
21002 {{padleft:|2|x<nowiki/>y}}
21003 !! html
21004 <p>xy
21005 </p>
21006 !! end
21007
21008 !! test
21009 Strip marker in padright
21010 !! wikitext
21011 {{padright:|2|x<nowiki/>y}}
21012 !! html
21013 <p>xy
21014 </p>
21015 !! end
21016
21017 !! test
21018 Strip marker in anchorencode
21019 !! wikitext
21020 {{anchorencode:x<nowiki/>y}}
21021 !! html
21022 <p>xy
21023 </p>
21024 !! end
21025
21026 !! test
21027 nowiki inside link inside heading (bug 18295)
21028 !! wikitext
21029 ==[[foo|x<nowiki>y</nowiki>z]]==
21030 !! html
21031 <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>
21032
21033 !! end
21034
21035 !! test
21036 new support for bdi element (bug 31817)
21037 !! wikitext
21038 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21039 !! html
21040 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21041
21042 !!end
21043
21044 !! test
21045 Ignore pipe between table row attributes
21046 !! wikitext
21047 {|
21048 | quux
21049 |- id=foo | style='color: red'
21050 | bar
21051 |}
21052 !! html
21053 <table>
21054 <tr>
21055 <td> quux
21056 </td></tr>
21057 <tr id="foo" style="color: red">
21058 <td> bar
21059 </td></tr></table>
21060
21061 !! end
21062
21063 !!test
21064 Gallery override link with WikiLink (bug 34852)
21065 !! wikitext
21066 <gallery>
21067 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21068 </gallery>
21069 !! html
21070 <ul class="gallery mw-gallery-traditional">
21071 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21072 <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>
21073 <div class="gallerytext">
21074 <p>caption
21075 </p>
21076 </div>
21077 </div></li>
21078 </ul>
21079
21080 !! end
21081
21082 !!test
21083 Gallery override link with absolute external link (bug 34852)
21084 !! wikitext
21085 <gallery>
21086 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21087 </gallery>
21088 !! html
21089 <ul class="gallery mw-gallery-traditional">
21090 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21091 <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>
21092 <div class="gallerytext">
21093 <p>caption
21094 </p>
21095 </div>
21096 </div></li>
21097 </ul>
21098
21099 !! end
21100
21101 !!test
21102 Gallery override link with malicious javascript (bug 34852)
21103 !! wikitext
21104 <gallery>
21105 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21106 </gallery>
21107 !! html
21108 <ul class="gallery mw-gallery-traditional">
21109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21110 <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>
21111 <div class="gallerytext">
21112 <p>caption
21113 </p>
21114 </div>
21115 </div></li>
21116 </ul>
21117
21118 !! end
21119
21120 !!test
21121 Gallery with invalid title as link (bug 43964)
21122 !! wikitext
21123 <gallery>
21124 File:foobar.jpg|link=<
21125 </gallery>
21126 !! html
21127 <ul class="gallery mw-gallery-traditional">
21128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21129 <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>
21130 <div class="gallerytext">
21131 </div>
21132 </div></li>
21133 </ul>
21134
21135 !! end
21136
21137 !!test
21138 Language parser function
21139 !! wikitext
21140 {{#language:ar}}
21141 !! html
21142 <p>العربية
21143 </p>
21144 !! end
21145
21146 !!test
21147 Padleft and padright as substr
21148 !! wikitext
21149 {{padleft:|3|abcde}}
21150 {{padright:|3|abcde}}
21151 !! html
21152 <p>abc
21153 abc
21154 </p>
21155 !! end
21156
21157 !!test
21158 Special parser function
21159 !! wikitext
21160 {{#special:RandomPage}}
21161 {{#special:BaDtItLe}}
21162 {{#special:Foobar}}
21163 !! html
21164 <p>Special:Random
21165 Special:Badtitle
21166 Special:Foobar
21167 </p>
21168 !! end
21169
21170 !!test
21171 Bug 34939 - Case insensitive link parsing ([HttP://])
21172 !! wikitext
21173 [HttP://MediaWiki.Org/]
21174 !! html/php
21175 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21176 </p>
21177 !! html/parsoid
21178 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21179 !! end
21180
21181 !!test
21182 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21183 !! wikitext
21184 [HttP://MediaWiki.Org/ MediaWiki]
21185 !! html
21186 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21187 </p>
21188 !! end
21189
21190 !!test
21191 Bug 34939 - Case insensitive link parsing (HttP://)
21192 !! wikitext
21193 HttP://MediaWiki.Org/
21194 !! html/php
21195 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21196 </p>
21197 !! html/parsoid
21198 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21199 !! end
21200
21201 !!test
21202 Disable TOC
21203 !! options
21204 notoc
21205 !! wikitext
21206 Lead
21207 == Section 1 ==
21208 == Section 2 ==
21209 == Section 3 ==
21210 == Section 4 ==
21211 == Section 5 ==
21212 !! html
21213 <p>Lead
21214 </p>
21215
21216 <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>
21217 <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>
21218 <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>
21219 <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>
21220 <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>
21221
21222 !! end
21223
21224
21225 ###
21226 ### Parsoid-specific tests
21227 ### Parsoid-PHP parser incompatibilities
21228 ###
21229 !!test
21230 1. SOL-sensitive wikitext tokens as template-args
21231 !!options
21232 parsoid=wt2html,wt2wt
21233 !! wikitext
21234 {{echo|*a}}
21235 {{echo|#a}}
21236 {{echo|:a}}
21237 !! html
21238 <span about="#mwt1" typeof="mw:Transclusion">
21239 </span><ul about="#mwt1"><li>a</li>
21240 </ul>
21241 <span about="#mwt2" typeof="mw:Transclusion">
21242 </span><ol about="#mwt2"><li>a</li>
21243 </ol>
21244 <span about="#mwt3" typeof="mw:Transclusion">
21245 </span><dl about="#mwt3"><dd>a</dd>
21246 </dl>
21247 !!end
21248
21249 #### -----------------------------------------------------------------
21250 #### Parsoid-specific functionality tests
21251 #### -----------------------------------------------------------------
21252
21253 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21254 # We know wt2wt will fail, but we expect selser to pass.
21255 # Due to the nature of our testing, wt2wt and selser tests will enter the
21256 # blacklist and we'll catch selser regressions based on changes to the
21257 # blacklist entries for selser tests.
21258 !! test
21259 1. Bad treebuilder fixup of formatting elt is cleaned up
21260 !! options
21261 parsoid=wt2html,wt2wt
21262 !! wikitext
21263 {|
21264 |
21265 <small>
21266 [[Image:Foobar.jpg|right|Test]]
21267 </small>
21268 |}
21269 !! html/parsoid
21270 <table>
21271 <tbody><tr><td>
21272 <small>
21273 <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>
21274 </small>
21275 </td></tr>
21276 </tbody></table>
21277 !! end
21278
21279 !! test
21280 2. Bad treebuilder fixup of formatting elt is cleaned up
21281 !! options
21282 parsoid=wt2html,wt2wt
21283 !! wikitext
21284 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21285
21286 <small>[[Image:Foobar.jpg|right|300px]]</small>
21287 !! html/parsoid
21288
21289 <p><b>foo</b></p>
21290 <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>
21291 <p><b>bar</b></p>
21292 <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>
21293 !! end
21294
21295 !! test
21296 3. Bad treebuilder fixup of formatting elt is cleaned up
21297 !! options
21298 parsoid=wt2html,wt2wt
21299 !! wikitext
21300 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21301 !! html/parsoid
21302 <p><small><b>foo</b></small></p>
21303 <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>
21304 <p><small><b>bar</b></small></p>
21305 !! end
21306
21307 !! test
21308 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21309 !! options
21310 parsoid=wt2html,wt2wt
21311 !! wikitext
21312 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21313 !! html/parsoid
21314 <p><b><small></small></b></p>
21315 <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>
21316 <p></p>
21317 !! end
21318
21319 #### ----------------------------------------------------------------
21320 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21321 #### tags. Parsoid's output for these tags differs from that of the
21322 #### PHP parser.
21323 #### ----------------------------------------------------------------
21324
21325 !!test
21326 Ref: 1. ref-location should be replaced with an index span
21327 !!options
21328 parsoid
21329 !! wikitext
21330 A <ref>foo</ref>
21331 B <ref name="x">foo</ref>
21332 C <ref name="y" />
21333 <references />
21334 !! html
21335 <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>
21336 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>
21337 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>
21338 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21339 <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>
21340 <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>
21341 <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>
21342 </ol>
21343 !!end
21344
21345 !!test
21346 Ref: 2. ref-tags with identical names should all get the same index
21347 !!options
21348 parsoid
21349 !! wikitext
21350 A <ref name="x">foo</ref>
21351 B <ref name="x" />
21352 <references />
21353 !! html
21354 <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>
21355 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>
21356 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21357 <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>
21358 </ol>
21359 !!end
21360
21361 !!test
21362 Ref: 3. spaces in ref-names should be ignored
21363 !!options
21364 parsoid
21365 !! wikitext
21366 A <ref name="x">foo</ref>
21367 B <ref name=" x " />
21368 C <ref name= x />
21369 <references />
21370 !! html
21371 <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>
21372 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>
21373 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>
21374 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21375 <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>
21376 </ol>
21377 !!end
21378
21379 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21380 !!test
21381 Ref: 4. 'constructor' should be accepted as a valid ref-name
21382 !!options
21383 parsoid
21384 !! wikitext
21385 A <ref name="constructor">foo</ref>
21386 <references />
21387 !! html
21388 <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>
21389 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21390 <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>
21391 </ol>
21392 !!end
21393
21394 !!test
21395 Ref: 5. body should accept generic wikitext
21396 !!options
21397 parsoid
21398 !! wikitext
21399 A <ref>
21400 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21401 </ref>
21402
21403 <references />
21404 !! html
21405 <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>
21406
21407 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21408 <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>
21409 </span></li>
21410 </ol>
21411 !!end
21412
21413 !!test
21414 Ref: 6. indent-pres should not be output in ref-body
21415 !!options
21416 parsoid
21417 !! wikitext
21418 A <ref>
21419 foo
21420 bar
21421 baz
21422 </ref>
21423
21424 <references />
21425 !! html
21426 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21427
21428 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21429 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21430 bar
21431 baz
21432 </span></li>
21433 </ol>
21434 !!end
21435
21436 !!test
21437 Ref: 7. No p-wrapping in ref-body
21438 !!options
21439 parsoid
21440 !! wikitext
21441 A <ref>
21442 foo
21443
21444 bar
21445
21446
21447 baz
21448
21449
21450
21451 booz
21452 </ref>
21453
21454 <references />
21455 !! html
21456 <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>
21457
21458 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21459 <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
21460
21461 bar
21462
21463
21464 baz
21465
21466
21467
21468 booz
21469 </span></li>
21470 </ol>
21471 !!end
21472
21473 !!test
21474 Ref: 8. transclusion wikitext has lower precedence
21475 !!options
21476 parsoid
21477 !! wikitext
21478 A <ref> foo {{echo|</ref> B C}}
21479
21480 <references />
21481 !! html
21482 <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>
21483 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21484 <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>
21485 </ol>
21486 !!end
21487
21488 !!test
21489 Ref: 9. unclosed comments should not leak out of ref-body
21490 !!options
21491 parsoid
21492 !! wikitext
21493 A <ref> foo <!--</ref> B C
21494 <references />
21495 !! html
21496 <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>
21497 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21498 <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>
21499 </ol>
21500 !!end
21501
21502 !!test
21503 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21504 !!options
21505 parsoid
21506 !! wikitext
21507 A <ref> <b> foo </ref> B C
21508
21509 <references />
21510 !! html
21511 <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>
21512
21513
21514 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21515 <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>
21516 </ol>
21517 !!end
21518
21519 !!test
21520 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21521 !!options
21522 parsoid
21523 !! wikitext
21524 A <ref>foo</ref> B
21525 C <ref>bar</ref> D
21526 <references />
21527 !! html
21528 <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
21529 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>
21530 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21531 <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>
21532 <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>
21533 </ol>
21534 !!end
21535
21536 !!test
21537 Ref: 12. ref-tags act as trailing newline migration barrier
21538 !! wikitext
21539 <!--the newline at the end of this line moves out of the p tag-->a
21540
21541 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21542 <ref />
21543
21544 c
21545 <references />
21546 !! html/parsoid
21547 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21548
21549
21550 <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>
21551 <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>
21552
21553 <p>c</p>
21554 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21555 <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>
21556 <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>
21557 !!end
21558
21559 !!test
21560 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21561 !!options
21562 parsoid
21563 !! wikitext
21564 <ref>foo</ref> A
21565 <ref>bar
21566 </ref> B
21567 <references />
21568 !! html
21569 <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
21570 <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>
21571 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21572 <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>
21573 <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
21574 </span></li>
21575 </ol>
21576 !!end
21577
21578 !!test
21579 Ref: 14. A nested ref-tag should be emitted as plain text
21580 !!options
21581 parsoid
21582 !! wikitext
21583 <ref>foo <ref>bar</ref> baz</ref>
21584
21585 <references />
21586 !! html
21587 <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>
21588 </p>
21589 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21590 <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>
21591 </ol>
21592 !!end
21593
21594 !!test
21595 Ref: 15. ref-tags with identical names should get identical indexes
21596 !!options
21597 parsoid
21598 !! wikitext
21599 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21600 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21601
21602 <references />
21603 !! html
21604 <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>
21605 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>
21606
21607 <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>
21608 </ol>
21609 !!end
21610
21611 ## We don't bother wt2wt-ing non-standard whitespace
21612 !!test
21613 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21614 !!options
21615 parsoid=wt2html
21616 !! wikitext
21617 A <ref >foo</ref >
21618
21619 <references />
21620 !! html
21621 <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>
21622 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21623 <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>
21624 !!end
21625
21626 !!test
21627 Ref: 17. Generate valid HTML5 id/about attributes
21628 !!options
21629 parsoid
21630 !!wikitext
21631 <ref name="a b">foo</ref>
21632
21633 <references />
21634 !!html
21635 <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>
21636 </p>
21637
21638 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21639 <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>
21640 </ol>
21641 !!end
21642
21643 !!test
21644 Ref: 18. T58916: Extension attributes should be parsed as plain text
21645 !!options
21646 parsoid
21647 !!wikitext
21648 <ref name="{{echo|a}}">foo</ref>
21649
21650 <references />
21651 !!html
21652 <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>
21653 </p>
21654
21655 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21656 <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>
21657 </ol>
21658 !!end
21659
21660 !!test
21661 Ref: 19. ref-tags with identical name encodings should get identical indexes
21662 !!options
21663 parsoid
21664 !! wikitext
21665 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21666
21667 <references />
21668 !! html
21669 <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>
21670 </p>
21671 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21672 <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>
21673 </ol>
21674 !!end
21675
21676 !!test
21677 Ref: 20. ref-tags with identical names but different content should keep it
21678 !!options
21679 parsoid
21680 !! wikitext
21681 A <ref name="foo">Foo one</ref>
21682 B <ref name="foo">Foo two</ref>
21683 C <ref name="foo" />
21684
21685 <references />
21686 !! html
21687 <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>
21688 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>
21689 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>
21690
21691 <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>
21692 </ol>
21693 !!end
21694
21695 !!test
21696 References: 1. references tag without any refs should be handled properly
21697 !! wikitext
21698 <references />
21699 !! html/parsoid
21700 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21701 !!end
21702
21703 !!test
21704 References: 2. references tag with group only outputs references from that group
21705 !! wikitext
21706 A <ref group="a">foo</ref>
21707 B <ref group="b">bar</ref>
21708 C <ref>baz</ref>
21709
21710 <references group="a" />
21711 <references />
21712 <references group="b" />
21713 !! html/parsoid
21714 <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>
21715 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>
21716 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>
21717
21718 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21719 <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>
21720 </ol>
21721 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21722 <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>
21723 </ol>
21724 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21725 <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>
21726 </ol>
21727 !!end
21728
21729 !!test
21730 References: 3. ref list should be cleared after processing references
21731 !! wikitext
21732 A <ref>foo</ref>
21733
21734 <references />
21735
21736 B <ref>bar</ref>
21737
21738 <references />
21739 !! html/parsoid
21740 <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>
21741
21742 <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>
21743 </ol>
21744
21745 <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>
21746
21747 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21748 <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>
21749 </ol>
21750 !!end
21751
21752 !!test
21753 References: 4. only referenced group should be cleared after processing references
21754 !! wikitext
21755 A <ref group="a">afoo</ref>
21756 B <ref>bfoo</ref>
21757
21758 <references group="a" />
21759
21760 C <ref>cfoo</ref>
21761
21762 <references />
21763 !! html/parsoid
21764 <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>
21765 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>
21766
21767 <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>
21768 </ol>
21769
21770 <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>
21771
21772 <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>
21773 </ol>
21774 !!end
21775
21776 !!test
21777 References: 5. ref tags in references should be processed while ignoring all other content
21778 !! wikitext
21779 A <ref name="a" />
21780 B <ref name="b">bar</ref>
21781
21782 <references>
21783 <ref name="a">foo</ref>
21784 This should just get lost.
21785 </references>
21786 !! html/parsoid
21787 <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>
21788 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>
21789
21790
21791 <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>
21792 </ol>
21793 !!end
21794
21795 !!test
21796 References: 6. <references /> from a transclusion
21797 !! wikitext
21798 <ref>Foo</ref> {{echo|<references />}}
21799 !! html/parsoid
21800 <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>
21801 </ol>
21802 !!end
21803
21804 !! test
21805 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21806 !! wikitext
21807 A <ref>foo bar for a</ref>
21808 B <ref group="X" name="b" />
21809
21810 <references />
21811
21812 <references group="X">
21813 <ref name="b">foo</ref>
21814 </references>
21815 !! html/parsoid
21816 <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>
21817 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>
21818 </p>
21819
21820 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21821 <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>
21822 </ol>
21823
21824 <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"}}'>
21825 <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>
21826 </ol>
21827 !! end
21828
21829 !! test
21830 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21831 !! wikitext
21832 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21833 <references />
21834 !! html/parsoid
21835 <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>
21836 <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>
21837 </ol>
21838 !!end
21839
21840 # This test only works in wt2html now as the <references /> are always generated
21841 # unless selser is active. Once T72722 is fixed, we should add a changes test
21842 # here to ensure that unrelated changes don't add the new <references /> in
21843 # wt2wt.
21844 !! test
21845 References: 9. Generate missing references list at the end
21846 !! wikitext
21847 A <ref>foo</ref>
21848 B <ref group="inexistent">bar</ref>
21849 !! html/parsoid
21850 <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>
21851 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21852 <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>
21853 </ol>
21854 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21855 <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>
21856 </ol>
21857 !! end
21858
21859 !! test
21860 References: 10. New <references/> shouldn't be added for unrelated edits.
21861 !! options
21862 parsoid={
21863 "modes": ["selser"],
21864 "changes": [["#x", "remove"]],
21865 "selser": "noauto"
21866 }
21867 !! wikitext
21868 Unrelated text<span id="x"> that's going to disappear</span>.
21869 A <ref>foo</ref>
21870 !! wikitext/edited
21871 Unrelated text.
21872 A <ref>foo</ref>
21873 !!end
21874
21875 !! test
21876 Entities in ref name
21877 !! wikitext
21878 <ref name="test &amp; me">hi</ref>
21879 <references />
21880 !! html/parsoid
21881 <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>
21882 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21883 <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>
21884 </ol>
21885 !! end
21886
21887 # This test is wt2html only because we're permitting the serializer to produce
21888 # dirty diffs, normalizing the unclosed references to the self-closed version.
21889 !! test
21890 Generate references for unclosed references tag
21891 !! options
21892 parsoid=wt2html
21893 !! wikitext
21894 a<ref>foo</ref>
21895
21896 <references>
21897 !! html/parsoid
21898 <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>
21899 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21900 <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>
21901 !! end
21902
21903 !! test
21904 New reference serializes on its own line
21905 !! options
21906 parsoid=wt2wt,html2wt
21907 !! wikitext
21908 foo
21909 <references />
21910 !! html/parsoid
21911 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21912 !! end
21913
21914 #### ----------------------------------------------------------------
21915 #### Parsoid-only testing of Parsoid's impl of LST
21916 #### Not implemented yet, see
21917 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21918 #### ----------------------------------------------------------------
21919
21920 !!test
21921 LST Sections: 1. Simple section start and end
21922 !! wikitext
21923 <section begin="2011-05-16" />
21924 <section end="2014-04-10 (MW 1.23wmf22)" />
21925 !! html/parsoid
21926 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21927 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21928 !! end
21929
21930 #--------- Test stripping of empty nodes in template content ----------
21931 !!test
21932 Empty LI and TR nodes should be stripped from template content
21933 !!wikitext
21934 {{EmptyLITest}}
21935 {{EmptyTRTest}}
21936 !!html/parsoid
21937 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21938 <li>a</li>
21939 <li>b</li>
21940 </ul>
21941 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21942 <tbody>
21943 <tr>
21944 <td>foo</td>
21945 </tr>
21946 <tr>
21947 <td>bar</td>
21948 </tr>
21949 </tbody>
21950 </table>
21951 !!end
21952
21953 !!test
21954 Empty LI and TR nodes should not be stripped from top-level content
21955 !!wikitext
21956 * a
21957 *
21958 * b
21959 {|
21960 |-
21961 |-
21962 |foo
21963 |}
21964 !!html/parsoid
21965 <ul>
21966 <li> a</li>
21967 <li></li>
21968 <li> b</li>
21969 </ul>
21970 <table>
21971 <tbody>
21972 <tr></tr>
21973 <tr>
21974 <td>foo</td>
21975 </tr>
21976 </tbody>
21977 </table>
21978 !!end
21979
21980 !!test
21981 Empty TR nodes should not be stripped if they have any attributes set
21982 !!wikitext
21983 {{EmptyTRWithHTMLAttrTest}}
21984 !!html/parsoid
21985 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21986 <tr align="center"></tr>
21987 <tr><td>foo</td></tr>
21988 <tr align="center"></tr>
21989 <tr><td>bar</td></tr>
21990 </table>
21991 !!end
21992
21993 #### ----------------------------------------------------------------
21994 #### The following section of tests are primarily to test
21995 #### wikitext escaping capabilities of Parsoid. Given that
21996 #### escaping can be done any number of ways, the wikitext (input)
21997 #### is always adjusted to reflect how Parsoid adds nowiki
21998 #### escape tags.
21999 ####
22000 #### We are marking several tests as parsoid-only since the
22001 #### HTML in the result section is different from what the
22002 #### PHP parser generates for it.
22003 #### ----------------------------------------------------------------
22004
22005
22006 #### --------------- Headings ---------------
22007 #### 0. Unnested
22008 #### 1. Nested inside html <h1>=foo=</h1>
22009 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22010 #### 3. Nested inside html with wikitext split by html tags
22011 #### 4. No escape needed
22012 #### 5. Empty headings <h1></h1>
22013 #### 6. Heading chars in SOL context
22014 #### ----------------------------------------
22015 !! test
22016 Headings: 0. Unnested
22017 !! options
22018 parsoid=html2wt
22019 !! html/parsoid
22020 <p>=foo=</p>
22021
22022 <p> =foo=
22023 <!--cmt-->
22024 =foo=</p>
22025
22026 <p>=foo<i>a</i>=</p>
22027 !! wikitext
22028 <nowiki>=foo=</nowiki>
22029
22030 <nowiki> </nowiki>=foo=
22031 <!--cmt-->
22032 <nowiki>=foo=</nowiki>
22033
22034 =foo''a''<nowiki>=</nowiki>
22035 !!end
22036
22037 # New headings and existing headings are handled differently
22038 !! test
22039 Headings: 1. Nested inside html
22040 !! options
22041 parsoid=html2wt
22042 !! html/parsoid
22043 <h1>=foo=</h1>
22044 <h2>=foo=</h2>
22045 <h3>=foo=</h3>
22046
22047 <h1 data-parsoid=''>=foo=</h1>
22048 <h2 data-parsoid=''>=foo=</h2>
22049 <h3 data-parsoid=''>=foo=</h3>
22050 <h4 data-parsoid=''>=foo=</h4>
22051 <h5 data-parsoid=''>=foo=</h5>
22052 <h6 data-parsoid=''>=foo=</h6>
22053 !! wikitext
22054 = =foo= =
22055
22056 == =foo= ==
22057
22058 === =foo= ===
22059
22060 =<nowiki>=foo=</nowiki>=
22061 ==<nowiki>=foo=</nowiki>==
22062 ===<nowiki>=foo=</nowiki>===
22063 ====<nowiki>=foo=</nowiki>====
22064 =====<nowiki>=foo=</nowiki>=====
22065 ======<nowiki>=foo=</nowiki>======
22066
22067 !!end
22068
22069 !! test
22070 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22071 !! options
22072 parsoid=html2wt
22073 !! html/parsoid
22074 <h1>foo</h1>*bar
22075 <h1>foo</h1>=bar
22076 <h1>foo</h1>=bar=
22077 !! wikitext
22078 = foo =
22079 <nowiki>*</nowiki>bar
22080
22081 = foo =
22082 =bar
22083
22084 = foo =
22085 <nowiki>=bar=</nowiki>
22086 !!end
22087
22088 !! test
22089 Headings: 3. Nested inside html with wikitext split by html tags
22090 !! options
22091 parsoid=html2wt
22092 !! html/parsoid
22093 <h1>=<b>bold</b>foo=</h1>
22094 !! wikitext
22095 = ='''bold'''<nowiki>foo=</nowiki> =
22096 !!end
22097
22098 !! test
22099 Headings: 4a. No escaping needed (testing just h1 and h2)
22100 !! options
22101 parsoid=html2wt
22102 !! html/parsoid
22103 <h1>=foo</h1>
22104 <h1>foo=</h1>
22105 <h1> =foo= </h1>
22106 <h1>=foo= bar</h1>
22107 <h2>=foo</h2>
22108 <h2>foo=</h2>
22109 <h1>=</h1>
22110 <h1><i>=</i>foo=</h1>
22111 !! wikitext
22112 = =foo =
22113
22114 = foo= =
22115
22116 = =foo= =
22117
22118 = =foo= bar =
22119
22120 == =foo ==
22121
22122 == foo= ==
22123
22124 = = =
22125
22126 = ''=''foo= =
22127 !!end
22128
22129 !! test
22130 Headings: 4b. No escaping needed (inside p-tags)
22131 !! options
22132 parsoid=html2wt
22133 !! html/parsoid
22134 <p>===
22135 =foo= x
22136 =foo= <s></s>
22137 </p>
22138 !! wikitext
22139 ===
22140 =foo= x
22141 =foo= <s></s>
22142 !!end
22143
22144 !! test
22145 Headings: 5. Empty headings
22146 !! options
22147 parsoid=html2wt
22148 !! html/parsoid
22149 <h1 data-parsoid='{}'></h1>
22150
22151 <h2 data-parsoid='{}'></h2>
22152
22153 <h3 data-parsoid='{}'></h3>
22154
22155 <h4 data-parsoid='{}'></h4>
22156
22157 <h5 data-parsoid='{}'></h5>
22158
22159 <h6 data-parsoid='{}'></h6>
22160 !! wikitext
22161 =<nowiki/>=
22162
22163 ==<nowiki/>==
22164
22165 ===<nowiki/>===
22166
22167 ====<nowiki/>====
22168
22169 =====<nowiki/>=====
22170
22171 ======<nowiki/>======
22172 !!end
22173
22174 !! test
22175 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22176 !! options
22177 parsoid=html2wt
22178 !! html/parsoid
22179 <p>=a=</p>
22180
22181 <p>=a=</p>
22182
22183 <p>=a=</p>
22184 !! wikitext
22185 <nowiki>=a=</nowiki>
22186
22187 <nowiki>=a=</nowiki>
22188
22189 <nowiki>=a=</nowiki>
22190 !!end
22191
22192 !! test
22193 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22194 !! options
22195 parsoid=html2wt
22196 !! html/parsoid
22197 <p>=a=
22198 b</p>
22199
22200 <p>=a=
22201 b</p>
22202
22203 <p>=a=
22204 b</p>
22205 !! wikitext
22206 <nowiki>=a=</nowiki>
22207 b
22208
22209 <nowiki>=a=</nowiki>
22210 b
22211
22212 <nowiki>=a=</nowiki>
22213 b
22214 !!end
22215
22216 !! test
22217 Headings: 6c. Heading chars in SOL context (leading newline break)
22218 !! options
22219 parsoid=html2wt
22220 !! html/parsoid
22221 <p>a
22222 =b=</p>
22223 !! wikitext
22224 a
22225 <nowiki>=b=</nowiki>
22226 !!end
22227
22228 !! test
22229 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22230 !! options
22231 parsoid=html2wt
22232 !! html/parsoid
22233 <!--c0--><p>=a=</p>
22234
22235 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22236 !! wikitext
22237 <!--c0--><nowiki>=a=</nowiki>
22238
22239 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22240 !!end
22241
22242 !! test
22243 Headings: 6d. Heading chars in SOL context (No escaping needed)
22244 !! options
22245 parsoid=html2wt
22246 !! html/parsoid
22247 =a=<div>b</div>
22248 !! wikitext
22249 =a=<div>b</div>
22250 !!end
22251
22252 !! test
22253 Headings: 7. Insert a newline between new content and headings
22254 !! options
22255 parsoid=html2wt
22256 !! html/parsoid
22257 <h2>NEW</h2>
22258 <p>new</p>
22259 <h2 data-parsoid='{}'>A</h2>
22260 <p data-parsoid='{}'>a</p>
22261 !! wikitext
22262 == NEW ==
22263 new
22264
22265 ==A==
22266 a
22267
22268 !! end
22269
22270 #### --------------- Lists ---------------
22271 #### 0. Outside nests (*foo, etc.)
22272 #### 1. Nested inside html <ul><li>*foo</li></ul>
22273 #### 2. Inside definition lists
22274 #### 3. Only bullets at start should be escaped
22275 #### 4. No escapes needed
22276 #### 5. No unnecessary escapes
22277 #### 6. Escape bullets in SOL position
22278 #### 7. Escape bullets in a multi-line context
22279 #### ----------------------------------------
22280
22281 !! test
22282 Lists: 0. Outside nests
22283 !! options
22284 parsoid=html2wt
22285 !! html/parsoid
22286 <p>*foo</p>
22287
22288 <p>#foo</p>
22289
22290 <p>;Foo:bar</p>
22291 !! wikitext
22292 <nowiki>*</nowiki>foo
22293
22294 <nowiki>#</nowiki>foo
22295
22296 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22297 !!end
22298
22299 !! test
22300 Lists: 1. Nested inside html
22301 !! options
22302 parsoid=html2wt
22303 !! html/parsoid
22304 <ul><li>*foo</li></ul>
22305 <ul><li>#foo</li></ul>
22306 <ul><li>:foo</li></ul>
22307 <ul><li>;foo</li></ul>
22308 <ol><li>*foo</li></ol>
22309 <ol><li>#foo</li></ol>
22310 <ol><li>:foo</li></ol>
22311 <ol><li>;foo</li></ol>
22312
22313 !! wikitext
22314 *<nowiki>*foo</nowiki>
22315
22316 *<nowiki>#foo</nowiki>
22317
22318 *<nowiki>:foo</nowiki>
22319
22320 *<nowiki>;foo</nowiki>
22321
22322 #<nowiki>*foo</nowiki>
22323
22324 #<nowiki>#foo</nowiki>
22325
22326 #<nowiki>:foo</nowiki>
22327
22328 #<nowiki>;foo</nowiki>
22329 !!end
22330
22331 !! test
22332 Lists: 2. Inside definition lists
22333 !! options
22334 parsoid=html2wt
22335 !! html/parsoid
22336 <dl><dt>;foo</dt></dl>
22337 <dl><dt>:foo</dt></dl>
22338 <dl><dt>:foo</dt>
22339 <dd>bar</dd></dl>
22340 <dl><dd>:foo</dd></dl>
22341
22342 !! wikitext
22343 ;<nowiki>;foo</nowiki>
22344
22345 ;<nowiki>:foo</nowiki>
22346
22347 ;<nowiki>:foo</nowiki>
22348 :bar
22349
22350 :<nowiki>:foo</nowiki>
22351 !!end
22352
22353 !! test
22354 Lists: 3. Only bullets at start of text should be escaped
22355 !! options
22356 parsoid=html2wt
22357 !! html/parsoid
22358 <ul><li>*foo*bar</li></ul>
22359 <ul><li>*foo<i>it</i>*bar</li></ul>
22360
22361 !! wikitext
22362 *<nowiki>*foo*bar</nowiki>
22363
22364 *<nowiki>*foo</nowiki>''it''*bar
22365 !!end
22366
22367 !! test
22368 Lists: 4. No escapes needed
22369 !! options
22370 parsoid=html2wt
22371 !! html/parsoid
22372 <ul>
22373 <li>foo*bar
22374 </li>
22375 </ul>
22376 <ul>
22377 <li><i>foo</i>*bar
22378 </li>
22379 </ul>
22380 <ul>
22381 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22382 </li>
22383 </ul>
22384 <ul>
22385 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22386 </li>
22387 </ul>
22388 !! wikitext
22389 *foo*bar
22390
22391 *''foo''*bar
22392
22393 *[[Foo]]: bar
22394
22395 *[[Foo]]*bar
22396 !!end
22397
22398 !! test
22399 Lists: 5. No unnecessary escapes
22400 !! options
22401 parsoid=html2wt
22402 !! html/parsoid
22403 <ul><li> bar <span>[[foo]]</span></li></ul>
22404 <ul><li> =bar <span>[[foo]]</span></li></ul>
22405 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22406 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22407 <ul><li> =bar <span>foo]]</span>=</li></ul>
22408 <ul><li> <s></s>: a</li></ul>
22409 <ul><li> <i>* foo</i></li></ul>
22410
22411 !! wikitext
22412 * bar <span><nowiki>[[foo]]</nowiki></span>
22413
22414 * =bar <span><nowiki>[[foo]]</nowiki></span>
22415
22416 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22417
22418 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22419
22420 * =bar <span>foo]]</span>=
22421
22422 * <s></s>: a
22423
22424 * ''* foo''
22425 !!end
22426
22427 !! test
22428 Lists: 6. Escape bullets in SOL position
22429 !! options
22430 parsoid=html2wt
22431 !! html/parsoid
22432 <p><!--cmt-->*foo</p>
22433 !! wikitext
22434 <!--cmt--><nowiki>*</nowiki>foo
22435 !!end
22436
22437 !! test
22438 Lists: 7. Escape bullets in a multi-line context
22439 !! options
22440 parsoid=html2wt
22441 !! html/parsoid
22442 <p>a
22443 *b
22444 </p>
22445 !! wikitext
22446 a
22447 <nowiki>*</nowiki>b
22448 !!end
22449
22450 !! test
22451 Lists: 8. Escape colons only if not present in tags
22452 !! options
22453 parsoid=html2wt
22454 !! html/parsoid
22455 <dl><dt>a:b<i>c:d</i></dt></dl>
22456 !! wikitext
22457 ; <nowiki>a:b</nowiki>''c:d''
22458 !! end
22459
22460 #### --------------- HRs ---------------
22461 #### 1. Single line
22462 #### -----------------------------------
22463
22464 !! test
22465 HRs: 1. Single line
22466 !! options
22467 parsoid=html2wt
22468 !! html/parsoid
22469 <hr />----
22470 <hr />=foo=
22471 <hr />*foo
22472 !! wikitext
22473 ----<nowiki>----</nowiki>
22474 ----=foo=
22475 ----*foo
22476 !! end
22477
22478 #### --------------- Tables ---------------
22479 #### 1a. Simple example
22480 #### 1b. No escaping needed (!foo)
22481 #### 1c. No escaping needed (|foo)
22482 #### 1d. No escaping needed (|}foo)
22483 ####
22484 #### 2a. Nested in td (<td>foo|bar</td>)
22485 #### 2b. Nested in td (<td>foo||bar</td>)
22486 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22487 ####
22488 #### 3a. Nested in th (<th>foo!bar</th>)
22489 #### 3b. Nested in th (<th>foo!!bar</th>)
22490 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22491 ####
22492 #### 4a. Escape -
22493 #### 4b. Escape +
22494 #### 4c. No escaping needed
22495 #### --------------------------------------
22496
22497 !! test
22498 Tables: 1a. Simple example
22499 !! options
22500 parsoid=html2wt
22501 !! html/parsoid
22502 <p>{|
22503 |}
22504 </p>
22505 !! wikitext
22506 <nowiki>{|</nowiki>
22507 |}
22508 !! end
22509
22510 !! test
22511 Tables: 1b. No escaping needed
22512 !! options
22513 parsoid=html2wt
22514 !! html/parsoid
22515 <p>!foo
22516 </p>
22517 !! wikitext
22518 !foo
22519 !! end
22520
22521 !! test
22522 Tables: 1c. No escaping needed
22523 !! options
22524 parsoid=html2wt
22525 !! html/parsoid
22526 <p>|foo
22527 </p>
22528 !! wikitext
22529 |foo
22530 !! end
22531
22532 !! test
22533 Tables: 1d. No escaping needed
22534 !! options
22535 parsoid=html2wt
22536 !! html/parsoid
22537 <p>|}foo
22538 </p>
22539 !! wikitext
22540 |}foo
22541 !! end
22542
22543 !! test
22544 Tables: 2a. Nested in td
22545 !! options
22546 parsoid=html2wt
22547 !! html/parsoid
22548 <table><tbody><tr>
22549 <td>foo|bar</td></tr>
22550 <tr><td>x<div>a|b</div></td>
22551 </tbody></table>
22552 !! wikitext
22553 {|
22554 |<nowiki>foo|bar</nowiki>
22555 |-
22556 |x<div><nowiki>a|b</nowiki></div>
22557 |}
22558 !! html/php+tidy
22559 <table>
22560 <tr>
22561 <td>foo|bar</td>
22562 </tr>
22563 <tr>
22564 <td>x
22565 <div>a|b</div>
22566 </td>
22567 </tr>
22568 </table>
22569 !! end
22570
22571 !! test
22572 Tables: 2b. Nested in td
22573 !! options
22574 parsoid=html2wt
22575 !! html/parsoid
22576 <table><tbody><tr>
22577 <td>foo||bar</td>
22578 <td>a<i>b||c</i></td>
22579 <td>a<i><div>b||c</div></i></td>
22580 </tr></tbody></table>
22581 !! wikitext
22582 {|
22583 |<nowiki>foo||bar</nowiki>
22584 |a''<nowiki>b||c</nowiki>''
22585 |a''<div><nowiki>b||c</nowiki></div>''
22586 |}
22587 !! html/php
22588 <table>
22589 <tr>
22590 <td>foo||bar
22591 </td>
22592 <td>a<i>b||c</i>
22593 </td>
22594 <td>a<i><div>b||c</div></i>
22595 </td></tr></table>
22596
22597 !! end
22598
22599 !! test
22600 Tables: 2c. Nested in td -- no escaping needed
22601 !! options
22602 parsoid=html2wt
22603 !! html/*
22604 <table>
22605
22606 <tr>
22607 <td>foo!!bar
22608 </td></tr></table>
22609
22610 !! wikitext
22611 {|
22612
22613 |foo!!bar
22614 |}
22615 !! end
22616
22617 !! test
22618 Tables: 3a. Nested in th
22619 !! options
22620 parsoid=html2wt
22621 !! html/*
22622 <table>
22623
22624 <tr>
22625 <th>foo!bar
22626 </th></tr></table>
22627
22628 !! wikitext
22629 {|
22630
22631 !foo!bar
22632 |}
22633 !! end
22634
22635 !! test
22636 Tables: 3b. Nested in th
22637 !! options
22638 parsoid=html2wt
22639 !! html/parsoid
22640 <table><tbody>
22641 <tr><th>foo!!bar</th>
22642 <th><i>foo|bar</i></th>
22643 <th><i>foo!!bar</i></th>
22644 <th><i><span>foo!!bar</span></i></th>
22645 </tr></tbody></table>
22646 !! wikitext
22647 {|
22648 !<nowiki>foo!!bar</nowiki>
22649 !''<nowiki>foo|bar</nowiki>''
22650 !''<nowiki>foo!!bar</nowiki>''
22651 !''<span><nowiki>foo!!bar</nowiki></span>''
22652 |}
22653 !! html/php
22654 <table>
22655 <tr>
22656 <th>foo!!bar
22657 </th>
22658 <th><i>foo|bar</i>
22659 </th>
22660 <th><i>foo!!bar</i>
22661 </th>
22662 <th><i><span>foo!!bar</span></i>
22663 </th></tr></table>
22664
22665 !! end
22666
22667 !! test
22668 Tables: 3c. Nested in th
22669 !! options
22670 parsoid=html2wt
22671 !! html/parsoid
22672 <table><tbody>
22673 <tr><th>foo||bar</th>
22674 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22675 </tr></tbody></table>
22676 !! wikitext
22677 {|
22678 !<nowiki>foo||bar</nowiki>
22679 !<nowiki>foo||bar</nowiki>
22680 |}
22681 !! html/php
22682 <table>
22683 <tr>
22684 <th>foo||bar
22685 </th>
22686 <th>foo||bar
22687 </th></tr></table>
22688
22689 !! end
22690
22691 !! test
22692 Tables: 4a. Escape -
22693 !! options
22694 parsoid=html2wt
22695 !! html/*
22696 <table>
22697
22698 <tr>
22699 <th>-bar
22700 </th></tr>
22701 <tr>
22702 <td>-bar
22703 </td></tr></table>
22704
22705 !! wikitext
22706 {|
22707
22708 !-bar
22709
22710 |-
22711 |<nowiki>-bar</nowiki>
22712 |}
22713 !! end
22714
22715 !! test
22716 Tables: 4b. Escape +
22717 !! options
22718 parsoid=html2wt
22719 !! html/*
22720 <table>
22721
22722 <tr>
22723 <th>+bar
22724 </th></tr>
22725 <tr>
22726 <td>+bar
22727 </td></tr></table>
22728
22729 !! wikitext
22730 {|
22731
22732 !+bar
22733
22734 |-
22735 |<nowiki>+bar</nowiki>
22736 |}
22737 !! end
22738
22739 !! test
22740 Tables: 4c. No escaping needed
22741 !! options
22742 parsoid=html2wt
22743 !! html/parsoid
22744 <table><tbody>
22745 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22746 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22747 <tr><td>foo
22748 <p>bar|baz
22749 +bar
22750 -bar</p></td></tr>
22751 <tr><td>x
22752 <div>a|b</div></td>
22753 </tbody></table>
22754 !! wikitext
22755 {|
22756 |foo-bar
22757 |foo+bar
22758 |-
22759 |''foo''-bar
22760 |''foo''+bar
22761 |-
22762 |foo
22763 bar|baz
22764 +bar
22765 -bar
22766 |-
22767 |x
22768 <div>a|b</div>
22769 |}
22770 !! html/php
22771 <table>
22772 <tr>
22773 <td>foo-bar
22774 </td>
22775 <td>foo+bar
22776 </td></tr>
22777 <tr>
22778 <td><i>foo</i>-bar
22779 </td>
22780 <td><i>foo</i>+bar
22781 </td></tr>
22782 <tr>
22783 <td>foo
22784 <p>bar|baz
22785 +bar
22786 -bar
22787 </p>
22788 </td></tr>
22789 <tr>
22790 <td>x
22791 <div>a|b</div>
22792 </td></tr></table>
22793
22794 !! end
22795
22796 !! test
22797 Tables: 4d. No escaping needed
22798 !! options
22799 parsoid=html2wt
22800 !! html/parsoid
22801 <table>
22802 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22803 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22804 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22805 </tbody></table>
22806 !! wikitext
22807 {|
22808 |[[Foo]]-bar
22809 ||+1
22810 ||-2
22811 |}
22812 !! html/php
22813 <table>
22814 <tr>
22815 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22816 </td>
22817 <td>+1
22818 </td>
22819 <td>-2
22820 </td></tr></table>
22821
22822 !! end
22823
22824 !! test
22825 T97430: Don't emit empty nowiki pairs around marker meta tags
22826 !! options
22827 parsoid=html2wt
22828 !! html/parsoid
22829 <p>*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.</p>
22831 !! wikitext
22832 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22833 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22834 !! end
22835
22836 !! test
22837 Unclosed xmlish element in table line shouldn't eat end delimiters
22838 !! options
22839 parsoid=html2wt
22840 !! html/parsoid
22841 <table>
22842 <tbody><tr><td> &lt;foo</td>
22843 <td> bar></td></tr>
22844 </tbody></table>
22845 !! wikitext
22846 {|
22847 | <foo
22848 | bar>
22849 |}
22850 !! html/php
22851 <table>
22852 <tr>
22853 <td> &lt;foo
22854 </td>
22855 <td> bar&gt;
22856 </td></tr></table>
22857
22858 !! end
22859
22860 #### --------------- Links ----------------
22861 #### 1. Quote marks in link text
22862 #### 2. Wikilinks: Escapes needed
22863 #### 3. Wikilinks: No escapes needed
22864 #### 4. Extlinks: Escapes needed
22865 #### 5. Extlinks: No escapes needed
22866 #### --------------------------------------
22867 !! test
22868 Links 1. WikiLinks: No escapes needed
22869 !! options
22870 parsoid=html2wt
22871 !! html/parsoid
22872 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22873 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22874 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22875 !! wikitext
22876 [[Foo|Foo''boo'']]
22877 [[Foo|[Foobar]]]
22878 [[Foo|x [Foobar] x]]
22879 !! html/php
22880 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22881 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22882 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22883 </p>
22884 !! end
22885
22886 !! test
22887 Links 2. WikiLinks: Escapes needed
22888 !! options
22889 parsoid=html2wt
22890 !! html/parsoid
22891 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22892 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22893 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22894 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22895 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22896 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22897 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22898 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22899 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22900 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22901 !! wikitext
22902 [[Foo|<nowiki>Foobar]</nowiki>]]
22903 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22904 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22905 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22906 [[Foo|<nowiki>|Bar</nowiki>]]
22907 [[Foo|<nowiki>]]bar</nowiki>]]
22908 [[Foo|<nowiki>[[bar</nowiki>]]
22909 [[Foo|<nowiki>x [[ y</nowiki>]]
22910 [[Foo|<nowiki>x ]] y</nowiki>]]
22911 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22912 !! html/php
22913 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22914 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22915 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22916 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22917 <a href="/wiki/Foo" title="Foo">|Bar</a>
22918 <a href="/wiki/Foo" title="Foo">]]bar</a>
22919 <a href="/wiki/Foo" title="Foo">[[bar</a>
22920 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22921 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22922 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22923 </p>
22924 !! end
22925
22926 !! test
22927 Links 3. WikiLinks: No escapes needed
22928 !! options
22929 parsoid=html2wt
22930 !! html/parsoid
22931 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22932 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22933 !! wikitext
22934 [[Foo|[Foobar]]
22935 [[Foo|foo|bar]]
22936 !! html/php
22937 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22938 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22939 </p>
22940 !! end
22941
22942 !! test
22943 Links 4. ExtLinks: Escapes needed
22944 !! options
22945 parsoid=html2wt
22946 !! html/parsoid
22947 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22948 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22949 <p>[http://google.com]</p>
22950 <p>[http://google.com google]</p>
22951 !! wikitext
22952 [http://google.com <nowiki>[google]</nowiki>]
22953 [http://google.com <nowiki>google]</nowiki>]
22954
22955 <nowiki>[http://google.com]</nowiki>
22956
22957 <nowiki>[http://google.com google]</nowiki>
22958
22959 !! html/php
22960 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22961 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22962 </p><p>[http://google.com]
22963 </p><p>[http://google.com google]
22964 </p>
22965 !! end
22966
22967 !! test
22968 Links 5. ExtLinks: No escapes needed
22969 !! options
22970 parsoid=html2wt
22971 !! html/parsoid
22972 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22973 !! wikitext
22974 [http://google.com [google]
22975 !! html/php
22976 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22977 </p>
22978 !! end
22979
22980 !! test
22981 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22982 !! options
22983 parsoid=html2wt
22984 !! html/parsoid
22985 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;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" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22995 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22996 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22997 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22998 </p>
22999 !! wikitext
23000 x<nowiki/>http://example.com<nowiki/>y
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<nowiki/>!x
23010 http://example.com<nowiki/>=x
23011 http://example.com<nowiki/>(x)
23012 http://example.com(x<nowiki/>)
23013 !! end
23014
23015 !! test
23016 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23017 !! options
23018 parsoid=html2wt
23019 !! html/parsoid
23020 <p>x
23021 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23022 y
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>)
23025 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23026 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23027 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23028 </p>
23029 !! wikitext
23030 x
23031 http://example.com
23032 y
23033 "http://example.com"
23034 (http://example.com)
23035 (http://example.com) foo
23036 http://example.com,
23037 http://example.com, foo
23038 !! html/php
23039 <p>x
23040 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23041 y
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>)
23044 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23045 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23046 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23047 </p>
23048 !! end
23049
23050 !! test
23051 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23052 !! options
23053 parsoid=html2wt
23054 !! html/parsoid
23055 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23056 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23057 !! wikitext
23058 http://example.com.,;:!?\
23059 -http://example.com:
23060 !! html/php
23061 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23062 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23063 </p>
23064 !! end
23065
23066 !! test
23067 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23068 !! options
23069 parsoid=html2wt
23070 !! html/parsoid
23071 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23072 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23073 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23074 !! wikitext
23075 RFC 123<nowiki/>4
23076 RFC 123<nowiki/>y
23077 X<nowiki/>RFC 123<nowiki/>y
23078 !! end
23079
23080 !! test
23081 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23082 !! options
23083 parsoid=html2wt
23084 !! html/parsoid
23085 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23086 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23087 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23088 </p>
23089 !! wikitext
23090 RFC 123?foo
23091 RFC 123&foo
23092 -RFC 123-
23093 !! html/php
23094 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23095 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23096 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23097 </p>
23098 !! end
23099
23100 !! test
23101 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23102 !! options
23103 parsoid=html2wt
23104 !! html/parsoid
23105 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23106 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23107 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23108 !! wikitext
23109 PMID 123<nowiki/>4
23110 PMID 123<nowiki/>y
23111 X<nowiki/>PMID 123<nowiki/>y
23112 !! end
23113
23114 !! test
23115 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23116 !! options
23117 parsoid=html2wt
23118 !! html/parsoid
23119 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23120 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23121 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23122 </p>
23123 !! wikitext
23124 PMID 123?foo
23125 PMID 123&foo
23126 -PMID 123-
23127 !! html/php
23128 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23129 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23130 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23131 </p>
23132 !! end
23133
23134 !! test
23135 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23136 !! options
23137 parsoid=html2wt
23138 !! html/parsoid
23139 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23140 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23141 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23142 </p>
23143 !! wikitext
23144 ISBN 1234567890<nowiki/>1
23145 ISBN 1234567890<nowiki/>x
23146 a<nowiki/>ISBN 1234567890<nowiki/>b
23147 !! end
23148
23149 !! test
23150 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23151 !! options
23152 parsoid=html2wt
23153 !! html/parsoid
23154 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23155 !! wikitext
23156 -ISBN 1234567890's
23157 !! html/php
23158 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23159 </p>
23160 !! end
23161
23162 !! test
23163 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23164 !! options
23165 parsoid=html2wt
23166 !! html/*
23167 <p>this is not a link: http://example.com
23168 </p>
23169 !! wikitext
23170 <nowiki>this is not a link: http://example.com</nowiki>
23171 !! end
23172
23173 !! test
23174 Links 15. Link trails can't become link prefixes.
23175 !! options
23176 language=is
23177 parsoid=html2wt
23178 !! html/parsoid
23179 <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>
23180 !! wikitext
23181 [[Söfnuður]]-[[00]]
23182 !! html/php
23183 <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>
23184 </p>
23185 !! end
23186
23187 #### --------------- Quotes ---------------
23188 #### 1. Quotes inside <b> and <i>
23189 #### 2. Link fragments separated by <i> and <b> tags
23190 #### 3. Link fragments inside <i> and <b>
23191 #### 4. No escaping needed
23192 #### --------------------------------------
23193 !! test
23194 1a. Quotes inside <b> and <i>
23195 !! options
23196 parsoid=html2wt
23197 !! html/*
23198 <p><i>'foo'</i>
23199 <i>''foo''</i>
23200 <i>'''foo'''</i>
23201 <i>foo</i>'s
23202 <b>'foo'</b>
23203 <b>''foo''</b>
23204 <b>'''foo'''</b>
23205 <b>foo'<i>bar'</i>baz</b>
23206 <b>foo</b>'s
23207 '<i>foo</i>
23208 <i>foo</i>'
23209 <i>foo'</i>'
23210 '<i>foo</i>'
23211 '<b>foo</b>
23212 <b>foo</b>'
23213 '<b>foo</b>'
23214 <i>fools'<span> errand</span></i>
23215 <i><span>fool</span>'s errand</i>
23216 '<i>foo</i> bar '<i>baz</i>
23217 a|!*#-:;+-~[]{}b'<i>x</i>
23218 </p>
23219 !! wikitext
23220 ''<nowiki/>'foo'''
23221 ''<nowiki>''foo''</nowiki>''
23222 ''<nowiki>'''foo'''</nowiki>''
23223 ''foo''<nowiki/>'s
23224 '''<nowiki/>'foo''''
23225 '''<nowiki>''foo''</nowiki>'''
23226 '''<nowiki>'''foo'''</nowiki>'''
23227 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23228 '''foo'''<nowiki/>'s
23229 '''foo''
23230 ''foo''<nowiki/>'
23231 ''foo'''<nowiki/>'
23232 '''foo''<nowiki/>'
23233 ''''foo'''
23234 '''foo'''<nowiki/>'
23235 ''''foo'''<nowiki/>'
23236 ''fools'<span> errand</span>''
23237 ''<span>fool</span>'s errand''
23238 '<nowiki/>''foo'' bar '''baz''
23239 a|!*#-:;+-~[]{}b'''x''
23240 !! end
23241
23242 !! test
23243 1b. Quotes inside <b> and <i> with other tags on same line
23244 !! options
23245 parsoid=html2wt
23246 !! html/parsoid
23247 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23248 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23249 <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>
23250 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23251 '<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>
23252 '<i>foo</i> <div title="name">test</div>
23253 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23254 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23255 <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>
23256 </ol>
23257 !! wikitext
23258 '''a'' foo ''[[bar]]''
23259 ''a''' foo ''[[bar]]''
23260 ''a''' foo '''{{echo|[[bar]]}}'''
23261 [[foo]] x'''[[bar]]''
23262 '''foo'' <ref>test</ref>
23263 '''foo'' <div title="name">test</div>
23264 '''foo'' and <br> bar
23265 <references />
23266 !! end
23267
23268 !! test
23269 2. Link fragments separated by <i> and <b> tags
23270 !! options
23271 parsoid=html2wt
23272 !! html/parsoid
23273 <p>[[<i>foo</i>hello]]</p>
23274 <p>[[<b>foo</b>hello]]</p>
23275 !! wikitext
23276 [[''foo''<nowiki>hello]]</nowiki>
23277
23278 [['''foo'''<nowiki>hello]]</nowiki>
23279 !! end
23280
23281 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23282 # this is one of the shortcomings of this format
23283 !! test
23284 3. Link fragments inside <i> and <b>
23285 !! options
23286 parsoid=html2wt
23287 !! html/parsoid
23288 <p><i>[[foo</i>]]</p>
23289 <p><b>[[foo</b>]]</p>
23290 !! wikitext
23291 ''[[foo''<nowiki>]]</nowiki>
23292
23293 '''[[foo'''<nowiki>]]</nowiki>
23294 !! end
23295
23296 !! test
23297 4. No escaping needed
23298 !! options
23299 options=html2wt
23300 !! html/parsoid
23301 <p>'<span><i>bar</i></span>'
23302 '<span><b>bar</b></span>'
23303 'a:b'foo
23304 </p>
23305 !! wikitext
23306 '<span>''bar''</span>'
23307 '<span>'''bar'''</span>'
23308 'a:b'foo
23309 !! end
23310
23311 #### ----------- Paragraphs ---------------
23312 #### 1. No unnecessary escapes
23313 #### --------------------------------------
23314
23315 !! test
23316 1. No unnecessary escapes
23317 !! options
23318 parsoid=html2wt
23319 !! html/parsoid
23320 <p>bar <span>[[foo]]</span>
23321 </p><p>=bar <span>[[foo]]</span>
23322 </p><p>[[bar <span>[[foo]]</span>
23323 </p><p>]]bar <span>[[foo]]</span>
23324 </p><p>=bar <span>foo]]</span>=
23325 </p>
23326 !! wikitext
23327 bar <span><nowiki>[[foo]]</nowiki></span>
23328
23329 =bar <span><nowiki>[[foo]]</nowiki></span>
23330
23331 [[bar <span><nowiki>[[foo]]</nowiki></span>
23332
23333 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23334
23335 =bar <span>foo]]</span><nowiki>=</nowiki>
23336 !!end
23337
23338 #### ----------------------- PRE --------------------------
23339 #### 1. Leading whitespace in SOL context should be escaped
23340 #### ------------------------------------------------------
23341 !! test
23342 1. Leading whitespace in SOL context should be escaped
23343 !! options
23344 parsoid=html2wt
23345 !! html/parsoid
23346 <p> a</p>
23347
23348 <p> a</p>
23349
23350 <p> a(tab)</p>
23351
23352 <p> a
23353 <!--cmt-->
23354 a</p>
23355
23356 <p>a
23357 b</p>
23358
23359 <p>a
23360 b</p>
23361
23362 <p>a
23363 b</p>
23364 !! wikitext
23365 <nowiki> </nowiki>a
23366
23367 <nowiki> </nowiki> a
23368
23369 a(tab)
23370
23371 <nowiki> </nowiki> a
23372 <!--cmt-->
23373 <nowiki> </nowiki>a
23374
23375 a
23376 <nowiki> </nowiki>b
23377
23378 a
23379 b
23380
23381 a
23382 b
23383 !! html/php
23384 <p> a
23385 </p><p> a
23386 </p><p> a(tab)
23387 </p><p> a
23388 a
23389 </p><p>a
23390 b
23391 </p><p>a
23392 b
23393 </p><p>a
23394 b
23395 </p>
23396 !! end
23397
23398 !! test
23399 2. Leading whitespace in non-indent-pre contexts should not be escaped
23400 !! options
23401 parsoid=htm2wt
23402 !! html/parsoid
23403 <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>
23404 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23405 <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>
23406 b</span></li>
23407 </ol>
23408 !! wikitext
23409 foo <ref>''a''
23410 b</ref>
23411 <references />
23412 !! end
23413
23414 !! test
23415 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23416 !! options
23417 parsoid=html2wt
23418 !! html/parsoid
23419 <blockquote>
23420 <p>
23421 a
23422 <span>b</span>
23423 c</p>
23424 </blockquote>
23425 !! wikitext
23426 <blockquote>
23427 a
23428 <span>b</span>
23429 c
23430 </blockquote>
23431 !! end
23432
23433 !! test
23434 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23435 !! options
23436 options=html2wt
23437 !! html/parsoid
23438 <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>
23439 !! wikitext
23440 [[File:Foobar.jpg|thumb|caption]]
23441 !! end
23442
23443 !! test
23444 5. Nowiki escaping should account for indent-pres
23445 !! options
23446 parsoid=html2wt
23447 !! html/parsoid
23448 <pre>==foo==</pre>
23449 !! wikitext
23450 ==foo==
23451 !! end
23452
23453 !!test
23454 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23455 !! options
23456 parsoid=html2wt
23457 !! html/parsoid
23458 <pre>
23459 * foo
23460 * bar
23461 </pre>
23462 !! wikitext
23463 * foo
23464 * bar
23465 !! end
23466
23467 #### --------------- Behavior Switches --------------------
23468
23469 !! test
23470 1. Valid behavior switches should be escaped
23471 !! options
23472 parsoid=html2wt
23473 !! html/parsoid
23474 __TOC__
23475 <i>__TOC__</i>
23476 !! wikitext
23477 <nowiki>__TOC__</nowiki>
23478 ''<nowiki>__TOC__</nowiki>''
23479 !! end
23480
23481 !! test
23482 2. Invalid behavior switches should not be escaped
23483 !! options
23484 parsoid=html2wt
23485 !! html/parsoid
23486 __TOO__
23487 __|__
23488 !! wikitext
23489 __TOO__
23490 __|__
23491 !! end
23492
23493 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23494 !! test
23495 Behavior switches should be SOL-transparent
23496 !! options
23497 parsoid=html2wt
23498 !! html/parsoid
23499 <meta property="mw:PageProp/toc" />
23500
23501 <!-- this one's bogus -->
23502 <pre>__TOO__</pre>
23503
23504 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23505
23506 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23507 !! wikitext
23508 __TOC__
23509
23510 <!-- this one's bogus -->
23511 __TOO__
23512
23513 __TOC__ foo
23514
23515 __TOC__ bar
23516 !! end
23517
23518 #### --------------- HTML tags ---------------
23519 #### 1. a tags
23520 #### 2. other tags
23521 #### 3. multi-line html tag
23522 #### 4. extension tags
23523 #### -----------------------------------------
23524 !! test
23525 1. a tags
23526 !! options
23527 parsoid=html2wt
23528 !! html/parsoid
23529 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23530 !! wikitext
23531 <a href="http://google.com">google</a>
23532 !! end
23533
23534 !! test
23535 2. other tags
23536 !! options
23537 parsoid=html2wt
23538 !! html/parsoid
23539 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23540 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23541 <li> &lt;td&gt;</li></ul>
23542
23543 !! wikitext
23544 * <nowiki><div>foo</div></nowiki>
23545 * <nowiki><div style="color:red">foo</div></nowiki>
23546 * <nowiki><td></nowiki>
23547 !! end
23548
23549 !! test
23550 3. multi-line html tag
23551 !! options
23552 parsoid=html2wt
23553 !! html/parsoid
23554 <p>&lt;div
23555 &gt;foo&lt;/div
23556 &gt;
23557 </p>
23558 !! wikitext
23559 <nowiki><div
23560 >foo</div
23561 ></nowiki>
23562 !! end
23563
23564 !! test
23565 4. extension tags
23566 !! options
23567 parsoid=html2wt
23568 !! html/parsoid
23569 <p>&lt;ref&gt;foo&lt;/ref&gt;
23570 </p><p>&lt;ref&gt;bar
23571 </p><p>baz&lt;/ref&gt;
23572 </p>
23573 !! wikitext
23574 <nowiki><ref>foo</ref></nowiki>
23575
23576 <nowiki><ref>bar</nowiki>
23577
23578 baz<nowiki></ref></nowiki>
23579 !! end
23580
23581 #### --------------- Others ---------------
23582 !! test
23583 Escaping nowikis
23584 !! options
23585 parsoid=html2wt
23586 !! html/parsoid
23587 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23588 </p>
23589 !! wikitext
23590 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23591 !! end
23592
23593 ## The quote-char in the input is necessary for triggering the bug
23594 !! test
23595 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23596 !! options
23597 parsoid=html2wt
23598 !! html/parsoid
23599 <p>foo's bar :</p>
23600 !! wikitext
23601 foo's bar :
23602 !! end
23603
23604 #----------- End of wikitext escaping tests --------------
23605
23606 !! test
23607
23608 Tag-like HTML structures are passed through as text
23609 !! wikitext
23610 <x y>
23611
23612 <x.y>
23613
23614 <x-y>
23615
23616 1>2
23617
23618 x<y
23619
23620 a>b
23621
23622 1<d e>f
23623 !! html
23624 <p>&lt;x y&gt;
23625 </p><p>&lt;x.y&gt;
23626 </p><p>&lt;x-y&gt;
23627 </p><p>1&gt;2
23628 </p><p>x&lt;y
23629 </p><p>a&gt;b
23630 </p><p>1&lt;d e&gt;f
23631 </p>
23632 !! end
23633
23634 !! test
23635 HTML tag with necessary entities in attributes
23636 !! wikitext
23637 <span title="&amp;amp;">foo</span>
23638 !! html
23639 <p><span title="&amp;amp;">foo</span>
23640 </p>
23641 !! end
23642
23643 !! test
23644 HTML tag with 'unnecessary' entity encoding in attributes
23645 !! wikitext
23646 <span title="&amp;">foo</span>
23647 !! html
23648 <p><span title="&amp;">foo</span>
23649 </p>
23650 !! end
23651
23652 !! test
23653 HTML tag with broken attribute value quoting
23654 !! wikitext
23655 <span title="Hello world>Foo</span>
23656 !! html/php
23657 <p><span title="Hello world">Foo</span>
23658 </p>
23659 !! html/parsoid
23660 <p><span title="Hello world">Foo</span>
23661 </p>
23662 !! end
23663
23664 !! test
23665 Table with broken attribute value quoting
23666 !! wikitext
23667 {|
23668 | title="Hello world|Foo
23669 |}
23670 !! html/php
23671 <table>
23672 <tr>
23673 <td title="Hello world">Foo
23674 </td></tr></table>
23675
23676 !! html/parsoid
23677 <table>
23678 <tr>
23679 <td title="Hello world">Foo
23680 </td></tr></table>
23681
23682 !! end
23683
23684 !! test
23685 Table with broken attribute value quoting on consecutive lines
23686 !! wikitext
23687 {|
23688 | title="Hello world|Foo
23689 | style="color:red|Bar
23690 |}
23691 !! html/php
23692 <table>
23693 <tr>
23694 <td title="Hello world">Foo
23695 </td>
23696 <td style="color:red">Bar
23697 </td></tr></table>
23698
23699 !! html/parsoid
23700 <table><tbody>
23701 <tr>
23702 <td title="Hello world">Foo
23703 </td><td style="color: red">Bar
23704 </td></tr></tbody></table>
23705
23706 !! end
23707
23708 !! test
23709 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23710 !! options
23711 parsoid
23712 !! wikitext
23713 {{}}
23714 !! html
23715 {{}}
23716 !! end
23717
23718 !! test
23719 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23720 !! options
23721 parsoid
23722 !! wikitext
23723 }}{{
23724 !! html
23725 }}{{
23726 !! end
23727
23728 !!test
23729 Accept empty td cell attribute
23730 !! wikitext
23731 {|
23732 | align="center" | foo || |
23733 |}
23734 !! html
23735 <table>
23736 <tr>
23737 <td align="center"> foo </td>
23738 <td>
23739 </td></tr></table>
23740
23741 !!end
23742
23743 !!test
23744 Non-empty attributes in th-cells
23745 !! wikitext
23746 {|
23747 ! Foo !! style="color: red" | Bar
23748 |}
23749 !! html
23750 <table>
23751 <tr>
23752 <th> Foo </th>
23753 <th style="color: red"> Bar
23754 </th></tr></table>
23755
23756 !!end
23757
23758 !!test
23759 Accept empty attributes in th-cells
23760 !! wikitext
23761 {|
23762 !| foo !!| bar
23763 |}
23764 !! html
23765 <table>
23766 <tr>
23767 <th> foo </th>
23768 <th> bar
23769 </th></tr></table>
23770
23771 !!end
23772
23773 !!test
23774 Empty table rows go away
23775 !! wikitext
23776 {|
23777 | Hello
23778 | there
23779 |- class="foo"
23780 |-
23781 |}
23782 !! html
23783 <table>
23784 <tr>
23785 <td> Hello
23786 </td>
23787 <td> there
23788 </td></tr>
23789
23790 </table>
23791
23792 !! end
23793
23794 ###
23795 ### Parsoid-centric tests for testing RTing of inter-element separators
23796 ### Edge cases not tested by existing parser tests and specific to
23797 ### Parsoid-specific serialization strategies.
23798 ###
23799
23800 !!test
23801 RT-ed inter-element separators should be valid separators
23802 !! wikitext
23803 {|
23804 |- [[foo]]
23805 |}
23806 !! html/php
23807 <table>
23808
23809 </table>
23810
23811 !! html/parsoid
23812 <table>
23813 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
23814 </tbody></table>
23815 !!end
23816
23817 # Parsoid-only since PHP parser relies on Tidy for correct output
23818 !!test
23819 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23820 !!options
23821 parsoid
23822 !! wikitext
23823 {|
23824 |<small>foo
23825 bar
23826 |}
23827
23828 {|
23829 |<small>foo<small>
23830 |}
23831 !! html
23832 <table>
23833 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23834 <p>bar</p></small></td></tr>
23835 </tbody></table>
23836
23837 <table>
23838 <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>
23839 </tbody></table>
23840 !!end
23841
23842 # Note that the "style" attribute is really a template parameter here.
23843 # The = would have to be {{=}} if you wanted the literal.
23844 !!test
23845 Empty TD followed by TD with tpl-generated attribute
23846 !! wikitext
23847 {|
23848 |-
23849 |
23850 |{{echo|style='color:red'}}|foo
23851 |}
23852 !! html
23853 <table>
23854
23855 <tr>
23856 <td>
23857 </td>
23858 <td>foo
23859 </td></tr></table>
23860
23861 !!end
23862
23863 !!test
23864 Indented table with an empty td
23865 !! wikitext
23866 {|
23867 |-
23868 |
23869 |foo
23870 |}
23871 !! html
23872 <table>
23873
23874 <tr>
23875 <td>
23876 </td>
23877 <td>foo
23878 </td></tr></table>
23879
23880 !!end
23881
23882 ## We have some newline diffs RT-ing this edge case
23883 ## and it is not important enough -- we seem to be emitting
23884 ## at most 2 newlines after a </tr> and this is unrelated to
23885 ## the issue from T85627 that this is testing.
23886 !!test
23887 Indented table with blank lines in between (T85627)
23888 !! options
23889 parsoid=wt2html
23890 !! wikitext
23891 {|
23892 |foo
23893
23894
23895 |}
23896 !! html
23897 <table>
23898
23899 <tr>
23900 <td>foo
23901 </td></tr></table>
23902
23903 !!end
23904
23905 !!test
23906 Indented block & table
23907 !! wikitext
23908 <div>foo</div>
23909 {|
23910 |foo
23911 |}
23912 !! html/php
23913 <div>foo</div>
23914 <table>
23915 <tr>
23916 <td>foo
23917 </td></tr></table>
23918
23919 !! html/parsoid
23920 <div data-parsoid='{"stx":"html"}'>foo</div>
23921 <table><tbody>
23922 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23923 </tbody></table>
23924 !!end
23925
23926 !! test
23927 Indent and comment before table row
23928 !! wikitext
23929 {|
23930 <!--hi-->|-
23931 | there
23932 |}
23933 !! html/php
23934 <table>
23935
23936 <tr>
23937 <td> there
23938 </td></tr></table>
23939
23940 !! html/parsoid
23941 <table>
23942 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23943 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23944 </tbody></table>
23945 !! end
23946
23947 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23948 !!test
23949 Empty TR followed by a template-generated TR
23950 !!options
23951 parsoid
23952 !! wikitext
23953 {|
23954 |-
23955 {{echo|<tr><td>foo</td></tr>}}
23956 |}
23957 !! html
23958 <table>
23959 <tbody>
23960 <tr></tr>
23961 <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}}]}'>
23962 <td>foo</td></tr>
23963 </tbody></table>
23964 !!end
23965
23966 ## PHP and parsoid output differ for this, and since this is primarily
23967 ## for testing Parsoid's serializer, marking this Parsoid only
23968 !!test
23969 Empty TR followed by mixed-ws-comment line should RT correctly
23970 !!options
23971 parsoid
23972 !! wikitext
23973 {|
23974 |-
23975 <!--c-->
23976 |-
23977 <!--c--> <!--d-->
23978 |}
23979 !! html
23980 <table>
23981 <tbody>
23982 <tr></tr>
23983 <!--c-->
23984 <tr>
23985 <!--c--> </tr><!--d-->
23986 </tbody></table>
23987
23988 !!end
23989
23990 !!test
23991 Multi-line image caption generated by templates with/without trailing newlines
23992 !! wikitext
23993 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23994 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23995 !! html/parsoid
23996 <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>
23997 <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>
23998 !!end
23999
24000 !! test
24001 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24002 !! options
24003 parsoid=html2wt
24004 !! html/parsoid
24005 <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>
24006
24007 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24008 !! wikitext
24009 <includeonly>foo</includeonly>
24010 new para
24011
24012 [[Category:Foo]]
24013
24014 = new heading =
24015 !! end
24016
24017 ## PHP emits broken html for this, and since this is primarily
24018 ## a Parsoid serializer test, marking this Parsoid only
24019 !!test
24020 Improperly nested inline or quotes tags with whitespace in between
24021 !! wikitext
24022 <span> <s>x</span> </s>
24023 ''' ''x''' ''
24024 !! html/parsoid
24025 <p><span> <s>x</s></span><s> </s>
24026 <b> <i>x</i></b><i> </i>
24027 </p>
24028 !!end
24029
24030 !!test
24031 Encapsulate protected attributes from wt
24032 !! wikitext
24033 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24034 !! html/parsoid
24035 <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>
24036 </body>
24037 !!end
24038
24039 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24040 ## Having nested or stray pre tags results in the attempt to add duplicates,
24041 ## causing an assertion fail. This test tries to prevent that situation.
24042 !!test
24043 Ensure ParagraphWrapper can deal with stray closing pre tags
24044 !!options
24045 parsoid=wt2html
24046 !! wikitext
24047 plain text</pre>
24048 !! html/parsoid
24049 plain text
24050 !!end
24051
24052 !!test
24053 1. Ensure fostered text content is wrapped in element nodes
24054 !!options
24055 parsoid=wt2html
24056 !! wikitext
24057 <table>hi</table><table>ho</table>
24058 !! html/parsoid
24059 <p>hi</p>
24060 <table></table>
24061 <p>ho</p>
24062 <table></table>
24063 !!end
24064
24065 !!test
24066 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24067 !!options
24068 parsoid=wt2html,wt2wt
24069 !! wikitext
24070 <table>
24071 <tr> || ||
24072 <td> a
24073 </table>
24074 !! html/parsoid
24075 <p> || ||
24076 </p><table>
24077 <tbody><tr><td> a</td></tr>
24078 </tbody></table>
24079 !!end
24080
24081 !!test
24082 Encapsulation properly handles null DSR information from foster box
24083 !!options
24084 parsoid=wt2html,wt2wt
24085 !! wikitext
24086 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24087 !! html/parsoid
24088 <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>
24089 !!end
24090
24091 !!test
24092 1. Encapsulate foster-parented transclusion content
24093 !!options
24094 parsoid=wt2wt,wt2html
24095 !! wikitext
24096 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24097 !! html/parsoid
24098 <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>
24099 <tbody>
24100 <tr>
24101 <td>bar</td>
24102 </tr>
24103 </tbody>
24104 </table>
24105 !!end
24106
24107 !!test
24108 2. Encapsulate foster-parented transclusion content
24109 !!options
24110 parsoid=wt2wt,wt2html
24111 !! wikitext
24112 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24113 !! html/parsoid
24114 <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>
24115 <table>
24116 <tbody>
24117 <tr>
24118 <td>bar</td>
24119 </tr>
24120 </tbody>
24121 </table>
24122 !!end
24123
24124 !!test
24125 3. Encapsulate foster-parented transclusion content
24126 !!options
24127 parsoid=wt2wt,wt2html
24128 !! wikitext
24129 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24130 !! html/parsoid
24131 <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;]}">
24132 <p>foo</p>
24133 </div>
24134 <table>
24135 <tbody>
24136 <tr>
24137 <td>bar</td>
24138 </tr>
24139 </tbody>
24140 </table>
24141 !!end
24142
24143 !!test
24144 4. Encapsulate foster-parented transclusion content
24145 !!options
24146 parsoid=wt2wt,wt2html
24147 !! wikitext
24148 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24149 !! html/parsoid
24150 <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;]}">
24151 <p>foo</p>
24152 </div>
24153 <table>
24154 <tbody>
24155 <tr>
24156 <td>bar</td>
24157 </tr>
24158 </tbody>
24159 </table>
24160 !!end
24161
24162 !!test
24163 5. Encapsulate foster-parented transclusion content
24164 !!options
24165 parsoid=wt2wt,wt2html
24166 !! wikitext
24167 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24168 !! html/parsoid
24169 <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>
24170 <table>
24171 <tbody>
24172 <tr>
24173 <td>
24174 <div>
24175 <p>foo</p>
24176 </div>
24177 </td>
24178 </tr>
24179 </tbody>
24180 </table>
24181 !!end
24182
24183 !!test
24184 6. Encapsulate foster-parented transclusion content
24185 !!options
24186 parsoid=wt2wt,wt2html
24187 !! wikitext
24188 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24189 !! html/parsoid
24190 <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>
24191 <table>
24192 <tbody>
24193 <tr>
24194 <td>
24195 <div>
24196 <p>foo</p>
24197 </div>
24198 </td>
24199 </tr>
24200 </tbody>
24201 </table>
24202 <p>ok</p>
24203 !!end
24204
24205 !!test
24206 7. Encapsulate foster-parented transclusion content
24207 !!options
24208 parsoid=wt2wt,wt2html
24209 !! wikitext
24210 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24211 !! html/parsoid
24212 <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>
24213 <table>
24214 <tbody>
24215 <tr>
24216 <td>bar</td>
24217 </tr>
24218 </tbody>
24219 </table>
24220 !!end
24221
24222 # Note that the wt is broken on purpose: the = should be {{=}} if you
24223 # don't want it to be a template parameter key.
24224 !!test
24225 8. Encapsulate foster-parented transclusion content
24226 !!options
24227 parsoid=wt2wt,wt2html
24228 !! wikitext
24229 {{echo|a
24230 }}{|{{echo|style='color:red'}}
24231 |-
24232 |b
24233 |}
24234 !! html/parsoid
24235 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24236 <span> </span>
24237 <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>
24238 <table>
24239 <tbody>
24240 <tr>
24241 <td>b</td>
24242 </tr>
24243 </tbody>
24244 </table>
24245 !!end
24246
24247 !!test
24248 9. Encapsulate foster-parented transclusion content
24249 !!options
24250 parsoid=wt2wt,wt2html
24251 !! wikitext
24252 <table>{{echo|hi</table>hello}}
24253 !! html/parsoid
24254 <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>
24255 !!end
24256
24257 !!test
24258 Table in fosterable position
24259 !!options
24260 parsoid=wt2html,wt2wt
24261 !! wikitext
24262 {{OpenTable}}
24263 <div>
24264 {|
24265 |}
24266 </div>
24267 |}
24268 !! html/parsoid
24269 <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">
24270 </span>
24271 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24272
24273 <table>
24274 </table>
24275 !!end
24276
24277 # Parsoid only for bug 64747
24278 !! test
24279 Properly encapsulate empty-content transclusions in fosterable positions
24280 !! wikitext
24281 <table>
24282 {{#if:|
24283 <td>foo</td>
24284 }}
24285 </table>
24286 !! html/parsoid
24287 <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":["","","",""]}]]}'>
24288
24289 </table>
24290 !! end
24291
24292 !!test
24293 Support <object> element with .data attribute
24294 !!options
24295 parsoid=html2wt
24296 !! html/parsoid
24297 <object data="test.swf"></object>
24298 !! wikitext
24299 <object data="test.swf"></object>
24300 !!end
24301
24302 !! test
24303 Don't block XML namespace declaration
24304 !! wikitext
24305 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24306 !! html/php
24307 <p><span>MediaWiki</span>
24308 </p>
24309 !! html/parsoid
24310 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24311 !! end
24312
24313 # -----------------------------------------------------------------
24314 # The following section of tests are primarily to spec requirements
24315 # around serialization of new/edited content.
24316 #
24317 # All these tests are marked Parsoid html2wt and html2html only
24318 # ----------------------------------------------------------------
24319
24320 # 'mi' is a localinterwiki prefix as well as a language
24321 !! test
24322 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24323 !! options
24324 parsoid=html2wt
24325 !! html/parsoid
24326 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24327 !! wikitext
24328 [[Foo]]
24329 !! end
24330
24331 # See T93839
24332 !! test
24333 New wikilinks should be serialized properly
24334 !! options
24335 parsoid=html2wt
24336 !! html/parsoid
24337 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24338 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24339 !! wikitext
24340 [[Foo]]
24341 [[Foo]]
24342 !! end
24343
24344 !! test
24345 New wiki links (href variations)
24346 !! options
24347 parsoid=html2wt
24348 !! html/parsoid
24349 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24350 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24351 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24352 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24353 !! wikitext
24354 [[Foo_bar]]
24355 [[Foo_bar]]
24356 [[Foo_bar]]
24357 [[Toxine bactérienne]]
24358 !! end
24359
24360 !! test
24361 New wiki links (content string variations)
24362 !! options
24363 parsoid=html2wt
24364 !! html/parsoid
24365 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24366 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24367 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24368 !! wikitext
24369 [[Foo_bar]]
24370 [[Foo bar]]
24371 [[Foo_bar|./Foo_bar]]
24372 !! end
24373
24374 !! test
24375 New category links (href variations)
24376 !! options
24377 parsoid=html2wt
24378 !! html/parsoid
24379 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24380 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24381 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24382 !! wikitext
24383 [[Category:Toxine bactérienne]]
24384 [[Category:Toxine bactérienne]]
24385 [[Category:Toxine bactérienne]]
24386 !! end
24387
24388 !! test
24389 New sol transparent links don't need indent-pre nowiki protection
24390 !! options
24391 parsoid=html2wt
24392 language=de
24393 !! html/parsoid
24394 <link rel="mw:PageProp/redirect" href="./Main_Page">
24395 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24396 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24397 !! wikitext
24398 #WEITERLEITUNG [[Main Page]]
24399 <!-- this is good --> [[Category:Good]]
24400 <!-- this is great --> [[Kategorie:Great]]
24401 !! end
24402
24403 !! test
24404 New interlanguage links (href variations)
24405 !! options
24406 parsoid=html2wt
24407 !! html/parsoid
24408 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24409 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24410 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24411 !! wikitext
24412 [[es:Toxine bactérienne]]
24413 [[es:Toxine_bactérienne]]
24414 [[es:Toxine_bactérienne]]
24415 !! end
24416
24417 !! test
24418 Image: Modifying size of an image (1)
24419 !! options
24420 parsoid={
24421 "modes": ["wt2wt"],
24422 "changes": [
24423 ["img[height]", "attr", "height", "22"],
24424 ["img[width]", "attr", "width", "200"]
24425 ]
24426 }
24427 !! wikitext
24428 [[Image:Foobar.jpg|230x230px]]
24429 !! wikitext/edited
24430 [[Image:Foobar.jpg|200x200px]]
24431 !!end
24432
24433 !! test
24434 Image: Modifying size of an image (2)
24435 !! options
24436 parsoid={
24437 "modes": ["wt2wt"],
24438 "changes": [
24439 ["img[height]", "attr", "height", "100"],
24440 ["img[width]", "attr", "width", "500"]
24441 ]
24442 }
24443 !! wikitext
24444 [[Image:Foobar.jpg|230x230px]]
24445 !! wikitext/edited
24446 [[Image:Foobar.jpg|500x500px]]
24447 !!end
24448
24449 # Change in size is ignored so long as class='mw-default-size'
24450 !! test
24451 Image: Modifying size of an image (3)
24452 !! options
24453 parsoid={
24454 "modes": ["wt2wt"],
24455 "changes": [
24456 ["figure[class]", "removeClass", "mw-default-size"],
24457 ["figure img", "attr", "height", "19"],
24458 ["figure img", "attr", "width", "170"]
24459 ]
24460 }
24461 !! wikitext
24462 [[Image:Foobar.jpg|thumb]]
24463 !! wikitext/edited
24464 [[Image:Foobar.jpg|thumb|170x170px]]
24465 !!end
24466
24467 !! test
24468 Image: Modifying alignment of an image (bug 48665)
24469 !! options
24470 parsoid={
24471 "modes": ["wt2wt"],
24472 "changes": [
24473 ["figure[class]", "removeClass", "mw-halign-right"],
24474 ["figure[class]", "addClass", "mw-halign-left"]
24475 ]
24476 }
24477 !! wikitext
24478 [[Image:Foobar.jpg|thumb|caption|right]]
24479 !! wikitext/edited
24480 [[Image:Foobar.jpg|thumb|caption|left]]
24481 !! end
24482
24483 !! test
24484 Image: Modifying mw-default-size of an frameless image (bug 62805)
24485 !! options
24486 parsoid={
24487 "modes": ["wt2wt"],
24488 "changes": [
24489 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24490 ]
24491 }
24492 !! wikitext
24493 [[Image:Foobar.jpg|frameless|right]]
24494 !! wikitext/edited
24495 [[Image:Foobar.jpg|frameless|right|220x220px]]
24496 !! end
24497
24498 !! test
24499 Image: Modifying valign of an image (bug 49221)
24500 !! options
24501 parsoid={
24502 "modes": ["wt2wt"],
24503 "changes": [
24504 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24505 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24506 ]
24507 }
24508 !! wikitext
24509 [[File:Foobar.jpg|20px|middle]]
24510 !! wikitext/edited
24511 [[File:Foobar.jpg|20px|text-top]]
24512 !! end
24513
24514 !! test
24515 Image: Modifying alt attribute of an image (bug 56400)
24516 !! options
24517 parsoid={
24518 "modes": ["wt2wt"],
24519 "changes": [
24520 ["img[alt]", "attr", "alt", "some alternate edited text"]
24521 ]
24522 }
24523 !! wikitext
24524 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24525 !! wikitext/edited
24526 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24527 !!end
24528
24529 !! test
24530 Image: Modifying caption of an image
24531 !! options
24532 parsoid={
24533 "modes": ["wt2wt"],
24534 "changes": [
24535 ["figcaption", "text", "new caption"]
24536 ]
24537 }
24538 !! wikitext
24539 [[Image:Foobar.jpg|thumb|original caption]]
24540 !! wikitext/edited
24541 [[Image:Foobar.jpg|thumb|new caption]]
24542 !!end
24543
24544 !! test
24545 Image: empty alt attribute (bug 48924)
24546 !! options
24547 parsoid
24548 !! wikitext
24549 [[File:Foobar.jpg|thumb|alt=|bar]]
24550 !! html
24551 <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>
24552 !! end
24553
24554 !! test
24555 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24556 !! options
24557 parsoid=html2wt
24558 language=ar
24559 disabled
24560 !! html/parsoid
24561 <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>
24562 !! wikitext
24563 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24564 !! end
24565
24566 !! test
24567 Image: Block level image should have \n before and after
24568 !! wikitext
24569 123
24570 [[File:Foobar.jpg|right|thumb|150x150px]]
24571 456
24572 !! html/parsoid
24573 <p>123</p>
24574 <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>
24575 <p>456</p>
24576 !!end
24577
24578 !! test
24579 Image: New block level image should have \n before and after (existing content)
24580 !! wikitext
24581 123
24582 [[File:Foobar.jpg|right|thumb|150x150px]]
24583 456
24584 !! html/parsoid
24585 <p>123</p>
24586 <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>
24587 <p>456</p>
24588 !!end
24589
24590 !! test
24591 Image: upright option (parsoid)
24592 !! wikitext
24593 [[File:Foobar.jpg|thumb|upright|caption]]
24594 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24595 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24596 !! html/parsoid
24597 <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>
24598 <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>
24599 <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>
24600 !!end
24601
24602 !! test
24603 Image: upright option is ignored on inline and frame images (parsoid)
24604 !! wikitext
24605 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24606 !! html/parsoid
24607 <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>
24608 !!end
24609
24610 !! test
24611 Image: from basic HTML (1)
24612 !! options
24613 parsoid=html2wt
24614 !! html/parsoid
24615 <span typeof="mw:Image">
24616 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24617 </span>
24618 !! wikitext
24619 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24620 !! end
24621
24622 !! test
24623 Image: from basic HTML (2)
24624 !! options
24625 parsoid=html2wt
24626 !! html/parsoid
24627 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24628 !! wikitext
24629 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24630 !! end
24631
24632 !! test
24633 Image: from basic HTML (3)
24634 !! options
24635 parsoid=html2wt
24636 !! html/parsoid
24637 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24638 !! wikitext
24639 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24640 !! end
24641
24642 !! test
24643 Image: from basic HTML (4)
24644 !! options
24645 parsoid=html2wt
24646 !! html/parsoid
24647 <img src="./File:Foobar.jpg">
24648 !! wikitext
24649 [[File:Foobar.jpg|link=]]
24650 !! end
24651
24652 !! test
24653 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24654 !! options
24655 parsoid=html2wt
24656 !! html/parsoid
24657 <ul>
24658 <li><p>foo</p></li>
24659 </ul>
24660 !! wikitext
24661 * foo
24662 !! end
24663
24664 !! test
24665 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24666 !! options
24667 parsoid=html2wt
24668 !! html/parsoid
24669 <ul> <li>foo</li></ul>
24670 !! wikitext
24671 * foo
24672 !! end
24673
24674 !! test
24675 Don't strip leading whitespace when handling indent-pre suppressing tags
24676 !! options
24677 parsoid=html2wt
24678 !! html/parsoid
24679 <table>
24680 <tr><td> indented row</td></tr>
24681 </table>
24682 <blockquote><p>
24683 <b>This is very bold of you!</b>
24684 </p>
24685 <table><tr><td>
24686 indented cell (no pre-wrapping!)
24687 </td></tr></table>
24688 </blockquote>
24689 <p>foo</p>
24690 <div>bar</div>
24691 !! wikitext
24692 {|
24693 | indented row
24694 |}
24695 <blockquote>
24696 '''This is very bold of you!'''
24697
24698 {|
24699 |
24700 indented cell (no pre-wrapping!)
24701 |}
24702 </blockquote>
24703 foo
24704 <div>bar</div>
24705 !! end
24706
24707 !! test
24708 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24709 !! options
24710 parsoid=html2wt
24711 !! html/parsoid
24712 <p>foo</p>
24713 <span>bar</span>
24714
24715 <span>foo2
24716 </span>bar2
24717
24718 <div>foo</div>
24719 <span>bar</span>
24720
24721 <div>
24722 <span>foo</span>
24723 </div>
24724 !! wikitext
24725 foo
24726 <nowiki> </nowiki><span>bar</span>
24727
24728 <span>foo2
24729 <nowiki> </nowiki></span>bar2
24730
24731 <div>foo</div>
24732 <nowiki> </nowiki><span>bar</span>
24733
24734 <div>
24735 <nowiki> </nowiki><span>foo</span>
24736 </div>
24737 !! end
24738
24739 !! test
24740 Lists: Dont insert newlines in a serialized list item.
24741 !! options
24742 parsoid=html2wt
24743 !! html/parsoid
24744 <ul><li>a<br>b</li><li>c</li></ul>
24745 !! wikitext
24746 * a<br>b
24747 * c
24748 !! end
24749
24750 !! test
24751 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24752 !! options
24753 parsoid={
24754 "modes": ["html2wt"],
24755 "scrubWikitext": false
24756 }
24757 !! html/parsoid
24758 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24759 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24760
24761 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24762 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24763
24764 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24765
24766 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24767 !! wikitext
24768 == hello there [[Category:A1]] ==
24769
24770 == [[Category:A2]] hi pal ==
24771
24772 == <!--foo--> [[Category:A3]] how goes it ==
24773
24774 == it goes well [[Category:A4]] <!--bar--> ==
24775
24776 ==howdy [[Category:A5]] ==
24777
24778 == __TOC__ ok ==
24779 !! end
24780
24781 !! test
24782 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24783 !! options
24784 parsoid={
24785 "modes": ["html2wt"],
24786 "scrubWikitext": true
24787 }
24788 !! html/parsoid
24789 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24790 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24791
24792 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24793 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24794
24795 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24796 !! wikitext
24797 == hello there ==
24798 [[Category:A1]]
24799 [[Category:A2]]
24800
24801 == hi pal ==
24802
24803 <!--foo--> [[Category:A3]]
24804
24805 == how goes it ==
24806
24807 == it goes well ==
24808 [[Category:A4]] <!--bar-->
24809
24810 __TOC__
24811
24812 == ok ==
24813 !! end
24814
24815 !! test
24816 Headings: Don't hoist metas that come from templates
24817 !! options
24818 parsoid={
24819 "modes": ["html2wt"],
24820 "scrubWikitext": true
24821 }
24822 !! html/parsoid
24823 <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>
24824 !! wikitext
24825 == {{echo|foo [[Category:Foo]]}} ==
24826 !! end
24827
24828 !! test
24829 Headings: Category in ref isn't hoisted
24830 !! options
24831 parsoid={
24832 "modes": ["html2wt"],
24833 "scrubWikitext": true
24834 }
24835 !! html/parsoid
24836 <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>
24837
24838 <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>
24839 !! wikitext
24840 == foo <ref>bar
24841 [[Category:Baz]] </ref> ==
24842
24843 <references />
24844 !! end
24845
24846 !! test
24847 Parsoid: Serialize positional parameters with = in them as named parameter
24848 !! options
24849 parsoid=html2wt
24850 !! html/parsoid
24851 <p about="#mwt1" typeof="mw:Transclusion"
24852 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24853
24854 <p about="#mwt1" typeof="mw:Transclusion"
24855 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24856
24857 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24858 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24859 <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>
24860 !! wikitext
24861 {{echo|1 = f=oo}}
24862
24863 {{echo|1 = f=oo|2 = bar}}
24864
24865 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24866 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24867 {{echo|<nowiki>f=oo</nowiki>|bar}}
24868 !! end
24869
24870 !! test
24871 Parsoid: Serialize positional parameters with = in extlink as named parameter
24872 !! options
24873 parsoid=html2wt
24874 !! html/parsoid
24875 <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>
24876 !! wikitext
24877 {{echo|1 = http://stuff?is=ok}}
24878 !! end
24879
24880 !! test
24881 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24882 !! options
24883 parsoid=html2wt
24884 !! html/parsoid
24885 <div>a<p>b</p></div>
24886 <div>a
24887 <p>b</p></div>
24888 <div>
24889 a
24890 <p>b</p></div>
24891 !! wikitext
24892 <div>a
24893 b
24894 </div>
24895 <div>a
24896 b
24897 </div>
24898 <div>
24899 a
24900
24901 b
24902 </div>
24903 !! end
24904
24905 !! test
24906 Substrings resembling wikitext in hrefs should not get nowiki escapes
24907 !! options
24908 parsoid=html2wt
24909 !! html/parsoid
24910 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24911 !! wikitext
24912 [[Foo''bar''baz]]
24913 !! end
24914
24915 !! test
24916 Enforce single-line context in the serializer
24917 !! options
24918 parsoid=html2wt
24919 !! html/parsoid
24920 <h2>testing
24921 123</h2>
24922
24923 <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">
24924 </span><span about="#mwt1">you</span> </h2>
24925
24926 <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>
24927
24928 <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
24929 there</span></li></ol>
24930
24931 <ul><li>asd
24932 sdf</li></ul>
24933
24934 <ul><li>foo
24935 bar
24936 baz</li>
24937 <li>foo <b>bar</b>
24938 baz</li></ul>
24939
24940 <dl><dt>hi
24941 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24942 ho</dd></dl>
24943
24944 <dl><dd> <table>
24945 <tbody><tr><td> ha
24946 ha
24947 ha</td></tr>
24948 </tbody></table></dd></dl>
24949 !! wikitext
24950 == testing 123 ==
24951
24952 == hi {{bogus|there
24953 you}} ==
24954
24955 == foo <ref>hello
24956 there</ref> ==
24957
24958 <references />
24959
24960 * asd sdf
24961
24962 * foo bar baz
24963 * foo '''bar''' baz
24964
24965 ; hi ho : hi ho
24966
24967 : {|
24968 | ha
24969 ha
24970 ha
24971 |}
24972 !! end
24973
24974 !! test
24975 Serialize new placeholder space without spans
24976 !! options
24977 parsoid=html2wt
24978 !! html/parsoid
24979 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24980
24981 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24982
24983 <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>
24984 !! wikitext
24985 foo : bar
24986
24987 foo : bar
24988
24989 <ref>foo : bar</ref>ok
24990 !! end
24991
24992
24993 #-----------------------
24994 # Tag minimization tests
24995 #-----------------------
24996
24997 !! test
24998 1. I/B quote minimization: wikitext-only tags should be combined
24999 !! options
25000 parsoid=html2wt
25001 !! html/parsoid
25002 <p><i>A</i><i>B</i></p>
25003 <p><b>A</b><b>B</b></p>
25004 <p><i>A</i><b><i>B</i></b></p>
25005 <p><b>A</b><i><b>B</b></i></p>
25006 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25007 <p><i><b>A</b></i><i><b>B</b></i></p>
25008 <p><i><b>A</b></i><b><i>B</i></b></p>
25009 <p><b><i>A</i></b><i><b>B</b></i></p>
25010 !! wikitext
25011 ''AB''
25012
25013 '''AB'''
25014
25015 ''A'''B'''''
25016
25017 '''A''B'''''
25018
25019 '''A''BC''D'''
25020
25021 '''''AB'''''
25022
25023 '''''AB'''''
25024
25025 '''''AB'''''
25026 !! end
25027
25028 !! test
25029 2. I/B quote minimization: wikitext and html tags should not be combined
25030 !! options
25031 parsoid=html2wt
25032 !! html/parsoid
25033 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25034 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25035 !! wikitext
25036 ''A''<i>B</i>
25037
25038 ''A''<nowiki/>'''<i>B</i>'''
25039 !! end
25040
25041 !! test
25042 3. I/B quote minimization: templated content stops minimization
25043 !! options
25044 parsoid=html2wt
25045 !! html/parsoid
25046 <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>
25047 <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>
25048 !! wikitext
25049 ''A''{{echo|''B''}}
25050
25051 ''A''{{echo|'''''B'''''}}
25052 !! end
25053
25054 !! test
25055 4. I/B quote minimization: new content should be mimimized with adjacent old content
25056 !! options
25057 parsoid=html2wt
25058 !! html/parsoid
25059 <p><i>A</i><i>B</i></p>
25060 <p><b>A</b><b>B</b></p>
25061 <p><i>A</i><b><i>B</i></b></p>
25062 !! wikitext
25063 ''AB''
25064
25065 '''AB'''
25066
25067 ''A'''B'''''
25068 !! end
25069
25070 !! test
25071 5a. Merge adjacent quote nodes if they've been edited
25072 !! options
25073 parsoid={
25074 "modes": ["wt2wt", "selser"],
25075 "changes": [
25076 ["p", "contents", "remove", ":contains('b')"]
25077 ]
25078 }
25079 !! wikitext
25080 ''a''b''c''
25081 !! wikitext/edited
25082 ''ac''
25083 !! end
25084
25085 !! test
25086 5b. Merge adjacent quote nodes if they've been edited
25087 !! options
25088 parsoid={
25089 "modes": ["wt2wt", "selser"],
25090 "changes": [
25091 ["#x", "remove"]
25092 ]
25093 }
25094 !! wikitext
25095 ''a''<span id="x">b</span>''c''
25096 !! wikitext/edited
25097 ''ac''
25098 !! end
25099
25100 !! test
25101 1. Merge adjacent link nodes as long as at least one element is new
25102 !! options
25103 parsoid={
25104 "modes": ["html2wt"],
25105 "scrubWikitext": true
25106 }
25107 !! html/parsoid
25108 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25109 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25110 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25111 !! wikitext
25112 [[Football]]
25113 [[Football]]
25114 [[Football|Foot]][[Football|ball]]
25115 !! end
25116
25117 !! test
25118 2. Merge adjacent link nodes and enable additional normalizations
25119 !! options
25120 parsoid={
25121 "modes": ["html2wt"],
25122 "scrubWikitext": true
25123 }
25124 !! html/parsoid
25125 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25126 !! wikitext
25127 [[Football|''Football'']]
25128 !! end
25129
25130 !! test
25131 3. Don't merge adjacent link nodes if scrubWikitext is false
25132 !! options
25133 parsoid={
25134 "modes": ["html2wt"],
25135 "scrubWikitext": false
25136 }
25137 !! html/parsoid
25138 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25139 !! wikitext
25140 [[Football|Foot]][[Football|ball]]
25141 !! end
25142
25143 #------------------------------
25144 # End of tag minimization tests
25145 #------------------------------
25146
25147 !!test
25148 Bug 54262: New entities
25149 !! options
25150 parsoid=html2wt
25151 !! html/parsoid
25152 <span typeof="mw:Entity">&nbsp;</span>
25153 !! wikitext
25154 &nbsp;
25155 !! end
25156
25157 ## Note that there is no wikitext output for 'unknownproperty' ##
25158 ## Unknown magic words are silently dropped ##
25159
25160 !! test
25161 Magic words
25162 !! options
25163 parsoid=html2wt
25164 !! html/parsoid
25165 <meta property='mw:PageProp/toc' />
25166 <meta property='mw:PageProp/notoc' />
25167 <meta property='mw:PageProp/forcetoc' />
25168 <meta property='mw:PageProp/index' />
25169 <meta property='mw:PageProp/noindex' />
25170 <meta property='mw:PageProp/nogallery' />
25171 <meta property='mw:PageProp/noeditsection' />
25172 <meta property='mw:PageProp/notitleconvert' />
25173 <meta property='mw:PageProp/nocontentconvert' />
25174 <meta property='mw:PageProp/unknownproperty' />
25175 !! wikitext
25176 __TOC__
25177 __NOTOC__
25178 __FORCETOC__
25179 __INDEX__
25180 __NOINDEX__
25181 __NOGALLERY__
25182 __NOEDITSECTION__
25183 __NOTITLECONVERT__
25184 __NOCONTENTCONVERT__
25185 !! end
25186
25187 !! test
25188 Consecutive <pre>s should not get merged
25189 !! options
25190 parsoid=html2wt,html2html
25191 !! html/parsoid
25192 <pre>a</pre><pre>b</pre>
25193
25194 <pre>c
25195 </pre><pre>
25196 d</pre>
25197
25198 <pre>e
25199
25200 </pre><pre>
25201
25202 f</pre>
25203 !! wikitext
25204 a
25205
25206 b
25207
25208 c
25209
25210 d
25211
25212 e
25213
25214
25215
25216 f
25217 !! end
25218
25219 !! test
25220 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25221 !! options
25222 parsoid=html2wt
25223 !! html/parsoid
25224 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25225 !! wikitext
25226 [[Special:BookSources/1234567890|ISBN 1234567895]]
25227 !! end
25228
25229 !! test
25230 Edited RFC links not serializable as RFC links should serialize as extlinks
25231 !! options
25232 parsoid=html2wt
25233 !! html/parsoid
25234 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25235 !! wikitext
25236 [//tools.ietf.org/html/rfc123 New RFC]
25237 !! end
25238
25239 !! test
25240 Edited PMID links not serializable as PMID links should serialize as extlinks
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25245 !! wikitext
25246 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25247 !! end
25248
25249 !! test
25250 WTS of autolinks with trailing/surrounding context
25251 !! options
25252 parsoid=html2wt
25253 !! html/parsoid
25254 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25255 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25256 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25257 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25258 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25259 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25260 !! wikitext
25261 http://cscott.net<nowiki/>'''foo'''
25262
25263 http://cscott.net<b>foo</b>
25264
25265 '''http://cscott.net<nowiki/>'''
25266
25267 '''http://cscott.net '''
25268
25269 '''http://cscott.net<nowiki/>x'''
25270
25271 http://cscott.net<nowiki/>x
25272 !! end
25273
25274 !! test
25275 WTS of autolinks with nowikis (round-trip)
25276 !! wikitext
25277 x<nowiki/>http://cscott.net<nowiki/>x
25278 !! html/parsoid
25279 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25280 !! end
25281
25282 # this is the "easy" test because it leaves in place all the
25283 # data-parsoid information indicating this is an autolink
25284 !! test
25285 WTS of autolinks with escapes (editing)
25286 !! options
25287 parsoid={
25288 "modes": ["wt2wt"],
25289 "changes": [
25290 [ "meta", "remove" ]
25291 ]
25292 }
25293 !! wikitext
25294 x<nowiki/>http://cscott.net<nowiki/>x
25295 !! wikitext/edited
25296 x<nowiki/>http://cscott.net<nowiki/>x
25297 !! end
25298
25299 !! test
25300 WTS of edited autolink-like text (T103364)
25301 !! options
25302 parsoid={
25303 "modes": ["wt2wt"],
25304 "changes": [
25305 [ "span[typeof]", "removeAttr", "typeof" ]
25306 ]
25307 }
25308 !! wikitext
25309 Not a link: <nowiki>http://example.com</nowiki>.
25310 !! wikitext/edited
25311 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25312 !! end
25313
25314 !! test
25315 WTS of newly-authored autolink-like text (T103364)
25316 !! options
25317 parsoid=html2wt
25318 !! html/parsoid
25319 <p>http://example.com is not a link.</p>
25320 !! wikitext
25321 <nowiki>http://example.com is not a link.</nowiki>
25322 !! end
25323
25324 !! test
25325 WTS of autolink-like text after an autolink (T108563)
25326 !! options
25327 parsoid=html2wt
25328 !! html/parsoid
25329 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25330 !! wikitext
25331 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25332 !! end
25333
25334 !! test
25335 Magic links inside links (not autolinked)
25336 !! wikitext
25337 [[Foo|http://example.com]]
25338 [[Foo|RFC 1234]]
25339 [[Foo|PMID 1234]]
25340 [[Foo|ISBN 123456789x]]
25341
25342 [http://foo.com http://example.com]
25343 [http://foo.com RFC 1234]
25344 [http://foo.com PMID 1234]
25345 [http://foo.com ISBN 123456789x]
25346 !! html+tidy
25347 <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>
25348 <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>
25349 !! html/parsoid
25350 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25351 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25352 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25353 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25354
25355 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25356 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25357 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25358 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25359 !! end
25360
25361 !! test
25362 Magic links inside image captions (autolinked)
25363 !! wikitext
25364 [[File:Foobar.jpg|thumb|http://example.com]]
25365 [[File:Foobar.jpg|thumb|RFC 1234]]
25366 [[File:Foobar.jpg|thumb|PMID 1234]]
25367 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25368 !! html+tidy
25369 <div class="thumb tright">
25370 <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>
25371 <div class="thumbcaption">
25372 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25373 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25374 </div>
25375 </div>
25376 <div class="thumb tright">
25377 <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>
25378 <div class="thumbcaption">
25379 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25380 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25381 </div>
25382 </div>
25383 <div class="thumb tright">
25384 <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>
25385 <div class="thumbcaption">
25386 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25387 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25388 </div>
25389 </div>
25390 <div class="thumb tright">
25391 <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>
25392 <div class="thumbcaption">
25393 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25394 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25395 </div>
25396 </div>
25397 !! html/parsoid
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 rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
25399 <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>
25400 <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>
25401 <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>
25402 !! end
25403
25404 !! test
25405 WTS of magic word text (T109371)
25406 !! options
25407 parsoid=html2wt
25408 !! html/parsoid
25409 <p>RFC 1234</p>
25410 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25411 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25412 !! wikitext
25413 <nowiki>RFC 1234</nowiki>
25414
25415 [http://foo.com RFC 1234]
25416
25417 [[Foo|RFC 1234]]
25418 !! end
25419
25420 !! test
25421 Edited Redirect link should emit a non-piped wikitext link
25422 !! options
25423 parsoid=html2wt
25424 !! html/parsoid
25425 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25426 !! wikitext
25427 #REDIRECT [[Bar]]
25428 !! end
25429
25430 !! test
25431 T75121: Infer extension name from typeOf if data-mw is not present
25432 !! options
25433 parsoid=html2wt
25434 !! html/parsoid
25435 <div typeOf="mw:Extension/foo"></div>
25436 !! wikitext
25437 <foo />
25438 !! end
25439
25440 # Note that the <p> wrapping isn't present in PHP parser output
25441 # The important thing for this test is that P-wrapping doesn't
25442 # interfere with the <nowiki> protection for leading - in <td>
25443 # (which isn't necessary for <th>).
25444 !! test
25445 T88318: p-wrapped dash in table.
25446 !! options
25447 parsoid=html2wt,wt2wt
25448 !! html/parsoid
25449 <table><tbody>
25450 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25451 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25452 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25453 </tbody></table>
25454 !! wikitext
25455 {|
25456 !-
25457 !-
25458 |-
25459 |<nowiki>-</nowiki>
25460 |<nowiki>- </nowiki>
25461 |-
25462 |<small>-</small>
25463 |<br>
25464 -
25465 |<br>
25466 -
25467 |}
25468 !! html/php+tidy
25469 <table>
25470 <tr>
25471 <th>-</th>
25472 <th>-</th>
25473 </tr>
25474 <tr>
25475 <td>-</td>
25476 <td>-</td>
25477 </tr>
25478 <tr>
25479 <td><small>-</small></td>
25480 <td><br />
25481 <p>-</p>
25482 </td>
25483 <td><br />
25484 <p>-</p>
25485 </td>
25486 </tr>
25487 </table>
25488 !! end
25489
25490 !! test
25491 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25492 !! options
25493 parsoid=html2wt
25494 !! html/parsoid
25495 <table id='mwAb'>
25496 <td id='mwAc'>foo</td>
25497 <td id='serialize-this'>bar</td>
25498 </table>
25499 !! wikitext
25500 {|
25501 |foo
25502 | id="serialize-this" |bar
25503 |}
25504 !! end
25505
25506 !! test
25507 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25508 !! options
25509 parsoid=html2wt
25510 !! html/parsoid
25511 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25512 !! wikitext
25513 <div id="hello">ok</div>
25514 !! end
25515
25516 !! test
25517 WTS change modes
25518 !! options
25519 parsoid={
25520 "modes": ["wt2wt"],
25521 "changes": [
25522 [ "#xyz", "before", "<b>before</b> stuff " ],
25523 [ "#xyz", "after", " stuff <i>after</i>" ],
25524 [ "#xyz", "html", "x <b>y</b> z" ]
25525 ]
25526 }
25527 !! wikitext
25528 <span id="xyz">hello</span>
25529 !! wikitext/edited
25530 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25531 !! end
25532
25533 !! test
25534 Never serialize a-tag as html, regardless of what data-parsoid has to say
25535 !! options
25536 parsoid=html2wt
25537 !! html/parsoid
25538 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25539 !! wikitext
25540 [[Foo]]
25541 !! end
25542
25543 ## SSS FIXME: This is broken output nevertheless.
25544 ## What might be a reasonable non-broken output for this?
25545 ## This is an edge case unlikely to be seen in production
25546 ## that I am not wasting more time on this right now.
25547 !! test
25548 Never serialize a-tag as html, no matter what attributes it has
25549 !! options
25550 parsoid=html2wt
25551 !! html/parsoid
25552 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25553 !! wikitext
25554 [http://boo.org http://boohoo.org]
25555 !! end
25556
25557 # Misnested is an indication that selser can reuse the source but these have
25558 # shown to sneak through on occasion. See T101768.
25559 # The original wikitext here is: [http://test.com [[one]] two three]
25560 !! test
25561 Strip span tags added to mark as misnested
25562 !! options
25563 parsoid=html2wt
25564 !! html/parsoid
25565 <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>
25566 !! wikitext
25567 [http://test.com][[one]] two three
25568 !! end
25569
25570 # --------------------------------------------
25571 # Tests spec'ing wikitext serialization norms |
25572 # --------------------------------------------
25573
25574 !! test
25575 Lists: Add space after bullets
25576 !! options
25577 parsoid=html2wt
25578 !! html/parsoid
25579 <ul>
25580 <li>foo</li>
25581 <li> bar</li>
25582 <li><span> baz</span></li>
25583 </ul>
25584 !! wikitext
25585 * foo
25586 * bar
25587 * <span> baz</span>
25588 !! end
25589
25590 !! test
25591 1. Headings: Add space before/after == (T53744)
25592 !! options
25593 parsoid=html2wt
25594 !! html/parsoid
25595 <h2>foo</h2>
25596 <h2> bar</h2>
25597 <h2>baz </h2>
25598 <h2><span> baz</span></h2>
25599 !! wikitext
25600 == foo ==
25601
25602 == bar ==
25603
25604 == baz ==
25605
25606 == <span> baz</span> ==
25607 !! end
25608
25609 !! test
25610 2. Headings: Add space before/after == even after hoisted content
25611 !! options
25612 parsoid={
25613 "modes": ["html2wt"],
25614 "scrubWikitext": true
25615 }
25616 !! html/parsoid
25617 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25618 !! wikitext
25619 [[Category:A2]]
25620
25621 == ok ==
25622 !! end
25623
25624 !! test
25625 1. Headings: suppress newly created empty headings
25626 !! options
25627 parsoid={
25628 "modes": ["html2wt"],
25629 "scrubWikitext": true
25630 }
25631 !! html/parsoid
25632 <h2></h2>
25633 !! wikitext
25634 !! end
25635
25636 !! test
25637 2. Headings: don't suppress empty headings if scrubWikitext is false
25638 !! options
25639 parsoid=html2wt
25640 !! html/parsoid
25641 <h2></h2>
25642 !! wikitext
25643 ==<nowiki/>==
25644 !! end
25645
25646 !! test
25647 3. Headings: suppress empty headings on edits
25648 !! options
25649 parsoid={
25650 "modes": ["selser"],
25651 "scrubWikitext": true,
25652 "changes": [
25653 [ "#x", "remove"]
25654 ]
25655 }
25656 !! wikitext
25657 ==<span id="x">foo</span>==
25658 !! wikitext/edited
25659 !! end
25660
25661 !! test
25662 1. WT Quote Tags: suppress newly created empty style tags
25663 !! options
25664 parsoid={
25665 "modes": ["html2wt"],
25666 "scrubWikitext": true
25667 }
25668 !! html/parsoid
25669 <i></i><b></b>
25670 !! wikitext
25671 !! end
25672
25673 !! test
25674 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25675 !! options
25676 parsoid=html2wt
25677 !! html/parsoid
25678 <i></i><b></b>
25679 !! wikitext
25680 ''<nowiki/>'''''<nowiki/>'''
25681 !! end
25682
25683 !! test
25684 3. WT Quote Tags: suppress empty style tags on edits
25685 !! options
25686 parsoid={
25687 "modes": ["selser"],
25688 "scrubWikitext": true,
25689 "changes": [
25690 [ "#x", "remove"]
25691 ]
25692 }
25693 !! wikitext
25694 '''<span id="x">foo</span>'''
25695 !! wikitext/edited
25696 !! end
25697
25698 !! test
25699 1. Anchors: suppress newly created empty anchors
25700 !! options
25701 parsoid={
25702 "modes": ["html2wt"],
25703 "scrubWikitext": true
25704 }
25705 !! html/parsoid
25706 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25707 !! wikitext
25708 !! end
25709
25710 !! test
25711 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25712 !! options
25713 parsoid={
25714 "modes": ["html2wt"],
25715 "scrubWikitext": false
25716 }
25717 !! html/parsoid
25718 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25719 !! wikitext
25720 [[Test|<nowiki/>]]
25721 !! end
25722
25723 !! test
25724 3. Anchors: suppress empty anchors on edits
25725 !! options
25726 parsoid={
25727 "modes": ["selser"],
25728 "scrubWikitext": true,
25729 "changes": [
25730 [ "#x", "remove"]
25731 ]
25732 }
25733 !! wikitext
25734 [[Test|<span id="x">foo</span>]]
25735 !! wikitext/edited
25736 !! end
25737
25738 !! test
25739 3a. Anchors: do not suppress numbered extlinks
25740 !! options
25741 parsoid={
25742 "modes": ["wt2wt"],
25743 "scrubWikitext": true
25744 }
25745 !! wikitext
25746 [http://foo.com]
25747 !! html/parsoid
25748 <a rel="mw:ExtLink" href="http://foo.com"></a>
25749 !! end
25750
25751 !! test
25752 3b. Anchors: do not suppress numbered extlinks
25753 !! options
25754 parsoid={
25755 "modes": ["wt2wt"],
25756 "scrubWikitext": true,
25757 "changes": [
25758 [ "#x", "remove"]
25759 ]
25760 }
25761 !! wikitext
25762 [http://foo.com <span id="x">foo</span>]
25763 !! wikitext/edited
25764 [http://foo.com]
25765 !! end
25766
25767 !!test
25768 Normalizations should be restricted to edited content
25769 !!options
25770 parsoid={
25771 "modes": ["selser"],
25772 "scrubWikitext": true,
25773 "changes": [
25774 [ "h1", "before", "<i></i>"]
25775 ]
25776 }
25777 !!wikitext
25778 a
25779 = =
25780 b
25781 !!wikitext/edited
25782 a
25783 = =
25784 b
25785 !!end
25786
25787 !! test
25788 1. Multiple normalizations (html2wt)
25789 !! options
25790 parsoid={
25791 "modes": ["html2wt"],
25792 "scrubWikitext": true
25793 }
25794 !! html
25795 <h2><i></i></h2>
25796 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25797 </a><b><i></i></b>x</p>
25798 !! wikitext
25799
25800 [[foo]]
25801 x
25802
25803 !! end
25804
25805 !! test
25806 2. Multiple normalizations (selser)
25807 !! options
25808 parsoid={
25809 "modes": ["selser"],
25810 "scrubWikitext": true,
25811 "changes": [
25812 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25813 ]
25814 }
25815 !! wikitext
25816 <span id="x">foo</span>
25817 !! wikitext/edited
25818 <span id="x">foo</span>
25819
25820 x
25821 !! end
25822
25823 !! test
25824 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25825 !! options
25826 parsoid={
25827 "modes": ["html2wt"],
25828 "scrubWikitext": true
25829 }
25830 !! html/parsoid
25831 <p> hi</p>
25832 <p> hello</p>
25833 !! wikitext
25834 hi
25835
25836 hello
25837 !! end
25838
25839 !! test
25840 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25841 !! options
25842 parsoid=html2wt
25843 !! html/parsoid
25844 <p> hi</p>
25845 <p> hello</p>
25846 !! wikitext
25847 <nowiki> </nowiki>hi
25848
25849 <nowiki> </nowiki> hello
25850 !! end
25851
25852 !! test
25853 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25854 !! options
25855 parsoid={
25856 "modes": ["html2wt"],
25857 "scrubWikitext": true
25858 }
25859 !! html/parsoid
25860 <p>Foo
25861 bar
25862 baz</p>
25863
25864 <table><tr><td>Foo
25865 bar
25866 baz bang</td></tr></table>
25867
25868 <p><!--boo--> foo
25869 bar</p>
25870
25871 <p> foo
25872 bar<span>boo</span></p>
25873 !! wikitext
25874 Foo
25875 bar
25876 baz
25877
25878 {|
25879 |Foo
25880 bar
25881 baz bang
25882 |}
25883
25884 <!--boo-->foo
25885 bar
25886
25887 foo
25888 bar<span>boo</span>
25889 !! end
25890
25891 !! test
25892 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25893 !! options
25894 parsoid={
25895 "modes": ["selser"],
25896 "scrubWikitext": true,
25897 "changes": [
25898 [ "p", "html", " a\n b" ]
25899 ]
25900 }
25901 !! wikitext
25902 xyz
25903 !! wikitext/edited
25904 a
25905 b
25906 !! end
25907
25908 !! test
25909 1. New links that end in spaces
25910 !! options
25911 parsoid={
25912 "modes": ["html2wt"],
25913 "scrubWikitext": false
25914 }
25915 !! html/parsoid
25916 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25917 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25918 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25919 !! wikitext
25920 [[Berlin ]]<nowiki/>is the capital of Germany.
25921
25922 [[Foo ]]'''bar'''
25923
25924 [[Boston ]] is a city.
25925 !! end
25926
25927 !! test
25928 2. New links that end in spaces
25929 !! options
25930 parsoid={
25931 "modes": ["html2wt"],
25932 "scrubWikitext": true
25933 }
25934 !! html/parsoid
25935 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25936 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25937 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25938 !! wikitext
25939 [[Berlin]] is the capital of Germany.
25940
25941 [[Foo]] '''bar'''
25942
25943 [[Boston]] is a city.
25944 !! end
25945
25946 !! test
25947 1. Table cells with escapable prefixes
25948 !! options
25949 parsoid={
25950 "modes": ["html2wt"],
25951 "scrubWikitext": false
25952 }
25953 !! html
25954 <table>
25955 <tr><td>a</td></tr>
25956 <tr><td>-</td></tr>
25957 <tr><td>+</td></tr>
25958 </table>
25959 !! wikitext
25960 {|
25961 |a
25962 |-
25963 |<nowiki>-</nowiki>
25964 |-
25965 |<nowiki>+</nowiki>
25966 |}
25967 !! end
25968
25969 !! test
25970 2. Table cells with escapable prefixes
25971 !! options
25972 parsoid={
25973 "modes": ["html2wt"],
25974 "scrubWikitext": true
25975 }
25976 !! html
25977 <table>
25978 <tr><td>a</td></tr>
25979 <tr><td>-</td></tr>
25980 <tr><td>+</td></tr>
25981 </table>
25982 !! wikitext
25983 {|
25984 |a
25985 |-
25986 | -
25987 |-
25988 | +
25989 |}
25990 !! end
25991
25992 !! test
25993 3a. Table cells with escapable prefixes after edits
25994 !! options
25995 parsoid={
25996 "modes": ["selser"],
25997 "scrubWikitext": true,
25998 "changes": [
25999 [ "table tbody tr:first-child td:first-child", "remove"]
26000 ]
26001 }
26002 !! wikitext
26003 {|
26004 |a||-
26005 |}
26006 !! wikitext/edited
26007 {|
26008 | -
26009 |}
26010 !! end
26011
26012 !! test
26013 3b. Table cells with escapable prefixes after edits
26014 !! options
26015 parsoid={
26016 "modes": ["selser"],
26017 "scrubWikitext": true,
26018 "changes": [
26019 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26020 [ "#x", "remove" ]
26021 ]
26022 }
26023 !! wikitext
26024 {|
26025 |pqr
26026 |<span id="x">foo</span>+
26027 |}
26028 !! wikitext/edited
26029 {|
26030 | -
26031 | +
26032 |}
26033 !! end
26034
26035 # FIXME: This test will fail because
26036 # normalization doesn't realize that the id attribute
26037 # will eliminate the escapable scenario
26038 !! test
26039 4a. Table cells without escapable prefixes after edits
26040 !! options
26041 parsoid={
26042 "modes": ["selser"],
26043 "scrubWikitext": true,
26044 "changes": [
26045 [ "#x", "html", "-" ]
26046 ]
26047 }
26048 !! wikitext
26049 {|
26050 | id="x" |abcd
26051 |}
26052 !! wikitext/edited
26053 {|
26054 | id="x" |-
26055 |}
26056 !! end
26057
26058 ## This tests normalizer's ability to discriminate between
26059 ## cells having identical content.
26060 !! test
26061 4b. Table cells without escapable prefixes after edits
26062 !! options
26063 parsoid={
26064 "modes": ["selser"],
26065 "scrubWikitext": true,
26066 "changes": [
26067 [ "td", "html", "-" ]
26068 ]
26069 }
26070 !! wikitext
26071 {|
26072 |a||b
26073 |}
26074 !! wikitext/edited
26075 {|
26076 | -||-
26077 |}
26078 !! end
26079
26080 ## This tests normalizer's ability to not be tripped by
26081 ## comments (and whitespace)
26082 !! test
26083 4c. Table cells without escapable prefixes after edits
26084 !! options
26085 parsoid={
26086 "modes": ["selser"],
26087 "scrubWikitext": true,
26088 "changes": [
26089 [ "table tbody tr td:first-child", "remove" ]
26090 ]
26091 }
26092 !! wikitext
26093 {|
26094 |-
26095 <!--foo--> |a||-
26096 |}
26097 !! wikitext/edited
26098 {|
26099 |-
26100 <!--foo--> | -
26101 |}
26102 !! end
26103
26104 ## This tests normalizer's ability to handle HTML cells
26105 !! test
26106 4d. Table cells without escapable prefixes after edits
26107 !! options
26108 parsoid={
26109 "modes": ["selser"],
26110 "scrubWikitext": true,
26111 "changes": [
26112 [ "td", "html", "-" ]
26113 ]
26114 }
26115 !! wikitext
26116 <table>
26117 <tr><td>a</td></tr>
26118 </table>
26119 !! wikitext/edited
26120 <table>
26121 <tr><td>-</td></tr>
26122 </table>
26123 !! end
26124
26125 ## T111151 Remove font elements without attributes
26126 !! test
26127 5a. font tags without attributes should be dropped in scrubWikitext mode
26128 !! options
26129 parsoid={
26130 "modes": ["html2wt"],
26131 "scrubWikitext": true
26132 }
26133 !! html
26134 <font>foo</font>
26135 <font><font>bar</font></font>
26136 <font class="x">boo</font>
26137 !! wikitext
26138 foo
26139 bar
26140 <font class="x">boo</font>
26141 !! end
26142
26143 !! test
26144 5b. font tags should not be dropped without scrubWikitext being enabled
26145 !! options
26146 parsoid={
26147 "modes": ["html2wt"],
26148 "scrubWikitext": false
26149 }
26150 !! html
26151 <font>foo</font>
26152 !! wikitext
26153 <font>foo</font>
26154 !! end
26155
26156 !! test
26157 Escape nowiki DOM elements
26158 !! options
26159 parsoid=html2wt
26160 !! html/parsoid
26161 <nowiki><i>foo</i></nowiki>
26162 !! wikitext
26163 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26164 !! end
26165
26166 # ---------------------------------------------------
26167 # End of tests spec'ing wikitext serialization norms |
26168 # ---------------------------------------------------
26169
26170 # -----------------------------------------------------------------
26171 # End of section for Parsoid-only html2wt tests for serialization
26172 # of new content
26173 # -----------------------------------------------------------------
26174
26175 # -----------------------------------------------------------------
26176 # The following section of tests are primarily to spec behavior of
26177 # the selective serializer. All these tests have manual selser
26178 # changes. The automated selser changes for all tests handle the
26179 # wide variation of changes, but these tests here capture specs
26180 # deterministically.
26181 # ----------------------------------------------------------------
26182
26183 ## T90517
26184 !! test
26185 Selser: New comments should not be lost
26186 !! options
26187 parsoid={
26188 "modes": ["selser"],
26189 "changes": [
26190 [ "#a", "after", "<!--c1-->" ],
26191 [ "#b", "before", "<!--c2-->" ]
26192 ]
26193 }
26194 !! wikitext
26195 <span id="a">a</span>
26196
26197 <span id="b">b</span>
26198 !! wikitext/edited
26199 <span id="a">a</span><!--c1-->
26200
26201 <!--c2--><span id="b">b</span>
26202 !! end
26203
26204 ## T89383
26205 !! test
26206 Selser: Check for validity of DSR before using it
26207 !! options
26208 parsoid={
26209 "modes": ["selser"],
26210 "changes": [
26211 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26212 ]
26213 }
26214 !! wikitext
26215 <span id="a">a</span>
26216 !! wikitext/edited
26217 {{DISPLAYTITLE:foo}}
26218 <span id="a">a</span>
26219 !! end
26220
26221 !! test
26222 1. DOMDiff: Changes to <ref> content should be looked up using id
26223 !! options
26224 parsoid={
26225 "modes": ["selser"],
26226 "changes": [
26227 ["#X", "after", "bar"],
26228 ["#Y", "after", "baz"]
26229 ]
26230 }
26231 !! wikitext
26232 X <ref><span id="X">foo</span></ref>
26233 Y <ref name="a" />
26234 <references>
26235 <ref name="a"><span id="Y">foo</span></ref>
26236 </references>
26237 !! wikitext/edited
26238 X <ref><span id="X">foo</span>bar</ref>
26239 Y <ref name="a" />
26240 <references>
26241 <ref name="a"><span id="Y">foo</span>baz</ref>
26242 </references>
26243 !! end
26244
26245 !! test
26246 2. DOMDiff: Changes to <ref> content should be looked up using id
26247 !! options
26248 parsoid={
26249 "modes": ["selser"],
26250 "changes": [
26251 ["#Z", "after", "bar"]
26252 ]
26253 }
26254 !! wikitext
26255 A <ref>foo bar for a</ref>
26256 B <ref group="X" name="b" />
26257
26258 <references />
26259
26260 <references group="X">
26261 <ref name="b"><span id="Z">foo</span></ref>
26262 </references>
26263 !! wikitext/edited
26264 A <ref>foo bar for a</ref>
26265 B <ref group="X" name="b" />
26266
26267 <references />
26268
26269 <references group="X">
26270 <ref name="b"><span id="Z">foo</span>bar</ref>
26271 </references>
26272 !! end