Support IPv6 URLs in bracketed and auto links.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1522 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1534 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! end
2068
2069 !! test
2070 Ident preformatting with inline content
2071 !! wikitext
2072 a
2073 ''b''
2074 !! html
2075 <pre>a
2076 <i>b</i>
2077 </pre>
2078 !! end
2079
2080 !! test
2081 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2082 !! wikitext
2083 <pre><nowiki>
2084 <b>
2085 <cite>
2086 <em>
2087 </nowiki></pre>
2088 !! html
2089 <pre>
2090 &lt;b&gt;
2091 &lt;cite&gt;
2092 &lt;em&gt;
2093 </pre>
2094
2095 !! end
2096
2097 !! test
2098 Regression with preformatted in <center>
2099 !! wikitext
2100 <center>
2101 Blah
2102 </center>
2103 !! html
2104 <center>
2105 <pre>Blah
2106 </pre>
2107 </center>
2108
2109 !! end
2110
2111 !! test
2112 Bug 52763: Preformatted in <blockquote>
2113 !! wikitext
2114 <blockquote>
2115 Blah
2116 {|
2117 |
2118 indented cell (no pre-wrapping!)
2119 |}
2120 </blockquote>
2121 !! html
2122 <blockquote>
2123 <p> Blah
2124 </p>
2125 <table>
2126 <tr>
2127 <td>
2128 <p> indented cell (no pre-wrapping!)
2129 </p>
2130 </td></tr></table>
2131 </blockquote>
2132
2133 !! end
2134
2135 !! test
2136 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2137 !! wikitext
2138 <blockquote>
2139 Foo
2140
2141 Bar
2142 </blockquote>
2143 !! html
2144 <blockquote>
2145 <p>Foo
2146 </p><p>Bar
2147 </p>
2148 </blockquote>
2149
2150 !! end
2151
2152 !! test
2153 Bug 15491: <ins>/<del> in blockquote
2154 !! wikitext
2155 <blockquote>
2156 Foo <del>bar</del> <ins>baz</ins> quux
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo <del>bar</del> <ins>baz</ins> quux
2161 </p>
2162 </blockquote>
2163
2164 !! end
2165
2166 # Note that the p-wrapping is newline sensitive, which could be
2167 # considered a bug: tidy will wrap only the 'Foo' in the example
2168 # below in a <p> tag. (see comment 23-25 of bug #6200)
2169 !! test
2170 Bug 15491: <ins>/<del> in blockquote (2)
2171 !! wikitext
2172 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2173 </blockquote>
2174 !! html
2175 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177
2178 !! html+tidy
2179 <blockquote>
2180 <p>Foo</p>
2181 <del>bar</del> <ins>baz</ins> quux</blockquote>
2182 !! end
2183
2184 !! test
2185 <pre> with attributes (bug 3202)
2186 !! wikitext
2187 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2188 !! html
2189 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2190
2191 !! end
2192
2193 !! test
2194 <pre> with width attribute (bug 3202)
2195 !! wikitext
2196 <pre width="8">Narrow screen goodies</pre>
2197 !! html
2198 <pre width="8">Narrow screen goodies</pre>
2199
2200 !! end
2201
2202 !! test
2203 <pre> with forbidden attribute (bug 3202)
2204 !! wikitext
2205 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2206 !! html
2207 <pre width="8">Narrow screen goodies</pre>
2208
2209 !! end
2210
2211 !! test
2212 Entities inside <pre>
2213 !! wikitext
2214 <pre>&lt;</pre>
2215 !! html
2216 <pre>&lt;</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute values (bug 3202)
2222 !! wikitext
2223 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 <nowiki> inside <pre> (bug 13238)
2231 !! wikitext
2232 <pre>
2233 <nowiki>
2234 </pre>
2235 <pre>
2236 <nowiki></nowiki>
2237 </pre>
2238 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2239 !! html
2240 <pre>
2241 &lt;nowiki&gt;
2242 </pre>
2243 <pre>
2244
2245 </pre>
2246 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2247
2248 !! end
2249
2250 !! test
2251 <nowiki> and <pre> preference (first one wins)
2252 !! wikitext
2253 <pre>
2254 <nowiki>
2255 </pre>
2256 </nowiki>
2257 </pre>
2258
2259 <nowiki>
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 </nowiki>
2264 </pre>
2265
2266 !! html/php
2267 <pre>
2268 &lt;nowiki&gt;
2269 </pre>
2270 <p>&lt;/nowiki&gt;
2271 &lt;/pre&gt;
2272 </p><p>
2273 &lt;pre&gt;
2274 &lt;nowiki&gt;
2275 &lt;/pre&gt;
2276
2277 &lt;/pre&gt;
2278 </p>
2279 !! html/parsoid
2280 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2281 </pre>
2282 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2283 &lt;/pre></p>
2284
2285 <p><span typeof="mw:Nowiki">
2286 &lt;pre>
2287 &lt;nowiki>
2288 &lt;/pre>
2289 </span>
2290 &lt;/pre></p>
2291 !! end
2292
2293 !! test
2294 </pre> inside nowiki
2295 !! wikitext
2296 <nowiki></pre></nowiki>
2297 !! html
2298 <p>&lt;/pre&gt;
2299 </p>
2300 !! end
2301
2302 # Parsoid doesn't strip empty tags, like Tidy does.
2303 !! test
2304 Empty pre; pre inside other HTML tags (bug 54946)
2305 !! options
2306 parsoid=wt2html,wt2wt
2307 !! wikitext
2308 a
2309
2310 <div><pre>
2311 foo
2312 </pre></div>
2313 <pre></pre>
2314 !! html/php
2315 <p>a
2316 </p>
2317 <div><pre>
2318 foo
2319 </pre></div>
2320 <pre></pre>
2321
2322 !! html/php+tidy
2323 <p>a</p>
2324 <div>
2325 <pre>
2326 foo
2327 </pre></div>
2328 !! html/parsoid
2329 <p>a</p>
2330
2331 <div><pre>foo
2332 </pre></div>
2333 <pre></pre>
2334 !! end
2335
2336 !! test
2337 HTML pre followed by indent-pre
2338 !! wikitext
2339 <pre>foo</pre>
2340 bar
2341 !! html
2342 <pre>foo</pre>
2343 <pre>bar
2344 </pre>
2345 !! end
2346
2347 # Note that tidy removes the empty <p> tags from the start and end.
2348 # Parsoid does not, by design.
2349 !!test
2350 Block tag pre
2351 !! wikitext
2352 <p><pre>foo</pre></p>
2353 !! html/php+tidy
2354 <pre>
2355 foo
2356 </pre>
2357 !! html/parsoid
2358 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2359 !!end
2360
2361 !!test
2362 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2363 !! wikitext
2364 {{echo|}}
2365 !! html
2366
2367 !!end
2368
2369 !!test
2370 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2371 !! wikitext
2372 {{echo|
2373 foo}}
2374 !! html
2375 <p>foo
2376 </p>
2377 !!end
2378
2379 !! test
2380 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2381 !! wikitext
2382 {{echo|a
2383 b}}
2384 !! html
2385 <pre>a
2386 </pre>
2387 <p>b
2388 </p>
2389 !!end
2390
2391 !! test
2392 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2393 !! wikitext
2394 {{echo|a
2395 b
2396 c
2397 d
2398 e
2399 }}
2400 !! html
2401 <pre>a
2402 </pre>
2403 <p>b
2404 c
2405 </p>
2406 <pre>d
2407 </pre>
2408 <p>e
2409 </p>
2410 !!end
2411
2412 !!test
2413 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2414 !! wikitext
2415 {{echo| foo}}
2416
2417 {{echo| foo}}{{echo| bar}}
2418
2419 {{echo| foo}}
2420 {{echo| bar}}
2421
2422 {{echo|<!--cmt--> foo}}
2423
2424 <!--cmt-->{{echo| foo}}
2425
2426 {{echo|{{echo| }}bar}}
2427 !! html
2428 <pre>foo
2429 </pre>
2430 <pre>foo bar
2431 </pre>
2432 <pre>foo
2433 bar
2434 </pre>
2435 <pre>foo
2436 </pre>
2437 <pre>foo
2438 </pre>
2439 <pre>bar
2440 </pre>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo| }}a
2447
2448 {{echo|
2449 }}a
2450
2451 {{echo|
2452 b}}
2453
2454 {{echo|a
2455 }}b
2456
2457 {{echo|a
2458 }} b
2459 !! html
2460 <pre>a
2461 </pre>
2462 <p><br />
2463 </p>
2464 <pre>a
2465 </pre>
2466 <p><br />
2467 </p>
2468 <pre>b
2469 </pre>
2470 <p>a
2471 </p>
2472 <pre>b
2473 </pre>
2474 <p>a
2475 </p>
2476 <pre>b
2477 </pre>
2478 !!end
2479
2480 !! test
2481 Pres with newline attributes
2482 !! wikitext
2483 <pre class="one
2484 two">hi</pre>
2485 !! html/php
2486 <pre class="one two">hi</pre>
2487
2488 !! html/parsoid
2489 <pre class="one
2490 two" data-parsoid='{"stx":"html"}'>hi</pre>
2491 !! end
2492
2493 !! test
2494 Things that look like <pre> tags aren't treated as such
2495 !! wikitext
2496 Barack Obama <President> of the United States
2497 <President></President>
2498 !! html
2499 <p>Barack Obama &lt;President&gt; of the United States
2500 &lt;President&gt;&lt;/President&gt;
2501 </p>
2502 !! end
2503
2504 ## PHP parser discards the "<pre " string
2505 !! test
2506 Handle broken pre-like tags (bug 64025)
2507 !! options
2508 parsoid=wt2html
2509 !! wikitext
2510 {{echo|<pre <pre>x</pre>}}
2511
2512 <table><pre </table>
2513 !! html/php
2514 <pre>x</pre>
2515 <table><pre></pre></table>
2516
2517 !! html/parsoid
2518 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2519
2520
2521 <p>&lt;pre </p>
2522
2523 <table></table>
2524 !! end
2525
2526 !! test
2527 Parsoid: handle pre with space after attribute
2528 !! options
2529 parsoid=wt2html
2530 !! wikitext
2531 <pre style="width:50%;" >{{echo|foo}}</pre>
2532 !! html/php
2533 <pre style="width:50%;">{{echo|foo}}</pre>
2534
2535 !! html/parsoid
2536 <pre style="width:50%;">{{echo|foo}}</pre>
2537 !! end
2538
2539 # TODO / maybe: fix wt2wt for this
2540 !! test
2541 Parsoid: Don't paragraph-wrap fosterable content
2542 !! options
2543 parsoid=wt2html
2544 !! wikitext
2545 {|
2546 <td></td>
2547 <td></td>
2548
2549
2550
2551 |}
2552 !! html
2553 <table>
2554
2555 <tbody>
2556 <tr>
2557 <td></td>
2558
2559 <td></td></tr>
2560
2561
2562
2563 </tbody></table>
2564 !! end
2565
2566 !! test
2567 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2568 !! options
2569 parsoid=wt2html
2570 !! wikitext
2571 {|
2572 <td>
2573 <td>
2574 </td>
2575
2576
2577
2578 |}
2579 !! html
2580 <table>
2581
2582 <tbody>
2583 <tr>
2584 <td></td>
2585
2586 <td>
2587 </td></tr>
2588
2589
2590
2591 </tbody></table>
2592 !! end
2593
2594
2595 #--------------------------------------------------------------------
2596 # Transclusion parameter whitespace stripping tests
2597 # Behavior is different for positional and named parameters
2598 #--------------------------------------------------------------------
2599 !! test
2600 Templates: Strip leading and trailing whitespace from named-param values
2601 !! wikitext
2602 {{echo|1= a }}
2603
2604 {{echo|1= {{echo|b}} }}
2605
2606 {{echo| 1 =
2607 c }}
2608
2609 {{echo| 1 =
2610 * d
2611 }}
2612 !! html
2613 <p>a
2614 </p><p>b
2615 </p><p>c
2616 </p>
2617 <ul><li> d</li></ul>
2618
2619 !! end
2620
2621 !! test
2622 Templates: Don't strip whitespace from positional-param values
2623 !! wikitext
2624 {{echo|a }}
2625
2626 {{echo|{{echo|b}} }}
2627
2628 {{echo| c
2629 }}
2630
2631 {{echo| {{echo|d}}
2632 }}
2633
2634 {{echo|
2635 e}}
2636
2637 {{echo|
2638 * f}}
2639
2640 {{echo|
2641 }}g
2642 !! html
2643 <p>a
2644 </p><p>b
2645 </p>
2646 <pre>c
2647 </pre>
2648 <p><br />
2649 </p>
2650 <pre>d
2651 </pre>
2652 <p><br />
2653 </p>
2654 <pre>e
2655 </pre>
2656 <p><br />
2657 </p>
2658 <ul><li> f</li></ul>
2659 <p><br />
2660 </p>
2661 <pre>g
2662 </pre>
2663 !! end
2664
2665 !! test
2666 Templates: Handle empty comment-and-ws-only lines correctly
2667 !! wikitext
2668 {{echo|foo
2669 <!--should be ignored-->
2670 <!--should be ignored as well-->
2671 bar}}
2672 !! html
2673 <p>foo
2674 bar
2675 </p>
2676 !! end
2677
2678 !! test
2679 Templates: Handle comments in the target
2680 !! wikitext
2681 {{echo
2682 <!-- should be ignored -->
2683 |foo}}
2684
2685 {{echo<!-- should be ignored -->
2686 |foo}}
2687
2688 {{echo<!-- should be ignored -->|foo}}
2689
2690 {{<!-- should be ignored -->echo|foo}}
2691 !!html/parsoid
2692 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2693
2694 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2695
2696 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2697
2698 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2699 !!end
2700
2701 !! test
2702 Templates: Handle comments in parameter names (bug 67657)
2703 !! wikitext
2704 {{echo|1
2705 <!-- should be ignored -->
2706 =foo}}
2707
2708 {{echo|
2709 <!-- should be ignored -->
2710 1 = foo}}
2711
2712 {{echo|1<!-- should be ignored --> = foo}}
2713
2714 {{echo|<!-- should be ignored -->1 = foo}}
2715 !!html/parsoid
2716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2717
2718 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2721
2722 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2723 !!end
2724
2725 !! test
2726 Templates: Other wikitext in parameter names (bug 67657)
2727 !! wikitext
2728 {{echo|''1''=foo}}
2729 !!html/parsoid
2730 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2731 !!html/php
2732 <p>{{{1}}}
2733 </p>
2734 !!end
2735
2736 #--------------------------------------------------------------------
2737 # Transclusion parameter escaping tests
2738 #--------------------------------------------------------------------
2739 !! test
2740 Templates: Parsoid parameter escaping test 1
2741 !! wikitext
2742 {{echo|[foo]|{{echo|[bar]}}}}
2743 !! html/php+tidy
2744 <p>[foo]</p>
2745 !! html/parsoid
2746 <p about="#mwt1" typeof="mw:Transclusion"
2747 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2748 !! end
2749
2750 !! test
2751 Parsoid: Pipes in external links in template parameter
2752 !! wikitext
2753 {{echo|[{{echo|http://example.com}} link]}}
2754 !! html/php+tidy
2755 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2756 !! html/parsoid
2757 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2758 !! end
2759
2760 !! test
2761 Parsoid: pipe in transclusion parameter
2762 !! wikitext
2763 {{echo|http://foo.com/a&#124;b}}
2764 !! html/php+tidy
2765 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2766 !! html/parsoid
2767 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2768 typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipe in external link target and content in template parameter
2774 !! options
2775 parsoid=html2wt,wt2wt
2776 !! wikitext
2777 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2778 !! html/php+tidy
2779 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2780 !! html/parsoid
2781 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2782 typeof="mw:Transclusion"
2783 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2784 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2789 !! options
2790 parsoid
2791 !! wikitext
2792 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2793 !! html
2794 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2795 !! end
2796
2797 !! test
2798 Templates: Don't escape already nowiki-escaped text in template parameters
2799 !! options
2800 parsoid=html2wt,wt2wt
2801 !! wikitext
2802 {{echo|foo<nowiki>|</nowiki>bar}}
2803 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2804 {{echo|<nowiki></nowiki>}}
2805 !! html/php+tidy
2806 <p>foo|bar &lt;div&gt;</p>
2807 !! html/parsoid
2808 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2809 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2810 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2811 </p>
2812 !! end
2813
2814 ## Bug 52824
2815 !! test
2816 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|{{echo|1=bar}}}}
2821 !! html/php+tidy
2822 <p>bar</p>
2823 !! html/parsoid
2824 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2825 !! end
2826
2827 ## Bug 56733
2828 !! test
2829 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2830 !! wikitext
2831 {{echo|a : b}}
2832 !! html/php+tidy
2833 <p>a&#160;: b</p>
2834 !! html/parsoid
2835 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2836 !! end
2837
2838 ## Bug T73412
2839 !! test
2840 Templates: Preserve blank parameter names
2841 !! wikitext
2842 {{echo|=foo}}
2843 !! html/php+tidy
2844 <p>{{{1}}}</p>
2845 !! html/parsoid
2846 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2847 !! end
2848
2849 !! test
2850 Templates: Preserve blank parameter names in other positions
2851 !! wikitext
2852 {{blank_param|bar|=foo}}
2853 !! html/php+tidy
2854 <p>bar foo</p>
2855 !! html/parsoid
2856 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2857 foo</p>
2858 !! end
2859
2860 ###
2861 ### Parsoid-centric tests for testing RT edge cases for pre
2862 ###
2863
2864 !!test
2865 1a. Indent-Pre and Comments
2866 !! wikitext
2867 a
2868 <!--a-->
2869 c
2870 !! html
2871 <pre>a
2872 </pre>
2873 <p>c
2874 </p>
2875 !!end
2876
2877 !!test
2878 1b. Indent-Pre and Comments
2879 !! wikitext
2880 a
2881 <!--a-->
2882 c
2883 !! html
2884 <pre>a
2885 </pre>
2886 <p>c
2887 </p>
2888 !!end
2889
2890 !!test
2891 1c. Indent-Pre and Comments
2892 !! wikitext
2893 <!--a--> a
2894
2895 <!--a--> a
2896 !! html
2897 <pre> a
2898 </pre>
2899 <pre> a
2900 </pre>
2901 !!end
2902
2903 !!test
2904 1d. Indent-Pre and Comments
2905 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2906 !! wikitext
2907 <!--a--> a
2908
2909 <!--b-->b
2910 !! html
2911 <pre>a
2912 </pre>
2913 <pre>b
2914 </pre>
2915 !!end
2916
2917 !!test
2918 2a. Indent-Pre and tables
2919 !! wikitext
2920 {|
2921 |-
2922 !h1!!h2
2923 |foo||bar
2924 |}
2925 !! html
2926 <table>
2927
2928 <tr>
2929 <th>h1</th>
2930 <th>h2
2931 </th>
2932 <td>foo</td>
2933 <td>bar
2934 </td></tr></table>
2935
2936 !!end
2937
2938 !!test
2939 2b. Indent-Pre and tables
2940 !! wikitext
2941 {|
2942 |-
2943 |foo
2944 |}
2945 !! html
2946 <table>
2947
2948 <tr>
2949 <td>foo
2950 </td></tr></table>
2951
2952 !!end
2953
2954 !!test
2955 2c. Indent-Pre and tables (bug 42252)
2956 !! wikitext
2957 {|
2958 |+ foo
2959 ! | bar
2960 |}
2961 !! html
2962 <table>
2963 <caption> foo
2964 </caption>
2965 <tr>
2966 <th> bar
2967 </th></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2d. Indent-Pre and tables
2973 !! wikitext
2974 a
2975 {|
2976 | b
2977 |}
2978 !! html/php
2979 <pre>a
2980 </pre>
2981 <table>
2982 <tr>
2983 <td> b
2984 </td></tr></table>
2985
2986 !! html/parsoid
2987 <pre>a</pre>
2988 <table>
2989 <tbody><tr><td> b</td></tr>
2990 </tbody></table>
2991 !!end
2992
2993 !!test
2994 2e. Indent-Pre and table-line syntax
2995 !! wikitext
2996 a
2997 | b
2998 | c
2999 !! html/php
3000 <pre>a
3001 | b
3002 | c
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2f. Indent-pre started by table-line syntax
3008 !! wikitext
3009 a
3010 | b
3011 | c
3012 !! html/php
3013 <p>a
3014 </p>
3015 <pre>| b
3016 | c
3017 </pre>
3018 !! html/parsoid
3019 <p>a</p>
3020 <pre>
3021 | b
3022 | c</pre>
3023 !!end
3024
3025 !!test
3026 3a. Indent-Pre and block tags (single-line html)
3027 !! wikitext
3028 a <p> foo </p>
3029 b <div> foo </div>
3030 c <blockquote> foo </blockquote>
3031 <span> foo </span>
3032 !! html
3033 a <p> foo </p>
3034 b <div> foo </div>
3035 c <blockquote> foo </blockquote>
3036 <pre><span> foo </span>
3037 </pre>
3038 !! html/parsoid
3039 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3040 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3041 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3042 <pre><span> foo </span>
3043 </pre>
3044 !! html+tidy
3045 <p>a</p>
3046 <p>foo</p>
3047 <p>b</p>
3048 <div>foo</div>
3049 <p>c</p>
3050 <blockquote>
3051 <p>foo</p>
3052 </blockquote>
3053 <pre>
3054 <span> foo </span>
3055 </pre>
3056 !! end
3057
3058 !!test
3059 3b. Indent-Pre and block tags (multi-line html)
3060 !! wikitext
3061 a <span>foo</span>
3062 b <div> foo </div>
3063 !! html
3064 <pre>a <span>foo</span>
3065 </pre>
3066 b <div> foo </div>
3067
3068 !! html/parsoid
3069 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3070 b <div data-parsoid='{"stx":"html"}'> foo </div>
3071 !! html+tidy
3072 <pre>
3073 a <span>foo</span>
3074 </pre>
3075 <p>b</p>
3076 <div>foo</div>
3077 !!end
3078
3079 !!test
3080 3c. Indent-Pre and block tags (pre-content on separate line)
3081 !! wikitext
3082 <p>
3083 foo
3084 </p>
3085
3086 <div>
3087 foo
3088 </div>
3089
3090 <center>
3091 foo
3092 </center>
3093
3094 <blockquote>
3095 foo
3096 </blockquote>
3097
3098 <blockquote>
3099 <pre>
3100 foo
3101 </pre>
3102 </blockquote>
3103
3104 <table><tr><td>
3105 foo
3106 </td></tr></table>
3107
3108 <ul><li>
3109 foo
3110 </li></ul>
3111
3112 !! html
3113 <p>
3114 foo
3115 </p>
3116 <div>
3117 <pre>foo
3118 </pre>
3119 </div>
3120 <center>
3121 <pre>foo
3122 </pre>
3123 </center>
3124 <blockquote>
3125 <p> foo
3126 </p>
3127 </blockquote>
3128 <blockquote>
3129 <pre>
3130 foo
3131 </pre>
3132 </blockquote>
3133 <table><tr><td>
3134 <pre>foo
3135 </pre>
3136 </td></tr></table>
3137 <ul><li>
3138 foo
3139 </li></ul>
3140
3141 !!end
3142
3143 !!test
3144 4. Indent-Pre and extension tags
3145 !! wikitext
3146 a <gallery>
3147 File:foobar.jpg
3148 </gallery>
3149 !! html
3150 a <ul class="gallery mw-gallery-traditional">
3151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3152 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3153 <div class="gallerytext">
3154 </div>
3155 </div></li>
3156 </ul>
3157
3158 !! html+tidy
3159 <p>a</p>
3160 <ul class="gallery mw-gallery-traditional">
3161 <li class="gallerybox" style="width: 155px">
3162 <div style="width: 155px">
3163 <div class="thumb" style="width: 150px;">
3164 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3165 </div>
3166 <div class="gallerytext"></div>
3167 </div>
3168 </li>
3169 </ul>
3170 !!end
3171
3172 !! test
3173 Table wikitext syntax outside wiki-tables
3174 !! wikitext
3175 a
3176 ! not a table heading
3177 |- not a table row
3178 | not a table cell
3179 | class="foo bar" | baz
3180 b
3181 |}
3182 |-
3183 c
3184 !! html
3185 <p>a
3186 ! not a table heading
3187 |- not a table row
3188 | not a table cell
3189 | class="foo bar" | baz
3190 b
3191 |}
3192 |-
3193 c
3194 </p>
3195 !! end
3196
3197 !!test
3198 Render paragraphs when indent-pre is suppressed in blocklevels
3199 !! wikitext
3200 <blockquote>
3201 foo
3202
3203 bar
3204 </blockquote>
3205 !! html
3206 <blockquote>
3207 <p> foo
3208 </p><p> bar
3209 </p>
3210 </blockquote>
3211
3212 !!end
3213
3214 !!test
3215 4. Multiple spaces at start-of-line
3216 !! wikitext
3217 <p> foo </p>
3218 foo
3219 {|
3220 |foo
3221 |}
3222 !! html
3223 <p> foo </p>
3224 <pre> foo
3225 </pre>
3226 <table>
3227 <tr>
3228 <td>foo
3229 </td></tr></table>
3230
3231 !!end
3232
3233 ## NOTE: the leading white-space chars on empty line are significant
3234 !! test
3235 5a. White-space in indent-pre
3236 !! wikitext
3237 a<br />
3238
3239 b
3240 !! html
3241 <pre>a<br />
3242
3243 b
3244 </pre>
3245 !! end
3246
3247 ## NOTE: the leading white-space chars on empty line are significant
3248 !! test
3249 5b. White-space in indent-pre
3250 !! wikitext
3251 a
3252
3253 b
3254
3255
3256 c
3257 !! html
3258 <pre>a
3259
3260 b
3261
3262
3263 c
3264 </pre>
3265 !! end
3266
3267 !! test
3268 5c. White-space in indent-pre
3269 !! wikitext
3270 ''a''
3271 ''b''
3272 ''c''
3273 !! html
3274 <pre><i>a</i>
3275 <i>b</i>
3276 <i>c</i>
3277 </pre>
3278 !! end
3279
3280 !! test
3281 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3282 !! wikitext
3283 a
3284
3285 <!-- continue -->
3286 b
3287
3288 c
3289
3290 d
3291 !! html
3292 <pre>a
3293
3294 b
3295 </pre>
3296 <pre>c
3297
3298 </pre>
3299 <p>d
3300 </p>
3301 !! end
3302
3303 !! test
3304 7a. Indent-pre and category links
3305 !! options
3306 parsoid=wt2html,wt2wt
3307 !! wikitext
3308 [[Category:foo]] <!-- No pre-wrapping -->
3309 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3310 !! html/php+tidy
3311 !! html/parsoid
3312 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3313 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3314 !! end
3315
3316 !! test
3317 7b. Indent-pre and category links
3318 !! options
3319 parsoid=wt2html,wt2wt
3320 !! wikitext
3321 [[Category:foo]] a
3322 [[Category:foo]] {{echo|b}}
3323 !! html
3324 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3325 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3326 !! end
3327
3328 !! test
3329 Indent-Pre: Newlines in comments shouldn't affect sol state
3330 !! wikitext
3331 a <!--
3332 foo
3333 --> b
3334 !! html/php+tidy
3335 <p>a b</p>
3336 !! html/parsoid
3337 <p>a <!--
3338 foo
3339 --> b</p>
3340 !! end
3341
3342 ###
3343 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3344 ###
3345
3346 !!test
3347 HTML-pre: 1. embedded newlines
3348 !! wikitext
3349 <pre>foo</pre>
3350
3351 <pre>
3352 foo
3353 </pre>
3354
3355 <pre>
3356
3357 foo
3358 </pre>
3359
3360 <pre>
3361
3362
3363 foo
3364 </pre>
3365 !! html/php+tidy
3366 <pre>
3367 foo
3368 </pre>
3369 <pre>
3370 foo
3371 </pre>
3372 <pre>
3373
3374 foo
3375 </pre>
3376 <pre>
3377
3378
3379 foo
3380 </pre>
3381 !! html/parsoid
3382 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3383
3384 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3385 foo
3386 </pre>
3387
3388 <pre data-parsoid='{"stx":"html"}'>
3389
3390 foo
3391 </pre>
3392
3393 <pre data-parsoid='{"stx":"html"}'>
3394
3395
3396 foo
3397 </pre>
3398 !!end
3399
3400 !! test
3401 HTML-pre: big spaces
3402 !! wikitext
3403 <pre>
3404
3405
3406
3407
3408 haha
3409
3410
3411
3412
3413 haha
3414
3415
3416
3417
3418 </pre>
3419 !! html/php+tidy
3420 <pre>
3421
3422
3423
3424
3425 haha
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 </pre>
3436 !! html/parsoid
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440
3441
3442 haha
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 </pre>
3453 !! end
3454
3455 !!test
3456 HTML-pre: 2: indented text
3457 !! wikitext
3458 <pre>
3459 foo
3460 </pre>
3461 !! html
3462 <pre>
3463 foo
3464 </pre>
3465
3466 !!end
3467
3468 !!test
3469 HTML-pre: 3: other wikitext
3470 !! wikitext
3471 <pre>
3472 * foo
3473 # bar
3474 = no-h =
3475 '' no-italic ''
3476 [[ NoLink ]]
3477 </pre>
3478 !! html/php
3479 <pre>
3480 * foo
3481 # bar
3482 = no-h =
3483 '' no-italic ''
3484 [[ NoLink ]]
3485 </pre>
3486
3487 !! html/parsoid
3488 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3489 # bar
3490 = no-h =
3491 '' no-italic ''
3492 [[ NoLink ]]
3493 </pre>
3494 !!end
3495
3496 ###
3497 ### Definition lists
3498 ###
3499 !! test
3500 Simple definition
3501 !! wikitext
3502 ; name : Definition
3503 !! html
3504 <dl><dt> name&#160;</dt>
3505 <dd> Definition</dd></dl>
3506
3507 !! end
3508
3509 !! test
3510 Definition list for indentation only
3511 !! wikitext
3512 : Indented text
3513 !! html
3514 <dl><dd> Indented text</dd></dl>
3515
3516 !! end
3517
3518 !! test
3519 Definition list with no space
3520 !! wikitext
3521 ;name:Definition
3522 !! html
3523 <dl><dt>name</dt>
3524 <dd>Definition</dd></dl>
3525
3526 !!end
3527
3528 !! test
3529 Definition list with URL link
3530 !! wikitext
3531 ; http://example.com/ : definition
3532 !! html
3533 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3534 <dd> definition</dd></dl>
3535
3536 !! end
3537
3538 !! test
3539 Definition list with bracketed URL link
3540 !! wikitext
3541 ;[http://www.example.com/ Example]:Something about it
3542 !! html
3543 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3544 <dd>Something about it</dd></dl>
3545
3546 !! end
3547
3548 !! test
3549 Definition list with wikilink containing colon
3550 !! wikitext
3551 ; [[Help:FAQ]]: The least-read page on Wikipedia
3552 !! html
3553 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3554 <dd> The least-read page on Wikipedia</dd></dl>
3555
3556 !! end
3557
3558 # At Brion's and JeLuF's insistence... :)
3559 !! test
3560 Definition list with news link containing colon
3561 !! wikitext
3562 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3563 !! html/php
3564 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3565 <dd> This isn't even a real newsgroup!</dd></dl>
3566
3567 !! html/parsoid
3568 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3569 !! end
3570
3571 !! test
3572 Malformed definition list with colon
3573 !! wikitext
3574 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3575 !! html
3576 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3577
3578 !! end
3579
3580 !! test
3581 Definition lists: colon in external link text
3582 !! wikitext
3583 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3584 !! html
3585 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3586 <dd> OK, I made that up</dd></dl>
3587
3588 !! end
3589
3590 !! test
3591 Definition lists: colon in HTML attribute
3592 !! wikitext
3593 ;<b style="display: inline">bold</b>
3594 !! html
3595 <dl><dt><b style="display: inline">bold</b></dt></dl>
3596
3597 !! end
3598
3599 !! test
3600 Definition lists: self-closed tag
3601 !! wikitext
3602 ;one<br/>two : two-line fun
3603 !! html
3604 <dl><dt>one<br />two&#160;</dt>
3605 <dd> two-line fun</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Bug 11748: Literal closing tags
3611 !! wikitext
3612 <dl>
3613 <dt>test 1</dt>
3614 <dd>test test test test test</dd>
3615 <dt>test 2</dt>
3616 <dd>test test test test test</dd>
3617 </dl>
3618 !! html
3619 <dl>
3620 <dt>test 1</dt>
3621 <dd>test test test test test</dd>
3622 <dt>test 2</dt>
3623 <dd>test test test test test</dd>
3624 </dl>
3625
3626 !! end
3627
3628 !! test
3629 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3630 !! wikitext
3631 <ul><li>
3632 ; term : description
3633 * unordered
3634 </li></ul>
3635 !! html
3636 <ul><li>
3637 <dl><dt> term&#160;</dt>
3638 <dd> description</dd></dl>
3639 <ul><li> unordered</li></ul>
3640 </li></ul>
3641
3642 !! end
3643
3644 !! test
3645
3646 Definition list with empty definition and following paragraph
3647 !! wikitext
3648 ; term:
3649 Paragraph text
3650 !! html
3651 <dl><dt> term</dt>
3652 <dd></dd></dl>
3653 <p>Paragraph text
3654 </p>
3655 !! end
3656
3657 !! test
3658 Nested definition lists using html syntax
3659 !! wikitext
3660 <dl><dt>x</dt>
3661 <dd>a</dd>
3662 <dd>b</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition Lists: No nesting: Multiple dd's
3668 !! wikitext
3669 ;x
3670 :a
3671 :b
3672 !! html
3673 <dl><dt>x</dt>
3674 <dd>a</dd>
3675 <dd>b</dd></dl>
3676
3677 !! end
3678
3679 !! test
3680 Definition Lists: Indentation: Regular
3681 !! wikitext
3682 :i1
3683 ::i2
3684 :::i3
3685 !! html
3686 <dl><dd>i1
3687 <dl><dd>i2
3688 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: Indentation: Missing 1st level
3694 !! wikitext
3695 ::i2
3696 :::i3
3697 !! html
3698 <dl><dd><dl><dd>i2
3699 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: Indentation: Multi-level indent
3705 !! wikitext
3706 :::i3
3707 !! html
3708 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition Lists: Hacky use to indent tables
3714 !! wikitext
3715 ::{|
3716 |foo
3717 |bar
3718 |}
3719 this text
3720 should be left alone
3721 !! html
3722 <dl><dd><dl><dd><table>
3723 <tr>
3724 <td>foo
3725 </td>
3726 <td>bar
3727 </td></tr></table></dd></dl></dd></dl>
3728 <p>this text
3729 should be left alone
3730 </p>
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3735 !! wikitext
3736 <!-- foo -->
3737 ::{|
3738 |foo
3739 |bar
3740 |}<!-- bar -->
3741 this text
3742 should be left alone
3743 !! html/parsoid
3744 <!-- foo -->
3745 <dl><dd><dl><dd><table><tr>
3746 <td>foo</td>
3747 <td>bar</td>
3748 </tr></table><!-- bar --></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone</p>
3751 !! end
3752
3753 !! test
3754 Definition Lists: Hacky use to indent tables, with comment before table
3755 !! wikitext
3756 ::<!-- foo -->{|
3757 |foo
3758 |}
3759 !! html/parsoid
3760 <dl><dd><dl><dd><!-- foo --><table><tr>
3761 <td>foo</td>
3762 </tr></table></dd></dl></dd></dl>
3763 !! end
3764
3765 # The trailing whitespace in this test is to catch a regression in
3766 # Parsoid after T54473.
3767 !! test
3768 Definition Lists: Hacky use to indent tables (WS-insensitive)
3769 !! wikitext
3770 : {|
3771 |a
3772 |}
3773 !! html/php
3774 <dl><dd><table>
3775 <tr>
3776 <td>a
3777 </td></tr></table></dd></dl>
3778
3779 !! html/parsoid
3780 <dl><dd> <table>
3781 <tbody><tr><td>a</td></tr>
3782 </tbody></table> </dd></dl>
3783 !! end
3784
3785 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3786 ## as an empty dt item. It also ignores all but the last ";" when followed
3787 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3788 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3789 ## ";"s.
3790 ##
3791 ## Ex: ";;t2 ::d2" is transformed into:
3792 ##
3793 ## <dl>
3794 ## <dt>t2 </dt>
3795 ## <dd>
3796 ## <dl>
3797 ## <dt></dt>
3798 ## <dd>d2</dd>
3799 ## </dl>
3800 ## </dd>
3801 ## </dl>
3802 ##
3803 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3804 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3805 ##
3806 ## <dl>
3807 ## <dt>
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>:d2</dd>
3811 ## </dl>
3812 ## </dt>
3813 ## </dl>
3814 ##
3815 ## All Parsoid only definition list tests have this difference.
3816 ##
3817 ## See also: https://phabricator.wikimedia.org/T8569
3818 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3819
3820 !! test
3821 Table / list interaction: indented table with lists in table contents
3822 !! wikitext
3823 :{|
3824 |-
3825 | a
3826 * b
3827 |-
3828 | c
3829 * d
3830 |}
3831 !! html
3832 <dl><dd><table>
3833
3834 <tr>
3835 <td> a
3836 <ul><li> b</li></ul>
3837 </td></tr>
3838 <tr>
3839 <td> c
3840 <ul><li> d</li></ul>
3841 </td></tr></table></dd></dl>
3842
3843 !! end
3844
3845 !!test
3846 Table / list interaction: lists nested in tables nested in indented lists
3847 !! wikitext
3848 :{|
3849 |
3850 :a
3851 :b
3852 |
3853 *c
3854 *d
3855 |}
3856
3857 *e
3858 *f
3859 !! html
3860 <dl><dd><table>
3861 <tr>
3862 <td>
3863 <dl><dd>a</dd>
3864 <dd>b</dd></dl>
3865 </td>
3866 <td>
3867 <ul><li>c</li>
3868 <li>d</li></ul>
3869 </td></tr></table></dd></dl>
3870 <ul><li>e</li>
3871 <li>f</li></ul>
3872
3873 !!end
3874
3875 !! test
3876 Definition Lists: Nesting: Multi-level (Parsoid only)
3877 !! options
3878 parsoid
3879 !! wikitext
3880 ;t1 :d1
3881 ;;t2 ::d2
3882 ;;;t3 :::d3
3883 !! html
3884 <dl>
3885 <dt>t1 </dt>
3886 <dd>d1</dd>
3887 <dt>
3888 <dl>
3889 <dt>t2 </dt>
3890 <dd>:d2</dd>
3891 <dt>
3892 <dl>
3893 <dt>t3 </dt>
3894 <dd>::d3</dd>
3895 </dl>
3896 </dt>
3897 </dl>
3898 </dt>
3899 </dl>
3900
3901
3902 !! end
3903
3904
3905 !! test
3906 Definition Lists: Nesting: Test 2 (Parsoid only)
3907 !! wikitext
3908 ;t1
3909 ::d2
3910 !! html/php+tidy
3911 <dl>
3912 <dt>t1</dt>
3913 <dd>
3914 <dl>
3915 <dd>d2</dd>
3916 </dl>
3917 </dd>
3918 </dl>
3919 !! html/parsoid
3920 <dl>
3921 <dt>t1</dt>
3922 <dd>
3923 <dl>
3924 <dd>d2</dd>
3925 </dl>
3926 </dd>
3927 </dl>
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 3 (Parsoid only)
3934 !! wikitext
3935 :;t1
3936 ::::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dd>
3940 <dl>
3941 <dt>t1</dt>
3942 <dd>
3943 <dl>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954 !! html/parsoid
3955 <dl>
3956 <dd>
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971
3972 !! end
3973
3974
3975 !! test
3976 Definition Lists: Nesting: Test 4
3977 !! wikitext
3978 ::;t3
3979 :::d3
3980 !! html
3981 <dl><dd><dl><dd><dl><dt>t3</dt>
3982 <dd>d3</dd></dl></dd></dl></dd></dl>
3983
3984 !! end
3985
3986
3987 ## The Parsoid team believes the following three test exposes a
3988 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3989 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3990 ## It also exposes a "misfeature" in tidy, which doesn't like
3991 ## <dl> tags with a single <dt> child; it converts the <dt> into
3992 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3993 !! test
3994 Definition Lists: Mixed Lists: Test 1
3995 !! wikitext
3996 :;* foo
3997 ::* bar
3998 :; baz
3999 !! html/php
4000 <dl><dd><dl><dt><ul><li> foo</li>
4001 <li> bar</li></ul></dt></dl>
4002 <dl><dt> baz</dt></dl></dd></dl>
4003
4004 !! html/php+tidy
4005 <dl>
4006 <dd>
4007 <dl>
4008 <dd>
4009 <ul>
4010 <li>foo</li>
4011 <li>bar</li>
4012 </ul>
4013 </dd>
4014 </dl>
4015 <dl>
4016 <dt>baz</dt>
4017 </dl>
4018 </dd>
4019 </dl>
4020 !! html/parsoid
4021 <dl>
4022 <dd><dl>
4023 <dt><ul>
4024 <li> foo
4025 </li>
4026 </ul></dt>
4027 <dd><ul>
4028 <li> bar
4029 </li>
4030 </ul></dd>
4031 <dt> baz</dt>
4032 </dl></dd>
4033 </dl>
4034 !! end
4035
4036 !! test
4037 Definition Lists: Mixed Lists: Test 2
4038 !! wikitext
4039 *: d1
4040 *: d2
4041 !! html
4042 <ul><li><dl><dd> d1</dd>
4043 <dd> d2</dd></dl></li></ul>
4044
4045 !! end
4046
4047
4048 !! test
4049 Definition Lists: Mixed Lists: Test 3
4050 !! wikitext
4051 *::: d1
4052 *::: d2
4053 !! html
4054 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4055 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4056
4057 !! end
4058
4059
4060 !! test
4061 Definition Lists: Mixed Lists: Test 4
4062 !! wikitext
4063 *;d1 :d2
4064 *;d3 :d4
4065 !! html
4066 <ul><li><dl><dt>d1&#160;</dt>
4067 <dd>d2</dd>
4068 <dt>d3&#160;</dt>
4069 <dd>d4</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 5
4076 !! wikitext
4077 *:d1
4078 *:: d2
4079 !! html
4080 <ul><li><dl><dd>d1
4081 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 6
4088 !! wikitext
4089 #*:d1
4090 #*::: d3
4091 !! html
4092 <ol><li><ul><li><dl><dd>d1
4093 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4094
4095 !! end
4096
4097
4098 !! test
4099 Definition Lists: Mixed Lists: Test 7
4100 !! wikitext
4101 :* d1
4102 :* d2
4103 !! html
4104 <dl><dd><ul><li> d1</li>
4105 <li> d2</li></ul></dd></dl>
4106
4107 !! end
4108
4109
4110 !! test
4111 Definition Lists: Mixed Lists: Test 8
4112 !! wikitext
4113 :* d1
4114 ::* d2
4115 !! html
4116 <dl><dd><ul><li> d1</li></ul>
4117 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 9
4124 !! wikitext
4125 *;foo :bar
4126 !! html
4127 <ul><li><dl><dt>foo&#160;</dt>
4128 <dd>bar</dd></dl></li></ul>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 10
4135 !! wikitext
4136 *#;foo :bar
4137 !! html
4138 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4139 <dd>bar</dd></dl></li></ol></li></ul>
4140
4141 !! end
4142
4143 # The Parsoid team disagrees with the PHP parser's seemingly-random
4144 # rules regarding dd/dt on the next two tests. Parsoid is more
4145 # consistent, and recognizes the shared nesting and keeps the
4146 # still-open tags around until the nesting is complete.
4147 # (And tidy again converts <dt> to <dd> before 'bar'.)
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 11
4151 !! wikitext
4152 *#*#;*;;foo :bar
4153 *#*#;boo :baz
4154 !! html/php
4155 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4156 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4157 <dl><dt>boo&#160;</dt>
4158 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4159
4160 !! html/php+tidy
4161 <ul>
4162 <li>
4163 <ol>
4164 <li>
4165 <ul>
4166 <li>
4167 <ol>
4168 <li>
4169 <dl>
4170 <dt>foo&#160;</dt>
4171 <dd>
4172 <ul>
4173 <li>
4174 <dl>
4175 <dd>
4176 <dl>
4177 <dt>bar</dt>
4178 </dl>
4179 </dd>
4180 </dl>
4181 </li>
4182 </ul>
4183 </dd>
4184 </dl>
4185 <dl>
4186 <dt>boo&#160;</dt>
4187 <dd>baz</dd>
4188 </dl>
4189 </li>
4190 </ol>
4191 </li>
4192 </ul>
4193 </li>
4194 </ol>
4195 </li>
4196 </ul>
4197 !! html/parsoid
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>
4208 <ul>
4209 <li>
4210 <dl>
4211 <dt>
4212 <dl>
4213 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4214 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4215 </dl></dt>
4216 </dl></li>
4217 </ul></dt>
4218 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4219 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4220 </dl></li>
4221 </ol></li>
4222 </ul></li>
4223 </ol></li>
4224 </ul>
4225 !! end
4226
4227
4228 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4229 # From whitelist:
4230 # * The test is wrong, there are two colons where there should be :;
4231 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4232 !! test
4233 Definition Lists: Weird Ones: Test 1
4234 !! wikitext
4235 *#;*::;; foo : bar (who uses this?)
4236 !! html/php
4237 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4238 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <dl>
4246 <dt>foo&#160;</dt>
4247 <dd>
4248 <ul>
4249 <li>
4250 <dl>
4251 <dd>
4252 <dl>
4253 <dd>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar (who uses this?)</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </dd>
4264 </dl>
4265 </li>
4266 </ul>
4267 </dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 !! html/parsoid
4274 <ul>
4275 <li>
4276 <ol>
4277 <li>
4278 <dl>
4279 <dt>
4280 <ul>
4281 <li>
4282 <dl>
4283 <dd>
4284 <dl>
4285 <dd>
4286 <dl>
4287 <dt>
4288 <dl>
4289 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4290 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4291 </dl></dt>
4292 </dl></dd>
4293 </dl></dd>
4294 </dl></li>
4295 </ul></dt>
4296 </dl></li>
4297 </ol></li>
4298 </ul>
4299 !! end
4300
4301 !! test
4302 Definition Lists: colons occurring in tags
4303 !! wikitext
4304 ;a:b
4305 ;'''a:b'''
4306 ;<i>a:b</i>
4307 ;<span>a:b</span>
4308 ;<div>a:b</div>
4309 ;<div>a
4310 :b</div>
4311 ;{{echo|a:b}}
4312 ;{{echo|''a:b''}}
4313 ;;;''a:b''
4314 !! html+tidy
4315 <dl>
4316 <dt>a</dt>
4317 <dd>b</dd>
4318 <dt><b>a:b</b></dt>
4319 <dt><i>a:b</i></dt>
4320 <dt><span>a:b</span></dt>
4321 <dd>
4322 <div>a:b</div>
4323 </dd>
4324 <dd>
4325 <div>a
4326 <dl>
4327 <dd>b</dd>
4328 </dl>
4329 </div>
4330 </dd>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><i>a:b</i></dt>
4334 </dl>
4335 <dl>
4336 <dd>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dt><i>a:b</i></dt>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </dd>
4345 </dl>
4346 !! html/parsoid
4347 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4348 <dt><b>a:b</b></dt>
4349 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4350 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4351 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4352 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4353 <dd>b</dd>
4354 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4355 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4356 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4357 !! end
4358
4359 !! test
4360 Definition Lists: colons and tables 1
4361 !! wikitext
4362 :{|
4363 | x
4364 |}
4365 :{|
4366 | y
4367 |}
4368 !! html
4369 <dl><dd><table>
4370 <tr>
4371 <td> x
4372 </td></tr></table></dd></dl>
4373 <dl><dd><table>
4374 <tr>
4375 <td> y
4376 </td></tr></table></dd></dl>
4377
4378 !! end
4379
4380 # Parsoid's output (as documented below) differs from php's in this case.
4381 # This is probably a bug. If we fixup parsoid to match php's output, the
4382 # above test should pass and the below test case can be removed. It is
4383 # unclear which output is more desirable.
4384
4385 !! test
4386 Definition Lists: colons and tables 2
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html/parsoid
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd>
4399 <dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403 !! end
4404
4405 !! test
4406 Definition Lists: template interaction
4407 !! wikitext
4408 ::{{definition_list}}
4409
4410 :one
4411 ::{{definition_list}}
4412 :::two
4413 :::three
4414 ::four
4415 !! html/parsoid
4416 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4417 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4418
4419 <dl><dd data-parsoid='{}'>one
4420 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4421 </span><dd about="#mwt2">two
4422 <dl><dd>two</dd>
4423 <dd>three</dd></dl></dd>
4424 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 ###
4429 ### External links
4430 ###
4431 !! test
4432 External links: non-bracketed
4433 !! wikitext
4434 Non-bracketed: http://example.com
4435 !! html
4436 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4437 </p>
4438 !! end
4439
4440 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4441 !! test
4442 External links: numbered
4443 !! wikitext
4444 Numbered: [http://example.com]
4445 Numbered: [http://example.net]
4446 Numbered: [http://example.com]
4447 !! html/php
4448 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4449 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4450 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4451 </p>
4452 !! html/parsoid
4453 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4454 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4455 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4456 !!end
4457
4458 !! test
4459 External links: specified text
4460 !! wikitext
4461 Specified text: [http://example.com link]
4462 !! html
4463 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4464 </p>
4465 !!end
4466
4467 !! test
4468 External links: trail
4469 !! wikitext
4470 Linktrails should not work for external links: [http://example.com link]s
4471 !! html
4472 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4473 </p>
4474 !! end
4475
4476 !! test
4477 External links: dollar sign in URL
4478 !! wikitext
4479 http://example.com/1$2345
4480 !! html
4481 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4482 </p>
4483 !! end
4484
4485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4486 !! test
4487 External links: dollar sign in URL (autonumber)
4488 !! wikitext
4489 [http://example.com/1$2345]
4490 !! html/php
4491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4492 </p>
4493 !! html/parsoid
4494 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4495 !!end
4496
4497 !! test
4498 External links: open square bracket forbidden in URL (bug 4377)
4499 !! options
4500 parsoid=wt2html,wt2wt,html2html
4501 !! wikitext
4502 http://example.com/1[2345
4503 !! html/php
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4505 </p>
4506 !! html/parsoid
4507 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4508 !! end
4509
4510 !! test
4511 External links: open square bracket forbidden in URL (named) (bug 4377)
4512 !! options
4513 parsoid=wt2html,html2html
4514 !! wikitext
4515 [http://example.com/1[2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4521 !!end
4522
4523 # parsoid adds a space before the link name
4524 !! test
4525 External links: open square bracket forbidden in URL (named) (bug 4377)
4526 Parsoid variant.
4527 !! wikitext
4528 [http://example.com/1 [2345]
4529 !! html
4530 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4531 </p>
4532 !!end
4533
4534 !! test
4535 External links: nowiki in URL link text (bug 6230)
4536 !! wikitext
4537 [http://example.com/ <nowiki>''example site''</nowiki>]
4538 !! html
4539 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: newline forbidden in text (bug 6230 regression check)
4545 !! wikitext
4546 [http://example.com/ first
4547 second]
4548 !! html
4549 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4550 second]
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: Pipe char between url and text
4556 !! wikitext
4557 [http://example.com | link]
4558 !! html
4559 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4560 </p>
4561 !!end
4562
4563 !! test
4564 External links: protocol-relative URL in brackets
4565 !! wikitext
4566 [//example.com/ Test]
4567 !! html
4568 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: protocol-relative URL in brackets without text
4575 !! wikitext
4576 [//example.com]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4582 !! end
4583
4584 !! test
4585 External links: protocol-relative URL in free text is left alone
4586 !! wikitext
4587 //example.com/Foo
4588 !! html
4589 <p>//example.com/Foo
4590 </p>
4591 !!end
4592
4593 !! test
4594 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4595 !! wikitext
4596 foo//example.com/Foo
4597 !! html
4598 <p>foo//example.com/Foo
4599 </p>
4600 !! end
4601
4602 !! test
4603 External links: with no contents
4604 !! wikitext
4605 [http://en.wikipedia.org/wiki/Foo]
4606
4607 [[wikipedia:Foo|Bar]]
4608
4609 [[wikipedia:Foo|<span>Bar</span>]]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4612 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4613 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4617 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4618 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4619 !! end
4620
4621 !! test
4622 External links: Free with trailing punctuation
4623 !! wikitext
4624 http://example.com,
4625 http://example.com;
4626 http://example.com\
4627 http://example.com.
4628 http://example.com:
4629 http://example.com!
4630 http://example.com?
4631 http://example.com)
4632 http://example.com/url_with_(brackets)
4633 (http://example.com/url_without_brackets)
4634 http://example.com/url_with_entity&nbsp;
4635 http://example.com/url_with_entity&#xA0;
4636 http://example.com/url_with_entity&#160;
4637 http://example.com/url_with_entity&lt;
4638 http://example.com/url_with_entity&#x3C;
4639 http://example.com/url_with_entity&#60;
4640 !! html/php
4641 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4642 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4647 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4649 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4650 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4651 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4652 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4653 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4654 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4655 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4656 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4660 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4661 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4662 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4663 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4664 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4665 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4666 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4667 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4670 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4671 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4672 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4673 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4674 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4675 !! end
4676
4677 !! test
4678 External links: Lone protocols are never linked (T105697)
4679 !! wikitext
4680 http://
4681 http://;
4682 (http://)
4683 bitcoin:
4684 bitcoin:;
4685 (bitcoin:)
4686 !! html
4687 <p>http://
4688 http://;
4689 (http://)
4690 bitcoin:
4691 bitcoin:;
4692 (bitcoin:)
4693 </p>
4694 !! end
4695
4696 !! test
4697 External links: No preceding word characters allowed (bug 65278)
4698 !! wikitext
4699 NOPEhttp://example.com
4700 N0http://example.com
4701 ok:http://example.com
4702 ok-http://example.com
4703 !! html
4704 <p>NOPEhttp://example.com
4705 N0http://example.com
4706 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4707 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4708 </p>
4709 !! end
4710
4711 !! test
4712 External image
4713 !! wikitext
4714 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4715 !! html
4716 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4717 </p>
4718 !! end
4719
4720 !! test
4721 External image from https
4722 !! wikitext
4723 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4724 !! html
4725 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4726 </p>
4727 !! end
4728
4729 !! test
4730 External image (when not allowed)
4731 !! options
4732 wgAllowExternalImages=0
4733 !! wikitext
4734 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4735 !! html
4736 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4737 </p>
4738 !! end
4739
4740 !! test
4741 Link to non-http image, no img tag
4742 !! wikitext
4743 Link to non-http image, no img tag: ftp://example.com/test.jpg
4744 !! html
4745 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4746 </p>
4747 !! end
4748
4749 !! test
4750 External links: terminating separator
4751 !! wikitext
4752 Terminating separator: http://example.com/thing,
4753 !! html
4754 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4755 </p>
4756 !! end
4757
4758 !! test
4759 External links: intervening separator
4760 !! wikitext
4761 Intervening separator: http://example.com/1,2,3
4762 !! html
4763 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4764 </p>
4765 !! end
4766
4767 !! test
4768 External links: old bug with URL in query
4769 !! wikitext
4770 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4771 !! html
4772 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4773 </p>
4774 !! end
4775
4776 !! test
4777 External links: old URL-in-URL bug, mixed protocols
4778 !! wikitext
4779 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4780 !! html
4781 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4782 </p>
4783 !!end
4784
4785 !! test
4786 External links: URL in text
4787 !! wikitext
4788 URL in text: [http://example.com http://example.com]
4789 !! html
4790 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4791 </p>
4792 !! end
4793
4794 !! test
4795 External links: Clickable images
4796 !! wikitext
4797 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4798 !! html/php
4799 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4800 </p>
4801 !! html/parsoid
4802 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4803 !! end
4804
4805 !! test
4806 External links: raw ampersand
4807 !! wikitext
4808 Old &amp; use: http://x&y
4809 !! html
4810 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External links: encoded ampersand
4816 !! wikitext
4817 Old &amp; use: http://x&amp;y
4818 !! html/php
4819 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4820 </p>
4821 !! html/parsoid
4822 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4823 !! end
4824
4825 !! test
4826 External links: encoded equals (bug 6102)
4827 !! wikitext
4828 http://example.com/?foo&#61;bar
4829 !! html/php
4830 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4831 </p>
4832 !! html/parsoid
4833 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4834 !! end
4835
4836 ##
4837 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4838 ## does it number them. As discussed in bug 53505, we can identify
4839 ## autonumbered links via CSS.
4840 ##
4841
4842 !! test
4843 External links: [raw ampersand]
4844 !! wikitext
4845 Old &amp; use: [http://x&y]
4846 !! html/php
4847 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4848 </p>
4849 !! html/parsoid
4850 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4851 !! end
4852
4853 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4854 # mode will return the [raw ampersand] wikitext
4855 !! test
4856 External links: [encoded ampersand]
4857 !! options
4858 parsoid=wt2html,wt2wt,html2html
4859 !! wikitext
4860 Old &amp; use: [http://x&amp;y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 !! test
4869 External links: [raw equals]
4870 !! wikitext
4871 [http://example.com/?foo=bar]
4872 !! html/php
4873 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4877 !! end
4878
4879 # note that parsoid html is identical to [raw equals] case; so html2wt
4880 # mode will return the [raw equals] wikitext
4881 !! test
4882 External links: [encoded equals] (bug 6102)
4883 !! options
4884 parsoid=wt2html,wt2wt,html2html
4885 !! wikitext
4886 [http://example.com/?foo&#61;bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # xxx parsoid strips the IDN character, so the round-trip tests will
4895 # obviously fail and are disabled. --cscott
4896 !! test
4897 External links: [IDN ignored character reference in hostname; strip it right off]
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://e&zwnj;xample.com/]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4907 !! end
4908
4909 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4910 # Where an external link could easily circumvent the sanitization of the text of
4911 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4912 # test demands a higher standard. That's a bit strange.
4913 #
4914 # Example:
4915 #
4916 # http://e‌xample.com -> [http://example.com|http://example.com]
4917 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4918 #
4919 # The first example is sanitized, but the second is not. Any security benefits
4920 # from this production are trivial to circumvent. Either remove this test and
4921 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4922 # the test accordingly.
4923 #
4924 # All our love,
4925 # The Parsoid team.
4926 # xxx parsoid strips the IDN character, so the round-trip tests will
4927 # obviously fail and are disabled. --cscott
4928 !! test
4929 External links: IDN ignored character reference in hostname; strip it right off
4930 !! options
4931 parsoid=wt2html,html2html
4932 !! wikitext
4933 http://e&zwnj;xample.com/
4934 !! html/php
4935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4936 </p>
4937 !! html/parsoid
4938 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4939 !! end
4940
4941 !! test
4942 External links: www.jpeg.org (bug 554)
4943 !! wikitext
4944 http://www.jpeg.org
4945 !! html
4946 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4951 !! test
4952 External links: URL within URL (original bug 2)
4953 !! wikitext
4954 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4960 !! end
4961
4962 !! test
4963 BUG 361: URL inside bracketed URL
4964 !! wikitext
4965 [http://www.example.com/foo http://www.example.com/bar]
4966 !! html
4967 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4968 </p>
4969 !! end
4970
4971 !! test
4972 BUG 361: URL within URL, not bracketed
4973 !! wikitext
4974 http://www.example.com/foo?=http://www.example.com/bar
4975 !! html
4976 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4977 </p>
4978 !! end
4979
4980 !! test
4981 BUG 289: ">"-token in URL-tail
4982 !! wikitext
4983 http://www.example.com/<hello>
4984 !! html
4985 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4986 </p>
4987 !!end
4988
4989 !! test
4990 BUG 289: literal ">"-token in URL-tail
4991 !! wikitext
4992 http://www.example.com/<b>html</b>
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4998 !! end
4999
5000 !! test
5001 BUG 289: ">"-token in bracketed URL
5002 !! wikitext
5003 [http://www.example.com/<hello> stuff]
5004 !! html
5005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5006 </p>
5007 !!end
5008
5009 !! test
5010 BUG 289: literal ">"-token in bracketed URL
5011 !! wikitext
5012 [http://www.example.com/<b>html</b> stuff]
5013 !! html
5014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5015 </p>
5016 !!end
5017
5018 !! test
5019 BUG 289: literal double quote at end of URL
5020 !! wikitext
5021 http://www.example.com/"hello"
5022 !! html
5023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5024 </p>
5025 !!end
5026
5027 !! test
5028 BUG 289: literal double quote in bracketed URL
5029 !! wikitext
5030 [http://www.example.com/"hello" stuff]
5031 !! html
5032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5033 </p>
5034 !!end
5035
5036 !! test
5037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5038 !! wikitext
5039 [http://www.example.com test]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 External links: link text with spaces
5047 !! wikitext
5048 [http://www.example.com a b c]
5049 [http://www.example.com ''a'' ''b'']
5050 !! html
5051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 External links: wiki links within external link (Bug 3695)
5058 !! wikitext
5059 [http://example.com [[wikilink]] embedded in ext link]
5060 !! html/php
5061 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5062 </p>
5063 !! html/parsoid
5064 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5065 !! end
5066
5067 !! test
5068 BUG 787: Links with one slash after the url protocol are invalid
5069 !! wikitext
5070 http:/example.com
5071
5072 [http:/example.com title]
5073 !! html
5074 <p>http:/example.com
5075 </p><p>[http:/example.com title]
5076 </p>
5077 !! end
5078
5079 !! test
5080 Bracketed external links with template-generated invalid target
5081 !! wikitext
5082 [{{echo|http:/example.com}} title]
5083 !! html
5084 <p>[http:/example.com title]
5085 </p>
5086 !! end
5087
5088 !! test
5089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5090 !! wikitext
5091 ''[http://example.com text'']
5092 [http://example.com '''text]'''
5093 ''Something [http://example.com in italic'']
5094 ''Something [http://example.com mixed''''', even bold]'''
5095 '''''Now [http://example.com both''''']
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5102 </p>
5103 !! end
5104
5105
5106 !! test
5107 Bug 4781: %26 in URL
5108 !! wikitext
5109 http://www.example.com/?title=AT%26T
5110 !! html/php
5111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5112 </p>
5113 !! html/parsoid
5114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5115 !! end
5116
5117 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5118 # % is actually legal in HTML5. Any change in output would need testing though.
5119 !! test
5120 Bug 4781, 5267: %25 in URL
5121 !! wikitext
5122 http://www.example.com/?title=100%25_Bran
5123 !! html/php
5124 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5125 </p>
5126 !! html/parsoid
5127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5128 !! end
5129
5130 !! test
5131 Bug 4781, 5267: %28, %29 in URL
5132 !! wikitext
5133 http://www.example.com/?title=Ben-Hur_%281959_film%29
5134 !! html/php
5135 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5136 </p>
5137 !! html/parsoid
5138 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5139 !! end
5140
5141
5142 !! test
5143 Bug 4781: %26 in autonumber URL
5144 !! wikitext
5145 [http://www.example.com/?title=AT%26T]
5146 !! html/php
5147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5148 </p>
5149 !! html/parsoid
5150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5151 !! end
5152
5153 !! test
5154 Bug 4781, 5267: %26 in autonumber URL
5155 !! wikitext
5156 [http://www.example.com/?title=100%25_Bran]
5157 !! html/php
5158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5159 </p>
5160 !! html/parsoid
5161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5162 !! end
5163
5164 !! test
5165 Bug 4781, 5267: %28, %29 in autonumber URL
5166 !! wikitext
5167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5168 !! html/php
5169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5170 </p>
5171 !! html/parsoid
5172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5173 !! end
5174
5175
5176 !! test
5177 Bug 4781: %26 in bracketed URL
5178 !! wikitext
5179 [http://www.example.com/?title=AT%26T link]
5180 !! html/php
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5185 !! end
5186
5187 !! test
5188 Bug 4781, 5267: %25 in bracketed URL
5189 !! wikitext
5190 [http://www.example.com/?title=100%25_Bran link]
5191 !! html
5192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in bracketed URL
5198 !! wikitext
5199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5200 !! html/php
5201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5202 </p>
5203 !! html/parsoid
5204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5205 !! end
5206
5207 !! test
5208 External link containing a period in the anchor. (bug 63947)
5209 !! wikitext
5210 [//foo.org/bar#baz. bang]
5211
5212 [//foo.org/bar. bang]
5213 !! html/php
5214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5216 </p>
5217 !! html/parsoid
5218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a single quote. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar'baz]
5226
5227 [//foo.org/bar'baz bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5235 !! end
5236
5237
5238 !! test
5239 External link containing a period in the anchor. (bug 63947)
5240 !! wikitext
5241 [//foo.org/bar#baz. bang]
5242
5243 [//foo.org/bar. bang]
5244 !! html/php
5245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5251 !! end
5252
5253 !! test
5254 External link containing a single quote. (bug 63947)
5255 !! wikitext
5256 [//foo.org/bar'baz]
5257
5258 [//foo.org/bar'baz bang]
5259 !! html/php
5260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5266 !! end
5267
5268
5269 !! test
5270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5271 !! wikitext
5272 Some [http://example.com/ pretty ''italics'' and stuff]!
5273 !! html
5274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5275 </p>
5276 !! end
5277
5278 !! test
5279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5280 !! wikitext
5281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5282 !! html
5283 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5284 </p>
5285 !! end
5286
5287 !! test
5288 External link containing double-single-quotes with no space separating the url from text in italics
5289 !! wikitext
5290 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5291 !! html/php
5292 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5293 </p>
5294 !! html/php+tidy
5295 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5296 !! html/parsoid
5297 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5298 !! end
5299
5300 !! test
5301 External link with comments in link text
5302 !! wikitext
5303 [http://www.google.com Google <!-- comment -->]
5304 !! html
5305 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5306 </p>
5307 !! end
5308
5309 !! test
5310 URL-encoding in URL functions (single parameter)
5311 !! wikitext
5312 {{localurl:Some page|amp=&}}
5313 !! html
5314 <p>/index.php?title=Some_page&amp;amp=&amp;
5315 </p>
5316 !! end
5317
5318 !! test
5319 URL-encoding in URL functions (multiple parameters)
5320 !! wikitext
5321 {{localurl:Some page|q=?&amp=&}}
5322 !! html
5323 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5324 </p>
5325 !! end
5326
5327 !! test
5328 Brackets in urls
5329 !! wikitext
5330 http://example.com/index.php?foozoid%5B%5D=bar
5331
5332 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5333 !! html/php
5334 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5335 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5339
5340 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5341 !! end
5342
5343 !! test
5344 IPv6 urls, autolink format (T23261)
5345 !! wikitext
5346 http://[2404:130:0:1000::187:2]/index.php
5347
5348 Examples from RFC2373, section 2.2:
5349 * http://[1080::8:800:200C:417A]/unicast
5350 * http://[FF01::101]/multicast
5351 * http://[::1]/loopback
5352 * http://[::]/unspecified
5353 * http://[::13.1.68.3]/ipv4compat
5354 * http://[::FFFF:129.144.52.38]/ipv4compat
5355
5356 Examples from RFC 2732, section 2:
5357 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5358 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5359 * http://[3ffe:2a00:100:7031::1]
5360 * http://[1080::8:800:200C:417A]/foo
5361 * http://[::192.9.5.5]/ipng
5362 * http://[::FFFF:129.144.52.38]:80/index.html
5363 * http://[2010:836B:4179::836B:4179]
5364
5365 !! html
5366 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5367 </p><p>Examples from RFC2373, section 2.2:
5368 </p>
5369 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5371 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5372 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5375 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5376 </p>
5377 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5380 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5381 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5382 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5383 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5384
5385 !! end
5386
5387 !! test
5388 IPv6 urls, bracketed format (T23261)
5389 !! wikitext
5390 [http://[2404:130:0:1000::187:2]/index.php test]
5391
5392 Examples from RFC2373, section 2.2:
5393 * [http://[1080::8:800:200C:417A] unicast]
5394 * [http://[FF01::101] multicast]
5395 * [http://[::1]/ loopback]
5396 * [http://[::] unspecified]
5397 * [http://[::13.1.68.3] ipv4compat]
5398 * [http://[::FFFF:129.144.52.38] ipv4compat]
5399
5400 Examples from RFC 2732, section 2:
5401 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5402 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5403 * [http://[3ffe:2a00:100:7031::1] 3]
5404 * [http://[1080::8:800:200C:417A]/foo 4]
5405 * [http://[::192.9.5.5]/ipng 5]
5406 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5407 * [http://[2010:836B:4179::836B:4179] 7]
5408
5409 !! html
5410 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5411 </p><p>Examples from RFC2373, section 2.2:
5412 </p>
5413 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5414 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5415 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5416 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5417 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5418 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5419 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5420 </p>
5421 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5422 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5423 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5424 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5425 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5426 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5427 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5428
5429 !! end
5430
5431 !! test
5432 Non-extlinks in brackets
5433 !! wikitext
5434 [foo]
5435 [foo bar]
5436 [foo ''bar'']
5437 [fool's] errand
5438 [fool's errand]
5439 [{{echo|foo}}]
5440 [{{echo|foo}} bar]
5441 [{{echo|foo}} ''bar'']
5442 [{{echo|foo}}l's] errand
5443 [{{echo|foo}}l's errand]
5444 [url={{echo|foo}}]
5445 [url=http://example.com]
5446 !! html
5447 <p>[foo]
5448 [foo bar]
5449 [foo <i>bar</i>]
5450 [fool's] errand
5451 [fool's errand]
5452 [foo]
5453 [foo bar]
5454 [foo <i>bar</i>]
5455 [fool's] errand
5456 [fool's errand]
5457 [url=foo]
5458 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5459 </p>
5460 !! end
5461
5462 !! test
5463 Percent encoding in external links
5464 !! wikitext
5465 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5466 !! html/php
5467 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5468 </p>
5469 !! html/parsoid
5470 <p><a rel="mw:ExtLink"
5471 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5472 !! end
5473
5474 !! test
5475 Use url link syntax for links where the content is equal the link target
5476 !! wikitext
5477 http://example.com
5478 !! html/php
5479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5483 !! end
5484
5485 !! test
5486 Parenthesis in external links, especially URL links
5487 !! wikitext
5488 http://example.com)
5489
5490 http://example.com/test)
5491
5492 http://example.com/(test)
5493
5494 http://example.com/((test)
5495
5496 (http://example.com/(test))
5497
5498 (http://example.com/(test)))))
5499
5500 http://example.com/a)b
5501
5502 [http://example.com) foo]
5503 !! html/php
5504 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5505 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5506 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5507 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5508 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5509 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5510 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5511 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5512 </p>
5513 !! html/parsoid
5514 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5515 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5516 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5517 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5518 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5519 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5520 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5521 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5522 !! end
5523
5524 !! test
5525 Parenthesis in external links, w/ transclusion or comment
5526 !! wikitext
5527 (http://example.com/{{echo|hi}})
5528
5529 (http://example.com<!-- hi -->)
5530 !! html/php
5531 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5532 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5533 </p>
5534 !! html/parsoid
5535 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5536
5537 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5538 !! end
5539
5540 !! test
5541 Serialize <a> tags with invalid link targets as plain text
5542 !! options
5543 parsoid=html2wt
5544 !! html/parsoid
5545 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5546 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5547 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5548 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5549 !! wikitext
5550 text
5551 <nowiki>*</nowiki>text
5552 <nowiki>[[foo]]</nowiki>
5553 <nowiki>*a [[foo]]</nowiki>
5554 !! end
5555
5556 !! test
5557 mw:ExtLink -vs- mw:WikiLink (T94723)
5558 !! options
5559 parsoid=html2wt
5560 !! html/parsoid
5561 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5562 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5563 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5564 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5565 <p>
5566 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5567 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5568 </p>
5569 !! wikitext
5570 [[Foo|Bar]]
5571 [[Foo|Bar]]
5572 [[wikipedia:Foo|Bar]]
5573 [[wikipedia:Foo|Bar]]
5574
5575 [[wikipedia:European_Robin|European Robin]]
5576 [[wikipedia:European_Robin|European Robin]]
5577 !! end
5578
5579 !! test
5580 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5581 !! options
5582 parsoid=wt2wt
5583 !! wikitext
5584 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5585 !! html/parsoid
5586 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5587 !! end
5588
5589
5590 ###
5591 ### Quotes
5592 ###
5593
5594 !! test
5595 Quotes
5596 !! wikitext
5597 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5598
5599 Normal text. '''''Bold italic text.''''' Normal text.
5600 !! html
5601 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5602 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5603 </p>
5604 !! end
5605
5606
5607 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5608 # parser strips. The wikitext contains just the first half of the bold
5609 # quote pair.
5610 !! test
5611 Unclosed and unmatched quotes
5612 !! wikitext
5613 '''''Bold italic text '''with bold deactivated''' in between.'''''
5614
5615 '''''Bold italic text ''with italic deactivated'' in between.'''''
5616
5617 '''Bold text..
5618
5619 ..spanning two paragraphs (should not work).'''
5620
5621 '''Bold tag left open
5622
5623 ''Italic tag left open
5624
5625 Normal text.
5626
5627 <!-- Unmatching number of opening, closing tags: -->
5628 '''This year''''s election ''should'' beat '''last year''''s.
5629
5630 ''Tom'''s car is bigger than ''Susan'''s.
5631
5632 Plain ''italic'''s plain
5633 !! html/php
5634 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5635 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5636 </p><p><b>Bold text..</b>
5637 </p><p>..spanning two paragraphs (should not work).
5638 </p><p><b>Bold tag left open</b>
5639 </p><p><i>Italic tag left open</i>
5640 </p><p>Normal text.
5641 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5642 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5643 </p><p>Plain <i>italic'</i>s plain
5644 </p>
5645 !! html/parsoid
5646 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5647 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5648 </p><p><b>Bold text..</b>
5649 </p><p>..spanning two paragraphs (should not work).<b></b>
5650 </p><p><b>Bold tag left open</b>
5651 </p><p><i>Italic tag left open</i>
5652 </p><p>Normal text.
5653 </p>
5654 <!-- Unmatching number of opening, closing tags: -->
5655 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5656 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5657 </p><p>Plain <i>italic'</i>s plain
5658 </p>
5659 !! end
5660
5661 ###
5662 ### Tables
5663 ###
5664 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5665 ###
5666
5667 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5668 # is the bare minimum required by the spec, see:
5669 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5670 # Parsoid team replies: empty table tags are legal in HTML5
5671 !! test
5672 A table with no data.
5673 !! options
5674 parsoid=wt2html
5675 !! wikitext
5676 {||}
5677 !! html/php
5678
5679 !! html/parsoid
5680 <table></table>
5681
5682 !! end
5683
5684 !! test
5685 A table with stray table end tags on start tag line (wt2html)
5686 !! options
5687 parsoid=wt2html
5688 !! wikitext
5689 {|style="color: red;"|}
5690
5691 {|style="color: red;" |}
5692 |foo
5693 |}
5694
5695 {|style="color: red;"|} id="foo"
5696 |foo
5697 |}
5698
5699 {|style="color: red;" |} id="foo"
5700 |foo
5701 |}
5702 !! html
5703 <table style="color: red;"></table>
5704
5705 <table style="color: red;">
5706 <tbody><tr>
5707 <td>foo</td>
5708 </tr></tbody>
5709 </table>
5710
5711 <table style="color: red;" id="foo">
5712 <tbody><tr>
5713 <td>foo</td>
5714 </tr></tbody>
5715 </table>
5716
5717 <table style="color: red;" id="foo">
5718 <tbody><tr>
5719 <td>foo</td>
5720 </tr></tbody>
5721 </table>
5722
5723 !! end
5724
5725 !! test
5726 A table with no data (take 2)
5727 !! wikitext
5728 {|
5729 |}
5730 !! html/parsoid
5731 <table></table>
5732 !! end
5733
5734 # A table with nothing but a caption is invalid XHTML, we might want to render
5735 # this as <p>caption</p>
5736 # Parsoid team replies: table with only a caption is legal in HTML5
5737 !! test
5738 A table with nothing but a caption
5739 !! wikitext
5740 {|
5741 |+ caption
5742 |}
5743 !! html/php
5744 <table>
5745 <caption> caption
5746 </caption><tr><td></td></tr></table>
5747
5748 !! html/parsoid
5749 <table><caption> caption</caption></table>
5750 !! end
5751
5752 !! test
5753 A table with caption with default-spaced attributes and a table row
5754 !! wikitext
5755 {|
5756 |+ style="color: red;" | caption1
5757 |-
5758 | foo
5759 |}
5760 !! html
5761 <table>
5762 <caption style="color: red;"> caption1
5763 </caption>
5764 <tr>
5765 <td> foo
5766 </td></tr></table>
5767
5768 !! end
5769
5770 !! test
5771 A table with captions with non-default spaced attributes and a table row
5772 !! wikitext
5773 {|
5774 |+style="color: red;"|caption2
5775 |+ style="color: red;"| caption3
5776 |-
5777 | foo
5778 |}
5779 !! html
5780 <table>
5781 <caption style="color: red;">caption2
5782 </caption>
5783 <caption style="color: red;"> caption3
5784 </caption>
5785 <tr>
5786 <td> foo
5787 </td></tr></table>
5788
5789 !! end
5790
5791 !! test
5792 Table td-cell syntax variations
5793 !! wikitext
5794 {|
5795 | foo bar foo | baz
5796 | foo bar foo || baz
5797 | style='color:red;' | baz
5798 | style='color:red;' || baz
5799 |}
5800 !! html
5801 <table>
5802 <tr>
5803 <td> baz
5804 </td>
5805 <td> foo bar foo </td>
5806 <td> baz
5807 </td>
5808 <td style="color:red;"> baz
5809 </td>
5810 <td> style='color:red;' </td>
5811 <td> baz
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Simple table
5818 !! wikitext
5819 {|
5820 | 1 || 2
5821 |-
5822 | 3 || 4
5823 |}
5824 !! html
5825 <table>
5826 <tr>
5827 <td> 1 </td>
5828 <td> 2
5829 </td></tr>
5830 <tr>
5831 <td> 3 </td>
5832 <td> 4
5833 </td></tr></table>
5834
5835 !! end
5836
5837 !! test
5838 Simple table but with multiple dashes for row wikitext
5839 !! wikitext
5840 {|
5841 | foo
5842 |-----
5843 | bar
5844 |}
5845 !! html
5846 <table>
5847 <tr>
5848 <td> foo
5849 </td></tr>
5850 <tr>
5851 <td> bar
5852 </td></tr></table>
5853
5854 !! end
5855
5856 !! test
5857 Multiplication table
5858 !! wikitext
5859 {| border="1" cellpadding="2"
5860 |+Multiplication table
5861 |-
5862 ! &times; !! 1 !! 2 !! 3
5863 |-
5864 ! 1
5865 | 1 || 2 || 3
5866 |-
5867 ! 2
5868 | 2 || 4 || 6
5869 |-
5870 ! 3
5871 | 3 || 6 || 9
5872 |-
5873 ! 4
5874 | 4 || 8 || 12
5875 |-
5876 ! 5
5877 | 5 || 10 || 15
5878 |}
5879 !! html
5880 <table border="1" cellpadding="2">
5881 <caption>Multiplication table
5882 </caption>
5883 <tr>
5884 <th> &#215; </th>
5885 <th> 1 </th>
5886 <th> 2 </th>
5887 <th> 3
5888 </th></tr>
5889 <tr>
5890 <th> 1
5891 </th>
5892 <td> 1 </td>
5893 <td> 2 </td>
5894 <td> 3
5895 </td></tr>
5896 <tr>
5897 <th> 2
5898 </th>
5899 <td> 2 </td>
5900 <td> 4 </td>
5901 <td> 6
5902 </td></tr>
5903 <tr>
5904 <th> 3
5905 </th>
5906 <td> 3 </td>
5907 <td> 6 </td>
5908 <td> 9
5909 </td></tr>
5910 <tr>
5911 <th> 4
5912 </th>
5913 <td> 4 </td>
5914 <td> 8 </td>
5915 <td> 12
5916 </td></tr>
5917 <tr>
5918 <th> 5
5919 </th>
5920 <td> 5 </td>
5921 <td> 10 </td>
5922 <td> 15
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Accept "||" in table headings
5929 !! wikitext
5930 {|
5931 !h1 || h2
5932 |}
5933 !! html
5934 <table>
5935 <tr>
5936 <th>h1 </th>
5937 <th> h2
5938 </th></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 Accept "!!" in table data
5944 !! wikitext
5945 {|
5946 | Foo!! ||
5947 |}
5948 !! html
5949 <table>
5950 <tr>
5951 <td> Foo!! </td>
5952 <td>
5953 </td></tr></table>
5954
5955 !! html/parsoid
5956 <table>
5957 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5958 </tbody></table>
5959 !! end
5960
5961 !! test
5962 Accept "||" in indented table headings
5963 !! wikitext
5964 :{|
5965 !h1 || h2
5966 |}
5967 !! html
5968 <dl><dd><table>
5969 <tr>
5970 <th>h1 </th>
5971 <th> h2
5972 </th></tr></table></dd></dl>
5973
5974 !! end
5975
5976 !! test
5977 Accept "!!" in templates
5978 !! wikitext
5979 {|
5980 !a {{echo|b!!c}}
5981 |}
5982 !! html/php
5983 <table>
5984 <tr>
5985 <th>a b</th>
5986 <th>c
5987 </th></tr></table>
5988
5989 !! html/parsoid
5990 <table>
5991 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
5992 !! end
5993
5994 !! test
5995 Accept "!!" in table headings after newline
5996 !! wikitext
5997 {|
5998 !a
5999 b!!c
6000 |}
6001 !! html/php
6002 <table>
6003 <tr>
6004 <th>a
6005 <p>b!!c
6006 </p>
6007 </th></tr></table>
6008
6009 !! html/parsoid
6010 <table>
6011 <tbody><tr><th>a
6012 <p>b!!c</p></th></tr>
6013 </tbody></table>
6014 !! end
6015
6016 !! test
6017 Accept "!!" in table data of mixed wikitext / html syntax
6018 !! wikitext
6019 {|
6020 !a
6021 <tr><td>b!!c</td></tr>
6022 |}
6023 !! html+tidy
6024 <table>
6025 <tr>
6026 <th>a</th>
6027 </tr>
6028 <tr>
6029 <td>b!!c</td>
6030 </tr>
6031 </table>
6032 !! html/parsoid
6033 <table>
6034 <tbody><tr><th>a</th></tr>
6035 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6036 </tbody></table>
6037 !! end
6038
6039 !! test
6040 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6041 !! wikitext
6042 {|
6043 !| h1
6044 || a
6045 |}
6046 !! html
6047 <table>
6048 <tr>
6049 <th> h1
6050 </th>
6051 <td> a
6052 </td></tr></table>
6053
6054 !! end
6055
6056 !!test
6057 Accept "| !" at start of line in tables (ignore !-attribute)
6058 !! wikitext
6059 {|
6060 |-
6061 | !style="color:red" | bar
6062 |}
6063 !! html
6064 <table>
6065
6066 <tr>
6067 <td> bar
6068 </td></tr></table>
6069
6070 !!end
6071
6072 !!test
6073 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6074 !! wikitext
6075 {|
6076 |-
6077 |style='color:red;'|+1
6078 |style='color:blue;'|-1
6079 |-
6080 | 1 || 2 || 3
6081 | 1 ||+2 ||-3
6082 |-
6083 | +1
6084 | -1
6085 |}
6086 !! html
6087 <table>
6088
6089 <tr>
6090 <td style="color:red;">+1
6091 </td>
6092 <td style="color:blue;">-1
6093 </td></tr>
6094 <tr>
6095 <td> 1 </td>
6096 <td> 2 </td>
6097 <td> 3
6098 </td>
6099 <td> 1 </td>
6100 <td>+2 </td>
6101 <td>-3
6102 </td></tr>
6103 <tr>
6104 <td> +1
6105 </td>
6106 <td> -1
6107 </td></tr></table>
6108
6109 !!end
6110
6111 !! test
6112 Table rowspan
6113 !! wikitext
6114 {| border=1
6115 | Cell 1, row 1
6116 |rowspan=2| Cell 2, row 1 (and 2)
6117 | Cell 3, row 1
6118 |-
6119 | Cell 1, row 2
6120 | Cell 3, row 2
6121 |}
6122 !! html
6123 <table border="1">
6124 <tr>
6125 <td> Cell 1, row 1
6126 </td>
6127 <td rowspan="2"> Cell 2, row 1 (and 2)
6128 </td>
6129 <td> Cell 3, row 1
6130 </td></tr>
6131 <tr>
6132 <td> Cell 1, row 2
6133 </td>
6134 <td> Cell 3, row 2
6135 </td></tr></table>
6136
6137 !! end
6138
6139 !! test
6140 Nested table
6141 !! wikitext
6142 {| border=1
6143 | &alpha;
6144 |
6145 {| bgcolor=#ABCDEF border=2
6146 |nested
6147 |-
6148 |table
6149 |}
6150 |the original table again
6151 |}
6152 !! html
6153 <table border="1">
6154 <tr>
6155 <td> &#945;
6156 </td>
6157 <td>
6158 <table bgcolor="#ABCDEF" border="2">
6159 <tr>
6160 <td>nested
6161 </td></tr>
6162 <tr>
6163 <td>table
6164 </td></tr></table>
6165 </td>
6166 <td>the original table again
6167 </td></tr></table>
6168
6169 !! end
6170
6171 !! test
6172 Invalid attributes in table cell (bug 1830)
6173 !! wikitext
6174 {|
6175 |Cell:|broken
6176 |}
6177 !! html
6178 <table>
6179 <tr>
6180 <td>broken
6181 </td></tr></table>
6182
6183 !! end
6184
6185 !! test
6186 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6187 !! wikitext
6188 {|
6189 | title="foo" |bar
6190 | title="foo<nowiki>|</nowiki>" |bar
6191 | title="foo<nowiki>|</nowiki>" bar
6192 |}
6193 !! html
6194 <table>
6195 <tr>
6196 <td title="foo">bar
6197 </td>
6198 <td title="foo&#124;">bar
6199 </td>
6200 <td> title="foo|" bar
6201 </td></tr></table>
6202
6203 !! end
6204
6205 # The "|}" to close the table is missing from the input, so parsoid's
6206 # *2wt modes will fail.
6207 !! test
6208 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6209 !! options
6210 parsoid=wt2html,html2html
6211 !! wikitext
6212 {|
6213 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6214 !! html/php
6215 <table>
6216 <tr>
6217 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6218 <td>]" onmouseover="alert(document.cookie)"&gt;test
6219 </td>
6220 </tr>
6221 </table>
6222
6223 !! html/parsoid
6224 <table><tbody>
6225 <tr>
6226 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6227 !! end
6228
6229 # FIXME: The php output is broken.
6230 !! test
6231 ! and || in td attributes should not be parsed as <th>/<td>
6232 !! wikitext
6233 {|
6234 | style="color: red !important;" data-contrived="put this here ||" | foo
6235 |}
6236 !! html/php
6237 <table>
6238 <tr>
6239 <td> style="color: red !important;" data-contrived="put this here </td>
6240 <td> foo
6241 </td></tr></table>
6242
6243 !! html/parsoid
6244 <table>
6245 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6246 </tbody></table>
6247 !! end
6248
6249 !! test
6250 Indented table markup mixed with indented pre content (proposed in bug 6200)
6251 !! wikitext
6252 <table>
6253 <tr>
6254 <td>
6255 Text that should be rendered preformatted
6256 </td>
6257 </tr>
6258 </table>
6259 !! html
6260 <table>
6261 <tr>
6262 <td>
6263 <pre>Text that should be rendered preformatted
6264 </pre>
6265 </td>
6266 </tr>
6267 </table>
6268
6269 !! end
6270
6271 !! test
6272 1. Template-generated table cell attributes and cell content
6273 !! wikitext
6274 {|
6275 |{{table_attribs}}
6276 | {{table_attribs}}
6277 || {{table_attribs_5}}
6278 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6279 |align=center {{table_attribs}}
6280 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6281 |}
6282 !! html
6283 <table>
6284 <tr>
6285 <td style="color:red;">Foo
6286 </td>
6287 <td style="color:red;">Foo
6288 </td>
6289 <td> style="color:red;"</td>
6290 <td>Bar
6291 </td>
6292 <td style="color:red;">Foo
6293 </td>
6294 <td align="center" style="color:red;">Foo
6295 </td>
6296 <td align="center" style="color:red;">Foo
6297 </td></tr></table>
6298
6299 !! end
6300
6301 !! test
6302 2. Template-generated table cell attributes and cell content
6303 !! wikitext
6304 {|
6305 |{{table_attribs_2}}
6306 |}
6307 !! html/php
6308 <table>
6309 <tr>
6310 <td style="color:red;">Foo
6311 </td>
6312 <td>Bar</td>
6313 <td>Baz
6314 </td></tr></table>
6315
6316 !! html/parsoid
6317 <table>
6318 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6319 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6320 </tbody></table>
6321 !! end
6322
6323 !! test
6324 3. Template-generated table cell attributes and cell content
6325 !! wikitext
6326 {|
6327 !align=center {{table_header_cells}}
6328 |-
6329 |align=center {{table_cells}}
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <th align="center" style="color:red;">Foo</th>
6335 <th style="color:red;"><i>Bar</i></th>
6336 <th style="color:brown;"><i>Foo</i> and Baz
6337 </th></tr>
6338 <tr>
6339 <td align="center" style="color:red;">Foo</td>
6340 <td style="color:red;"><i>Bar</i></td>
6341 <td style="color:brown;"><i>Foo</i> and Baz
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6347 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6348 </tbody></table>
6349 !! end
6350
6351 !! test
6352 4. Template-generated table cell attributes and cell content inside a templated table
6353 !! wikitext
6354 {{tbl-start}}
6355 !align=center {{table_header_cells}}
6356 |-
6357 |align=center {{table_cells}}
6358 {{tbl-end}}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <th align="center" style="color:red;">Foo</th>
6363 <th style="color:red;"><i>Bar</i></th>
6364 <th style="color:brown;"><i>Foo</i> and Baz
6365 </th></tr>
6366 <tr>
6367 <td align="center" style="color:red;">Foo</td>
6368 <td style="color:red;"><i>Bar</i></td>
6369 <td style="color:brown;"><i>Foo</i> and Baz
6370 </td></tr></table>
6371
6372 !! html/parsoid
6373 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6374 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6375 <tr>
6376 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6377 </tbody></table>
6378 !! end
6379
6380 ## Edge case fix to prevent future regressions
6381 !! test
6382 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6383 !! wikitext
6384 {|
6385 |{{table_attribs_7}}
6386 |}
6387 <references />
6388 !! html/parsoid
6389 <table>
6390 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6391 </tbody></table>
6392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6393 !! end
6394
6395 !! test
6396 Table with row followed by newlines and table heading
6397 !! wikitext
6398 {|
6399 |-
6400
6401 ! foo
6402 |}
6403 !! html
6404 <table>
6405
6406
6407 <tr>
6408 <th> foo
6409 </th></tr></table>
6410
6411 !! end
6412
6413 !! test
6414 Table with empty line following the start tag
6415 !! wikitext
6416 {|
6417
6418 |-
6419 | foo
6420 |}
6421 !! html
6422 <table>
6423
6424
6425 <tr>
6426 <td> foo
6427 </td></tr></table>
6428
6429 !! end
6430
6431 # FIXME: Preserve the attribute properly (with an empty string as value) in
6432 # the PHP parser. Parsoid implements the behavior below.
6433 !! test
6434 Table attributes with empty value
6435 !! wikitext
6436 {|
6437 | style=| hello
6438 |}
6439 !! html/parsoid
6440 <table>
6441 <tbody>
6442 <tr>
6443 <td style=""> hello
6444 </td></tr></tbody></table>
6445
6446 !! end
6447
6448 !! test
6449 Wikitext table with a lot of comments
6450 !! wikitext
6451 {|
6452 <!-- c0 -->
6453 | foo
6454 <!-- c1 -->
6455 |-<!-- c2 -->
6456 <!-- c3 -->
6457 |<!-- c4 -->
6458 <!-- c5 -->
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td> foo
6464 </td></tr>
6465 <tr>
6466 <td>
6467 </td></tr></table>
6468
6469 !! end
6470
6471 !! test
6472 Wikitext table comments represented in parsoid dom
6473 !! wikitext
6474 {|<!--c1--><!--c2-->
6475 |-<!--c3-->
6476 | x
6477 |}
6478 !! html/php+tidy
6479 <table>
6480 <tr>
6481 <td>x</td>
6482 </tr>
6483 </table>
6484 !! html/parsoid
6485 <table><!--c1--><!--c2-->
6486 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6487 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 Wikitext table with double-line table cell
6493 !! wikitext
6494 {|
6495 |a
6496 b
6497 |}
6498 !! html
6499 <table>
6500 <tr>
6501 <td>a
6502 <p>b
6503 </p>
6504 </td></tr></table>
6505
6506 !! end
6507
6508 !! test
6509 Table cell with a single comment
6510 !! wikitext
6511 {|
6512 | <!-- c1 -->
6513 | a
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>
6519 </td>
6520 <td> a
6521 </td></tr></table>
6522
6523 !! end
6524
6525 !! test
6526 Table-cell after a comment-only-empty-line
6527 !! wikitext
6528 {|
6529 |a
6530 <!--c1-->
6531 <!--c2-->| b
6532 |}
6533 !! html
6534 <table>
6535 <tr>
6536 <td>a
6537 </td>
6538 <td> b
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6544 <!--c1-->
6545 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6546 </tbody></table>
6547
6548 !! end
6549
6550 !! test
6551 Build table with {{!}}
6552 !! wikitext
6553 {{{!}} class="wikitable"
6554 ! header
6555 ! second header
6556 {{!}}- style="color:red;"
6557 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6558 {{!}}}
6559 !! html
6560 <table class="wikitable">
6561 <tr>
6562 <th> header
6563 </th>
6564 <th> second header
6565 </th></tr>
6566 <tr style="color:red;">
6567 <td> data </td>
6568 <td style="color:red;"> second data
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Build table with pipe as data
6575 !! wikitext
6576 {| class="wikitable"
6577 ! header
6578 ! second header
6579 |- style="color:red;"
6580 | data || style="color:red;" | second data
6581 |-
6582 | style="color:red;" | data with | || style="color:red;" | second data with |
6583 |-
6584 || data with | ||| second data with |
6585 |}
6586 !! html
6587 <table class="wikitable">
6588 <tr>
6589 <th> header
6590 </th>
6591 <th> second header
6592 </th></tr>
6593 <tr style="color:red;">
6594 <td> data </td>
6595 <td style="color:red;"> second data
6596 </td></tr>
6597 <tr>
6598 <td style="color:red;"> data with | </td>
6599 <td style="color:red;"> second data with |
6600 </td></tr>
6601 <tr>
6602 <td> data with | </td>
6603 <td> second data with |
6604 </td></tr></table>
6605
6606 !! end
6607
6608 !! test
6609 Build table with wikilink
6610 !! wikitext
6611 {| class="wikitable"
6612 ! header || second header
6613 |- style="color:red;"
6614 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6615 |-
6616 | data || second data [[Main Page|link|text with pipe]]
6617 |}
6618 !! html
6619 <table class="wikitable">
6620 <tr>
6621 <th> header </th>
6622 <th> second header
6623 </th></tr>
6624 <tr style="color:red;">
6625 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6626 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6627 </td></tr>
6628 <tr>
6629 <td> data </td>
6630 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6631 </td></tr></table>
6632
6633 !! end
6634
6635 # The expected HTML structure in this test is debatable. The PHP parser does
6636 # not parse this kind of table at all. The main focus for Parsoid is on
6637 # round-tripping, so this output is ok for now. TODO: revisit!
6638 !! test
6639 Wikitext table with html-syntax row
6640 !! wikitext
6641 {|
6642 |-
6643 <td>foo</td>
6644 |}
6645 !! html/parsoid
6646 <table>
6647 <tbody>
6648 <tr>
6649 <td>foo</td></tr></tbody></table>
6650 !! end
6651
6652 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6653 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6654 ## PHP parser, which tidy then compounds by fostering the content
6655 ## entirely out of the table. Parsoid recognizes the table context
6656 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6657 ## depends on PHP's treatment of broken table markup!
6658 !! test
6659 Implicit <td> after a |-
6660 !! options
6661 parsoid=wt2html,html2html
6662 !! wikitext
6663 {|
6664 |-
6665 a
6666 |}
6667 !! html/php
6668 <table>
6669
6670 a
6671 </table>
6672
6673 !! html/php+tidy
6674 <p>a</p>
6675 !! html/parsoid
6676 <table>
6677 <tr><td>a</td></tr>
6678 </table>
6679 !! end
6680
6681 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6682 !! test
6683 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689 |
6690 a
6691 |-
6692 b
6693 |}
6694 !! html/php
6695 <table>
6696
6697 <tr>
6698 <td>
6699 <pre>a
6700 </pre>
6701 </td></tr>
6702 b
6703 </table>
6704
6705 !! html/php+tidy
6706 <p>b</p>
6707 <table>
6708 <tr>
6709 <td>
6710 <pre>
6711 a
6712 </pre></td>
6713 </tr>
6714 </table>
6715 !! html/parsoid
6716 <table>
6717 <tbody>
6718 <tr><td><pre>a</pre></td></tr>
6719 <tr><td> b</td></tr>
6720 </tbody>
6721 </table>
6722 !! end
6723
6724 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6725 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6726 !! test
6727 Lists should be recognized in an implicit <td> context
6728 !! options
6729 parsoid=wt2html,html2html
6730 !! wikitext
6731 {|
6732 |-
6733 *a
6734 |}
6735 !! html/php
6736 <table>
6737
6738 <ul><li>a</li></ul>
6739 </table>
6740
6741 !! html/php+tidy
6742 <ul>
6743 <li>a</li>
6744 </ul>
6745 !! html/parsoid
6746 <table>
6747 <tr>
6748 <td><ul>
6749 <li>a</li>
6750 </ul></td>
6751 </tr>
6752 </table>
6753 !! end
6754
6755 !! test
6756 Table cells not properly parsed in an implicit-td context
6757 !! wikitext
6758 {|
6759 |-
6760 {{table_attribs_4}} || a || b
6761 |}
6762 !! html/php+tidy
6763 <table>
6764 <tr>
6765 <td style="background-color:#DC241f;" width="10px"></td>
6766 <td>a</td>
6767 <td>b</td>
6768 </tr>
6769 </table>
6770 !! html/parsoid
6771 <table>
6772 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6773 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6774 </tbody></table>
6775 !! end
6776
6777 !! test
6778 Parsoid: Round-trip tables directly followed by content (bug 51219)
6779 !! options
6780 parsoid=wt2html,wt2wt
6781 !! wikitext
6782 {|
6783 |foo
6784 |} bar
6785
6786 {|
6787 |baz
6788 |}<b>quux</b>
6789 !! html+tidy
6790 <table>
6791 <tr>
6792 <td>foo</td>
6793 </tr>
6794 </table>
6795 <p>bar</p>
6796 <table>
6797 <tr>
6798 <td>baz</td>
6799 </tr>
6800 </table>
6801 <p><b>quux</b></p>
6802 !! end
6803
6804 !! test
6805 Parsoid: Default to a newline after tables in new content (bug 51219)
6806 !! options
6807 parsoid=html2wt
6808 !! html/parsoid
6809 <table><tbody>
6810 <tr><td>foo</td></tr></tbody></table> bar
6811 <table><tbody>
6812 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6813 !! wikitext
6814 {|
6815 |foo
6816 |}
6817 <nowiki> </nowiki>bar
6818 {|
6819 |baz
6820 |}
6821 '''quux'''
6822 !! end
6823
6824 !! test
6825 Parsoid: newline inducing block nodes don't suppress <nowiki>
6826 !! options
6827 parsoid=html2wt
6828 !! html/parsoid
6829 a<h1>foo</h1>
6830 !! wikitext
6831 <nowiki> </nowiki>a
6832
6833 = foo =
6834 !! end
6835
6836 !! test
6837 Parsoid: Row-syntax table headings followed by comment & table cells
6838 !! options
6839 parsoid=wt2html,wt2wt
6840 !! wikitext
6841 {|
6842 ! foo || bar
6843 <!-- foo --> || baz || quux
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <th> foo </th>
6849 <th> bar
6850 </th>
6851 <td> baz </td>
6852 <td> quux
6853 </td></tr></table>
6854
6855 !! html/parsoid
6856 <table>
6857 <tbody><tr><th> foo </th><th> bar
6858 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6859 </tbody></table>
6860 !! end
6861
6862
6863 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6864 # preserves it.
6865 !!test
6866 Parsoid: Recover better from broken table attributes
6867 !!options
6868 parsoid=wt2html
6869 !!wikitext
6870 {| class="foo
6871 | class="bar" |
6872 foo
6873 |}
6874 !!html/php+tidy
6875 <table>
6876 <tr>
6877 <td class="bar">
6878 <p>foo</p>
6879 </td>
6880 </tr>
6881 </table>
6882 !!html/parsoid
6883 <table class="foo">
6884 <tr>
6885 <td class="bar">
6886 <p>foo</p></td></tr>
6887 </tbody></table>
6888 !!end
6889
6890 !! test
6891 Strip unsupported table tags
6892 !! options
6893 parsoid=html2wt
6894 !! html/parsoid
6895 <table>
6896 <thead>
6897 <tr>
6898 <th>Month</th>
6899 <th>Savings</th>
6900 </tr>
6901 </thead>
6902 <tbody>
6903 <tr>
6904 <td>January</td>
6905 <td>$100</td>
6906 </tr>
6907 <tr>
6908 <td>February</td>
6909 <td>$80</td>
6910 </tr>
6911 </tbody>
6912 <tfoot>
6913 <tr>
6914 <td>Sum</td>
6915 <td>$180</td>
6916 </tr>
6917 </tfoot>
6918 </table>
6919 !! wikitext
6920 {|
6921
6922 !Month
6923 !Savings
6924
6925 |January
6926 |$100
6927
6928 |-
6929 |February
6930 |$80
6931
6932 |Sum
6933 |$180
6934
6935 |}
6936 !! end
6937
6938 !!test
6939 Testing serialization after deletion of table cells
6940 !!options
6941 parsoid={
6942 "modes": ["wt2wt", "selser"],
6943 "changes": [
6944 ["#x", "remove"]
6945 ]
6946 }
6947 !!wikitext
6948 {|
6949 !h1 !!h2 !!h3
6950 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6951 |}
6952 !! wikitext/edited
6953 {|
6954 !h1 !!h2 !!h3
6955 |c2 |||c3
6956 |}
6957 !!end
6958
6959 ###
6960 ### Internal links
6961 ###
6962 !! test
6963 Plain link, capitalized
6964 !! wikitext
6965 [[Main Page]]
6966 !! html
6967 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6968 </p>
6969 !! end
6970
6971 !! test
6972 Plain link, uncapitalized
6973 !! wikitext
6974 [[main Page]]
6975 !! html
6976 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6977 </p>
6978 !! end
6979
6980 !! test
6981 Piped link
6982 !! wikitext
6983 [[Main Page|The Main Page]]
6984 !! html
6985 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6986 </p>
6987 !! end
6988
6989 !! test
6990 Piped link with comment in link text
6991 !! wikitext
6992 [[Main Page|The Main<!--front--> Page]]
6993 !! html
6994 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6995 </p>
6996 !! end
6997
6998 !! test
6999 Piped link with multiple pipe characters in link text
7000 !! wikitext
7001 [[Main Page||The|Main|Page|]]
7002 !! html/php
7003 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7004 </p>
7005 !! html/parsoid
7006 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7007 !! end
7008
7009 !! test
7010 Broken link
7011 !! wikitext
7012 [[Zigzagzogzagzig]]
7013 !! html
7014 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7015 </p>
7016 !! end
7017
7018 !! test
7019 Broken link with fragment
7020 !! wikitext
7021 [[Zigzagzogzagzig#zug]]
7022 !! html
7023 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7024 </p>
7025 !! end
7026
7027 !! test
7028 Special page link with fragment
7029 !! wikitext
7030 [[Special:Version#anchor]]
7031 !! html
7032 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7033 </p>
7034 !! end
7035
7036 !! test
7037 Nonexistent special page link with fragment
7038 !! wikitext
7039 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7040 !! html
7041 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7042 </p>
7043 !! end
7044
7045 !! test
7046 Link with prefix
7047 !! wikitext
7048 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7049 !! html
7050 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7051 </p>
7052 !! end
7053
7054 !! test
7055 Link with suffix
7056 !! wikitext
7057 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7058 !! html
7059 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7060 </p>
7061 !! end
7062
7063 !! article
7064 prefixed article
7065 !! text
7066 Some text
7067 !! endarticle
7068
7069 !! test
7070 Bug 43661: Piped links with identical prefixes
7071 !! wikitext
7072 [[prefixed article|prefixed articles with spaces]]
7073
7074 [[prefixed article|prefixed articlesaoeu]]
7075
7076 [[Main Page|Main Page test]]
7077 !! html
7078 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7079 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7080 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7081 </p>
7082 !! end
7083
7084
7085 !! test
7086 Link with HTML entity in suffix / tail
7087 !! wikitext
7088 [[Main Page]]&quot;, [[Main Page]]&#97;
7089 !! html/php
7090 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7091 </p>
7092 !! html/parsoid
7093 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7094 !! end
7095
7096 !! test
7097 Link with 3 brackets
7098 !! wikitext
7099 [[[Main Page]]]
7100 !! html
7101 <p>[[[Main Page]]]
7102 </p>
7103 !! end
7104
7105 !! test
7106 Link with 4 brackets
7107 !! wikitext
7108 [[[[Main Page]]]]
7109 !! html
7110 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7111 </p>
7112 !! end
7113
7114 !! test
7115 Piped link with 3 brackets
7116 !! wikitext
7117 [[[main page|the main page]]]
7118 !! html
7119 <p>[[[main page|the main page]]]
7120 </p>
7121 !! end
7122
7123 !! test
7124 Piped link with extlink-like text
7125 !! wikitext
7126 [[Main Page|[bar]]]
7127 [[Main Page|This is a [bar]]]
7128 !! html/php
7129 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7130 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7131 </p>
7132 !! html/parsoid
7133 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7134 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7135 !! end
7136
7137 !! test
7138 Link with multiple pipes
7139 !! wikitext
7140 [[Main Page|The|Main|Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7143 </p>
7144 !! end
7145
7146 # Note that parsoid does not munge anchor text; all non-space
7147 # characters are valid in HTML5 ids.
7148 !! test
7149 Anchor containing a #. (bug 63430)
7150 !! wikitext
7151 [[Main Page#And#Link]]
7152 !! html/php
7153 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7154 </p>
7155 !! html/parsoid
7156 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7157 !! end
7158
7159 !! test
7160 Link to namespaces
7161 !! wikitext
7162 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7163 !! html
7164 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7165 </p>
7166 !! end
7167
7168 !! test
7169 Link with space in namespace
7170 !! wikitext
7171 [[User talk:Foo bar]]
7172 !! html
7173 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7174 </p>
7175 !! end
7176
7177 !! article
7178 MemoryAlpha:AlphaTest
7179 !! text
7180 This is an article in the MemoryAlpha namespace
7181 (which shadows the memoryalpha interwiki link).
7182 !! endarticle
7183
7184 !! test
7185 Namespace takes precedence over interwiki link (bug 51680)
7186 !! wikitext
7187 [[MemoryAlpha:AlphaTest]]
7188 !! html
7189 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7190 </p>
7191 !! end
7192
7193 # The previous test doesn't work correctly in html2*, due to not recognizing the
7194 # link as an internal one. This one checks for the correct behavior.
7195 !! test
7196 Link to namespace preferred over interwiki with correct rel attribute
7197 !! options
7198 parsoid=html2wt,html2html
7199 !! html/parsoid
7200 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7201 !! wikitext
7202 [[MemoryAlpha:AlphaTest]]
7203 !! end
7204
7205 !! test
7206 Piped link to namespace
7207 !! wikitext
7208 [[Meta:Disclaimers|The disclaimers]]
7209 !! html
7210 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7211 </p>
7212 !! end
7213
7214 !! test
7215 Link containing }
7216 !! wikitext
7217 [[Usually caused by a typo (oops}]]
7218 !! html
7219 <p>[[Usually caused by a typo (oops}]]
7220 </p>
7221 !! end
7222
7223 !! article
7224 7% Solution
7225 !! text
7226 Just a test of an article title containing a percent.
7227 !! endarticle
7228
7229 !! test
7230 Link containing % (not as a hex sequence)
7231 !! wikitext
7232 [[7% Solution]]
7233 !! html/php
7234 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7235 </p>
7236 !! html/parsoid
7237 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7238 !! end
7239
7240 # note that the parsoid HTML is identical to the previous test output,
7241 # so the previous test ensures that the html2wt mode will generate the
7242 # "not as a hex sequence" wikitext.
7243 !! test
7244 Link containing % as a single hex sequence interpreted to char
7245 !! options
7246 parsoid=wt2wt,wt2html,html2html
7247 !! wikitext
7248 [[7%25 Solution]]
7249 !! html/php
7250 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7251 </p>
7252 !! html/parsoid
7253 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7254 !!end
7255
7256 !! test
7257 Link containing % as a double hex sequence interpreted to hex sequence
7258 !! wikitext
7259 [[7%2525 Solution]]
7260 !! html
7261 <p>[[7%2525 Solution]]
7262 </p>
7263 !!end
7264
7265 # note that parsoid does not munge anchor text; all non-space
7266 # characters are valid in HTML5 anchors.
7267 !! test
7268 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7269 Example for such a section: == < ==
7270 !! wikitext
7271 [[%23%3c]][[%23%3e]]
7272 !! html/php
7273 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7274 </p>
7275 !! html/parsoid
7276 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7277 !! end
7278
7279 !! test
7280 Link containing "<#" and ">#" as a hex sequences
7281 !! wikitext
7282 [[%3c%23]][[%3e%23]]
7283 !! html
7284 <p>[[%3c%23]][[%3e%23]]
7285 </p>
7286 !! end
7287
7288 !! test
7289 Link containing an equals sign
7290 !! wikitext
7291 [[Special:BookSources/isbn=4-00-026157-6]]
7292 !! html/php
7293 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7294 </p>
7295 !! html/parsoid
7296 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7297 !! end
7298
7299 !! article
7300 Foo~bar
7301 !! text
7302 Just a test of an article title containing a tilde.
7303 !! endarticle
7304
7305 # note that links containing signatures, like [[Foo~~~~]], are
7306 # massaged by the pre-save transform (PST) and so the tildes are never
7307 # seen by the parser.
7308 !! test
7309 Link containing a tilde
7310 !! wikitext
7311 [[Foo~bar]]
7312 !! html/php
7313 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7314 </p>
7315 !! html/parsoid
7316 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7317 !! end
7318
7319 !! test
7320 Link containing double-single-quotes '' (bug 4598)
7321 !! wikitext
7322 [[Lista d''e paise d''o munno]]
7323 !! html/php
7324 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7325 </p>
7326 !! html/parsoid
7327 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7328 !! end
7329
7330 !! test
7331 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7332 !! wikitext
7333 Some [[Link|pretty ''italics'' and stuff]]!
7334 !! html/php
7335 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7336 </p>
7337 !! html/parsoid
7338 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7339 !! end
7340
7341 !! test
7342 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7343 !! wikitext
7344 ''Some [[Link|pretty ''italics'' and stuff]]!''
7345 !! html
7346 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7347 </p>
7348 !! end
7349
7350 !! test
7351 Link with double quotes in title part (literal) and alternate part (interpreted)
7352 !! wikitext
7353 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7354
7355 [[''Pentecoste'']]
7356
7357 [[''Pentecoste''|Pentecoste]]
7358
7359 [[''Pentecoste''|''Pentecoste'']]
7360 !! html/php
7361 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7362 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7363 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7364 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7365 </p>
7366 !! html/parsoid
7367 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7368 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7369 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7370 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7371 !! end
7372
7373 !! test
7374 Broken image links with HTML captions (bug 39700)
7375 !! wikitext
7376 [[File:Nonexistent|<script></script>]]
7377 [[File:Nonexistent|100x100px|<script></script>]]
7378 [[File:Nonexistent|&lt;]]
7379 [[File:Nonexistent|a<i>b</i>c]]
7380 !! html/php
7381 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7382 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7383 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7384 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7385 </p>
7386 !! html/parsoid
7387 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7388 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7389 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7390 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7391 !! end
7392
7393 !! test
7394 Plain link to URL
7395 !! wikitext
7396 [[http://www.example.com]]
7397 !! html/php
7398 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7399 </p>
7400 !! html/parsoid
7401 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7402 !! end
7403
7404 !! test
7405 Plain link to URL with link text
7406 !! wikitext
7407 [[http://www.example.com Link text]]
7408 !! html
7409 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7410 </p>
7411 !! end
7412
7413 !! test
7414 Plain link to protocol-relative URL
7415 !! wikitext
7416 [[//www.example.com]]
7417 !! html/php
7418 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7419 </p>
7420 !! html/parsoid
7421 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7422 !! end
7423
7424 !! test
7425 Plain link to protocol-relative URL with link text
7426 !! wikitext
7427 [[//www.example.com Link text]]
7428 !! html
7429 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7430 </p>
7431 !! end
7432
7433 !! test
7434 Plain link to page with question mark in title
7435 !! wikitext
7436 [[A?b]]
7437
7438 [[A?b|Baz]]
7439 !! html
7440 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7441 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7442 </p>
7443 !! end
7444
7445
7446 # I'm fairly sure the expected result here is wrong.
7447 # We want these to be URL links, not pseudo-pages with URLs for titles....
7448 # However the current output is also pretty screwy.
7449 #
7450 # ----
7451 # I'm changing it to match the current output--it arguably makes more
7452 # sense in the light of the test above. Old expected result was:
7453 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7454 #</p>
7455 # But I think this test is bordering on "garbage in, garbage out" anyway.
7456 # -- wtm
7457 !! test
7458 Piped link to URL
7459 !! wikitext
7460 Piped link to URL: [[http://www.example.com|an example URL]]
7461 !! html/php
7462 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7463 </p>
7464 !! html/parsoid
7465 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7466 !! end
7467
7468 !! test
7469 BUG 2: [[page|http://url/]] should link to page, not http://url/
7470 !! wikitext
7471 [[Main Page|http://url/]]
7472 !! html/php
7473 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7474 </p>
7475 !! html/parsoid
7476 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7477 !! end
7478
7479 # Parsoid does not mark self-links, by design.
7480 !! test
7481 BUG 337: Escaped self-links should be bold
7482 !! options
7483 title=[[Bug462]]
7484 !! wikitext
7485 [[Bu&#103;462]] [[Bug462]]
7486 !! html/php
7487 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7488 </p>
7489 !! html/php+tidy
7490 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7491 !! html/parsoid
7492 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7493 !! end
7494
7495 !! test
7496 Self-link to section should not be bold
7497 !! options
7498 title=[[Main Page]]
7499 !! wikitext
7500 [[Main Page#section]]
7501 !! html
7502 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7503 </p>
7504 !! end
7505
7506 !! article
7507 00
7508 !! text
7509 This is 00.
7510 !! endarticle
7511
7512 !!test
7513 Self-link to numeric title
7514 !!options
7515 title=[[0]]
7516 !! wikitext
7517 [[0]]
7518 !! html
7519 <p><strong class="selflink">0</strong>
7520 </p>
7521 !!end
7522
7523 !!test
7524 Link to numeric-equivalent title
7525 !!options
7526 title=[[0]]
7527 !! wikitext
7528 [[00]]
7529 !! html
7530 <p><a href="/wiki/00" title="00">00</a>
7531 </p>
7532 !!end
7533
7534 !! test
7535 <nowiki> inside a link
7536 !! wikitext
7537 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7538 !! html
7539 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7540 </p>
7541 !! end
7542
7543 !! test
7544 Non-breaking spaces in title
7545 !! wikitext
7546 [[&nbsp; Main &nbsp; Page &nbsp;]]
7547 !! html
7548 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7549 </p>
7550 !!end
7551
7552 !! test
7553 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7554 !! options
7555 language=ca
7556 !! wikitext
7557 '''[[Main Page]]'''
7558 !! html
7559 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7560 </p>
7561 !! end
7562
7563 !! test
7564 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7565 !! options
7566 language=ca
7567 !! wikitext
7568 ''[[Main Page]]''
7569 !! html
7570 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7571 </p>
7572 !! end
7573
7574 !! test
7575 Internal link with en linktrail: no apostrophes (bug 27473)
7576 !! options
7577 language=en
7578 !! wikitext
7579 [[Something]]'nice
7580 !! html
7581 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7582 </p>
7583 !! end
7584
7585 !! test
7586 Internal link with ca linktrail with apostrophes (bug 27473)
7587 !! options
7588 language=ca
7589 !! wikitext
7590 [[Something]]'nice
7591 !! html
7592 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7593 </p>
7594 !! end
7595
7596 !! test
7597 Internal link with kaa linktrail with apostrophes (bug 27473)
7598 !! options
7599 language=kaa
7600 !! wikitext
7601 [[Something]]'nice
7602 !! html
7603 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
7604 </p>
7605 !! end
7606
7607 !! test
7608 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7609 !! wikitext
7610 [[User:Foo/Test/63636:Bar|Test]]
7611 !! html/php
7612 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
7613 </p>
7614 !! html/parsoid
7615 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7616 !! end
7617
7618 !! test
7619 Purely hash wikilink
7620 !! options
7621 title=[[User:test/123]]
7622 !! wikitext
7623 [[#a|b]]
7624 !! html/php
7625 <p><a href="#a">b</a>
7626 </p>
7627 !! html/parsoid
7628 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
7629 !! end
7630
7631 !! test
7632 1. Interaction of linktrail and template encapsulation
7633 !! options
7634 parsoid
7635 !! wikitext
7636 {{echo|[[Foo]]}}l
7637 !! html
7638 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
7639 !! end
7640
7641 !! test
7642 2. Interaction of linktrail and template encapsulation
7643 !! options
7644 parsoid
7645 !! wikitext
7646 {{echo|Some [[Fool]]}}s
7647 !! html
7648 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7649 !! end
7650
7651 !! test
7652 3. Interaction of linktrail and template encapsulation
7653 !! options
7654 parsoid
7655 !! wikitext
7656 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7657 !! html
7658 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7659 !! end
7660
7661 !! article
7662 Söfnuður
7663 !! text
7664 Test.
7665 !! endarticle
7666
7667 !! test
7668 Internal link with is link prefix
7669 !! options
7670 language=is
7671 !! wikitext
7672 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7673 !! html
7674 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7675 </p>
7676 !! end
7677
7678 !! article
7679 Mótmælendatrú
7680 !! text
7681 Test.
7682 !! endarticle
7683
7684 !! test
7685 Internal link with is link trail and link prefix
7686 !! options
7687 language=is
7688 !! wikitext
7689 [[mótmælendatrú|xxx]]ar
7690 [[mótmælendatrú]]ar
7691 mótmælenda[[söfnuður]]
7692 mótmælenda[[söfnuður|söfnuðir]]
7693 mótmælenda[[söfnuður|söfnuðir]]xxx
7694 !! html
7695 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7696 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7697 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7698 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7699 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Parsoid link trail escaping
7705 !! options
7706 parsoid=html2wt,html2html
7707 !! html/parsoid
7708 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7709 !! wikitext
7710 [[apple]]<nowiki/>s
7711 !! end
7712
7713 !! test
7714 Parsoid link prefix escaping
7715 !! options
7716 language=is
7717 parsoid=html2wt,html2html
7718 !! html/parsoid
7719 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7720 !! wikitext
7721 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7722 !! end
7723
7724 !! test
7725 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7726 !! wikitext
7727 [[Foo| bar]]
7728
7729 [[Foo| ''bar'']]
7730
7731 [http://wp.org foo]
7732
7733 [http://wp.org ''foo'']
7734 !! html
7735 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7736 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7737 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7738 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7744 !! options
7745 parsoid
7746 !! wikitext
7747 [[Foo|{{echo|a}} b {{echo|c}}]]
7748 !! html
7749 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
7750 !! end
7751
7752 !! test
7753 Link with angle bracket after anchor
7754 !! wikitext
7755 [[Foo#<bar>]]
7756 !! html/php
7757 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7758 </p>
7759 !! html/parsoid
7760 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
7761 !! end
7762
7763 ###
7764 ### Interwiki links (see maintenance/interwiki.sql)
7765 ###
7766
7767 !! test
7768 Inline interwiki link
7769 !! options
7770 parsoid=wt2html,wt2wt,html2html
7771 !! wikitext
7772 [[MeatBall:SoftSecurity]]
7773 !! html/php
7774 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7775 </p>
7776 !! html/parsoid
7777 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7778 !! end
7779
7780 !! test
7781 Inline interwiki link with empty title (bug 2372)
7782 !! options
7783 parsoid=wt2html,wt2wt,html2html
7784 !! wikitext
7785 [[MeatBall:]]
7786 !! html/php
7787 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7791 !! end
7792
7793 !! test
7794 Interwiki link encoding conversion (bug 1636)
7795 !! wikitext
7796 *[[Wikipedia:ro:Olteni&#0355;a]]
7797 *[[Wikipedia:ro:Olteni&#355;a]]
7798 !! html
7799 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
7800 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
7801
7802 !! html+tidy
7803 <ul>
7804 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7805 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7806 </ul>
7807 !! end
7808
7809 !! test
7810 Interwiki link with fragment (bug 2130)
7811 !! wikitext
7812 [[MeatBall:SoftSecurity#foo]]
7813 !! html
7814 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7815 </p>
7816 !! end
7817
7818 # Ideally the wikipedia: prefix here should be proto-relative too
7819 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7820 # define the 'en' prefix, and originally the test used 'wikipedia',
7821 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7822 # article.
7823 !! test
7824 Different interwiki prefixes mapping to the same URL
7825 !! wikitext
7826 [[:en:Foo]]
7827
7828 [[:en:Foo|Foo]]
7829
7830 [[wikipedia:Foo]]
7831
7832 [[:wikipedia:Foo|Foo]]
7833
7834 [[wikipedia:en:Foo]]
7835
7836 [[:wikipedia:en:Foo]]
7837
7838 [[ wikiPEdia :Foo]]
7839 !! html/parsoid
7840 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
7841
7842 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
7843
7844 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
7845
7846 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
7847
7848 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7849
7850 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7851
7852 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
7853 !! end
7854
7855 !! test
7856 Interwiki links that cannot be represented in wiki syntax
7857 !! wikitext
7858 [[meatball:ok]]
7859 [[meatball:ok#foo|ok with fragment]]
7860 [[meatball:ok_as_well?|ok ending with ? mark]]
7861 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7862 [http://de.wikipedia.org/wiki/#foo is just fragment]
7863
7864 !! html/php
7865 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7866 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7867 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
7868 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7869 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7870 </p>
7871 !! html/parsoid
7872 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7873 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7874 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
7875 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7876 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7877 !! end
7878
7879 !! test
7880 Interwiki links: trail
7881 !! wikitext
7882 [[wikipedia:Foo|Ba]]r
7883 !! html/php
7884 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7885 </p>
7886 !! html/parsoid
7887 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7888 !! end
7889
7890 !! test
7891 Local interwiki link
7892 !! options
7893 parsoid=wt2html,wt2wt,html2html
7894 !! wikitext
7895 [[local:Template:Foo]]
7896 !! html/php
7897 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7898 </p>
7899 !! html/parsoid
7900 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7901 !! end
7902
7903 # Parsoid does not mark self-links, by design.
7904 !! test
7905 Local interwiki link: self-link to current page
7906 !! options
7907 title=[[Main Page]]
7908 parsoid=wt2html,wt2wt,html2html
7909 !! wikitext
7910 [[local:Main Page]]
7911 !! html/php
7912 <p><strong class="selflink">local:Main Page</strong>
7913 </p>
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7916 !! end
7917
7918 !! test
7919 Local interwiki link: prefix only (bug 64167)
7920 !! options
7921 parsoid=wt2html,wt2wt,html2html
7922 !! wikitext
7923 [[local:]]
7924 !! html/php
7925 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7929 !! end
7930
7931 !! test
7932 Local interwiki link: with additional interwiki prefix (bug 61357)
7933 !! options
7934 parsoid=wt2html,wt2wt,html2html
7935 !! wikitext
7936 [[local:meatball:Hello]]
7937 !! html/php
7938 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7939 </p>
7940 !! html/parsoid
7941 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7942 !! end
7943
7944 !! test
7945 Multiple local interwiki link prefixes
7946 !! wikitext
7947 [[local:local:local:local:mi:local:Foo]]
7948 !! options
7949 parsoid=wt2html,wt2wt,html2html
7950 !! html/php
7951 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7952 </p>
7953 !! html/parsoid
7954 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7955 !! end
7956
7957 ###
7958 ### Interlanguage links
7959 ### Language links (so that searching for '### language' matches..)
7960 ###
7961
7962 !! test
7963 Interlanguage link
7964 !! options
7965 parsoid=wt2html,wt2wt,html2html
7966 !! wikitext
7967 Blah blah blah
7968 [[zh:Chinese]]
7969 !! html/php
7970 <p>Blah blah blah
7971 </p>
7972 !! html/parsoid
7973 <p>Blah blah blah</p>
7974 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7975 !! end
7976
7977 !! test
7978 Interlanguage link with spacing
7979 !! options
7980 parsoid=wt2html,wt2wt,html2html
7981 !! wikitext
7982 Blah blah blah
7983 [[ zh : Chinese ]]
7984 !! html/php
7985 <p>Blah blah blah
7986 </p>
7987 !! html/parsoid
7988 <p>Blah blah blah</p>
7989 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7990 !! end
7991
7992 !! test
7993 Double interlanguage link
7994 !! options
7995 parsoid=wt2html,wt2wt,html2html
7996 !! wikitext
7997 Blah blah blah
7998 [[es:Spanish]]
7999 [[zh:Chinese]]
8000 !! html/php
8001 <p>Blah blah blah
8002 </p>
8003 !! html/parsoid
8004 <p>Blah blah blah</p>
8005 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8006 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8007 !! end
8008
8009 !! test
8010 Interlanguage link variations
8011 !! options
8012 parsoid=wt2html,wt2wt,html2html
8013 !! wikitext
8014 Blah blah blah
8015 [[ es :Spanish]]
8016 [[ ZH :Chinese]]
8017 [[es:Foo_bar]]
8018 !! html/php
8019 <p>Blah blah blah
8020 </p>
8021 !! html/parsoid
8022 <p>Blah blah blah</p>
8023 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8024 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8025 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8026 !! end
8027
8028 !! test
8029 Space and question mark encoding in interlanguage links (T95473)
8030 !! options
8031 parsoid=wt2html,wt2wt,html2html
8032 !! wikitext
8033 Blah blah blah
8034 [[es:Foo bar?]]
8035 !! html/php
8036 <p>Blah blah blah
8037 </p>
8038 !! html/parsoid
8039 <p>Blah blah blah</p>
8040 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8041 !! end
8042
8043 !! test
8044 Interlanguage link, with prefix links
8045 !! options
8046 language=ln
8047 !! wikitext
8048 Blah blah blah
8049 [[zh:Chinese]]
8050 !! html/php
8051 <p>Blah blah blah
8052 </p>
8053 !! html/parsoid
8054 <p>Blah blah blah</p>
8055 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8056 !! end
8057
8058 !! test
8059 Double interlanguage link, with prefix links (bug 8897)
8060 !! options
8061 language=ln
8062 !! wikitext
8063 Blah blah blah
8064 [[es:Spanish]]
8065 [[zh:Chinese]]
8066 !! html/php
8067 <p>Blah blah blah
8068 </p>
8069 !! html/parsoid
8070 <p>Blah blah blah</p>
8071 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8072 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8073 !! end
8074
8075 !! test
8076 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8077 !! wikitext
8078 Blah blah blah
8079 [[mul:Article]]
8080 !! html/php
8081 <p>Blah blah blah
8082 </p>
8083 !! html/parsoid
8084 <p>Blah blah blah</p>
8085 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8086 !! end
8087
8088 !! test
8089 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8090 !! options
8091 language=ln
8092 !! wikitext
8093 [[WW&nbsp;II]]
8094 !! html
8095 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8096 </p>
8097 !! end
8098
8099 !! test
8100 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8101 !! options
8102 parsoid=html2wt
8103 !! html/parsoid
8104 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8105 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8106 !! wikitext
8107 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8108
8109 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8110 !! end
8111
8112 !! test
8113 Parsoid: handle constructor well
8114 !! wikitext
8115 [[constructor]]
8116
8117 [[constructor:foo]]
8118 !! html/php
8119 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8120 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8121 </p>
8122 !! html/parsoid
8123 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
8124
8125 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
8126 !! end
8127
8128 !! article
8129 ko:
8130 !! text
8131 Test.
8132 !! endarticle
8133
8134 # Note that `ko` isn't a known interlanguage prefix
8135 !! test
8136 Parsoid: recognize interlanguage links without a target page
8137 !! options
8138 ill
8139 !! wikitext
8140 [[es:]]
8141
8142 [[ko:]]
8143 !! html/php
8144 es:
8145 !! html/parsoid
8146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8147
8148 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8149 !! end
8150
8151 # Note that `ko` isn't a known interwiki prefix
8152 !! test
8153 Parsoid: recognize interwiki links without a target page
8154 !! options
8155 parsoid=wt2html,wt2wt,html2html
8156 !! wikitext
8157 [[:es:]]
8158
8159 [[:ko:]]
8160 !! html/php
8161 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8162 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8163 </p>
8164 !! html/parsoid
8165 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8166 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8167 !! end
8168
8169 !! test
8170 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8171 !! wikitext
8172 [[mi:Foo]]
8173 !! html/php
8174 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8175 </p>
8176 !! html/parsoid
8177 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8178 !! end
8179
8180 !! test
8181 Interlanguage link with preceding local interwiki link (bug 68085)
8182 !! options
8183 parsoid=wt2html,wt2wt,html2html
8184 !! wikitext
8185 Blah blah blah
8186 [[local:es:Spanish]]
8187 !! html/php
8188 <p>Blah blah blah
8189 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah
8193 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8194 !! end
8195
8196 !! test
8197 Looks like an interlanguage link, but is actually a local interwiki
8198 !! options
8199 parsoid=wt2html,wt2wt,html2html
8200 !! wikitext
8201 Blah blah blah
8202 [[mi:Template:Foo]]
8203 !! html/php
8204 <p>Blah blah blah
8205 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8206 </p>
8207 !! html/parsoid
8208 <p>Blah blah blah
8209 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8210 !! end
8211
8212 ###
8213 ### Redirects, Parsoid-only
8214 ###
8215
8216 !! test
8217 1. Simple redirect to page
8218 !! wikitext
8219 #REDIRECT [[Main Page]]
8220 !! html/parsoid
8221 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8222 !! end
8223
8224 !! test
8225 2. Other redirect variants
8226 !! wikitext
8227 #REDIRECT [[Main_Page]]
8228 !! html/parsoid
8229 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8230 !! end
8231
8232 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8233 # This tests the Parsoid bail-out code.
8234 !! test
8235 3. Other redirect variants
8236 !! wikitext
8237 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8238 !! html/parsoid
8239 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8240 !! end
8241
8242 !! test
8243 4. Redirect to a templated destination
8244 !! wikitext
8245 #REDIRECT [[{{echo|Foo}}bar]]
8246 !! html/parsoid
8247 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8248 !! end
8249
8250 !! test
8251 Empty redirect
8252 !! options
8253 parsoid=wt2html,wt2wt
8254 !! wikitext
8255 #REDIRECT [[]]
8256 !! html/parsoid
8257 <ol>
8258 <li>REDIRECT [[]]</li></ol>
8259 !! end
8260
8261 !! test
8262 Optional colon in #REDIRECT
8263 !! options
8264 # the colon is archaic syntax. we support it for wt2html, but we
8265 # don't care that it roundtrips back to the modern syntax.
8266 parsoid=wt2html,html2html
8267 !! wikitext
8268 #REDIRECT:[[Main Page]]
8269 !! html/parsoid
8270 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8271 !! end
8272
8273 !! test
8274 Whitespace in #REDIRECT with optional colon
8275 !! options
8276 # the colon and gratuitous whitespace is archaic syntax. we support
8277 # it for wt2html, but we don't care that it roundtrips back to the
8278 # modern syntax (without extra whitespace)
8279 parsoid=wt2html,html2html
8280 !! wikitext
8281
8282 #REDIRECT
8283 :
8284 [[Main Page]]
8285 !! html/parsoid
8286 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8287 !! end
8288
8289 !! test
8290 Piped link in #REDIRECT
8291 !! options
8292 # content after piped link is ignored. we support this syntax,
8293 # but don't care that the piped link is lost when we roundtrip this.
8294 parsoid=wt2html
8295 !! wikitext
8296 #REDIRECT [[Main Page|bar]]
8297 !! html/parsoid
8298 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8299 !! end
8300
8301 !! test
8302 Redirect to category (T104502)
8303 !! options
8304 parsoid=wt2html,wt2wt
8305 !! wikitext
8306 #REDIRECT [[Category:Foo]]
8307 !! html/parsoid
8308 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8309 !! end
8310
8311 !! test
8312 Redirect to category with URL encoding (T104502)
8313 !! options
8314 parsoid=wt2html
8315 !! wikitext
8316 #REDIRECT [[Category%3AFoo]]
8317 !! html/parsoid
8318 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8319 !! end
8320
8321 !! test
8322 Redirect to category page
8323 !! wikitext
8324 #REDIRECT [[:Category:Foo]]
8325 !! html/parsoid
8326 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8327 !! end
8328
8329 !! test
8330 Redirect to image page (1)
8331 !! wikitext
8332 #REDIRECT [[File:Wiki.png]]
8333 !! html/parsoid
8334 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8335 !! end
8336
8337 !! test
8338 Redirect to image page (2)
8339 !! wikitext
8340 #REDIRECT [[Image:Wiki.png]]
8341 !! html/parsoid
8342 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8343 !! end
8344
8345 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8346 # Next test confirms this.
8347 !! test
8348 Redirect to language (1) (T104918)
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 #REDIRECT [[en:File:Wiki.png]]
8353 !! html/parsoid
8354 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8355 !! end
8356
8357 !! test
8358 Redirect to language (2) (T104918)
8359 !! wikitext
8360 #REDIRECT [[:en:File:Wiki.png]]
8361 !! html/parsoid
8362 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8363 !! end
8364
8365 !! test
8366 Redirect to interwiki (T104918)
8367 !! wikitext
8368 #REDIRECT [[meatball:File:Wiki.png]]
8369 !! html/parsoid
8370 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8371 !! end
8372
8373 !! test
8374 Non-English #REDIRECT
8375 !! options
8376 language=is
8377 !! wikitext
8378 #TILVÍSUN [[Main Page]]
8379 !! html/parsoid
8380 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8381 !! end
8382
8383 !! test
8384 Redirect syntax under text isn't considered a redirect
8385 !! wikitext
8386 some text
8387 #redirect [[Main Page]]
8388 !! html/parsoid
8389 <p>some text</p>
8390 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8391 !! end
8392
8393 # FIXME: Should hoist the redirect to the top of the page and ensure there
8394 # is only one.
8395 !! test
8396 New redirect
8397 !! options
8398 parsoid=html2wt
8399 !! html/parsoid
8400 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8401 !! wikitext
8402 Foo
8403 #REDIRECT [[Foo]]
8404 !! end
8405
8406 ##
8407 ## XHTML tidiness
8408 ###
8409
8410 !! test
8411 <br> to <br />
8412 !! wikitext
8413 1<br>2<br />3
8414 !! html
8415 <p>1<br />2<br />3
8416 </p>
8417 !! end
8418
8419 !! test
8420 Broken br tag sanitization
8421 !! wikitext
8422 </br>
8423 !! html/php
8424 <p>&lt;/br&gt;
8425 </p>
8426 !! end
8427
8428 # TODO: Fix html2html mode (bug 51055)!
8429 !! test
8430 Parsoid: Broken br tag recognition
8431 !! options
8432 parsoid=wt2html
8433 !! wikitext
8434 </br>
8435
8436 <br/ >
8437 !! html+tidy
8438 <p><br /></p>
8439 <p><br /></p>
8440 !! end
8441
8442 !! test
8443 Incorrecly removing closing slashes from correctly formed XHTML
8444 !! wikitext
8445 <br style="clear:both;" />
8446 !! html
8447 <p><br style="clear:both;" />
8448 </p>
8449 !! end
8450
8451 !! test
8452 Failing to transform badly formed HTML into correct XHTML
8453 !! wikitext
8454 <br style="clear: left;">
8455 <br style="clear: right;">
8456 <br style="clear: both;">
8457 !! html
8458 <p><br style="clear: left;" />
8459 <br style="clear: right;" />
8460 <br style="clear: both;" />
8461 </p>
8462 !!end
8463
8464 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8465 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8466 !! test
8467 Handling html with a div self-closing tag
8468 !! wikitext
8469 <div title />
8470 <div title/>
8471 <div title/ >
8472 <div title=bar />
8473 <div title=bar/>
8474 <div title=bar/ >
8475 !! html/php
8476 <p>&lt;div title /&gt;
8477 &lt;div title/&gt;
8478 </p>
8479 <div>
8480 <p>&lt;div title=bar /&gt;
8481 &lt;div title=bar/&gt;
8482 </p>
8483 <div title="bar/"></div>
8484 </div>
8485
8486 !! html/parsoid
8487 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8488 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8489 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8490 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8491 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8492 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8493 !! end
8494
8495 !! test
8496 Handling html with a br self-closing tag
8497 !! wikitext
8498 <br title />
8499 <br title/>
8500 <br title/ >
8501 <br title=bar />
8502 <br title=bar/>
8503 <br title=bar/ >
8504 !! html/php
8505 <p><br title="" />
8506 <br title="" />
8507 <br />
8508 <br title="bar" />
8509 <br title="bar" />
8510 <br title="bar/" />
8511 </p>
8512 !! html/parsoid
8513 <p><br title="" />
8514 <br title="" />
8515 <br title="" />
8516 <br title="bar" />
8517 <br title="bar" />
8518 <br title="bar/" />
8519 </p>
8520 !! end
8521
8522 !! test
8523 Horizontal ruler (should it add that extra space?)
8524 !! wikitext
8525 <hr>
8526 <hr >
8527 foo <hr
8528 > bar
8529 !! html+tidy
8530 <hr />
8531 <hr />
8532 <p>foo</p>
8533 <hr />
8534 <p>bar</p>
8535 !! end
8536
8537 !! test
8538 Horizontal ruler -- 4+ dashes render hr
8539 !! wikitext
8540 ----
8541 !! html
8542 <hr />
8543
8544 !! end
8545
8546 !! test
8547 Horizontal ruler -- eats additional dashes on the same line
8548 !! wikitext
8549 ---------
8550 !! html
8551 <hr />
8552
8553 !! end
8554
8555 !! test
8556 Horizontal ruler -- does not collapse dashes on consecutive lines
8557 !! wikitext
8558 ----
8559 ----
8560 !! html
8561 <hr />
8562 <hr />
8563
8564 !! end
8565
8566 !! test
8567 Horizontal ruler -- <4 dashes render as plain text
8568 !! wikitext
8569 ---
8570 !! html
8571 <p>---
8572 </p>
8573 !! end
8574
8575 !! test
8576 Horizontal ruler -- Supports content following dashes on same line
8577 !! wikitext
8578 ---- Foo
8579 !! html
8580 <hr /> Foo
8581
8582 !! html+tidy
8583 <hr />
8584 <p>Foo</p>
8585 !! end
8586
8587 ###
8588 ### Block-level elements
8589 ###
8590 !! test
8591 Common list
8592 !! wikitext
8593 *Common list
8594 * item 2
8595 *item 3
8596 !! html
8597 <ul><li>Common list</li>
8598 <li> item 2</li>
8599 <li>item 3</li></ul>
8600
8601 !! end
8602
8603 !! test
8604 Numbered list
8605 !! wikitext
8606 #Numbered list
8607 #item 2
8608 # item 3
8609 !! html
8610 <ol><li>Numbered list</li>
8611 <li>item 2</li>
8612 <li> item 3</li></ol>
8613
8614 !! end
8615
8616 !! test
8617 Mixed list
8618 !! wikitext
8619 *Mixed list
8620 *# with numbers
8621 ** and bullets
8622 *# and numbers
8623 *bullets again
8624 **bullet level 2
8625 ***bullet level 3
8626 ***#Number on level 4
8627 **bullet level 2
8628 **#Number on level 3
8629 **#Number on level 3
8630 *#number level 2
8631 *Level 1
8632 *** Level 3
8633 #** Level 3, but ordered
8634 !! html
8635 <ul><li>Mixed list
8636 <ol><li> with numbers</li></ol>
8637 <ul><li> and bullets</li></ul>
8638 <ol><li> and numbers</li></ol></li>
8639 <li>bullets again
8640 <ul><li>bullet level 2
8641 <ul><li>bullet level 3
8642 <ol><li>Number on level 4</li></ol></li></ul></li>
8643 <li>bullet level 2
8644 <ol><li>Number on level 3</li>
8645 <li>Number on level 3</li></ol></li></ul>
8646 <ol><li>number level 2</li></ol></li>
8647 <li>Level 1
8648 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8649 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8650
8651 !! end
8652
8653 !! test
8654 Nested lists 1
8655 !! wikitext
8656 *foo
8657 **bar
8658 !! html
8659 <ul><li>foo
8660 <ul><li>bar</li></ul></li></ul>
8661
8662 !! end
8663
8664 !! test
8665 Nested lists 2
8666 !! wikitext
8667 **foo
8668 *bar
8669 !! html
8670 <ul><li><ul><li>foo</li></ul></li>
8671 <li>bar</li></ul>
8672
8673 !! end
8674
8675 !! test
8676 Nested lists 3 (first element empty)
8677 !! wikitext
8678 *
8679 **bar
8680 !! html
8681 <ul><li>
8682 <ul><li>bar</li></ul></li></ul>
8683
8684 !! end
8685
8686 !! test
8687 Nested lists 4 (first element empty)
8688 !! wikitext
8689 **
8690 *bar
8691 !! html
8692 <ul><li><ul><li></li></ul></li>
8693 <li>bar</li></ul>
8694
8695 !! end
8696
8697 !! test
8698 Nested lists 5 (both elements empty)
8699 !! wikitext
8700 **
8701 *
8702 !! html
8703 <ul><li><ul><li></li></ul></li>
8704 <li></li></ul>
8705
8706 !! end
8707
8708 !! test
8709 Nested lists 6 (both elements empty)
8710 !! wikitext
8711 *
8712 **
8713 !! html
8714 <ul><li>
8715 <ul><li></li></ul></li></ul>
8716
8717 !! end
8718
8719 !! test
8720 Nested lists 7 (skip initial nesting levels)
8721 !! wikitext
8722 *** foo
8723 !! html
8724 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8725
8726 !! end
8727
8728 !! test
8729 Nested lists 8 (multiple nesting transitions)
8730 !! wikitext
8731 * foo
8732 *** bar
8733 ** baz
8734 * boo
8735 !! html
8736 <ul><li> foo
8737 <ul><li><ul><li> bar</li></ul></li>
8738 <li> baz</li></ul></li>
8739 <li> boo</li></ul>
8740
8741 !! end
8742
8743 !! test
8744 Nested lists 9 (extension interaction)
8745 !! options
8746 parsoid
8747 !! wikitext
8748 *<references />
8749 !! html/parsoid
8750 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8751 !! end
8752
8753 !! test
8754 1. Lists with start-of-line-transparent tokens before bullets: Comments
8755 !! wikitext
8756 *foo
8757 *<!--cmt-->bar
8758 <!--cmt-->*baz
8759 !! html
8760 <ul><li>foo</li>
8761 <li>bar</li>
8762 <li>baz</li></ul>
8763
8764 !! end
8765
8766 !! test
8767 2. Lists with start-of-line-transparent tokens before bullets: Template close
8768 !! wikitext
8769 *foo {{echo|bar
8770 }}*baz
8771 !! html
8772 <ul><li>foo bar</li>
8773 <li>baz</li></ul>
8774
8775 !! end
8776
8777 !! test
8778 List items are not parsed correctly following a <pre> block (bug 785)
8779 !! wikitext
8780 * <pre>foo</pre>
8781 * <pre>bar</pre>
8782 * zar
8783 !! html/php
8784 <ul><li> <pre>foo</pre></li>
8785 <li> <pre>bar</pre></li>
8786 <li> zar</li></ul>
8787
8788 !! html/parsoid
8789 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8790 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8791 <li> zar</li></ul>
8792 !! end
8793
8794 !! test
8795 List items from template
8796 !! wikitext
8797
8798 {{inner list}}
8799 * item 2
8800
8801 * item 0
8802 {{inner list}}
8803 * item 2
8804
8805 * item 0
8806 * notSOL{{inner list}}
8807 * item 2
8808 !! html
8809 <ul><li> item 1</li>
8810 <li> item 2</li></ul>
8811 <ul><li> item 0</li>
8812 <li> item 1</li>
8813 <li> item 2</li></ul>
8814 <ul><li> item 0</li>
8815 <li> notSOL</li>
8816 <li> item 1</li>
8817 <li> item 2</li></ul>
8818
8819 !! end
8820
8821 !! test
8822 List interrupted by empty line or heading
8823 !! wikitext
8824 * foo
8825
8826 ** bar
8827 == A heading ==
8828 * Another list item
8829 !! html
8830 <ul><li> foo</li></ul>
8831 <ul><li><ul><li> bar</li></ul></li></ul>
8832 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8833 <ul><li> Another list item</li></ul>
8834
8835 !!end
8836
8837 !!test
8838 Multiple list tags generated by templates
8839 !! wikitext
8840 {{echo|<li>}}a
8841 {{echo|<li>}}b
8842 {{echo|<li>}}c
8843 !! html
8844 <li>a
8845 <li>b
8846 <li>c</li>
8847 </li>
8848 </li>
8849
8850 !! html+tidy
8851 <ul>
8852 <li>a</li>
8853 <li>b</li>
8854 <li>c</li>
8855 </ul>
8856 !!end
8857
8858 !!test
8859 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8860 !! wikitext
8861 *a
8862 <!--This line will NOT split the list-->
8863 *b
8864 <!--This line will NOT split the list either-->
8865 *c
8866 <!--foo--> <!----> <!--This line NOT split the list either-->
8867 *d
8868 !! html
8869 <ul><li>a</li>
8870 <li>b</li>
8871 <li>c</li>
8872 <li>d</li></ul>
8873
8874 !!end
8875
8876 !!test
8877 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8878 !! wikitext
8879 *a
8880 <!--This line will NOT split the list-->
8881 *b
8882 <!--This line will NOT split the list either-->
8883 *c
8884 <!--foo--> <!----> <!--This line NOT split the list
8885 either-->
8886 *d
8887 !! html
8888 <ul><li>a</li>
8889 <li>b</li>
8890 <li>c</li>
8891 <li>d</li></ul>
8892
8893 !!end
8894
8895 !!test
8896 Test the li-hack
8897 (The PHP parser relies on Tidy for the hack)
8898 !!options
8899 parsoid=wt2html,wt2wt
8900 !! wikitext
8901 * foo
8902 * <li>li-hack
8903 * {{echo|<li>templated li-hack}}
8904 * <!--foo--> <li> unsupported li-hack with preceding comments
8905
8906 <ul>
8907 <li><li>not a li-hack
8908 </li>
8909 </ul>
8910 !! html+tidy
8911 <ul>
8912 <li>foo</li>
8913 <li>li-hack</li>
8914 <li>templated li-hack</li>
8915 <li>unsupported li-hack with preceding comments</li>
8916 </ul>
8917 <ul>
8918 <li>not a li-hack</li>
8919 </ul>
8920 !!end
8921
8922 !! test
8923 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8924 !! options
8925 parsoid
8926 !! wikitext
8927 # foo
8928 ## bar
8929 * foo
8930 ** bar
8931 : foo
8932 :: bar
8933 !! html
8934 <ol>
8935 <li> foo<ol>
8936 <li> bar</li>
8937 </ol></li>
8938 </ol><ul>
8939 <li> foo<ul>
8940 <li> bar</li>
8941 </ul></li>
8942 </ul><dl>
8943 <dd> foo<dl>
8944 <dd> bar</dd>
8945 </dl></dd>
8946 </dl>
8947 !! end
8948
8949 !! test
8950 Parsoid: Test of whitespace serialization with Templated bullets
8951 !! options
8952 parsoid
8953 !! wikitext
8954 * {{bullet}}
8955 !! html
8956 <ul>
8957 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8958 </ul>
8959 !! end
8960
8961 # ------------------------------------------------------------------------
8962 # The next set of tests are about Parsoid's ability to handle badly nested
8963 # tags (parse, minimize scope of fixup, and roundtrip back)
8964 # ------------------------------------------------------------------------
8965
8966 !! test
8967 Unbalanced closing block tags break a list
8968 (php parser relies on Tidy to fix up)
8969 !! wikitext
8970 <div>
8971 *a</div><div>
8972 *b</div>
8973 !! html+tidy
8974 <div>
8975 <ul>
8976 <li>a</li>
8977 </ul>
8978 </div>
8979 <div>
8980 <ul>
8981 <li>b</li>
8982 </ul>
8983 </div>
8984 !! end
8985
8986 # Parsoid fails this test, but it might be tricky to support properly.
8987 # See bug 68395.
8988 !! test
8989 Unbalanced closing non-block tags don't break a list
8990 (php parser relies on Tidy to fix up)
8991 !! wikitext
8992 <span>
8993 *a</span><span>
8994 *b</span>
8995 !! html/php+tidy
8996 <ul>
8997 <li><span>a</span></li>
8998 <li><span>b</span></li>
8999 </ul>
9000 !! html/parsoid
9001 <span>
9002 <ul>
9003 <li>a<span></span>
9004 </li>
9005 <li>b
9006 </li>
9007 </ul>
9008 </span>
9009 !! end
9010
9011 !! test
9012 Unclosed formatting tags that straddle lists are closed and reopened
9013 (php parser relies on Tidy to fix up)
9014 !! options
9015 parsoid=wt2html,wt2wt,html2html
9016 !! wikitext
9017 # <s> a
9018 # b </s>
9019 !! html/php+tidy
9020 <ol>
9021 <li><s>a</s></li>
9022 <li><s>b</s></li>
9023 </ol>
9024 !! html/parsoid
9025 <ol><li> <s> a</s></li>
9026 <li><s> b </s></li></ol>
9027 !! end
9028
9029 # See bug 68395.
9030 !!test
9031 1. List embedded in a formatting tag
9032 !! wikitext
9033 <small>
9034 * foo
9035 </small>
9036 !! html/php+tidy
9037 <ul>
9038 <li><small>foo</small></li>
9039 </ul>
9040 !! html/parsoid
9041 <small>
9042 <ul>
9043 <li> foo</li>
9044 </ul>
9045 </small>
9046 !!end
9047
9048 ## Ugly Parsoid output here
9049 ## Not sure what the right output is.
9050 !!test
9051 2. List embedded in a formatting tag
9052 !! wikitext
9053 <small>
9054 *a
9055 *b</small>
9056 !! html/php+tidy
9057 <ul>
9058 <li><small>a</small></li>
9059 <li><small>b</small></li>
9060 </ul>
9061 !! html/parsoid
9062 <small></small>
9063 <ul><small>
9064 <li>a</li>
9065 </small>
9066 <li><small>b</small></li>
9067 </ul>
9068 !!end
9069
9070 # Ugly Parsoid and PHP parser output here
9071 # Not sure if we want to make this a test!
9072 #
9073 ## !!test
9074 ## 3. Unclosed formatting tags in list elements
9075 ## !! wikitext
9076 ## *<small>a
9077 ## *<small>b
9078 ## !! html/php+tidy
9079 ## <ul>
9080 ## <li><small>a</small></li>
9081 ## <li><small><small>b</small></small></li>
9082 ## </ul>
9083 ## !! html/parsoid
9084 ## <ul>
9085 ## <li><small>a</small></li>
9086 ## <small>
9087 ## <li><small>b</small></li>
9088 ## </small></ul>
9089 ## !!end
9090
9091 # This is a bug in the PHP parser + tidy combination.
9092 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9093 # and then fostered out of the table by tidy.)
9094 # We believe the Parsoid output to be correct.
9095 !! test
9096 Table with missing opening <tr> tag
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 <table>
9101 <td>foo</td>
9102 </tr>
9103 </table>
9104 !! html+tidy
9105 <table>
9106 <tr>
9107 <td>foo</td>
9108 </tr>
9109 </table>
9110 !! end
9111
9112 ###
9113 ### Magic Words
9114 ###
9115
9116 # Note that the current date is hard-coded as
9117 # 1970-01-01T00:02:03Z (a Thursday)
9118 # when running parser tests. The timezone is also fixed to GMT, so
9119 # local date will be identical to current date.
9120
9121 !! test
9122 Magic Word: {{CURRENTDAY}}
9123 !! wikitext
9124 {{CURRENTDAY}}
9125 !! html
9126 <p>1
9127 </p>
9128 !! end
9129
9130 !! test
9131 Magic Word: {{CURRENTDAY2}}
9132 !! wikitext
9133 {{CURRENTDAY2}}
9134 !! html
9135 <p>01
9136 </p>
9137 !! end
9138
9139 !! test
9140 Magic Word: {{CURRENTDAYNAME}}
9141 !! wikitext
9142 {{CURRENTDAYNAME}}
9143 !! html
9144 <p>Thursday
9145 </p>
9146 !! end
9147
9148 !! test
9149 Magic Word: {{CURRENTDOW}}
9150 !! wikitext
9151 {{CURRENTDOW}}
9152 !! html
9153 <p>4
9154 </p>
9155 !! end
9156
9157 !! test
9158 Magic Word: {{CURRENTMONTH}}
9159 !! wikitext
9160 {{CURRENTMONTH}}
9161 !! html
9162 <p>01
9163 </p>
9164 !! end
9165
9166 !! test
9167 Magic Word: {{CURRENTMONTH1}}
9168 !! wikitext
9169 {{CURRENTMONTH1}}
9170 !! html
9171 <p>1
9172 </p>
9173 !! end
9174
9175 !! test
9176 Magic Word: {{CURRENTMONTHABBREV}}
9177 !! wikitext
9178 {{CURRENTMONTHABBREV}}
9179 !! html
9180 <p>Jan
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic Word: {{CURRENTMONTHNAME}}
9186 !! wikitext
9187 {{CURRENTMONTHNAME}}
9188 !! html
9189 <p>January
9190 </p>
9191 !! end
9192
9193 !! test
9194 Magic Word: {{CURRENTMONTHNAMEGEN}}
9195 !! wikitext
9196 {{CURRENTMONTHNAMEGEN}}
9197 !! html
9198 <p>January
9199 </p>
9200 !! end
9201
9202 !! test
9203 Magic Word: {{CURRENTTIME}}
9204 !! wikitext
9205 {{CURRENTTIME}}
9206 !! html
9207 <p>00:02
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{CURRENTHOUR}}
9213 !! wikitext
9214 {{CURRENTHOUR}}
9215 !! html
9216 <p>00
9217 </p>
9218 !! end
9219
9220 !! test
9221 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9222 !! wikitext
9223 {{CURRENTWEEK}}
9224 !! html
9225 <p>1
9226 </p>
9227 !! end
9228
9229 !! test
9230 Magic Word: {{CURRENTYEAR}}
9231 !! wikitext
9232 {{CURRENTYEAR}}
9233 !! html
9234 <p>1970
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{CURRENTTIMESTAMP}}
9240 !! wikitext
9241 {{CURRENTTIMESTAMP}}
9242 !! html
9243 <p>19700101000203
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Words LOCAL (UTC)
9249 !! wikitext
9250 * {{LOCALMONTH}}
9251 * {{LOCALMONTH1}}
9252 * {{LOCALMONTHNAME}}
9253 * {{LOCALMONTHNAMEGEN}}
9254 * {{LOCALMONTHABBREV}}
9255 * {{LOCALDAY}}
9256 * {{LOCALDAY2}}
9257 * {{LOCALDAYNAME}}
9258 * {{LOCALYEAR}}
9259 * {{LOCALTIME}}
9260 * {{LOCALHOUR}}
9261 * {{LOCALWEEK}}
9262 * {{LOCALDOW}}
9263 * {{LOCALTIMESTAMP}}
9264 !! html
9265 <ul><li> 01</li>
9266 <li> 1</li>
9267 <li> January</li>
9268 <li> January</li>
9269 <li> Jan</li>
9270 <li> 1</li>
9271 <li> 01</li>
9272 <li> Thursday</li>
9273 <li> 1970</li>
9274 <li> 00:02</li>
9275 <li> 00</li>
9276 <li> 1</li>
9277 <li> 4</li>
9278 <li> 19700101000203</li></ul>
9279
9280 !! end
9281
9282 !! test
9283 Magic Word: {{FULLPAGENAME}}
9284 !! options
9285 title=[[User:Ævar Arnfjörð Bjarmason]]
9286 !! wikitext
9287 {{FULLPAGENAME}}
9288 !! html
9289 <p>User:Ævar Arnfjörð Bjarmason
9290 </p>
9291 !! end
9292
9293 !! test
9294 Magic Word: {{FULLPAGENAMEE}}
9295 !! options
9296 title=[[User:Ævar Arnfjörð Bjarmason]]
9297 !! wikitext
9298 {{FULLPAGENAMEE}}
9299 !! html
9300 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9301 </p>
9302 !! end
9303
9304 !! test
9305 Magic Word: {{TALKSPACE}}
9306 !! options
9307 title=[[User:Ævar Arnfjörð Bjarmason]]
9308 !! wikitext
9309 {{TALKSPACE}}
9310 !! html
9311 <p>User talk
9312 </p>
9313 !! end
9314
9315 !! test
9316 Magic Word: {{TALKSPACE}}, same namespace
9317 !! options
9318 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9319 !! wikitext
9320 {{TALKSPACE}}
9321 !! html
9322 <p>User talk
9323 </p>
9324 !! end
9325
9326 !! test
9327 Magic Word: {{TALKSPACE}}, main namespace
9328 !! options
9329 title=[[Parser Test]]
9330 !! wikitext
9331 {{TALKSPACE}}
9332 !! html
9333 <p>Talk
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{TALKSPACEE}}
9339 !! options
9340 title=[[User:Ævar Arnfjörð Bjarmason]]
9341 !! wikitext
9342 {{TALKSPACEE}}
9343 !! html
9344 <p>User_talk
9345 </p>
9346 !! end
9347
9348 !! test
9349 Magic Word: {{SUBJECTSPACE}}
9350 !! options
9351 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9352 !! wikitext
9353 {{SUBJECTSPACE}}
9354 !! html
9355 <p>User
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic Word: {{SUBJECTSPACE}}, same namespace
9361 !! options
9362 title=[[User:Ævar Arnfjörð Bjarmason]]
9363 !! wikitext
9364 {{SUBJECTSPACE}}
9365 !! html
9366 <p>User
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{SUBJECTSPACE}}, main namespace
9372 !! options
9373 title=[[Parser Test]]
9374 !! wikitext
9375 {{SUBJECTSPACE}}
9376 !! html
9377
9378 !! end
9379
9380 !! test
9381 Magic Word: {{SUBJECTSPACEE}}
9382 !! options
9383 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9384 !! wikitext
9385 {{SUBJECTSPACEE}}
9386 !! html
9387 <p>User
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{NAMESPACE}}
9393 !! options
9394 title=[[User:Ævar Arnfjörð Bjarmason]]
9395 !! wikitext
9396 {{NAMESPACE}}
9397 !! html
9398 <p>User
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{NAMESPACEE}}
9404 !! options
9405 title=[[User:Ævar Arnfjörð Bjarmason]]
9406 !! wikitext
9407 {{NAMESPACEE}}
9408 !! html
9409 <p>User
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{NAMESPACENUMBER}}
9415 !! options
9416 title=[[User:Ævar Arnfjörð Bjarmason]]
9417 !! wikitext
9418 {{NAMESPACENUMBER}}
9419 !! html
9420 <p>2
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{SUBPAGENAME}}
9426 !! options
9427 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9428 !! wikitext
9429 {{SUBPAGENAME}}
9430 !! html
9431 <p>sub ö
9432 </p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{SUBPAGENAMEE}}
9437 !! options
9438 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9439 !! wikitext
9440 {{SUBPAGENAMEE}}
9441 !! html
9442 <p>sub_%C3%B6
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{ROOTPAGENAME}}
9448 !! options
9449 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9450 !! wikitext
9451 {{ROOTPAGENAME}}
9452 !! html
9453 <p>Ævar Arnfjörð Bjarmason
9454 </p>
9455 !! end
9456
9457 !! test
9458 Magic Word: {{ROOTPAGENAMEE}}
9459 !! options
9460 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9461 !! wikitext
9462 {{ROOTPAGENAMEE}}
9463 !! html
9464 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9465 </p>
9466 !! end
9467
9468 !! test
9469 Magic Word: {{BASEPAGENAME}}
9470 !! options
9471 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9472 !! wikitext
9473 {{BASEPAGENAME}}
9474 !! html
9475 <p>Ævar Arnfjörð Bjarmason
9476 </p>
9477 !! end
9478
9479 !! test
9480 Magic Word: {{BASEPAGENAMEE}}
9481 !! options
9482 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9483 !! wikitext
9484 {{BASEPAGENAMEE}}
9485 !! html
9486 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{TALKPAGENAME}}
9492 !! options
9493 title=[[User:Ævar Arnfjörð Bjarmason]]
9494 !! wikitext
9495 {{TALKPAGENAME}}
9496 !! html
9497 <p>User talk:Ævar Arnfjörð Bjarmason
9498 </p>
9499 !! end
9500
9501 !! test
9502 Magic Word: {{TALKPAGENAMEE}}
9503 !! options
9504 title=[[User:Ævar Arnfjörð Bjarmason]]
9505 !! wikitext
9506 {{TALKPAGENAMEE}}
9507 !! html
9508 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9509 </p>
9510 !! end
9511
9512 !! test
9513 Magic Word: {{SUBJECTPAGENAME}}
9514 !! options
9515 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9516 !! wikitext
9517 {{SUBJECTPAGENAME}}
9518 !! html
9519 <p>User:Ævar Arnfjörð Bjarmason
9520 </p>
9521 !! end
9522
9523 !! test
9524 Magic Word: {{SUBJECTPAGENAMEE}}
9525 !! options
9526 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9527 !! wikitext
9528 {{SUBJECTPAGENAMEE}}
9529 !! html
9530 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9531 </p>
9532 !! end
9533
9534 !! test
9535 Magic Word: {{NUMBEROFFILES}}
9536 !! wikitext
9537 {{NUMBEROFFILES}}
9538 !! html
9539 <p>5
9540 </p>
9541 !! end
9542
9543 !! test
9544 Magic Word: {{PAGENAME}}
9545 !! options
9546 title=[[User:Ævar Arnfjörð Bjarmason]]
9547 !! wikitext
9548 {{PAGENAME}}
9549 !! html
9550 <p>Ævar Arnfjörð Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{PAGENAME}} with metacharacters
9556 !! options
9557 title=[['foo & bar = baz']]
9558 !! wikitext
9559 ''{{PAGENAME}}''
9560 !! html/php
9561 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9562 </p>
9563 !! html+tidy
9564 <p><i>'foo &amp; bar = baz'</i></p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9569 !! options
9570 title=[[*RFC 1234 http://example.com/]]
9571 !! wikitext
9572 {{PAGENAME}}
9573 !! html/php
9574 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9575 </p>
9576 !! html+tidy
9577 <p>*RFC 1234 http://example.com/</p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{PAGENAMEE}}
9582 !! options
9583 title=[[User:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{PAGENAMEE}}
9586 !! html
9587 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9593 !! options
9594 title=[[*RFC 1234 http://example.com/]]
9595 !! wikitext
9596 {{PAGENAMEE}}
9597 !! html/php
9598 <p>&#42;RFC_1234_http&#58;//example.com/
9599 </p>
9600 !! html+tidy
9601 <p>*RFC_1234_http://example.com/</p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{REVISIONID}}
9606 !! wikitext
9607 {{REVISIONID}}
9608 !! html
9609 <p>1337
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{SCRIPTPATH}}
9615 !! wikitext
9616 {{SCRIPTPATH}}
9617 !! html
9618 <p>/
9619 </p>
9620 !! end
9621
9622 !! test
9623 Magic Word: {{STYLEPATH}}
9624 !! wikitext
9625 {{STYLEPATH}}
9626 !! html
9627 <p>/skins
9628 </p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{SERVER}}
9633 !! wikitext
9634 {{SERVER}}
9635 !! html
9636 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9637 </p>
9638 !! end
9639
9640 !! test
9641 Magic Word: {{SERVERNAME}}
9642 !! wikitext
9643 {{SERVERNAME}}
9644 !! html
9645 <p>example.org
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{SITENAME}}
9651 !! wikitext
9652 {{SITENAME}}
9653 !! html
9654 <p>MediaWiki
9655 </p>
9656 !! end
9657
9658 !! test
9659 Case-sensitive magic words, when cased differently, should just be template transclusions
9660 !! wikitext
9661 {{CurrentMonth}}
9662 {{currentday}}
9663 {{cURreNTweEK}}
9664 {{currentHour}}
9665 !! html
9666 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
9667 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
9668 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
9669 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
9670 </p>
9671 !! end
9672
9673 !! test
9674 Case-insensitive magic words should still work with weird casing.
9675 !! wikitext
9676 {{sErVeRNaMe}}
9677 {{LCFirst:AOEU}}
9678 {{ucFIRST:aoeu}}
9679 {{SERver}}
9680 !! html
9681 <p>example.org
9682 aOEU
9683 Aoeu
9684 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9685 </p>
9686 !! end
9687
9688 # From plwiki:PLOS_ONE
9689 !! test
9690 Parsoid: Page property magic word with magic word contents
9691 !! wikitext
9692 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9693 !! html/parsoid
9694 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9695 !! end
9696
9697 !! test
9698 Parsoid: Template-generated DISPLAYTITLE
9699 !! wikitext
9700 {{{{echo|DISPLAYTITLE}}:Foo}}
9701 !! html/parsoid
9702 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9703 !! end
9704
9705 !! test
9706 Namespace 1 {{ns:1}}
9707 !! wikitext
9708 {{ns:1}}
9709 !! html
9710 <p>Talk
9711 </p>
9712 !! end
9713
9714 !! test
9715 Namespace 1 {{ns:01}}
9716 !! wikitext
9717 {{ns:01}}
9718 !! html
9719 <p>Talk
9720 </p>
9721 !! end
9722
9723 !! test
9724 Namespace 0 {{ns:0}} (bug 4783)
9725 !! wikitext
9726 {{ns:0}}
9727 !! html
9728
9729 !! end
9730
9731 !! test
9732 Namespace 0 {{ns:00}} (bug 4783)
9733 !! wikitext
9734 {{ns:00}}
9735 !! html
9736
9737 !! end
9738
9739 !! test
9740 Namespace -1 {{ns:-1}}
9741 !! wikitext
9742 {{ns:-1}}
9743 !! html
9744 <p>Special
9745 </p>
9746 !! end
9747
9748 !! test
9749 Namespace User {{ns:User}}
9750 !! wikitext
9751 {{ns:User}}
9752 !! html
9753 <p>User
9754 </p>
9755 !! end
9756
9757 !! test
9758 Namespace User talk {{ns:User_talk}}
9759 !! wikitext
9760 {{ns:User_talk}}
9761 !! html
9762 <p>User talk
9763 </p>
9764 !! end
9765
9766 !! test
9767 Namespace User talk {{ns:uSeR tAlK}}
9768 !! wikitext
9769 {{ns:uSeR tAlK}}
9770 !! html
9771 <p>User talk
9772 </p>
9773 !! end
9774
9775 !! test
9776 Namespace File {{ns:File}}
9777 !! wikitext
9778 {{ns:File}}
9779 !! html
9780 <p>File
9781 </p>
9782 !! end
9783
9784 !! test
9785 Namespace File {{ns:Image}}
9786 !! wikitext
9787 {{ns:Image}}
9788 !! html
9789 <p>File
9790 </p>
9791 !! end
9792
9793 !! test
9794 Namespace (lang=de) Benutzer {{ns:User}}
9795 !! options
9796 language=de
9797 !! wikitext
9798 {{ns:User}}
9799 !! html
9800 <p>Benutzer
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9806 !! options
9807 language=de
9808 !! wikitext
9809 {{ns:3}}
9810 !! html
9811 <p>Benutzer Diskussion
9812 </p>
9813 !! end
9814
9815
9816 !! test
9817 Urlencode
9818 !! wikitext
9819 {{urlencode:hi world?!}}
9820 {{urlencode:hi world?!|WIKI}}
9821 {{urlencode:hi world?!|PATH}}
9822 {{urlencode:hi world?!|QUERY}}
9823 !! html
9824 <p>hi+world%3F%21
9825 hi_world%3F!
9826 hi%20world%3F%21
9827 hi+world%3F%21
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: prioritize type info over data-parsoid
9833 !! options
9834 parsoid=html2wt
9835 !! html/parsoid
9836 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9837 !! wikitext
9838 __FORCETOC__
9839 !! end
9840
9841 !! test
9842 Magic Word: serialize on separate line (parsoid)
9843 !! options
9844 parsoid=wt2wt,html2wt
9845 !! wikitext
9846 foo
9847 __NOTOC__
9848 bar
9849 !! html/parsoid
9850 foo<meta property="mw:PageProp/notoc"/>bar
9851 !! end
9852
9853 !! test
9854 Magic Word: rt non-english wikis
9855 !! options
9856 parsoid=wt2wt
9857 language=de
9858 !! wikitext
9859 __NOEDITSECTION__
9860 !! html/parsoid
9861 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9862 !! end
9863
9864 !!test
9865 __proto__ is treated as normal wikitext (T105997)
9866 !!wikitext
9867 __proto__
9868 !!html
9869 <p>__proto__
9870 </p>
9871 !!end
9872
9873 ###
9874 ### Magic links
9875 ###
9876 !! test
9877 Magic links: internal link to RFC (bug 479)
9878 !! wikitext
9879 [[RFC 123]]
9880 !! html
9881 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic links: RFC (bug 479)
9887 !! wikitext
9888 RFC 822
9889 !! html
9890 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic links: RFC (bug 65278)
9896 !! wikitext
9897 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9898 !! html
9899 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9900 </p>
9901 !! end
9902
9903 !! test
9904 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9905 !! wikitext
9906 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9907 RFC
9908 822
9909 !! html
9910 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9911 RFC
9912 822
9913 </p>
9914 !! end
9915
9916 !! test
9917 Magic links: ISBN (bug 1937)
9918 !! wikitext
9919 ISBN 0-306-40615-2
9920 !! html
9921 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic links: ISBN (bug 65278)
9927 !! wikitext
9928 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9929 !! html/php
9930 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9931 </p>
9932 !! html/parsoid
9933 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9934 !! end
9935
9936 !! test
9937 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9938 !! wikitext
9939 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9940 ISBN
9941 9780316098113
9942 ISBN 978
9943 0316098113
9944 !! html
9945 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9946 ISBN
9947 9780316098113
9948 ISBN 978
9949 0316098113
9950 </p>
9951 !! end
9952
9953 !! test
9954 Magic links: PMID incorrectly converts space to underscore
9955 !! wikitext
9956 PMID 1234
9957 !! html
9958 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9959 </p>
9960 !! end
9961
9962 !! test
9963 Magic links: PMID (bug 65278)
9964 !! wikitext
9965 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9966 !! html
9967 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9968 </p>
9969 !! end
9970
9971 !! test
9972 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9973 !! wikitext
9974 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9975 PMID
9976 1234
9977 !! html
9978 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9979 PMID
9980 1234
9981 </p>
9982 !! end
9983
9984 ###
9985 ### Templates
9986 ####
9987
9988 !! test
9989 Nonexistent template
9990 !! wikitext
9991 {{thistemplatedoesnotexist}}
9992 !! html
9993 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
9994 </p>
9995 !! end
9996
9997 !! test
9998 Template with invalid target containing tags
9999 !! wikitext
10000 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10001 !! html
10002 <p>{{a<b>b</b>|foo|a=b|a = b}}
10003 </p>
10004 !! end
10005
10006 !! test
10007 Template with invalid target containing unclosed tag
10008 !! wikitext
10009 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10010 !! html
10011 <p>{{a<b>|foo|a=b|a = b}}</b>
10012 </p>
10013 !! end
10014
10015 !! test
10016 Template with invalid target containing wikilink
10017 !! wikitext
10018 {{[[Main Page]]}}
10019 !! html/php
10020 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10021 </p>
10022 !! html/parsoid
10023 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10024 !! end
10025
10026 !! test
10027 Template with just whitespace in it, bug #68421
10028 !! wikitext
10029 {{echo|{{ }}}}
10030 !! html/parsoid
10031 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
10032 !! end
10033
10034 !! article
10035 Template:test
10036 !! text
10037 This is a test template
10038 !! endarticle
10039
10040 !! test
10041 Simple template
10042 !! wikitext
10043 {{test}}
10044 !! html
10045 <p>This is a test template
10046 </p>
10047 !! end
10048
10049 !! test
10050 Template with explicit namespace
10051 !! wikitext
10052 {{Template:test}}
10053 !! html
10054 <p>This is a test template
10055 </p>
10056 !! end
10057
10058
10059 !! article
10060 Template:paramtest
10061 !! text
10062 This is a test template with parameter {{{param}}}
10063 !! endarticle
10064
10065 !! test
10066 Template parameter
10067 !! wikitext
10068 {{paramtest|param=foo}}
10069 !! html
10070 <p>This is a test template with parameter foo
10071 </p>
10072 !! end
10073
10074 !! article
10075 Template:paramtestnum
10076 !! text
10077 [[{{{1}}}|{{{2}}}]]
10078 !! endarticle
10079
10080 !! test
10081 Template unnamed parameter
10082 !! wikitext
10083 {{paramtestnum|Main Page|the main page}}
10084 !! html
10085 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10086 </p>
10087 !! end
10088
10089 !! article
10090 Template:templatesimple
10091 !! text
10092 (test)
10093 !! endarticle
10094
10095 !! article
10096 Template:templateredirect
10097 !! text
10098 #redirect [[Template:templatesimple]]
10099 !! endarticle
10100
10101 !! article
10102 Template:templateasargtestnum
10103 !! text
10104 {{{{{1}}}}}
10105 !! endarticle
10106
10107 !! article
10108 Template:templateasargtest
10109 !! text
10110 {{template{{{templ}}}}}
10111 !! endarticle
10112
10113 !! article
10114 Template:templateasargtest2
10115 !! text
10116 {{{{{templ}}}}}
10117 !! endarticle
10118
10119 !! test
10120 Template with template name as unnamed argument
10121 !! wikitext
10122 {{templateasargtestnum|templatesimple}}
10123 !! html
10124 <p>(test)
10125 </p>
10126 !! end
10127
10128 !! test
10129 Template with template name as argument
10130 !! wikitext
10131 {{templateasargtest|templ=simple}}
10132 !! html
10133 <p>(test)
10134 </p>
10135 !! end
10136
10137 !! test
10138 Template with template name as argument (2)
10139 !! wikitext
10140 {{templateasargtest2|templ=templatesimple}}
10141 !! html
10142 <p>(test)
10143 </p>
10144 !! end
10145
10146 !! article
10147 Template:templateasargtestdefault
10148 !! text
10149 {{{{{templ|templatesimple}}}}}
10150 !! endarticle
10151
10152 !! article
10153 Template:templa
10154 !! text
10155 '''templ'''
10156 !! endarticle
10157
10158 !! test
10159 Template with default value
10160 !! wikitext
10161 {{templateasargtestdefault}}
10162 !! html
10163 <p>(test)
10164 </p>
10165 !! end
10166
10167 !! test
10168 Template with default value (value set)
10169 !! wikitext
10170 {{templateasargtestdefault|templ=templa}}
10171 !! html
10172 <p><b>templ</b>
10173 </p>
10174 !! end
10175
10176 !! test
10177 Template redirect
10178 !! wikitext
10179 {{templateredirect}}
10180 !! html/php
10181 <p>(test)
10182 </p>
10183 !! html/parsoid
10184 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10185 !! end
10186
10187 !! test
10188 Template with argument in separate line
10189 !! wikitext
10190 {{ templateasargtest |
10191 templ = simple }}
10192 !! html
10193 <p>(test)
10194 </p>
10195 !! end
10196
10197 !! test
10198 Template with complex template as argument
10199 !! wikitext
10200 {{paramtest|
10201 param ={{ templateasargtest |
10202 templ = simple }}}}
10203 !! html
10204 <p>This is a test template with parameter (test)
10205 </p>
10206 !! end
10207
10208 !! test
10209 Template with thumb image (with link in description)
10210 !! wikitext
10211 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10212 !! html/php
10213 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
10214
10215 !! html+tidy
10216 <p>This is a test template with parameter</p>
10217 <div class="thumb tright">
10218 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
10219 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
10220 </div>
10221 </div>
10222 !! html/parsoid
10223 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10224 !! end
10225
10226 !! article
10227 Template:complextemplate
10228 !! text
10229 {{{1}}} {{paramtest|
10230 param ={{{param}}}}}
10231 !! endarticle
10232
10233 !! test
10234 Template with complex arguments
10235 !! wikitext
10236 {{complextemplate|
10237 param ={{ templateasargtest |
10238 templ = simple }}|[[Template:complextemplate|link]]}}
10239 !! html
10240 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10241 </p>
10242 !! end
10243
10244 !! test
10245 BUG 553: link with two variables in a piped link
10246 !! wikitext
10247 {|
10248 |[[{{{1}}}|{{{2}}}]]
10249 |}
10250 !! html
10251 <table>
10252 <tr>
10253 <td>[[{{{1}}}|{{{2}}}]]
10254 </td></tr></table>
10255
10256 !! end
10257
10258 !! test
10259 Magic variable as template parameter
10260 !! wikitext
10261 {{paramtest|param={{SITENAME}}}}
10262 !! html
10263 <p>This is a test template with parameter MediaWiki
10264 </p>
10265 !! end
10266
10267 !! article
10268 Template:linktest
10269 !! text
10270 [[{{{param}}}|link]]
10271 !! endarticle
10272
10273 !! test
10274 Template parameter as link source
10275 !! wikitext
10276 {{linktest|param=Main Page}}
10277 !! html
10278 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10279 </p>
10280 !! end
10281
10282 !!article
10283 Template:paramtest2
10284 !! text
10285 including another template, {{paramtest|param={{{arg}}}}}
10286 !! endarticle
10287
10288 !! test
10289 Template passing argument to another template
10290 !! wikitext
10291 {{paramtest2|arg='hmm'}}
10292 !! html
10293 <p>including another template, This is a test template with parameter 'hmm'
10294 </p>
10295 !! end
10296
10297 !! article
10298 Template:Linktest2
10299 !! text
10300 Main Page
10301 !! endarticle
10302
10303 !! test
10304 Template as link source
10305 !! wikitext
10306 [[{{linktest2}}]]
10307
10308 [[{{linktest2}}|Main Page]]
10309
10310 [[{{linktest2}}]]Page
10311 !! html
10312 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10313 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10314 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10315 </p>
10316 !! end
10317
10318
10319 !! article
10320 Template:loop1
10321 !! text
10322 {{loop2}}
10323 !! endarticle
10324
10325 !! article
10326 Template:loop2
10327 !! text
10328 {{loop1}}
10329 !! endarticle
10330
10331 !! test
10332 Template infinite loop
10333 !! wikitext
10334 {{loop1}}
10335 !! html
10336 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10337 </p>
10338 !! end
10339
10340 !! test
10341 Template from main namespace
10342 !! wikitext
10343 {{:Main Page}}
10344 !! html
10345 <p>blah blah
10346 </p>
10347 !! end
10348
10349 !! article
10350 Template:table
10351 !! text
10352 {|
10353 | 1 || 2
10354 |-
10355 | 3 || 4
10356 |}
10357 !! endarticle
10358
10359 !! test
10360 BUG 529: Template with table, not included at beginning of line
10361 !! wikitext
10362 foo {{table}}
10363 !! html
10364 <p>foo
10365 </p>
10366 <table>
10367 <tr>
10368 <td> 1 </td>
10369 <td> 2
10370 </td></tr>
10371 <tr>
10372 <td> 3 </td>
10373 <td> 4
10374 </td></tr></table>
10375
10376 !! end
10377
10378 !! test
10379 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10380 !! wikitext
10381 foo
10382 {{table}}
10383 !! html
10384 <p>foo
10385 </p>
10386 <table>
10387 <tr>
10388 <td> 1 </td>
10389 <td> 2
10390 </td></tr>
10391 <tr>
10392 <td> 3 </td>
10393 <td> 4
10394 </td></tr></table>
10395
10396 !! end
10397
10398 !! test
10399 BUG 41: Template parameters shown as broken links
10400 !! wikitext
10401 {{{parameter}}}
10402 !! html
10403 <p>{{{parameter}}}
10404 </p>
10405 !! end
10406
10407 !! test
10408 Template with targets containing wikilinks
10409 !! wikitext
10410 {{[[foo]]}}
10411
10412 {{[[{{echo|foo}}]]}}
10413
10414 {{{{echo|[[foo}}]]}}
10415 !! html
10416 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10417 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10418 </p><p>{{[[foo}}]]
10419 </p>
10420 !! end
10421
10422 !! article
10423 Template:''
10424 !! text
10425 bar
10426 !! endarticle
10427
10428 !! test
10429 Templates: Double quotes as template target
10430 !! wikitext
10431 foo {{''}} baz
10432 !! html/php
10433 <p>foo bar baz
10434 </p>
10435 !! html/parsoid
10436 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10437 </p>
10438 !! end
10439
10440 !! article
10441 Template:MSGNW test
10442 !! text
10443 ''None'' of '''this''' should be
10444 * interpreted
10445 but rather passed unmodified
10446 {{test}}
10447 <gallery>
10448 File:Foobar.jpg
10449 </gallery>
10450 <!-- comment -->
10451 !! endarticle
10452
10453 # hmm, fix this or just deprecate msgnw and document its behavior?
10454 !! test
10455 msgnw keyword
10456 !! wikitext
10457 {{msgnw:MSGNW test}}
10458 !! html/php
10459 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10460 &#42; interpreted
10461 &#32;but rather passed unmodified
10462 &#123;&#123;test&#125;&#125;
10463 &#60;gallery&#62;
10464 File:Foobar.jpg
10465 &#60;/gallery&#62;
10466 &#60;!-- comment --&#62;
10467 </p>
10468 !! end
10469
10470 !! test
10471 int keyword
10472 !! wikitext
10473 {{int:youhavenewmessages|lots of money|not!}}
10474 !! html
10475 <p>You have lots of money (not!).
10476 </p>
10477 !! end
10478
10479 !! article
10480 Template:Includes
10481 !! text
10482 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10483 !! endarticle
10484
10485 !! test
10486 <includeonly> and <noinclude> being included
10487 !! wikitext
10488 {{Includes}}
10489 !! html
10490 <p>Foobar
10491 </p>
10492 !! end
10493
10494 !! article
10495 Template:Includes2
10496 !! text
10497 <onlyinclude>Foo</onlyinclude>bar
10498 !! endarticle
10499
10500 !! test
10501 <onlyinclude> being included
10502 !! wikitext
10503 {{Includes2}}
10504 !! html
10505 <p>Foo
10506 </p>
10507 !! end
10508
10509
10510 !! article
10511 Template:Includes3
10512 !! text
10513 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10514 !! endarticle
10515
10516 !! test
10517 <onlyinclude> and <includeonly> being included
10518 !! wikitext
10519 {{Includes3}}
10520 !! html
10521 <p>Foo
10522 </p>
10523 !! end
10524
10525 !! test
10526 <includeonly> and <noinclude> on a page
10527 !! wikitext
10528 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10529 !! html
10530 <p>Foozar
10531 </p>
10532 !! end
10533
10534 !! test
10535 Un-closed <noinclude>
10536 !! wikitext
10537 <noinclude>
10538 !! html
10539 !! end
10540
10541 !! test
10542 <onlyinclude> on a page
10543 !! wikitext
10544 <onlyinclude>Foo</onlyinclude>bar
10545 !! html
10546 <p>Foobar
10547 </p>
10548 !! end
10549
10550 !! test
10551 Un-closed <onlyinclude>
10552 !! wikitext
10553 <onlyinclude>
10554 !! html
10555 !! end
10556
10557 !!test
10558 Self-closed noinclude, includeonly, onlyinclude tags
10559 !! wikitext
10560 <noinclude />
10561 <includeonly />
10562 <onlyinclude />
10563 !! html
10564 <p><br />
10565 </p>
10566 !!end
10567
10568 !!test
10569 Unbalanced includeonly and noinclude tags
10570 !! wikitext
10571 {|
10572 |a</noinclude>
10573 |b</noinclude></noinclude>
10574 |c</noinclude></includeonly>
10575 |d</includeonly></includeonly>
10576 |}
10577 !! html
10578 <table>
10579 <tr>
10580 <td>a
10581 </td>
10582 <td>b
10583 </td>
10584 <td>c&lt;/includeonly&gt;
10585 </td>
10586 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10587 </td></tr></table>
10588
10589 !!end
10590
10591 !! article
10592 Template:Includeonly section
10593 !! text
10594 <includeonly>
10595 ==Includeonly section==
10596 </includeonly>
10597 ==Section T-1==
10598 !!endarticle
10599
10600 !! test
10601 Bug 6563: Edit link generation for section shown by <includeonly>
10602 !! wikitext
10603 {{includeonly section}}
10604 !! html
10605 <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>
10606 <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>
10607
10608 !! end
10609
10610 # Uses same input as the contents of [[Template:Includeonly section]]
10611 !! test
10612 Bug 6563: Section extraction for section shown by <includeonly>
10613 !! options
10614 section=T-2
10615 !! wikitext
10616 <includeonly>
10617 ==Includeonly section==
10618 </includeonly>
10619 ==Section T-2==
10620 !! html
10621 ==Section T-2==
10622 !! end
10623
10624 !! test
10625 Bug 6563: Edit link generation for section suppressed by <includeonly>
10626 !! wikitext
10627 <includeonly>
10628 ==Includeonly section==
10629 </includeonly>
10630 ==Section 1==
10631 !! html
10632 <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>
10633
10634 !! end
10635
10636 !! test
10637 Bug 6563: Section extraction for section suppressed by <includeonly>
10638 !! options
10639 section=1
10640 !! wikitext
10641 <includeonly>
10642 ==Includeonly section==
10643 </includeonly>
10644 ==Section 1==
10645 !! html
10646 ==Section 1==
10647 !! end
10648
10649 !! test
10650 Un-closed <includeonly>
10651 !! wikitext
10652 <includeonly>
10653 !! html
10654 !! end
10655
10656 !! test
10657 Includes and comments at SOL
10658 !! wikitext
10659 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10660
10661 <noinclude>
10662 some
10663 </noinclude>* stuff
10664 * here
10665
10666 <includeonly>can have stuff</includeonly>=== here ===
10667
10668 !! html/php
10669 <h2><span class="mw-headline" id="hu">hu</span></h2>
10670 <p>some
10671 </p>
10672 <ul><li> stuff</li>
10673 <li> here</li></ul>
10674 <h3><span class="mw-headline" id="here">here</span></h3>
10675
10676 !! html/parsoid
10677 <!-- 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>
10678
10679 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10680 <p>some</p>
10681 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10682 <li> here</li></ul>
10683
10684 <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>
10685
10686 !! end
10687
10688 # TODO: test with DOM fragment reuse!
10689 !! test
10690 Parsoid: DOM fragment reuse
10691 !! options
10692 parsoid=wt2wt,wt2html
10693 !! wikitext
10694 a{{echo|b<table></table>c}}d
10695
10696 a{{echo|b
10697 <table></table>
10698 c}}d
10699
10700 {{echo|a
10701
10702 <table></table>
10703
10704 b}}
10705 !! html
10706 <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>
10707
10708 <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">
10709 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10710 </span><p about="#mwt2">cd</p>
10711
10712 <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">
10713
10714 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10715
10716 </span><p about="#mwt3">b</p>
10717 !! end
10718
10719 !! test
10720 Parsoid: Merge double tds (T52603)
10721 !! options
10722 parsoid
10723 !! wikitext
10724 {|
10725 |{{echo|{{!}} foo}}
10726 |}
10727 !! html
10728 <table><tbody>
10729 <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>
10730 </tbody></table>
10731 !! end
10732
10733 !! test
10734 Parsoid: Merge double tds in nested transclusion content (T52603)
10735 !! options
10736 parsoid
10737 !! wikitext
10738 {{echo|<div>}}
10739 {|
10740 |{{echo|{{!}} foo}}
10741 |}
10742 {{echo|</div>}}
10743 !! html
10744 <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}}]}'>
10745 <table><tbody>
10746 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10747 </tbody></table>
10748 </div>
10749 !! end
10750
10751 ###
10752 ### <includeonly> and <noinclude> in attributes
10753 ###
10754 !!test
10755 0. includeonly around the entire attribute
10756 !! wikitext
10757 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10758 !! html
10759 <p><span id="v2">bar</span>
10760 </p>
10761 !!end
10762
10763 !!test
10764 1. includeonly in html attr key
10765 !! wikitext
10766 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10767 !! html
10768 <p><span id="foo">bar</span>
10769 </p>
10770 !!end
10771
10772 !!test
10773 2. includeonly in html attr value
10774 !! wikitext
10775 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10776 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10777 !! html
10778 <p><span id="v1">bar</span>
10779 <span id="v1">bar</span>
10780 </p>
10781 !!end
10782
10783 !!test
10784 3. includeonly in part of an attr value
10785 !! wikitext
10786 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10787 !! html
10788 <p><span style="color:red;">bar</span>
10789 </p>
10790 !!end
10791
10792 !!test
10793 4. includeonly in table attributes
10794 !! wikitext
10795 {|
10796 |- <noinclude>
10797 |-
10798 |a
10799 </noinclude>
10800 |- <includeonly>
10801 |-
10802 |b
10803 </includeonly>
10804 |}
10805 !! html
10806 <table>
10807
10808
10809 <tr>
10810 <td>a
10811 </td></tr>
10812 </table>
10813
10814 !!end
10815
10816 ###
10817 ### Token Stream Patcher tests
10818 ###
10819 ### These tests won't always pass wt2wt and other modes because
10820 ### on serialization, the table will be output on a new line.
10821 ### For now, we are blacklisting them, and using this to test selser.
10822 ###
10823
10824 !!test
10825 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10826 !!options
10827 parsoid=wt2html,wt2wt
10828 !!wikitext
10829 {{echo|}}{| width = '100%'
10830 |foo
10831 |}
10832 !!html/parsoid
10833 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10834 <tbody><tr><td>foo</td></tr>
10835 </tbody></table>
10836 !!end
10837
10838 !!test
10839 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10840 !!options
10841 parsoid=wt2html,wt2wt
10842 !!wikitext
10843 <includeonly>a</includeonly>{| {{{b}}}
10844 |c
10845 |}
10846 !!html/parsoid
10847 <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}}}":""}}'>
10848 <tbody><tr><td>c</td></tr>
10849 </tbody></table>
10850
10851 !!end
10852
10853 ###
10854 ### Testing parsing of templates where a template arg
10855 ### has the same name as the template itself.
10856 ###
10857
10858 !! article
10859 Template:quote
10860 !! text
10861 {{{quote|{{{1}}}}}}
10862 !! endarticle
10863
10864 !!test
10865 Templates: Template Name/Arg clash: 1. Use of positional param
10866 !! wikitext
10867 {{quote|foo}}
10868 !! html
10869 <p>foo
10870 </p>
10871 !!end
10872
10873 !!test
10874 Templates: Template Name/Arg clash: 2. Use of named param
10875 !! wikitext
10876 {{quote|quote=foo}}
10877 !! html
10878 <p>foo
10879 </p>
10880 !!end
10881
10882 !!test
10883 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10884 !! wikitext
10885 {{quote|quote}}
10886 !! html
10887 <p>quote
10888 </p>
10889 !!end
10890
10891 ###
10892 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10893 ###
10894
10895 !!test
10896 Templates: 1. Simple use
10897 !! wikitext
10898 {{echo|Foo}}
10899 !! html
10900 <p>Foo
10901 </p>
10902 !!end
10903
10904 !!test
10905 Templates: 2. Inside a block tag
10906 !! wikitext
10907 <div>{{echo|Foo}}</div>
10908 <blockquote>{{echo|Foo}}</blockquote>
10909 !! html
10910 <div>Foo</div>
10911 <blockquote>Foo</blockquote>
10912
10913 !! html+tidy
10914 <div>Foo</div>
10915 <blockquote>
10916 <p>Foo</p>
10917 </blockquote>
10918 !!end
10919
10920 !!test
10921 Templates: P-wrapping: 1a. Templates on consecutive lines
10922 !! wikitext
10923 {{echo|Foo}}
10924 {{echo|bar}}
10925 !! html
10926 <p>Foo
10927 bar
10928 </p>
10929 !!end
10930
10931 !!test
10932 Templates: P-wrapping: 1b. Templates on consecutive lines
10933 !! wikitext
10934 Foo
10935
10936 {{echo|bar}}
10937 {{echo|baz}}
10938 !! html
10939 <p>Foo
10940 </p><p>bar
10941 baz
10942 </p>
10943 !!end
10944
10945 !!test
10946 Templates: P-wrapping: 1c. Templates on consecutive lines
10947 !! wikitext
10948 {{echo|Foo}}
10949 {{echo|bar}} <div>baz</div>
10950 !! html
10951 <p>Foo
10952 </p>
10953 bar <div>baz</div>
10954
10955 !! html+tidy
10956 <p>Foo</p>
10957 <p>bar</p>
10958 <div>baz</div>
10959 !! end
10960
10961 !!test
10962 Templates: P-wrapping: 1d. Template preceded by comment-only line
10963 !!options
10964 parsoid
10965 !! wikitext
10966 <!-- foo -->
10967 {{echo|Bar}}
10968 !! html
10969 <!-- foo -->
10970
10971 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10972 !!end
10973
10974 !!test
10975 Templates: Inline Text: 1. Multiple template uses
10976 !! wikitext
10977 {{echo|Foo}}bar{{echo|baz}}
10978 !! html
10979 <p>Foobarbaz
10980 </p>
10981 !!end
10982
10983 !!test
10984 Templates: Inline Text: 2. Back-to-back template uses
10985 !! wikitext
10986 {{echo|Foo}}{{echo|bar}}
10987 !! html
10988 <p>Foobar
10989 </p>
10990 !!end
10991
10992 !!test
10993 Templates: Block Tags: 1. Multiple template uses
10994 !! wikitext
10995 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10996 !! html
10997 <div>Foo</div><div>bar</div><div>baz</div>
10998
10999 !!end
11000
11001 !!test
11002 Templates: Block Tags: 2. Back-to-back template uses
11003 !! wikitext
11004 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11005 !! html
11006 <div>Foo</div><div>bar</div>
11007
11008 !!end
11009
11010 # This is an edge case relating to paragraph wrapping.
11011 !!test
11012 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11013 !! wikitext
11014 {{echo|a
11015 b</p>}}
11016 !! html/parsoid
11017 <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
11018 b</p>
11019 !!end
11020
11021 !!test
11022 Templates: Links: 1. Simple example
11023 !! wikitext
11024 {{echo|[[Foo|bar]]}}
11025 !! html
11026 <p><a href="/wiki/Foo" title="Foo">bar</a>
11027 </p>
11028 !!end
11029
11030 !!test
11031 Templates: Links: 2. Generation of link href
11032 !! wikitext
11033 [[{{echo|Foo}}|bar]]
11034 !! html
11035 <p><a href="/wiki/Foo" title="Foo">bar</a>
11036 </p>
11037 !!end
11038
11039 !!test
11040 Templates: Links: 3. Generation of part of a link href
11041 !! wikitext
11042 [[Fo{{echo|o}}|bar]]
11043
11044 [[Foo{{echo|bar}}]]
11045
11046 [[Foo{{echo|bar}}baz]]
11047
11048 [[Foo{{echo|bar}}|bar]]
11049
11050 [[:Foo{{echo|bar}}]]
11051
11052 [[:Foo{{echo|bar}}|bar]]
11053 !! html
11054 <p><a href="/wiki/Foo" title="Foo">bar</a>
11055 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11056 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11057 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11058 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11059 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11060 </p>
11061 !!end
11062
11063 !!test
11064 Templates: Links: 4. Multiple templates generating link href
11065 !! wikitext
11066 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11067 !! html
11068 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11069 </p>
11070 !!end
11071
11072 !!test
11073 Templates: Links: 5. Generation of link text
11074 !! wikitext
11075 [[Foo|{{echo|bar}}]]
11076 !! html
11077 <p><a href="/wiki/Foo" title="Foo">bar</a>
11078 </p>
11079 !!end
11080
11081 !!test
11082 Templates: Links: 5. Nested templates (only outermost template should be marked)
11083 !! wikitext
11084 {{echo|[[{{echo|Foo}}|bar]]}}
11085 !! html
11086 <p><a href="/wiki/Foo" title="Foo">bar</a>
11087 </p>
11088 !!end
11089
11090 !!test
11091 Templates: HTML Tag: 1. Generation of HTML attr. key
11092 !! wikitext
11093 <div {{echo|style}}="color:red;">foo</div>
11094 !! html
11095 <div style="color:red;">foo</div>
11096
11097 !!end
11098
11099 !!test
11100 Templates: HTML Tag: 2. Generation of HTML attr. value
11101 !! wikitext
11102 <div style={{echo|'color:red;'}}>foo</div>
11103 !! html
11104 <div style="color:red;">foo</div>
11105
11106 !!end
11107
11108 !!test
11109 Templates: HTML Tag: 3. Generation of HTML attr key and value
11110 !! wikitext
11111 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11112 !! html
11113 <div style="color:red;">foo</div>
11114
11115 !!end
11116
11117 !!test
11118 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11119 !! wikitext
11120 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11121 !! html
11122 <div title="This is a long title with just one piece templated">foo</div>
11123
11124 !!end
11125
11126 !!test
11127 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11128 !! wikitext
11129 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11130 !! html
11131 <div title="This is a long title with just one piece templated">foo</div>
11132
11133 !!end
11134
11135 !!test
11136 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11137 !! wikitext
11138 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11139 !! html
11140 <div title="This is a long title with just one piece templated">foo</div>
11141
11142 !!end
11143
11144 # SSS FIXME: While it is great we added support for all this,
11145 # do we want to make this part of the spec? Maybe we want to
11146 # deprecate this kind of usage in the future?
11147 !!test
11148 Templates: HTML Tag: 7. Generation of partial attribute key string
11149 !! wikitext
11150 <div st{{echo|yle}}="color:red;">foo</div>
11151 !! html
11152 <div style="color:red;">foo</div>
11153
11154 !!end
11155
11156 !! test
11157 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11158 !! wikitext
11159 <div {{echo|1=id="v1"}}>bar</div>
11160 !! html
11161 <div id="v1">bar</div>
11162
11163 !!end
11164
11165 !! test
11166 Templates: HTML Tag: 9. Multiple template-generated attributes
11167 !! wikitext
11168 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11169 !! html
11170 <div id="v1" title="foo">bar</div>
11171
11172 !!end
11173
11174 !! test
11175 Templates: Support for templates generating attributes and content
11176 !! wikitext
11177 {| {{mixed_attr_content_template}}
11178 |-
11179 |bar
11180 |}
11181 !! html/php
11182 <table style="color:red;" title="T48811">
11183
11184 <tr>
11185 <td>foo
11186 </td></tr>
11187 <tr>
11188 <td>bar
11189 </td></tr></table>
11190
11191 !! html/parsoid
11192 <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|}"]}'>
11193 <tbody><tr>
11194 <td>foo</td></tr>
11195 <tr>
11196 <td>bar</td></tr>
11197 </tbody></table>
11198 !!end
11199
11200 !! test
11201 1. Entities and nowikis inside templated attributes should be handled correctly
11202 !! wikitext
11203 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11204 !! html/php
11205 <div style="background:#f9f9f9;">foo</div>
11206
11207 !! html/parsoid
11208 <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>
11209 !! end
11210
11211 !! test
11212 2. Entities and nowikis inside templated attributes should be handled correctly
11213 !! wikitext
11214 {|
11215 |{{table_attribs_3}}
11216 |}
11217 !! html/php
11218 <table>
11219 <tr>
11220 <td style="background:#f9f9f9;">Foo
11221 </td></tr></table>
11222
11223 !! html/parsoid
11224 <table>
11225 <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>
11226 </tbody></table>
11227 !! end
11228
11229 !! test
11230 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11231 !! wikitext
11232 {{tbl-start}}
11233 |{{table_attribs_3}}
11234 {{tbl-end}}
11235 !! html/php
11236 <table>
11237 <tr>
11238 <td style="background:#f9f9f9;">Foo
11239 </td></tr></table>
11240
11241 !! html/parsoid
11242 <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}}]}'>
11243 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11244 </tbody></table>
11245 !! end
11246
11247 # T107622
11248 !! test
11249 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11250 !! wikitext
11251 {|
11252 | {{table_attribs_6}} hi
11253 |}
11254 !! html/php
11255 <table>
11256 <tr>
11257 <td style="background: red;"> hi
11258 </td></tr></table>
11259
11260 !! html/parsoid
11261 <table>
11262 <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>
11263 </tbody></table>
11264 !! end
11265
11266 !!test
11267 Templates: HTML Tables: 1. Generating start of a HTML table
11268 !! wikitext
11269 {{echo|<table><tr><td>foo</td>}}</tr></table>
11270 !! html
11271 <table><tr><td>foo</td></tr></table>
11272
11273 !!end
11274
11275 !!test
11276 Templates: HTML Tables: 2a. Generating middle of a HTML table
11277 !! wikitext
11278 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11279 !! html
11280 <table><tr><td>foo</td></tr></table>
11281
11282 !!end
11283
11284 !!test
11285 Templates: HTML Tables: 2b. Generating middle of a HTML table
11286 !! wikitext
11287 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11288 !! html
11289 <table><tr><td>foo</td></tr></table>
11290
11291 !!end
11292
11293 !!test
11294 Templates: HTML Tables: 3. Generating end of a HTML table
11295 !! wikitext
11296 <table><tr>{{echo|<td>foo</td></tr></table>}}
11297 !! html
11298 <table><tr><td>foo</td></tr></table>
11299
11300 !!end
11301
11302 !!test
11303 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11304 !! wikitext
11305 {{echo|<table>}}<tr><td>foo</td></tr></table>
11306 !! html
11307 <table><tr><td>foo</td></tr></table>
11308
11309 !!end
11310
11311 !!test
11312 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11313 !! wikitext
11314 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11315 !! html
11316 <table><tr><td>foo</td></tr></table>
11317
11318 !!end
11319
11320 !!test
11321 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11322 !! wikitext
11323 <table><tr>{{echo|<td>}}foo</td></tr></table>
11324 !! html
11325 <table><tr><td>foo</td></tr></table>
11326
11327 !!end
11328
11329 !!test
11330 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11331 !! wikitext
11332 <table><tr><td>foo{{echo|</td>}}</tr></table>
11333 !! html
11334 <table><tr><td>foo</td></tr></table>
11335
11336 !!end
11337
11338 !!test
11339 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11340 !! wikitext
11341 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11342 !! html
11343 <table><tr><td>foo</td></tr></table>
11344
11345 !!end
11346
11347 !!test
11348 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11349 !! wikitext
11350 <table><tr><td>foo</td></tr>{{echo|</table>}}
11351 !! html
11352 <table><tr><td>foo</td></tr></table>
11353
11354 !!end
11355
11356 !!test
11357 Templates: HTML Tables: 5. Proper fostering of categories from inside
11358 !!options
11359 parsoid=wt2html,wt2wt
11360 !! wikitext
11361 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11362 <!--Two categories (Bug 50330)-->
11363 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11364 !! html
11365 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11366 <!--Two categories (Bug 50330)-->
11367 <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>
11368 !!end
11369
11370 !!test
11371 Templates: Wiki Tables: 1a. Fostering of entire template content
11372 !! wikitext
11373 {|
11374 {{echo|a}}
11375 |}
11376 !! html
11377 <table>
11378 a
11379 <tr><td></td></tr></table>
11380
11381 !! html+tidy
11382 <p>a</p>
11383 <table>
11384 <tr>
11385 <td></td>
11386 </tr>
11387 </table>
11388 !! end
11389
11390 !!test
11391 Templates: Wiki Tables: 1b. Fostering of entire template content
11392 !! wikitext
11393 {|
11394 {{echo|<div>}}
11395 foo
11396 {{echo|</div>}}
11397 |}
11398 !! html
11399 <table>
11400 <div>
11401 <p>foo
11402 </p>
11403 </div>
11404 <tr><td></td></tr></table>
11405
11406 !! html+tidy
11407 <div>
11408 <p>foo</p>
11409 </div>
11410 <table>
11411 <tr>
11412 <td></td>
11413 </tr>
11414 </table>
11415 !! end
11416
11417 !!test
11418 Templates: Wiki Tables: 2. Fostering of partial template content
11419 !! wikitext
11420 {|
11421 {{echo|a
11422 <div>b</div>}}
11423 |}
11424 !! html
11425 <table>
11426 a
11427 <div>b</div>
11428 <tr><td></td></tr></table>
11429
11430 !! html+tidy
11431 <p>a</p>
11432 <div>b</div>
11433 <table>
11434 <tr>
11435 <td></td>
11436 </tr>
11437 </table>
11438 !! end
11439
11440 !!test
11441 Templates: Wiki Tables: 3. td-content via multiple templates
11442 !! wikitext
11443 {|
11444 {{echo|{{pipe}}a}}{{echo|b}}
11445 |}
11446 !! html
11447 <table>
11448 <tr>
11449 <td>ab
11450 </td></tr></table>
11451
11452 !!end
11453
11454 !!test
11455 Templates: Wiki Tables: 4. Templated tags, no content
11456 !! wikitext
11457 {{tbl-start}}
11458 {{tbl-end}}
11459 !! html
11460 <table>
11461 <tr><td></td></tr></table>
11462
11463 !!end
11464
11465 !!test
11466 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11467 !! wikitext
11468 {{tbl-start}}
11469 |foo
11470 {{tbl-end}}
11471 !! html
11472 <table>
11473 <tr>
11474 <td>foo
11475 </td></tr></table>
11476
11477 !!end
11478
11479 !!test
11480 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11481 !! wikitext
11482 {{tbl-start}}
11483 {{!}}foo
11484 {{tbl-end}}
11485 !! html
11486 <table>
11487 <tr>
11488 <td>foo
11489 </td></tr></table>
11490
11491 !!end
11492
11493 ## This test case is very specific to Parsoid's internals
11494 ## and is hence only tested for Parsoid's code. Parsoid uses
11495 ## a <meta> marker tag for <ref> tags and they are expanded
11496 ## much later. We are verifying that this <meta> tag usage
11497 ## doesn't prevent foster parenting.
11498 !!test
11499 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11500 !!wikitext
11501 {{PartialTable}}<ref>foo</ref>
11502 |}
11503
11504 <references />
11505 !!html/parsoid
11506 <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">
11507 <tbody>
11508 </tbody></table>
11509
11510 <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>
11511 !!end
11512
11513 !! test
11514 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11515 !! wikitext
11516 {{echo|
11517 {{{!}}
11518 {{!}}-}}
11519 <onlyinclude>
11520 |foo
11521 </onlyinclude>
11522 {{!}}}
11523 !! html/parsoid
11524 <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{{!}}}"]}'>
11525 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11526 <tbody><tr>
11527
11528 <td>foo
11529 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11530 </tbody></table>
11531 !! end
11532
11533 !!test
11534 Templates: Lists: Multi-line list-items via templates
11535 !! wikitext
11536 *{{echo|a {{nonexistent|
11537 unused}}}}
11538 *{{echo|b {{nonexistent|
11539 unused}}}}
11540 !! html
11541 <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>
11542 <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>
11543
11544 !!end
11545
11546 !!test
11547 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11548 !! wikitext
11549 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11550 !! html
11551 <p><i>ab</i>c<i>d</i>e
11552 </p>
11553 !!end
11554
11555 !!test
11556 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11557 (PHP parser generates misnested html)
11558 !! wikitext
11559 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11560 !! html/parsoid
11561 <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>
11562 !!end
11563
11564 !!test
11565 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11566 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11567 !! options
11568 parsoid=wt2html,wt2wt
11569 !! wikitext
11570 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11571 !! html
11572 <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>
11573 <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>
11574 <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>
11575 !!end
11576
11577 !!test
11578 Templates: Ugly nesting: 4. Divs opened/closed across templates
11579 !! wikitext
11580 a<div>b{{echo|c</div>d}}e
11581 !! html
11582 a<div>bc</div>de
11583
11584 !! html+tidy
11585 <p>a</p>
11586 <div>bc</div>
11587 <p>de</p>
11588 !! end
11589
11590 !!test
11591 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11592 (Parsoid-centric)
11593 !! options
11594 parsoid
11595 !! wikitext
11596 {|
11597 |{{echo|foo</table>}}
11598 |bar
11599 |}
11600 !! html
11601 <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|}"]}'>
11602
11603 <tbody>
11604 <tr>
11605 <td>foo</td></tr></tbody></table><span about="#mwt1">
11606 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11607 |}</span>
11608 !!end
11609
11610 !!test
11611 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11612 (Parsoid-centric)
11613 !! options
11614 parsoid
11615 !! wikitext
11616 <table>
11617 <tr>
11618 <td>
11619 <table>
11620 <tr>
11621 <td>1. {{echo|foo </table>}}</td>
11622 <td> bar </td>
11623 <td>2. {{echo|baz </table>}}</td>
11624 </tr>
11625 <tr>
11626 <td>abc</td>
11627 </tr>
11628 </table>
11629 </td>
11630 </tr>
11631 <tr>
11632 <td>xyz</td>
11633 </tr>
11634 </table>
11635 !! html
11636 <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>"]}'>
11637 <tbody><tr>
11638 <td>
11639 <table>
11640 <tbody><tr>
11641 <td>1. foo </td></tr></tbody></table></td>
11642 <td> bar </td>
11643 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11644 </span><span about="#mwt2">
11645 </span><span about="#mwt2">
11646 </span><span about="#mwt2">abc</span><span about="#mwt2">
11647 </span><span about="#mwt2">
11648 </span><span about="#mwt2">
11649 </span><span about="#mwt2">
11650 </span><span about="#mwt2">
11651 </span><span about="#mwt2">
11652 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11653 </span><span about="#mwt2">
11654 </span>
11655 !!end
11656
11657 !! test
11658 Templates: Ugly templates: 3. newline-only template parameter
11659 !! wikitext
11660 foo {{echo|
11661 }}
11662 !! html
11663 <p>foo
11664 </p>
11665 !! end
11666
11667 # This looks like a bug: a single newline triggers p/br for some reason.
11668 !! test
11669 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11670 !! wikitext
11671 {{echo|
11672 }}
11673 !! html
11674 <p><br />
11675 </p>
11676 !! end
11677
11678 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11679 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11680 !! test
11681 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11682 !! wikitext
11683 {{echo|<table>}}
11684 {{echo|<div>foo}}
11685 {{echo|</table>}}
11686 !! html/parsoid
11687 <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
11688 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11689 </table>
11690 !! end
11691
11692 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11693 # that are "identical" and generate nesting cycles in the algorithm
11694 !! test
11695 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11696 !! wikitext
11697 {{echo|<table><tr><td><table>}}
11698 {{echo|<div>}}
11699 {{echo|</div>}}
11700 !! html/parsoid
11701 <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"}'>
11702 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11703 </table></td></tr></tbody></table>
11704 !! end
11705
11706 !!test
11707 Parser Functions: 1. Simple example
11708 !! wikitext
11709 {{uc:foo}}
11710 !! html
11711 <p>FOO
11712 </p>
11713 !!end
11714
11715 !!test
11716 Parser Functions: 2. Nested use (only outermost should be marked up)
11717 !! wikitext
11718 {{uc:{{lc:FOO}}}}
11719 !! html
11720 <p>FOO
11721 </p>
11722 !!end
11723
11724 ###
11725 ### Pre-save transform tests
11726 ###
11727 !! test
11728 pre-save transform: subst:
11729 !! options
11730 pst
11731 !! wikitext
11732 {{subst:test}}
11733 !! html/php
11734 This is a test template
11735 !! end
11736
11737 !! test
11738 pre-save transform: normal template
11739 !! options
11740 pst
11741 !! wikitext
11742 {{test}}
11743 !! html/php
11744 {{test}}
11745 !! end
11746
11747 !! test
11748 pre-save transform: nonexistent template
11749 !! options
11750 pst
11751 !! wikitext
11752 {{thistemplatedoesnotexist}}
11753 !! html/php
11754 {{thistemplatedoesnotexist}}
11755 !! end
11756
11757 !! test
11758 pre-save transform: subst magic variables
11759 !! options
11760 pst
11761 !! wikitext
11762 {{subst:SITENAME}}
11763 !! html/php
11764 MediaWiki
11765 !! end
11766
11767 # This is bug 89, which I fixed. -- wtm
11768 !! test
11769 pre-save transform: subst: templates with parameters
11770 !! options
11771 pst
11772 !! wikitext
11773 {{subst:paramtest|param="something else"}}
11774 !! html/php
11775 This is a test template with parameter "something else"
11776 !! end
11777
11778 !! article
11779 Template:nowikitest
11780 !! text
11781 <nowiki>'''not wiki'''</nowiki>
11782 !! endarticle
11783
11784 !! test
11785 pre-save transform: nowiki in subst (bug 1188)
11786 !! options
11787 pst
11788 !! wikitext
11789 {{subst:nowikitest}}
11790 !! html/php
11791 <nowiki>'''not wiki'''</nowiki>
11792 !! end
11793
11794 !! article
11795 Template:commenttest
11796 !! text
11797 This template has <!-- a comment --> in it.
11798 !! endarticle
11799
11800 !! test
11801 pre-save transform: comment in subst (bug 1936)
11802 !! options
11803 pst
11804 !! wikitext
11805 {{subst:commenttest}}
11806 !! html/php
11807 This template has <!-- a comment --> in it.
11808 !! end
11809
11810 !! test
11811 pre-save transform: unclosed tag
11812 !! options
11813 pst noxml
11814 !! wikitext
11815 <nowiki>'''not wiki'''
11816 !! html/php
11817 <nowiki>'''not wiki'''
11818 !! end
11819
11820 !! test
11821 pre-save transform: mixed tag case
11822 !! options
11823 pst noxml
11824 !! wikitext
11825 <NOwiki>'''not wiki'''</noWIKI>
11826 !! html/php
11827 <NOwiki>'''not wiki'''</noWIKI>
11828 !! end
11829
11830 !! test
11831 pre-save transform: unclosed comment in <nowiki>
11832 !! options
11833 pst noxml
11834 !! wikitext
11835 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11836 !! html/php
11837 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11838 !!end
11839
11840 # Leading @ in this template definition works around a limitation
11841 # in parsoid's parserTests which otherwise strips the <span> from the
11842 # result (confusing it for a template wrapper)
11843 !! article
11844 Template:dangerous
11845 !!text
11846 @<span onmouseover="alert('crap')">Oh no</span>
11847 !!endarticle
11848
11849 !!test
11850 (confirming safety of fix for subst bug 1936)
11851 !! wikitext
11852 {{Template:dangerous}}
11853 !! html
11854 <p>@<span>Oh no</span>
11855 </p>
11856 !! end
11857
11858 !! test
11859 pre-save transform: comment containing gallery (bug 5024)
11860 !! options
11861 pst
11862 !! wikitext
11863 <!-- <gallery>data</gallery> -->
11864 !! html/php
11865 <!-- <gallery>data</gallery> -->
11866 !!end
11867
11868 !! test
11869 pre-save transform: comment containing extension
11870 !! options
11871 pst
11872 !! wikitext
11873 <!-- <tag>data</tag> -->
11874 !! html/php
11875 <!-- <tag>data</tag> -->
11876 !!end
11877
11878 !! test
11879 pre-save transform: comment containing nowiki
11880 !! options
11881 pst
11882 !! wikitext
11883 <!-- <nowiki>data</nowiki> -->
11884 !! html/php
11885 <!-- <nowiki>data</nowiki> -->
11886 !!end
11887
11888 !! test
11889 pre-save transform: <noinclude> in subst (bug 3298)
11890 !! options
11891 pst
11892 !! wikitext
11893 {{subst:Includes}}
11894 !! html/php
11895 Foobar
11896 !! end
11897
11898 !! test
11899 pre-save transform: <onlyinclude> in subst (bug 3298)
11900 !! options
11901 pst
11902 !! wikitext
11903 {{subst:Includes2}}
11904 !! html/php
11905 Foo
11906 !! end
11907
11908 !! article
11909 Template:SubstTest
11910 !!text
11911 {{<includeonly>subst:</includeonly>Includes}}
11912 !! endarticle
11913
11914 !! article
11915 Template:SafeSubstTest
11916 !! text
11917 {{<includeonly>safesubst:</includeonly>Includes}}
11918 !! endarticle
11919
11920 !! test
11921 bug 22297: safesubst: works during PST
11922 !! options
11923 pst
11924 !! wikitext
11925 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11926 !! html/php
11927 FoobarFoobar
11928 !! end
11929
11930 !! test
11931 bug 22297: safesubst: works during normal parse
11932 !! wikitext
11933 {{SafeSubstTest}}
11934 !! html
11935 <p>Foobar
11936 </p>
11937 !! end
11938
11939 !! test
11940 subst: does not work during normal parse
11941 !! wikitext
11942 {{SubstTest}}
11943 !! html
11944 <p>{{subst:Includes}}
11945 </p>
11946 !! end
11947
11948 !! test
11949 pre-save transform: context links ("pipe trick")
11950 !! options
11951 pst
11952 !! wikitext
11953 [[Article (context)|]]
11954 [[Bar:Article|]]
11955 [[:Bar:Article|]]
11956 [[Bar:Article (context)|]]
11957 [[:Bar:Article (context)|]]
11958 [[|Article]]
11959 [[|Article (context)]]
11960 [[Bar:X (Y) Z|]]
11961 [[:Bar:X (Y) Z|]]
11962 !! html/php
11963 [[Article (context)|Article]]
11964 [[Bar:Article|Article]]
11965 [[:Bar:Article|Article]]
11966 [[Bar:Article (context)|Article]]
11967 [[:Bar:Article (context)|Article]]
11968 [[Article]]
11969 [[Article (context)]]
11970 [[Bar:X (Y) Z|X (Y) Z]]
11971 [[:Bar:X (Y) Z|X (Y) Z]]
11972 !! end
11973
11974 !! test
11975 pre-save transform: context links ("pipe trick") with interwiki prefix
11976 !! options
11977 pst
11978 !! wikitext
11979 [[interwiki:Article|]]
11980 [[:interwiki:Article|]]
11981 [[interwiki:Bar:Article|]]
11982 [[:interwiki:Bar:Article|]]
11983 !! html/php
11984 [[interwiki:Article|Article]]
11985 [[:interwiki:Article|Article]]
11986 [[interwiki:Bar:Article|Bar:Article]]
11987 [[:interwiki:Bar:Article|Bar:Article]]
11988 !! end
11989
11990 !! test
11991 pre-save transform: context links ("pipe trick") with parens in title
11992 !! options
11993 pst title=[[Somearticle (context)]]
11994 !! wikitext
11995 [[|Article]]
11996 !! html/php
11997 [[Article (context)|Article]]
11998 !! end
11999
12000 !! test
12001 pre-save transform: context links ("pipe trick") with comma in title
12002 !! options
12003 pst title=[[Someplace, Somewhere]]
12004 !! wikitext
12005 [[|Otherplace]]
12006 [[Otherplace, Elsewhere|]]
12007 [[Otherplace, Elsewhere, Anywhere|]]
12008 !! html/php
12009 [[Otherplace, Somewhere|Otherplace]]
12010 [[Otherplace, Elsewhere|Otherplace]]
12011 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12012 !! end
12013
12014 !! test
12015 pre-save transform: context links ("pipe trick") with parens and comma
12016 !! options
12017 pst title=[[Someplace (IGNORED), Somewhere]]
12018 !! wikitext
12019 [[|Otherplace]]
12020 [[Otherplace (place), Elsewhere|]]
12021 !! html/php
12022 [[Otherplace, Somewhere|Otherplace]]
12023 [[Otherplace (place), Elsewhere|Otherplace]]
12024 !! end
12025
12026 !! test
12027 pre-save transform: context links ("pipe trick") with comma and parens
12028 !! options
12029 pst title=[[Who, me? (context)]]
12030 !! wikitext
12031 [[|Yes, you.]]
12032 [[Me, Myself, and I (1937 song)|]]
12033 !! html/php
12034 [[Yes, you. (context)|Yes, you.]]
12035 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12036 !! end
12037
12038 !! test
12039 pre-save transform: context links ("pipe trick") with namespace
12040 !! options
12041 pst title=[[Ns:Somearticle]]
12042 !! wikitext
12043 [[|Article]]
12044 !! html/php
12045 [[Ns:Article|Article]]
12046 !! end
12047
12048 !! test
12049 pre-save transform: context links ("pipe trick") with namespace and parens
12050 !! options
12051 pst title=[[Ns:Somearticle (context)]]
12052 !! wikitext
12053 [[|Article]]
12054 !! html/php
12055 [[Ns:Article (context)|Article]]
12056 !! end
12057
12058 !! test
12059 pre-save transform: context links ("pipe trick") with namespace and comma
12060 !! options
12061 pst title=[[Ns:Somearticle, Context, Whatever]]
12062 !! wikitext
12063 [[|Article]]
12064 !! html/php
12065 [[Ns:Article, Context, Whatever|Article]]
12066 !! end
12067
12068 !! test
12069 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12070 !! options
12071 pst title=[[Ns:Somearticle, Context (context)]]
12072 !! wikitext
12073 [[|Article]]
12074 !! html/php
12075 [[Ns:Article (context)|Article]]
12076 !! end
12077
12078 !! test
12079 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12080 !! options
12081 pst title=[[Ns:Somearticle (IGNORED), Context]]
12082 !! wikitext
12083 [[|Article]]
12084 !! html/php
12085 [[Ns:Article, Context|Article]]
12086 !! end
12087
12088 !! test
12089 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12090 !! options
12091 pst
12092 !! wikitext
12093 [[Article(context)|]]
12094 [[Bar:Article(context)|]]
12095 [[:Bar:Article(context)|]]
12096 [[|Article(context)]]
12097 [[Bar:X(Y)Z|]]
12098 [[:Bar:X(Y)Z|]]
12099 !! html/php
12100 [[Article(context)|Article]]
12101 [[Bar:Article(context)|Article]]
12102 [[:Bar:Article(context)|Article]]
12103 [[Article(context)]]
12104 [[Bar:X(Y)Z|X(Y)Z]]
12105 [[:Bar:X(Y)Z|X(Y)Z]]
12106 !! end
12107
12108 !! test
12109 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12110 !! options
12111 pst
12112 !! wikitext
12113 [[Article (context)|]]
12114 [[Bar:Article (context)|]]
12115 [[:Bar:Article (context)|]]
12116 [[|Article (context)]]
12117 [[Bar:X (Y) Z|]]
12118 [[:Bar:X (Y) Z|]]
12119 !! html/php
12120 [[Article (context)|Article]]
12121 [[Bar:Article (context)|Article]]
12122 [[:Bar:Article (context)|Article]]
12123 [[Article (context)]]
12124 [[Bar:X (Y) Z|X (Y) Z]]
12125 [[:Bar:X (Y) Z|X (Y) Z]]
12126 !! end
12127
12128 !! test
12129 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12130 !! options
12131 pst
12132 !! wikitext
12133 [[Article(context)|]]
12134 [[Bar:Article(context)|]]
12135 [[:Bar:Article(context)|]]
12136 [[|Article(context)]]
12137 [[Bar:X(Y)Z|]]
12138 [[:Bar:X(Y)Z|]]
12139 !! html/php
12140 [[Article(context)|Article]]
12141 [[Bar:Article(context)|Article]]
12142 [[:Bar:Article(context)|Article]]
12143 [[Article(context)]]
12144 [[Bar:X(Y)Z|X(Y)Z]]
12145 [[:Bar:X(Y)Z|X(Y)Z]]
12146 !! end
12147
12148 !! test
12149 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12150 !! options
12151 pst
12152 !! wikitext
12153 [[Article (context), context|]]
12154 [[Article (context),context|]]
12155 [[Bar:Article (context), context|]]
12156 [[Bar:Article (context),context|]]
12157 [[:Bar:Article (context), context|]]
12158 [[:Bar:Article (context),context|]]
12159 !! html/php
12160 [[Article (context), context|Article]]
12161 [[Article (context),context|Article]]
12162 [[Bar:Article (context), context|Article]]
12163 [[Bar:Article (context),context|Article]]
12164 [[:Bar:Article (context), context|Article]]
12165 [[:Bar:Article (context),context|Article]]
12166 !! end
12167
12168 !! test
12169 pre-save transform: trim trailing empty lines
12170 !! options
12171 pst
12172 !! wikitext
12173 Empty lines are trimmed
12174
12175
12176
12177
12178 !! html/php
12179 Empty lines are trimmed
12180 !! end
12181
12182 !! test
12183 pre-save transform: Signature expansion
12184 !! options
12185 pst
12186 !! wikitext
12187 * ~~~
12188 * <noinclude>~~~</noinclude>
12189 * <includeonly>~~~</includeonly>
12190 * <onlyinclude>~~~</onlyinclude>
12191 !! html/php
12192 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12193 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12194 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12195 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12196 !! end
12197
12198
12199 !! test
12200 pre-save transform: Signature expansion in nowiki tags (bug 93)
12201 !! options
12202 pst disabled
12203 !! wikitext
12204 Shall not expand:
12205
12206 <nowiki>~~~~</nowiki>
12207
12208 <includeonly><nowiki>~~~~</nowiki></includeonly>
12209
12210 <noinclude><nowiki>~~~~</nowiki></noinclude>
12211
12212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12213
12214 {{subst:Foo}} shall be converted to FOO
12215
12216 As well as inside noinclude/onlyinclude
12217 <noinclude>{{subst:Foo}}</noinclude>
12218 <onlyinclude>{{subst:Foo}}</onlyinclude>
12219
12220 But not inside includeonly
12221 <includeonly>{{subst:Foo}}</includeonly>
12222 !! html/php
12223 Shall not expand:
12224
12225 <nowiki>~~~~</nowiki>
12226
12227 <includeonly><nowiki>~~~~</nowiki></includeonly>
12228
12229 <noinclude><nowiki>~~~~</nowiki></noinclude>
12230
12231 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12232
12233 FOO shall be converted to FOO
12234
12235 As well as inside noinclude/onlyinclude
12236 <noinclude>FOO</noinclude>
12237 <onlyinclude>FOO</onlyinclude>
12238
12239 But not inside includeonly
12240 <includeonly>{{subst:Foo}}</includeonly>
12241 !! end
12242
12243 !! test
12244 Parsoid: Recognize nowiki with trailing space in tags
12245 !! options
12246 parsoid=wt2html
12247 !! wikitext
12248 <nowiki ><div>[[foo]]</nowiki >
12249
12250 a<nowiki / >b
12251
12252 c<nowiki />d
12253
12254 e<nowiki/ >f
12255 !! html
12256 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12257 <p>ab</p>
12258 <p>cd</p>
12259 <p>ef</p>
12260 !! end
12261
12262 !! test
12263 Parsoid: Recognize nowiki with odd capitalization
12264 !! options
12265 parsoid=wt2html
12266 !! wikitext
12267 <noWikI ><div>[[foo]]</Nowiki >
12268 !! html
12269 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12270 !! end
12271
12272
12273 !! test
12274 Parsoid: Escape nowiki with trailing space in tags
12275 !! options
12276 parsoid=html2wt
12277 !! html/parsoid
12278 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12279 <p>a&lt;nowiki /&gt;b</p>
12280 <p>c&lt;nowiki/ &gt;d</p>
12281 !! wikitext
12282 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12283
12284 a&lt;nowiki /&gt;b
12285
12286 c&lt;nowiki/ &gt;d
12287 !! end
12288
12289 !! test
12290 Parsoid: Escape weird noWikI capitalizations
12291 !! options
12292 parsoid=html2wt
12293 !! html/parsoid
12294 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12295 !! wikitext
12296 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12297 !! end
12298
12299 ###
12300 ### Message transform tests
12301 ###
12302 !! test
12303 message transform: magic variables
12304 !! options
12305 msg
12306 !! wikitext
12307 {{SITENAME}}
12308 !! html
12309 MediaWiki
12310 !! end
12311
12312 !! test
12313 message transform: should not transform wiki markup
12314 !! options
12315 msg
12316 !! wikitext
12317 ''test''
12318 !! html
12319 ''test''
12320 !! end
12321
12322 !! test
12323 message transform: <noinclude> in transcluded template (bug 4926)
12324 !! options
12325 msg
12326 !! wikitext
12327 {{Includes}}
12328 !! html
12329 Foobar
12330 !! end
12331
12332 !! test
12333 message transform: <onlyinclude> in transcluded template (bug 4926)
12334 !! options
12335 msg
12336 !! wikitext
12337 {{Includes2}}
12338 !! html
12339 Foo
12340 !! end
12341
12342 !! test
12343 {{#special:}} page name, known
12344 !! options
12345 msg
12346 !! wikitext
12347 {{#special:Recentchanges}}
12348 !! html
12349 Special:RecentChanges
12350 !! end
12351
12352 !! test
12353 {{#special:}} page name with subpage, known
12354 !! options
12355 msg
12356 !! wikitext
12357 {{#special:Recentchanges/param}}
12358 !! html
12359 Special:RecentChanges/param
12360 !! end
12361
12362 !! test
12363 {{#special:}} page name, unknown
12364 !! options
12365 msg
12366 !! wikitext
12367 {{#special:foobar nonexistent}}
12368 !! html
12369 Special:Foobar nonexistent
12370 !! end
12371
12372 !! test
12373 {{#speciale:}} page name, known
12374 !! options
12375 msg
12376 !! wikitext
12377 {{#speciale:Recentchanges}}
12378 !! html
12379 Special:RecentChanges
12380 !! end
12381
12382 !! test
12383 {{#speciale:}} page name with subpage, known
12384 !! options
12385 msg
12386 !! wikitext
12387 {{#speciale:Recentchanges/param}}
12388 !! html
12389 Special:RecentChanges/param
12390 !! end
12391
12392 !! test
12393 {{#speciale:}} page name, unknown
12394 !! options
12395 msg
12396 !! wikitext
12397 {{#speciale:foobar nonexistent}}
12398 !! html
12399 Special:Foobar_nonexistent
12400 !! end
12401
12402 ###
12403 ### Images
12404 ###
12405 ### For Parsoid-specific tests, see
12406 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12407
12408 !! test
12409 Simple image
12410 !! options
12411 parsoid=wt2html,wt2wt,html2html
12412 !! wikitext
12413 [[Image:foobar.jpg]]
12414 !! html/php
12415 <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>
12416 </p>
12417 !! html/parsoid
12418 <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>
12419 !! end
12420
12421 !! test
12422 Simple image (using File: namespace, now canonical)
12423 !! wikitext
12424 [[File:Foobar.jpg]]
12425 !! html/php
12426 <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>
12427 </p>
12428 !! html/parsoid
12429 <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>
12430 !! end
12431
12432 !! test
12433 Right-aligned image
12434 !! wikitext
12435 [[File:Foobar.jpg|right]]
12436 !! html/php
12437 <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>
12438
12439 !! html/parsoid
12440 <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>
12441 !! end
12442
12443 !! test
12444 Image with caption
12445 !! wikitext
12446 [[File:Foobar.jpg|right|Caption text]]
12447 !! html/php
12448 <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>
12449
12450 !! html/parsoid
12451 <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>
12452 !! end
12453
12454 !! test
12455 Image with caption, bug 53312 #1
12456 !! wikitext
12457 [[File:Foobar.jpg|right|Caption page stuff]]
12458 !! html/php
12459 <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>
12460
12461 !! html/parsoid
12462 <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>
12463 !! end
12464
12465 !! test
12466 Image with caption, bug 53312 #2
12467 !! wikitext
12468 [[File:Foobar.jpg|right|Caption page=]]
12469 !! html/php
12470 <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>
12471
12472 !! html/parsoid
12473 <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>
12474 !! end
12475
12476 !! test
12477 Image with caption, bug 53312 #3
12478 !! wikitext
12479 [[File:Foobar.jpg|right|Caption page=stuff]]
12480 !! html/php
12481 <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>
12482
12483 !! html/parsoid
12484 <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>
12485 !! end
12486
12487 !! test
12488 Allow empty links in image captions (Bug 60753)
12489 !! options
12490 thumbsize=220
12491 !! wikitext
12492 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12493 [[]]
12494 [[Link2]]
12495 ]]
12496 !! html/php
12497 <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>
12498
12499 !! html/parsoid
12500 <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>
12501 [[]]
12502 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12503 </figcaption></figure>
12504 !! end
12505
12506 !! test
12507 Titles in unlinked images (T23454)
12508 !! wikitext
12509 [[File:Foobar.jpg|link=|stuff]]
12510 !! html/php
12511 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12512 </p>
12513 !! end
12514
12515 !! test
12516 Link with empty target
12517 !! wikitext
12518 [[]]
12519 !! html
12520 <p>[[]]
12521 </p>
12522 !! end
12523
12524 !! test
12525 Image with link trail
12526 !! wikitext
12527 Linktrails should not work for images: [[File:Foobar.jpg]]s
12528 !! html/php
12529 <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
12530 </p>
12531 !! html/parsoid
12532 <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>
12533 !! end
12534
12535 !! test
12536 Image with empty attribute
12537 !! options
12538 parsoid=wt2html,wt2wt,html2html
12539 !! wikitext
12540 [[File:Foobar.jpg|right||Caption text]]
12541 !! html/php
12542 <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>
12543
12544 !! html/parsoid
12545 <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>
12546 !! end
12547
12548 !! test
12549 1. Block image with individual attributes from templates
12550 !! wikitext
12551 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12552 !! html/php
12553 <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>
12554
12555 !! html/parsoid
12556 <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>
12557 !! end
12558
12559 !! test
12560 2. Block Image with individual attributes from templates
12561 !! wikitext
12562 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12563 !! html/php
12564 <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>
12565
12566 !! html/parsoid
12567 <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>
12568 !! end
12569
12570 !! test
12571 3. Inline image with individual attributes from templates
12572 !! wikitext
12573 [[File:Foobar.jpg|{{echo|50px}}]]
12574 !! html/php
12575 <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>
12576 </p>
12577 !! html/parsoid
12578 <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>
12579 !! end
12580
12581 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12582 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12583 !! test
12584 Image with multiple attributes from the same template
12585 !! wikitext
12586 [[File:Foobar.jpg|{{image_attribs}}]]
12587 !! html/php
12588 <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>
12589
12590 !! html/parsoid
12591 <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>
12592 !! end
12593
12594 !! test
12595 Image with link tails
12596 !! options
12597 thumbsize=220
12598 !! wikitext
12599 123[[File:Foobar.jpg]]456
12600 123[[File:Foobar.jpg|right]]456
12601 123[[File:Foobar.jpg|thumb]]456
12602 !! html/php
12603 <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
12604 </p>
12605 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
12606 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
12607
12608 !! html/php+tidy
12609 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
12610 <p>123</p>
12611 <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>
12612 <p>456 123</p>
12613 <div class="thumb tright">
12614 <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>
12615 <div class="thumbcaption">
12616 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12617 </div>
12618 </div>
12619 </div>
12620 <p>456</p>
12621 !! html/parsoid
12622 <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>
12623 <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>
12624 <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>
12625 !! end
12626
12627 !! test
12628 Image with multiple captions -- only last one is accepted
12629 !! wikitext
12630 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12631 !! html/php
12632 <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>
12633
12634 !! html/parsoid
12635 <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>
12636 !! end
12637
12638 !! test
12639 Image with multiple widths -- use last
12640 !! wikitext
12641 [[File:Foobar.jpg|200px|300px|caption]]
12642 !! html/php
12643 <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>
12644 </p>
12645 !! html/parsoid
12646 <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>
12647 !! end
12648
12649 !! test
12650 Image with multiple alignments -- use first (bug 48664)
12651 !! options
12652 thumbsize=220
12653 !! wikitext
12654 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12655
12656 [[File:Foobar.jpg|middle|text-top|caption]]
12657 !! html/php
12658 <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>
12659 <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>
12660 </p>
12661 !! html/parsoid
12662 <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>
12663 <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>
12664 !! end
12665
12666 !! test
12667 Image with width attribute at different positions
12668 !! wikitext
12669 [[File:Foobar.jpg|200px|right|Caption]]
12670 [[File:Foobar.jpg|right|200px|Caption]]
12671 [[File:Foobar.jpg|right|Caption|200px]]
12672 !! html/php
12673 <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>
12674 <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>
12675 <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>
12676
12677 !! html/parsoid
12678 <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>
12679 <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>
12680 <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>
12681 !! end
12682
12683 # a sad bit of backward-compatibility
12684 !! test
12685 Image with size specified with pxpx (bug 13500, 51628)
12686 !! options
12687 parsoid=wt2html,wt2wt,html2html
12688 !! wikitext
12689 [[File:Foobar.jpg|20pxpx]]
12690 [[File:Foobar.jpg|200x20pxpx]]
12691 !! html/php
12692 <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>
12693 <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>
12694 </p>
12695 !! html/parsoid
12696 <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>
12697 !! end
12698
12699 !! test
12700 Image with link parameter, wiki target
12701 !! wikitext
12702 [[File:Foobar.jpg|link=Main Page]]
12703 !! html/php
12704 <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>
12705 </p>
12706 !! html/parsoid
12707 <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>
12708 !! end
12709
12710 # parsoid bug 49293 (part 1)
12711 !! test
12712 Image with link parameter, URL target
12713 !! wikitext
12714 [[File:Foobar.jpg|link=http://example.com/]]
12715 !! html/php
12716 <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>
12717 </p>
12718 !! html/parsoid
12719 <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>
12720 !! end
12721
12722 # parsoid bug 49293 (part 2)
12723 !! test
12724 Image with link parameter, protocol-less URL target
12725 !! wikitext
12726 [[File:Foobar.jpg|link=//example.com/]]
12727 !! html/php
12728 <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>
12729 </p>
12730 !! html/parsoid
12731 <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>
12732 !! end
12733
12734 !! test
12735 Escaping non-block captions (T107435)
12736 !! options
12737 parsoid={
12738 "modes": ["wt2wt"],
12739 "changes": [
12740 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12741 ]
12742 }
12743 !! wikitext
12744 [[Image:Foobar.jpg|caption]]
12745 !! wikitext/edited
12746 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12747 !! end
12748
12749 !! test
12750 Image with link parameter, wgExternalLinkTarget
12751 !! wikitext
12752 [[Image:foobar.jpg|link=http://example.com/]]
12753 !! config
12754 wgExternalLinkTarget='foobar'
12755 !! html
12756 <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>
12757 </p>
12758 !! end
12759
12760 !! test
12761 Image with link parameter, wgNoFollowLinks set to false
12762 !! wikitext
12763 [[Image:foobar.jpg|link=http://example.com/]]
12764 !! config
12765 wgNoFollowLinks=false
12766 !! html
12767 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12768 </p>
12769 !! end
12770
12771 !! test
12772 Image with link parameter, wgNoFollowDomainExceptions
12773 !! wikitext
12774 [[Image:foobar.jpg|link=http://example.com/]]
12775 !! config
12776 wgNoFollowDomainExceptions='example.com'
12777 !! html
12778 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12779 </p>
12780 !! end
12781
12782 !! test
12783 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12784 !! wikitext
12785 [[Image:foobar.jpg|link=http://example.com/|Title]]
12786 !! config
12787 wgExternalLinkTarget='foobar'
12788 !! html
12789 <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>
12790 </p>
12791 !! end
12792
12793 !! test
12794 Image with empty link parameter
12795 !! wikitext
12796 [[File:Foobar.jpg|link=]]
12797 !! html/php
12798 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12799 </p>
12800 !! html/parsoid
12801 <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>
12802 !! end
12803
12804 !! test
12805 Image with link parameter (wiki target) and unnamed parameter
12806 !! wikitext
12807 [[File:Foobar.jpg|link=Main_Page|Title]]
12808 !! html/php
12809 <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>
12810 </p>
12811 !! html/parsoid
12812 <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>
12813 !! end
12814
12815 !! test
12816 Image with link parameter (URL target) and unnamed parameter
12817 !! wikitext
12818 [[File:Foobar.jpg|link=http://example.com/|Title]]
12819 !! html/php
12820 <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>
12821 </p>
12822 !! html/parsoid
12823 <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>
12824 !! end
12825
12826 !! test
12827 Thumbnail image with link parameter
12828 !! options
12829 thumbsize=220
12830 parsoid=wt2html,wt2wt,html2html
12831 !! wikitext
12832 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12833 !! html/php
12834 <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>
12835
12836 !! html/parsoid
12837 <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>
12838 !! end
12839
12840 !! test
12841 Manually-specified thumbnail image
12842 !! options
12843 thumbsize=220
12844 !! wikitext
12845 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12846 !! html/php
12847 <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>
12848
12849 !! html/parsoid
12850 <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>
12851 !! end
12852
12853 !! test
12854 Manually-specified thumbnail image with explicit link to wiki page
12855 !! options
12856 thumbsize=220
12857 parsoid=wt2html,wt2wt,html2html
12858 !! wikitext
12859 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12860 !! html/php
12861 <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>
12862
12863 !! html/parsoid
12864 <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>
12865 !! end
12866
12867 !! test
12868 Manually-specified thumbnail image with explicit link to url
12869 !! options
12870 thumbsize=220
12871 parsoid=wt2html,wt2wt,html2html
12872 !! wikitext
12873 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12874 !! html/php
12875 <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>
12876
12877 !! html/parsoid
12878 <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>
12879 !! end
12880
12881 !! test
12882 Manually-specified thumbnail image with explicit no link
12883 !! options
12884 thumbsize=220
12885 parsoid=wt2html,wt2wt,html2html
12886 !! wikitext
12887 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12888 !! html/php
12889 <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>
12890
12891 !! html/parsoid
12892 <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>
12893 !! end
12894
12895 !! test
12896 Manually-specified thumbnail image with explicit link and alt text
12897 !! options
12898 thumbsize=220
12899 parsoid=wt2html,wt2wt,html2html
12900 !! wikitext
12901 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12902 !! html/php
12903 <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>
12904
12905 !! html/parsoid
12906 <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>
12907 !! end
12908
12909 !! test
12910 Image with frame and link
12911 !! options
12912 parsoid=wt2html,wt2wt,html2html
12913 !! wikitext
12914 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12915 !! html/php
12916 <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>
12917
12918 !! html/parsoid
12919 <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>
12920 !! end
12921
12922 !! test
12923 Image with frame and link and explicit alt
12924 !! options
12925 parsoid=wt2html,wt2wt,html2html
12926 !! wikitext
12927 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12928 !! html/php
12929 <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>
12930
12931 !! html/parsoid
12932 <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>
12933 !! end
12934
12935 !! test
12936 Image with wiki markup in implicit alt
12937 !! wikitext
12938 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12939
12940 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12941 !! html/php
12942 <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>
12943 </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>
12944 </p>
12945 !! html/parsoid
12946 <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>
12947 <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>
12948 !! end
12949
12950 !! test
12951 Alt image option should handle most kinds of wikitext without barfing
12952 !! wikitext
12953 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12954 !! html/php
12955 <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>
12956
12957 !! html/parsoid
12958 <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>
12959 !! end
12960
12961 ###################
12962 # Conflicting image format options.
12963 # First option specified should 'win'.
12964 # All three cases in each test should be identical.
12965
12966 !! test
12967 Image with 'frameless' first.
12968 !! options
12969 parsoid=wt2html,wt2wt,html2html
12970 !! wikitext
12971 [[File:Foobar.jpg|frameless|caption]]
12972
12973 [[File:Foobar.jpg|frameless|frame|caption]]
12974
12975 [[File:Foobar.jpg|frameless|thumb|caption]]
12976 !! html/php
12977 <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>
12978 </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>
12979 </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>
12980 </p>
12981 !! html/parsoid
12982 <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>
12983 <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>
12984 <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>
12985 !! end
12986
12987 !! test
12988 Image with 'frame' first.
12989 !! options
12990 parsoid=wt2html,wt2wt,html2html
12991 !! wikitext
12992 [[File:Foobar.jpg|frame|caption]]
12993 [[File:Foobar.jpg|frame|frameless|caption]]
12994 [[File:Foobar.jpg|frame|thumb|caption]]
12995 !! html/php
12996 <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>
12997 <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>
12998 <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>
12999
13000 !! html/parsoid
13001 <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>
13002 <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>
13003 <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>
13004 !! end
13005
13006 !! test
13007 Image with 'thumb' first.
13008 !! options
13009 parsoid=wt2html,wt2wt,html2html
13010 !! wikitext
13011 [[File:Foobar.jpg|thumb|caption]]
13012 [[File:Foobar.jpg|thumb|frameless|caption]]
13013 [[File:Foobar.jpg|thumb|frame|caption]]
13014 !! html/php
13015 <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>
13016 <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>
13017 <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>
13018
13019 !! html/parsoid
13020 <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>
13021 <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>
13022 <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>
13023 !! end
13024
13025 ###################
13026 # Image sizing.
13027 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13028 # and https://phabricator.wikimedia.org/T64258
13029 # Foobar has actual size of 1941x220
13030 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13031 # a scalable format.
13032 # 2. Framed images always ignore size options; always render at default size.
13033 # 3. "Unspecified format" and border are the only types which can be
13034 # enlarged.
13035
13036 !! test
13037 Image: "unspecified format" and border enlarge
13038 !! options
13039 parsoid=wt2html,wt2wt,html2html
13040 !! wikitext
13041 [[File:Foobar.jpg|2000px]]
13042
13043 [[File:Foobar.jpg|border|2000px]]
13044 !! html/php
13045 <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>
13046 </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>
13047 </p>
13048 !! html/parsoid
13049 <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>
13050 <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>
13051 !! end
13052
13053 !! test
13054 Image: "unspecified format" and border reduce
13055 !! options
13056 parsoid=wt2html,wt2wt,html2html
13057 !! wikitext
13058 [[File:Foobar.jpg|1000px]]
13059
13060 [[File:Foobar.jpg|border|1000px]]
13061 !! html/php
13062 <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>
13063 </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>
13064 </p>
13065 !! html/parsoid
13066 <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>
13067 <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>
13068 !! end
13069
13070 !! test
13071 Image: thumbs reduce
13072 !! options
13073 parsoid=wt2html,wt2wt,html2html
13074 !! wikitext
13075 [[File:Foobar.jpg|thumb|50px]]
13076 !! html/php
13077 <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>
13078
13079 !! html/parsoid
13080 <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>
13081 !! end
13082
13083 !! test
13084 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13085 !! options
13086 parsoid=wt2html,wt2wt,html2html
13087 !! wikitext
13088 [[File:Foobar.jpg|thumb|2000px]]
13089
13090 [[File:Foobar.svg|thumb|2000px]]
13091 !! html/php
13092 <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>
13093 <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>
13094
13095 !! html/parsoid
13096 <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>
13097 <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>
13098 !! end
13099
13100 !! test
13101 Image: frameless can reduce in size
13102 !! options
13103 parsoid=wt2html,wt2wt,html2html
13104 !! wikitext
13105 [[File:Foobar.jpg|frameless|50px]]
13106 !! html/php
13107 <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>
13108 </p>
13109 !! html/parsoid
13110 <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>
13111 !! end
13112
13113 !! test
13114 Image: bitmap frameless can't be enlarged past original size, but vector can
13115 !! options
13116 parsoid=wt2html,wt2wt,html2html
13117 !! wikitext
13118 [[File:Foobar.jpg|frameless|2000px]]
13119
13120 [[File:Foobar.svg|frameless|2000px]]
13121 !! html/php
13122 <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>
13123 </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>
13124 </p>
13125 !! html/parsoid
13126 <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>
13127 <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>
13128 !! end
13129
13130 !! test
13131 Image: framed images are always unscaled.
13132 !! options
13133 parsoid=wt2html,wt2wt,html2html
13134 !! wikitext
13135 [[File:Foobar.jpg|frame]]
13136
13137 [[File:Foobar.jpg|frame|50px]]
13138
13139 [[File:Foobar.jpg|frame|50x50px]]
13140
13141 [[File:Foobar.jpg|frame|2000px]]
13142 !! html/php
13143 <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>
13144 <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>
13145 <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>
13146 <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>
13147
13148 !! html/parsoid
13149 <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>
13150 <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>
13151 <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>
13152 <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>
13153 !! end
13154
13155 ###################
13156
13157 !! test
13158 Link to image page- image page normally doesn't exists, hence edit link
13159 Add test with existing image page
13160 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13161 !! wikitext
13162 [[:Image:test]]
13163 !! html
13164 <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>
13165 </p>
13166 !! end
13167
13168 !! test
13169 bug 18784 Link to non-existent image page with caption should use caption as link text
13170 !! wikitext
13171 [[:Image:test|caption]]
13172 !! html
13173 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
13174 </p>
13175 !! end
13176
13177 !! test
13178 Frameless image caption with a free URL
13179 !! wikitext
13180 [[File:Foobar.jpg|http://example.com]]
13181 !! html/php
13182 <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>
13183 </p>
13184 !! html/parsoid
13185 <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>
13186 !! end
13187
13188 !! test
13189 Thumbnail image caption with a free URL
13190 !! options
13191 thumbsize=220
13192 !! wikitext
13193 [[File:Foobar.jpg|thumb|http://example.com]]
13194 !! html/php
13195 <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>
13196
13197 !! html/parsoid
13198 <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>
13199 !! end
13200
13201 !! test
13202 Thumbnail image caption with a free URL and explicit alt
13203 !! options
13204 thumbsize=220
13205 parsoid=wt2html,wt2wt,html2html
13206 !! wikitext
13207 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13208 !! html/php
13209 <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>
13210
13211 !! html/parsoid
13212 <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>
13213 !! end
13214
13215 !! test
13216 SVG thumbnails with no language set
13217 !! options
13218 !! wikitext
13219 [[File:Foobar.svg|thumb|caption]]
13220 !! html/php
13221 <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>
13222
13223 !! html/parsoid
13224 <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>
13225 !! end
13226
13227 !! test
13228 SVG thumbnails with language de
13229 !! options
13230 parsoid=wt2html,wt2wt,html2html
13231 !! wikitext
13232 [[File:Foobar.svg|thumb|caption|lang=de]]
13233 !! html/php
13234 <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>
13235
13236 !! html/parsoid
13237 <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>
13238 !! end
13239
13240 !! test
13241 SVG thumbnails with invalid language code
13242 !! options
13243 parsoid=wt2html,wt2wt,html2html
13244 !! wikitext
13245 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13246 !! html/php
13247 <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>
13248
13249 !! html/parsoid
13250 <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>
13251 !! end
13252
13253 !! test
13254 BUG 1887: A ISBN with a thumbnail
13255 !! wikitext
13256 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13257 !! html/php
13258 <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>
13259
13260 !! html/parsoid
13261 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
13262 !! end
13263
13264 !! test
13265 BUG 1887: A RFC with a thumbnail
13266 !! wikitext
13267 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13268 !! html/php
13269 <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>
13270
13271 !! html/parsoid
13272 <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>
13273 !! end
13274
13275 !! test
13276 BUG 1887: A mailto link with a thumbnail
13277 !! wikitext
13278 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13279 !! html/php
13280 <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>
13281
13282 !! html/parsoid
13283 <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>
13284 !! end
13285
13286 # Pending resolution to bug 368
13287 !! test
13288 BUG 648: Frameless image caption with a link
13289 !! wikitext
13290 [[File:Foobar.jpg|text with a [[link]] in it]]
13291 !! html/php
13292 <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>
13293 </p>
13294 !! html/parsoid
13295 <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>
13296 !! end
13297
13298 !! test
13299 BUG 648: Frameless image caption with a link (suffix)
13300 !! wikitext
13301 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13302 !! html/php
13303 <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>
13304 </p>
13305 !! html/parsoid
13306 <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>
13307 !! end
13308
13309 !! test
13310 BUG 648: Frameless image caption with an interwiki link
13311 !! wikitext
13312 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13313 !! html/php
13314 <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>
13315 </p>
13316 !! html/parsoid
13317 <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>
13318 !! end
13319
13320 !! test
13321 BUG 648: Frameless image caption with a piped interwiki link
13322 !! wikitext
13323 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13324 !! html/php
13325 <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>
13326 </p>
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 T107474: Frameless image caption with <nowiki>
13333 !! wikitext
13334 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13335 !! html/parsoid
13336 <p><span class="mw-default-size" typeof="mw:Image mw:Placeholder" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\">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>
13337 !! end
13338
13339 !! test
13340 Escape HTML special chars in image alt text
13341 !! wikitext
13342 [[File:Foobar.jpg|& < > "]]
13343 !! html/php
13344 <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>
13345 </p>
13346 !! html/parsoid
13347 <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>
13348 !! end
13349
13350 !! test
13351 BUG 499: Alt text should have &#1234;, not &amp;1234;
13352 !! wikitext
13353 [[File:Foobar.jpg|&#9792;]]
13354 !! html/php
13355 <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>
13356 </p>
13357 !! html/parsoid
13358 <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>
13359 !! end
13360
13361 !! test
13362 Broken image caption with link
13363 !! options
13364 parsoid=wt2html,wt2wt,html2html
13365 !! wikitext
13366 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13367 !! html/php
13368 <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.
13369 </p>
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 !! test
13375 Image caption containing another image
13376 !! wikitext
13377 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13378 !! html/php
13379 <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>
13380
13381 !! html/parsoid
13382 <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>
13383 !! end
13384
13385 !! test
13386 Image: caption containing a newline
13387 !! wikitext
13388 [[File:Foobar.jpg|This
13389 *is some text]]
13390 !! html/php
13391 <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>
13392 </p>
13393 !! html/parsoid
13394 <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>
13395 !!end
13396
13397 !!test
13398 Image: caption containing leading space
13399 (The leading space should not trigger nowiki escaping in wt2wt mode)
13400 !! wikitext
13401 [[File:Foobar.jpg|thumb| bar]]
13402 !! html/php
13403 <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>
13404
13405 !! html/parsoid
13406 <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>
13407 !!end
13408
13409 !! test
13410 Image: caption containing a table
13411 !! options
13412 parsoid=wt2html,wt2wt,html2html
13413 !! wikitext
13414 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13415 {|
13416 ! Foo !! Bar
13417 |-
13418 | Foo1 || Bar1
13419 |}
13420 and some more text.]]
13421 !! html/php
13422 <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>
13423
13424 !! html/parsoid
13425 <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
13426 <table>
13427 <tbody>
13428 <tr><th>Foo </th><th>Bar</th></tr>
13429 <tr>
13430 <td>Foo1 </td>
13431 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13432 !! end
13433
13434 !! test
13435 Bug 3090: External links other than http: in image captions
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13438 !! html/php
13439 <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>
13440
13441 !! html/parsoid
13442 <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>
13443 !! end
13444
13445 !! test
13446 Custom class
13447 !! options
13448 parsoid=wt2html,wt2wt,html2html
13449 !! wikitext
13450 [[Image:foobar.jpg|a|class=b]]
13451 !! html/php
13452 <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>
13453 </p>
13454 !! html/parsoid
13455 <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>
13456 !! end
13457
13458 !! test
13459 Localized image handling (1).
13460 !! options
13461 parsoid=wt2html,wt2wt,html2html
13462 language=es
13463 !! wikitext
13464 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13465 !! html/php
13466 <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>
13467
13468 !! html/parsoid
13469 <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>
13470 !! end
13471
13472 !! test
13473 Localized image handling (2).
13474 !! options
13475 thumbsize=220
13476 parsoid=wt2html,wt2wt,html2html
13477 language=es
13478 !! wikitext
13479 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13480 !! html/php
13481 <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>
13482
13483 !! html/parsoid
13484 <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>
13485 !! end
13486
13487 !! test
13488 "border", "frameless" and "class" attributes on an image.
13489 !! options
13490 thumbsize=220
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13494 !! html/php
13495 <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>
13496 </p>
13497 !! html/parsoid
13498 <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>
13499 !! end
13500
13501 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13502 !! test
13503 Invalid image attributes (bug 62500)
13504 !! options
13505 thumbsize=220
13506 parsoid=wt2html,wt2wt,html2html
13507 !! wikitext
13508 [[File:Foobar.jpg|thumb|float|left|caption]]
13509
13510 [[File:Foobar.jpg|thumb|righ|caption]]
13511
13512 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13513 !! html/php
13514 <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>
13515 <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>
13516 <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>
13517
13518 !! html/parsoid
13519 <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>
13520 <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>
13521 <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>
13522 !! end
13523
13524 !! article
13525 File:Barfoo.jpg
13526 !! text
13527 #REDIRECT [[File:Barfoo.jpg]]
13528 !! endarticle
13529
13530 # FIXME: Parsoid should run this test -- but we'd need to teach the
13531 # mockAPI about the redirected Barfoo.jpg image.
13532 !! test
13533 Redirected image
13534 !! wikitext
13535 [[Image:Barfoo.jpg]]
13536 !! html/php
13537 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13538 </p>
13539 !! end
13540
13541 !! test
13542 Missing image with uploads disabled
13543 !! options
13544 wgEnableUploads=0
13545 !! wikitext
13546 [[File:Foobaz.jpg]]
13547 !! html/php
13548 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13549 </p>
13550 !! html/parsoid
13551 <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>
13552 !! end
13553
13554 # Parsoid-specific testing for images
13555 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13556 # Currently imperfect due to a flaw in the Parsoid testrunner
13557 # Work in progress
13558 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13559 # image tests.
13560
13561 !! test
13562 Parsoid-specific image handling - simple image with size and middle alignment
13563 !! wikitext
13564 [[File:Foobar.jpg|middle|50px]]
13565 !! html/parsoid
13566 <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>
13567 !! end
13568
13569 !! test
13570 Parsoid-specific image handling - simple image with size, middle alignment,
13571 non-standard namespace alias
13572 !! options
13573 parsoid=wt2wt,wt2html,html2html
13574 !! wikitext
13575 [[Image:Foobar.jpg|middle|50px]]
13576 !! html/parsoid
13577 <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>
13578 !! end
13579
13580 !! test
13581 Parsoid-specific image handling - simple image with size and middle alignment
13582 (existing content)
13583 !! wikitext
13584 [[File:Foobar.jpg|50px|middle]]
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 Parsoid-specific image handling - simple image with size and middle alignment
13591 and non-standard namespace name
13592 !! options
13593 parsoid=wt2html,wt2wt,html2html
13594 !! wikitext
13595 [[Image:Foobar.jpg|50px|middle]]
13596 !! html/parsoid
13597 <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>
13598 !! end
13599
13600 !! test
13601 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13602 !! wikitext
13603 [[File:Foobar.jpg|500x10px|baseline|caption]]
13604 !! html/parsoid
13605 <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>
13606 !! end
13607
13608 !! test
13609 Parsoid-specific image handling - simple image with border and size spec
13610 !! wikitext
13611 [[File:Foobar.jpg|50px|border|caption]]
13612 !! html/parsoid
13613 <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>
13614 !! end
13615
13616 !! test
13617 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13618 !! wikitext
13619 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13620 !! html/parsoid
13621 <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>
13622 !! end
13623
13624 !! test
13625 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13626 (existing content)
13627 !! wikitext
13628 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13629 !! html/parsoid
13630 <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>
13631 !! end
13632
13633 !! test
13634 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13635 !! wikitext
13636 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13637 !! html/parsoid
13638 <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>
13639 !! end
13640
13641 !! test
13642 Parsoid-specific image handling - thumbnail with specific size, halign,
13643 valign, and caption (existing content)
13644 !! wikitext
13645 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13646 !! html/parsoid
13647 <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>
13648 !! end
13649
13650 !! test
13651 Parsoid-specific image handling - framed image with specific size and caption
13652 (size is ignored)
13653 !! options
13654 parsoid=wt2html,wt2wt,html2html
13655 !! wikitext
13656 [[File:Foobar.jpg|frame|500x50px|caption]]
13657 !! html/parsoid
13658 <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>
13659 !! end
13660
13661 !! test
13662 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13663 (size is ignored)
13664 !! options
13665 parsoid=wt2html,wt2wt,html2html
13666 !! wikitext
13667 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13668 !! html/parsoid
13669 <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>
13670 !! end
13671
13672 !! test
13673 Parsoid-specific image handling - frameless image with specific size, border, and caption
13674 !! wikitext
13675 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13676 !! html/parsoid
13677 <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>
13678 !! end
13679
13680 !! test
13681 Parsoid-specific image handling - simple image with a formatted caption
13682 !! wikitext
13683 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13684 !! html/parsoid
13685 <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>
13686 !! end
13687
13688 !! test
13689 Parsoid-specific image handling - caption with a template in it
13690 !! wikitext
13691 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13692 !! html/parsoid
13693 <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>
13694 !! end
13695
13696 !! test
13697 Parsoid-specific image handling - caption with unbalanced tags in it
13698 !! options
13699 parsoid=wt2html,wt2wt,html2html
13700 !! wikitext
13701 foo
13702 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13703 bar
13704 !! html/parsoid
13705 <p>foo</p>
13706 <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>
13707 <p>bar</p>
13708 !! end
13709
13710 !! test
13711 Parsoid-specific image handling - empty caption (1)
13712 !! options
13713 parsoid=wt2html,wt2wt
13714 !! wikitext
13715 [[File:Foobar.jpg|thumb|]]
13716 !! html/parsoid
13717 <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>
13718 !! end
13719
13720 # empty captions don't get serialized unless we're in the "round trip" case
13721 !! test
13722 Parsoid-specific image handling - empty caption (2)
13723 !! options
13724 parsoid=html2wt
13725 !! html/parsoid
13726 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13727 <a href="./File:Foobar.jpg">
13728 <img resource="./File:Foobar.jpg"
13729 src="//example.com/images/3/3a/Foobar.jpg"
13730 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13731 height="25" width="220"/>
13732 </a>
13733 <figcaption></figcaption>
13734 </figure>
13735 !! wikitext
13736 [[File:Foobar.jpg|thumb]]
13737 !! end
13738
13739 !! test
13740 Parsoid-specific image handling - whitespace caption
13741 !! wikitext
13742 [[File:Foobar.jpg|thumb| ]]
13743 !! html/parsoid
13744 <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>
13745 !! end
13746
13747 !! test
13748 Parsoid-specific image handling - lang option
13749 !! wikitext
13750 foo
13751 [[File:Foobar.svg|lang=de|caption]]
13752 bar
13753 !! html/parsoid
13754 <p>foo
13755 <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>
13756 bar</p>
13757 !! end
13758
13759
13760 ###
13761 ### Subpages
13762 ###
13763 !! article
13764 Subpage test/subpage
13765 !! text
13766 foo
13767 !! endarticle
13768
13769 !! test
13770 Subpage link
13771 !! options
13772 subpage title=[[Subpage test]]
13773 !! wikitext
13774 [[/subpage]]
13775 !! html
13776 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13777 </p>
13778 !! end
13779
13780 !! test
13781 Subpage noslash link
13782 !! options
13783 subpage title=[[Subpage test]]
13784 !! wikitext
13785 [[/subpage/]]
13786 !! html
13787 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13788 </p>
13789 !! end
13790
13791 !! article
13792 Subpage test/1/2/subpage
13793 !! text
13794 blah
13795 !! endarticle
13796
13797 !! test
13798 Relative subpage noslash link
13799 !! options
13800 parsoid=wt2wt,wt2html,html2html
13801 subpage title=[[Subpage test/1/2/3/4]]
13802 !! wikitext
13803 [[../../subpage/]]
13804
13805 [[../../subpage]]
13806 !! html/php
13807 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13808 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13809 </p>
13810 !! html/parsoid
13811 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13812 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13813 !! end
13814
13815 !! test
13816 Parsoid: dot-slash prefixed wikilinks
13817 !! wikitext
13818 [[./foo]]
13819
13820 [[././bar]]
13821
13822 [[././baz/]]
13823 !! html/php
13824 <p>[[./foo]]
13825 </p><p>[[././bar]]
13826 </p><p>[[././baz/]]
13827 </p>
13828 !! html/parsoid
13829 <p>[[./foo]]
13830 </p><p>[[././bar]]
13831 </p><p>[[././baz/]]
13832 </p>
13833 !! end
13834
13835 !! test
13836 Render invalid page names as plain text (bug 51090)
13837 !! wikitext
13838 [[./../foo|bar]]
13839 [[foo�|bar]]
13840 [[foo/.|bar]]
13841 [[foo/..|bar]]
13842 [[foo~~~bar]]
13843 [[foo>bar]]
13844 [[foo[bar]]
13845 [[.]]
13846 [[..]]
13847 [[foo././bar]]
13848
13849 [[{{echo|./../foo}}|bar]]
13850 [[{{echo|foo/.}}|bar]]
13851 [[{{echo|foo/..}}|bar]]
13852 [[{{echo|foo~~~~bar}}]]
13853 [[{{echo|foo>bar}}]]
13854 [[{{echo|foo././bar}}]]
13855 [[{{echo|foo{bar}}]]
13856 [[{{echo|foo}bar}}]]
13857 [[{{echo|foo[bar}}]]
13858 [[{{echo|foo]bar}}]]
13859 [[{{echo|foo<bar}}]]
13860 !!html/php
13861 <p>[[./../foo|bar]]
13862 [[foo�|bar]]
13863 [[foo/.|bar]]
13864 [[foo/..|bar]]
13865 [[foo~~~bar]]
13866 [[foo&gt;bar]]
13867 [[foo[bar]]
13868 [[.]]
13869 [[..]]
13870 [[foo././bar]]
13871 </p><p>[[./../foo|bar]]
13872 [[foo/.|bar]]
13873 [[foo/..|bar]]
13874 [[foo~~~~bar]]
13875 [[foo&gt;bar]]
13876 [[foo././bar]]
13877 [[foo{bar]]
13878 [[foo}bar]]
13879 [[foo[bar]]
13880 [[foo]bar]]
13881 [[foo&lt;bar]]
13882 </p>
13883 !!html/parsoid
13884 <p>[[./../foo|bar]]
13885 [[foo�|bar]]
13886 [[foo/.|bar]]
13887 [[foo/..|bar]]
13888 [[foo~~~bar]]
13889 [[foo>bar]]
13890 [[foo[bar]]
13891 [[.]]
13892 [[..]]
13893 [[foo././bar]]</p>
13894
13895 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13896 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13897 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13898 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13899 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13900 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13901 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13902 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13903 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13904 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13905 [[<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>
13906 !!end
13907
13908 !! test
13909 Disabled subpages
13910 !! wikitext
13911 [[/subpage]]
13912 !! html
13913 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13914 </p>
13915 !! end
13916
13917 !! test
13918 BUG 561: {{/Subpage}}
13919 !! options
13920 subpage title=[[Page]]
13921 !! wikitext
13922 {{/Subpage}}
13923 !! html
13924 <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>
13925 </p>
13926 !! end
13927
13928 ###
13929 ### Categories
13930 ###
13931 !! article
13932 Category:MediaWiki User's Guide
13933 !! text
13934 blah
13935 !! endarticle
13936
13937 !! test
13938 Link to category
13939 !! wikitext
13940 [[:Category:MediaWiki User's Guide]]
13941 !! html
13942 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13943 </p>
13944 !! end
13945
13946 !! test
13947 Simple category
13948 !! options
13949 cat
13950 !! wikitext
13951 [[Category:MediaWiki User's Guide]]
13952 !! html
13953 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13954 !! end
13955
13956 !! test
13957 PAGESINCATEGORY invalid title fatal (r33546 fix)
13958 !! wikitext
13959 {{PAGESINCATEGORY:<bogus>}}
13960 !! html
13961 <p>0
13962 </p>
13963 !! end
13964
13965 !! test
13966 Category with different sort key
13967 !! options
13968 cat
13969 !! wikitext
13970 [[Category:MediaWiki User's Guide|Foo]]
13971 !! html
13972 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13973 !! end
13974
13975 !! test
13976 Category with identical sort key
13977 !! options
13978 cat
13979 !! wikitext
13980 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13981 !! html
13982 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13983 !! end
13984
13985 !! test
13986 Category with empty sort key
13987 !! options
13988 cat
13989 pst
13990 !! wikitext
13991 [[Category:MediaWiki User's Guide|]]
13992 !! html
13993 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13994 !! end
13995
13996 !! test
13997 Category with empty sort key and parentheses
13998 !! options
13999 cat
14000 pst
14001 !! wikitext
14002 [[Category:Foo (bar)|]]
14003 !! html
14004 [[Category:Foo (bar)|Foo]]
14005 !! end
14006
14007 !! test
14008 Category with link tail
14009 !! options
14010 cat
14011 pst
14012 !! wikitext
14013 123[[Category:Foo]]456
14014 !! html
14015 123[[Category:Foo]]456
14016 !! end
14017
14018 !! test
14019 Category with template
14020 !! options
14021 cat
14022 pst
14023 !! wikitext
14024 [[Category:{{echo|Foo}}]]
14025 !! html
14026 [[Category:{{echo|Foo}}]]
14027 !! end
14028
14029 !! test
14030 Category with template in sort key
14031 !! options
14032 cat
14033 pst
14034 !! wikitext
14035 [[Category:Foo|{{echo|Bar}}]]
14036 !! html
14037 [[Category:Foo|{{echo|Bar}}]]
14038 !! end
14039
14040 !! test
14041 Category with template in sort key and title
14042 !! options
14043 cat
14044 pst
14045 !! wikitext
14046 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14047 !! html
14048 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14049 !! end
14050
14051 !! test
14052 Category / paragraph interactions
14053 !! wikitext
14054 Foo [[Category:Baz]] Bar
14055
14056 Foo [[Category:Baz]]
14057 Bar
14058
14059 Foo
14060 [[Category:Baz]]
14061 Bar
14062
14063 Foo
14064 [[Category:Baz]] Bar
14065
14066 Foo
14067 [[Category:Baz]]
14068 [[Category:Baz]]
14069 [[Category:Baz]]
14070 Bar
14071
14072 [[Category:Baz]]
14073 [[Category:Baz]]
14074 [[Category:Baz]]
14075
14076 [[Category:Baz]]
14077 {{echo|[[Category:Baz]]}}
14078 [[Category:Baz]]
14079 !! html
14080 <p>Foo Bar
14081 </p><p>Foo
14082 Bar
14083 </p><p>Foo
14084 Bar
14085 </p><p>Foo Bar
14086 </p><p>Foo
14087 Bar
14088 </p>
14089 !! end
14090
14091 ## The whitespace on the empty line is part of the test. Please do not delete
14092 !! test
14093 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14094 !! options
14095 parsoid=wt2html,wt2wt
14096 !! wikitext
14097 This
14098
14099 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14100
14101 {{echo|[[Category:Foo]] and so should this!}}
14102 !! html
14103 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14104 </p>
14105 !! html/parsoid
14106 <p>This
14107
14108 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14109
14110 <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>
14111 !! end
14112
14113 ## Parsoid will not try to wt2wt this while preserving newlines because
14114 ## it suppresses excess newlines within list items -- and we don't want to
14115 ## introduce a special case just for categories, which is, in reality somewhat
14116 ## odd behavior -- categories are unlikely to be used in list items like this
14117 ## in top-level pages and are only likely to show up in template-generated
14118 ## list items where this RT-ing is a non-issue.
14119 ##
14120 ## The whitespace on the empty line is part of the test. Please do not delete
14121 !! test
14122 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14123 !! options
14124 parsoid=wt2html
14125 !! wikitext
14126 * This
14127
14128 [[Category:Foo]] and this should be part of the same list item
14129 * So should this
14130
14131 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14132 !! html
14133 <ul><li>This and this should be part of the same list item</li>
14134 <li>So should this and this should be part of the same list item</li></ul>
14135 !! html/parsoid
14136 <ul>
14137 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14138 <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>
14139 </ul>
14140 !! end
14141
14142 ## Newlines and categories that follow the last item of a list
14143 ## are treated differently because this (list followed by categories)
14144 ## is an extremely common pattern on wikis.
14145 !! test
14146 3. Categories and newlines: newline suppression for last list item should RT properly
14147 !! wikitext
14148 * a
14149 * b
14150
14151 [[Category:Foo]]
14152
14153 [[Category:Bar]]
14154 [[Category:Baz]]
14155 !! html/parsoid
14156 <ul><li> a</li>
14157 <li> b</li></ul>
14158
14159 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14160
14161 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14162 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14163 !! end
14164
14165 !! test
14166 4. Categories and newlines: newline suppression for last list item should RT properly
14167 !! wikitext
14168 * a
14169 **** b
14170
14171 [[Category:Foo]]
14172 !! html/parsoid
14173 <ul><li> a
14174 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14175
14176 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14177 !! end
14178
14179 ## only wt2html for this to make sure the algo only applies to the rightmost path
14180 !! test
14181 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14182 !! options
14183 parsoid=wt2html
14184 !! wikitext
14185 * a
14186 ** b
14187 [[Category:Foo]]
14188 * c
14189 ** d
14190 [[Category:Foo]]
14191 !! html/parsoid
14192 <ul><li> a
14193 <ul><li> b
14194 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14195 <li> c
14196 <ul><li> d</li></ul></li></ul>
14197 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14198 !! end
14199
14200 !! test
14201 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14202 !! wikitext
14203 * a [[Category:Foo]]
14204 !! html/parsoid
14205 <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>
14206 !! end
14207
14208 # This test also demonstrates because of newline+category tunneling
14209 # through the list hander, template wrapping doesn't expand to the
14210 # containing list when the list item swallows the category.
14211 !! test
14212 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14213 !! wikitext
14214 * {{echo|a
14215 [[Category:Foo]]}}
14216 !! html/parsoid
14217 <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">
14218 </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>
14219 !! end
14220
14221 !! test
14222 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14223 !! wikitext
14224 * a
14225
14226 {{echo|[[Category:Foo]]
14227 [[Category:Bar]]}}
14228 [[Category:Baz]]
14229 !! html/parsoid
14230 <ul><li> a</li></ul>
14231
14232 <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">
14233 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14234 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14235 !! end
14236
14237 !! test
14238 Parsoid: Serialize link to category page with colon escape
14239 !! options
14240 parsoid
14241 !! wikitext
14242
14243 [[:Category:Foo]]
14244 [[:Category:Foo|Bar]]
14245 !! html
14246 <p>
14247 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14248 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14249 </p>
14250 !! end
14251
14252 # html2wt localizes the "Category" namespace.
14253 # XXX the <link> element needs an empty data-parsoid attribute, or
14254 # else the html2html test fails because spaces are inserted.
14255 !! test
14256 Link prefix/suffixes aren't applied to category links
14257 !! options
14258 parsoid=wt2html,wt2wt,html2html
14259 language=is
14260 !! wikitext
14261 x[[Category:Foo]]y
14262 !! html/php
14263 <p>xy
14264 </p>
14265 !! html/parsoid
14266 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14267 !! end
14268
14269 !! test
14270 Parsoid: Serialize link to file page with colon escape
14271 !! options
14272 parsoid
14273 !! wikitext
14274
14275 [[:File:Foo.png]]
14276 [[:File:Foo.png|Bar]]
14277 !! html
14278 <p>
14279 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14280 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14281 </p>
14282 !! end
14283
14284 !! test
14285 Parsoid: Serialize a genuine category link without colon escape
14286 !! options
14287 parsoid
14288 !! wikitext
14289 [[Category:Foo]]
14290 [[Category:Foo|Bar]]
14291 !! html
14292 <link rel="mw:PageProp/Category" href="./Category:Foo">
14293 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14294 !! end
14295
14296 !! test
14297 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14298 !! options
14299 parsoid=html2wt
14300 !! html/parsoid
14301 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14302 !! wikitext
14303 [[Category:Toxine bactérienne]]
14304 !! end
14305
14306 !! test
14307 Parsoid: Defaultsort
14308 !! wikitext
14309 {{DEFAULTSORT:Foo}}
14310 !! html/parsoid
14311 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14312 !! end
14313
14314 !! test
14315 Parsoid: Defaultsort (template-generated)
14316 !! wikitext
14317 {{{{echo|DEFAULTSORT}}:Foo}}
14318 !! html/parsoid
14319 <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}}]}'/>
14320 !! end
14321
14322 ###
14323 ### Inter-language links
14324 ###
14325 !! test
14326 Interlanguage links
14327 !! options
14328 ill
14329 !! wikitext
14330 [[es:Alimento]]
14331 [[fr:Nourriture]]
14332 [[zh:食品]]
14333 !! html/php
14334 es:Alimento fr:Nourriture zh:食品
14335 !! html/parsoid
14336 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14337 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14338 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14339 !! end
14340
14341 !! test
14342 Duplicate interlanguage links (bug 24502)
14343 !! options
14344 ill
14345 !! wikitext
14346 [[es:1]]
14347 [[es:2]]
14348 [[fr:1]]
14349 [[fr:2]]
14350 !! html/php
14351 es:1 fr:1
14352 !! html/parsoid
14353 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14354 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14355 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14356 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14357 !! end
14358
14359 ###
14360 ### Sections
14361 ###
14362 !! test
14363 Basic section headings
14364 !! wikitext
14365 == Headline 1 ==
14366 Some text
14367
14368 ==Headline 2==
14369 More
14370 ===Smaller headline===
14371 Blah blah
14372 !! html
14373 <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>
14374 <p>Some text
14375 </p>
14376 <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>
14377 <p>More
14378 </p>
14379 <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>
14380 <p>Blah blah
14381 </p>
14382 !! end
14383
14384 !! test
14385 Section headings with TOC
14386 !! wikitext
14387 == Headline 1 ==
14388 === Subheadline 1 ===
14389 ===== Skipping a level =====
14390 ====== Skipping a level ======
14391
14392 == Headline 2 ==
14393 Some text
14394 ===Another headline===
14395 !! html
14396 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14397 <ul>
14398 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14399 <ul>
14400 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14401 <ul>
14402 <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>
14403 <ul>
14404 <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>
14405 </ul>
14406 </li>
14407 </ul>
14408 </li>
14409 </ul>
14410 </li>
14411 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14412 <ul>
14413 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14414 </ul>
14415 </li>
14416 </ul>
14417 </div>
14418
14419 <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>
14420 <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>
14421 <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>
14422 <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>
14423 <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>
14424 <p>Some text
14425 </p>
14426 <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>
14427
14428 !! end
14429
14430 !! test
14431 TOC anchors don't collide
14432 !! wikitext
14433 __FORCETOC__
14434 == Headline 2 ==
14435 == Headline ==
14436 == Headline 2 ==
14437 == Headline ==
14438 !! html/php
14439 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14440 <ul>
14441 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14442 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14443 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14444 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14445 </ul>
14446 </div>
14447
14448 <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>
14449 <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>
14450 <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>
14451 <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>
14452
14453 !! end
14454
14455 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14456 !! test
14457 Handling of sections up to level 6 and beyond
14458 !! wikitext
14459 = Level 1 Heading=
14460 == Level 2 Heading==
14461 === Level 3 Heading===
14462 ==== Level 4 Heading====
14463 ===== Level 5 Heading=====
14464 ====== Level 6 Heading======
14465 ======= Level 7 Heading=======
14466 ======== Level 8 Heading========
14467 ========= Level 9 Heading=========
14468 ========== Level 10 Heading==========
14469 !! html
14470 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14471 <ul>
14472 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14473 <ul>
14474 <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>
14475 <ul>
14476 <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>
14477 <ul>
14478 <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>
14479 <ul>
14480 <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>
14481 <ul>
14482 <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>
14483 <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>
14484 <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>
14485 <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>
14486 <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>
14487 </ul>
14488 </li>
14489 </ul>
14490 </li>
14491 </ul>
14492 </li>
14493 </ul>
14494 </li>
14495 </ul>
14496 </li>
14497 </ul>
14498 </div>
14499
14500 <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>
14501 <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>
14502 <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>
14503 <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>
14504 <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>
14505 <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>
14506 <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>
14507 <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>
14508 <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>
14509 <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>
14510
14511 !! end
14512
14513 !! test
14514 TOC regression (T11764)
14515 !! wikitext
14516 == title 1 ==
14517 === title 1.1 ===
14518 ==== title 1.1.1 ====
14519 === title 1.2 ===
14520 == title 2 ==
14521 === title 2.1 ===
14522 !! html
14523 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14524 <ul>
14525 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14526 <ul>
14527 <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>
14528 <ul>
14529 <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>
14530 </ul>
14531 </li>
14532 <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>
14533 </ul>
14534 </li>
14535 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14536 <ul>
14537 <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>
14538 </ul>
14539 </li>
14540 </ul>
14541 </div>
14542
14543 <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>
14544 <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>
14545 <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>
14546 <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>
14547 <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>
14548 <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>
14549
14550 !! end
14551
14552 !! test
14553 TOC for heading containing <span id="..."></span> (T96153)
14554 !! wikitext
14555 __FORCETOC__
14556 ==<span id="old-anchor"></span>New title==
14557 !! html/php
14558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14559 <ul>
14560 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14561 </ul>
14562 </div>
14563
14564 <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>
14565
14566 !! end
14567
14568 !! test
14569 TOC with wgMaxTocLevel=3 (bug 6204)
14570 !! options
14571 wgMaxTocLevel=3
14572 !! wikitext
14573 == title 1 ==
14574 === title 1.1 ===
14575 ==== title 1.1.1 ====
14576 === title 1.2 ===
14577 == title 2 ==
14578 === title 2.1 ===
14579 !! html
14580 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14581 <ul>
14582 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14583 <ul>
14584 <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>
14585 <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>
14586 </ul>
14587 </li>
14588 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14589 <ul>
14590 <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>
14591 </ul>
14592 </li>
14593 </ul>
14594 </div>
14595
14596 <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>
14597 <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>
14598 <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>
14599 <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>
14600 <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>
14601 <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>
14602
14603 !! end
14604
14605 !! test
14606 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14607 !! options
14608 wgMaxTocLevel=3
14609 !! wikitext
14610 ==Section 1==
14611 ===Section 1.1===
14612 ====Section 1.1.1====
14613 ====Section 1.1.1.1====
14614 ==Section 2==
14615 !! html
14616 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14617 <ul>
14618 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14619 <ul>
14620 <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>
14621 </ul>
14622 </li>
14623 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14624 </ul>
14625 </div>
14626
14627 <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>
14628 <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>
14629 <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>
14630 <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>
14631 <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>
14632
14633 !! end
14634
14635
14636 !! test
14637 Resolving duplicate section names
14638 !! wikitext
14639 == Foo bar ==
14640 == Foo bar ==
14641 !! html
14642 <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>
14643 <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>
14644
14645 !! end
14646
14647 !! test
14648 Resolving duplicate section names with differing case (bug 10721)
14649 !! wikitext
14650 == Foo bar ==
14651 == Foo Bar ==
14652 !! html
14653 <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>
14654 <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>
14655
14656 !! end
14657
14658 !! article
14659 Template:sections
14660 !! text
14661 ===Section 1===
14662 ==Section 2==
14663 !! endarticle
14664
14665 !! test
14666 Template with sections, __NOTOC__
14667 !! wikitext
14668 __NOTOC__
14669 ==Section 0==
14670 {{sections}}
14671 ==Section 4==
14672 !! html
14673 <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>
14674 <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>
14675 <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>
14676 <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>
14677
14678 !! end
14679
14680 !! test
14681 __NOEDITSECTION__ keyword
14682 !! wikitext
14683 __NOEDITSECTION__
14684 ==Section 1==
14685 ==Section 2==
14686 !! html
14687 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14688 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14689
14690 !! end
14691
14692 !! test
14693 Link inside a section heading
14694 !! wikitext
14695 ==Section with a [[Main Page|link]] in it==
14696 !! html
14697 <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>
14698
14699 !! end
14700
14701 !! test
14702 TOC regression (T14077)
14703 !! wikitext
14704 __TOC__
14705 == title 1 ==
14706 === title 1.1 ===
14707 == title 2 ==
14708 !! html
14709 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14710 <ul>
14711 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14712 <ul>
14713 <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>
14714 </ul>
14715 </li>
14716 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14717 </ul>
14718 </div>
14719
14720 <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>
14721 <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>
14722 <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>
14723
14724 !! end
14725
14726 !! test
14727 BUG 1219 URL next to image (good)
14728 !! wikitext
14729 http://example.com [[File:Foobar.jpg]]
14730 !! html/php
14731 <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>
14732 </p>
14733 !! html/parsoid
14734 <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>
14735 !!end
14736
14737 !! test
14738 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14739 !! wikitext
14740 ===
14741 The line above must have a trailing space!
14742 === <!--
14743 --> <!-- -->
14744 But just in case it doesn't...
14745 !! html
14746 <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>
14747 <p>The line above must have a trailing space!
14748 </p>
14749 <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>
14750 <p>But just in case it doesn't...
14751 </p>
14752 !! end
14753
14754 !! test
14755 Header with special characters (bug 25462)
14756 !! wikitext
14757 The tooltips shall not show entities to the user (ie. be double escaped)
14758
14759 == text > text ==
14760 section 1
14761
14762 == text < text ==
14763 section 2
14764
14765 == text & text ==
14766 section 3
14767
14768 == text ' text ==
14769 section 4
14770
14771 == text " text ==
14772 section 5
14773 !! html
14774 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14775 </p>
14776 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14777 <ul>
14778 <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>
14779 <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>
14780 <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>
14781 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14782 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14783 </ul>
14784 </div>
14785
14786 <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>
14787 <p>section 1
14788 </p>
14789 <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>
14790 <p>section 2
14791 </p>
14792 <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>
14793 <p>section 3
14794 </p>
14795 <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>
14796 <p>section 4
14797 </p>
14798 <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>
14799 <p>section 5
14800 </p>
14801 !! end
14802
14803 !! test
14804 Header with space, plus and underscore as entity
14805 !! wikitext
14806 Id should not contain + for spaces
14807
14808 == Space between Text ==
14809 section 1
14810
14811 == Space-Entity&#32;between&#32;Text ==
14812 section 2
14813
14814 == Plus+between+Text ==
14815 section 3
14816
14817 == Plus-Entity&#43;between&#43;Text ==
14818 section 4
14819
14820 == Underscore_between_Text ==
14821 section 5
14822
14823 == Underscore-Entity&#95;between&#95;Text ==
14824 section 6
14825
14826 [[#Space between Text]]
14827 [[#Space-Entity&#32;between&#32;Text]]
14828 [[#Plus+between+Text]]
14829 [[#Plus-Entity&#43;between&#43;Text]]
14830 [[#Underscore_between_Text]]
14831 [[#Underscore-Entity&#95;between&#95;Text]]
14832 !! html
14833 <p>Id should not contain + for spaces
14834 </p>
14835 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14836 <ul>
14837 <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>
14838 <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>
14839 <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>
14840 <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>
14841 <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>
14842 <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>
14843 </ul>
14844 </div>
14845
14846 <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>
14847 <p>section 1
14848 </p>
14849 <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>
14850 <p>section 2
14851 </p>
14852 <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>
14853 <p>section 3
14854 </p>
14855 <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>
14856 <p>section 4
14857 </p>
14858 <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>
14859 <p>section 5
14860 </p>
14861 <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>
14862 <p>section 6
14863 </p><p><a href="#Space_between_Text">#Space between Text</a>
14864 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14865 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14866 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14867 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14868 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14869 </p>
14870 !! end
14871
14872 !! test
14873 Headers with excess '=' characters
14874 (Are similar tests necessary beyond the 1st level?)
14875 !! wikitext
14876 =foo==
14877 ==foo=
14878 =''italic'' heading==
14879 ==''italic'' heading=
14880 !! html
14881 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14882 <ul>
14883 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14884 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14885 <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>
14886 <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>
14887 </ul>
14888 </div>
14889
14890 <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>
14891 <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>
14892 <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>
14893 <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>
14894
14895 !! end
14896
14897 !! test
14898 HTML headers vs TOC (bug 23393)
14899 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14900 !! wikitext
14901 <h1>Header 1</h1>
14902 == Header 1.1 ==
14903 == Header 1.2 ==
14904
14905 <h1>Header 2
14906 </h1>
14907 == Header 2.1 ==
14908 == Header 2.2 ==
14909 __NOEDITSECTION__
14910 !! html
14911 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14912 <ul>
14913 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14914 <ul>
14915 <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>
14916 <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>
14917 </ul>
14918 </li>
14919 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14920 <ul>
14921 <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>
14922 <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>
14923 </ul>
14924 </li>
14925 </ul>
14926 </div>
14927
14928 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14929 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14930 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14931 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14932 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14933 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14934
14935 !! end
14936
14937 !! test
14938 Single-line or multiline-comments can follow headings
14939 !! options
14940 parsoid=wt2html,wt2wt
14941 !! wikitext
14942 ==foo==<!---->
14943 ==bar==<!--c1-->
14944 ==baz==<!--
14945 c2
14946 c3-->
14947 !! html
14948 <h2><span class="mw-headline" id="foo">foo</span></h2>
14949 <h2><span class="mw-headline" id="bar">bar</span></h2>
14950 <h2><span class="mw-headline" id="baz">baz</span></h2>
14951
14952 !! end
14953
14954 !! test
14955 BUG 1219 URL next to image (broken)
14956 !! wikitext
14957 http://example.com[[File:Foobar.jpg]]
14958 !! html/php
14959 <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>
14960 </p>
14961 !! html/parsoid
14962 <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>
14963 !!end
14964
14965 !! test
14966 Bug 1186 news: in the middle of text
14967 !! wikitext
14968 http://en.wikinews.org/wiki/Wikinews:Workplace
14969 !! html
14970 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14971 </p>
14972 !!end
14973
14974
14975 !! test
14976 Namespaced link must have a title
14977 !! wikitext
14978 [[Project:]]
14979 !! html
14980 <p>[[Project:]]
14981 </p>
14982 !!end
14983
14984 !! test
14985 Namespaced link must have a title (bad fragment version)
14986 !! wikitext
14987 [[Project:#fragment]]
14988 !! html
14989 <p>[[Project:#fragment]]
14990 </p>
14991 !!end
14992
14993
14994 ###
14995 ### HTML tags and HTML attributes
14996 ###
14997
14998 !! test
14999 div with no attributes
15000 !! wikitext
15001 <div>HTML rocks</div>
15002 !! html
15003 <div>HTML rocks</div>
15004
15005 !! end
15006
15007 !! test
15008 div with double-quoted attribute
15009 !! wikitext
15010 <div id="rock">HTML rocks</div>
15011 !! html
15012 <div id="rock">HTML rocks</div>
15013
15014 !! end
15015
15016 !! test
15017 div with single-quoted attribute
15018 !! wikitext
15019 <div id='rock'>HTML rocks</div>
15020 !! html
15021 <div id="rock">HTML rocks</div>
15022
15023 !! end
15024
15025 !! test
15026 div with unquoted attribute
15027 !! wikitext
15028 <div id=rock>HTML rocks</div>
15029 !! html
15030 <div id="rock">HTML rocks</div>
15031
15032 !! end
15033
15034 !! test
15035 div with illegal double attributes
15036 !! wikitext
15037 <div id="a" id="b">HTML rocks</div>
15038 !! html
15039 <div id="b">HTML rocks</div>
15040
15041 !!end
15042
15043 # FIXME: produce empty string instead of "class" in the PHP parser, following
15044 # the HTML5 spec.
15045 !! test
15046 div with empty attribute value, space before equals
15047 !! options
15048 parsoid
15049 !! wikitext
15050 <div class =>HTML rocks</div>
15051 !! html
15052 <div class="">HTML rocks</div>
15053
15054 !! end
15055
15056 !! test
15057 div with multiple empty attribute values
15058 !! options
15059 parsoid
15060 !! wikitext
15061 <div id= title=>HTML rocks</div>
15062 !! html
15063 <div id="" title="">HTML rocks</div>
15064
15065 !! end
15066
15067 !! test
15068 table with multiple empty attribute values
15069 !! options
15070 parsoid
15071 !! wikitext
15072 {| title= id=
15073 | hi
15074 |}
15075 !! html
15076 <table title="" id="">
15077 <tbody><tr><td> hi</td></tr>
15078 </tbody></table>
15079 !! end
15080
15081 !! test
15082 div with braces in attribute value
15083 !! wikitext
15084 <div title="{}">Foo</div>
15085 !! html/php
15086 <div title="&#123;}">Foo</div>
15087
15088 !! html/parsoid
15089 <div title="{}">Foo</div>
15090 !! end
15091
15092 # This it very inconsistent in the PHP parser: it returns
15093 # class="class" if there is a space between the name and the equal sign (see
15094 # 'div with empty attribute value, space before equals'), but strips the
15095 # attribute completely if the space is missing. We hope that not much content
15096 # depends on this, so are implementing the behavior below in Parsoid for
15097 # consistencies' sake.
15098 # FIXME: fix this behavior in the PHP parser?
15099 !! test
15100 div with empty attribute value, no space before equals
15101 !! options
15102 parsoid=wt2html,html2html
15103 !! wikitext
15104 <div class=>HTML rocks</div>
15105 !! html/php
15106 <div>HTML rocks</div>
15107
15108 !! html/parsoid
15109 <div class="">HTML rocks</div>
15110 !! end
15111
15112 !! test
15113 HTML multiple attributes correction
15114 !! wikitext
15115 <p class="error" class="awesome">Awesome!</p>
15116 !! html
15117 <p class="awesome">Awesome!</p>
15118
15119 !!end
15120
15121 !! test
15122 Table multiple attributes correction
15123 !! wikitext
15124 {|
15125 !+ class="error" class="awesome"| status
15126 |}
15127 !! html
15128 <table>
15129 <tr>
15130 <th class="awesome"> status
15131 </th></tr></table>
15132
15133 !!end
15134
15135 !! test
15136 DIV IN UPPERCASE
15137 !! wikitext
15138 <DIV ID="x">HTML ROCKS</DIV>
15139 !! html
15140 <div id="x">HTML ROCKS</div>
15141
15142 !!end
15143
15144 !! test
15145 Non-ASCII pseudo-tags are rendered as text
15146 !! wikitext
15147 <khyô>
15148 !! html
15149 <p>&lt;khyô&gt;
15150 </p>
15151 !! end
15152
15153 !! test
15154 Pseudo-tag with URL 'name' renders as url link
15155 !! wikitext
15156 <http://example.com/>
15157 !! html
15158 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15159 </p>
15160 !! end
15161
15162 !! test
15163 text with amp in the middle of nowhere
15164 !! wikitext
15165 Remember AT&T?
15166 !! html
15167 <p>Remember AT&amp;T?
15168 </p>
15169 !! end
15170
15171 !! test
15172 text with character entity: eacute
15173 !! wikitext
15174 I always thought &eacute; was a cute letter.
15175 !! html
15176 <p>I always thought &#233; was a cute letter.
15177 </p>
15178 !! html+tidy
15179 <p>I always thought é was a cute letter.</p>
15180 !! end
15181
15182 !! test
15183 text with entity-escaped character entity-like string: eacute
15184 !! wikitext
15185 I always thought &amp;eacute; was a cute letter.
15186 !! html
15187 <p>I always thought &amp;eacute; was a cute letter.
15188 </p>
15189 !! end
15190
15191 !! test
15192 text with undefined character entity: xacute
15193 !! wikitext
15194 I always thought &xacute; was a cute letter.
15195 !! html
15196 <p>I always thought &amp;xacute; was a cute letter.
15197 </p>
15198 !! end
15199
15200 !! test
15201 HTML5 tags
15202 !! wikitext
15203 <data value="5">five</data>
15204 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15205 <mark>This highlighted text</mark>
15206 !! html
15207 <p><data value="5">five</data>
15208 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15209 <mark>This highlighted text</mark>
15210 </p>
15211 !! end
15212
15213 !! test
15214 HTML tag with leading space is parsed as text
15215 !! wikitext
15216 < div>foo< /div>
15217 !! html
15218 <p>&lt; div&gt;foo&lt; /div&gt;
15219 </p>
15220 !! end
15221
15222 ###
15223 ### Nesting tests (see bug 41545, 50604, 51081)
15224 ###
15225
15226 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15227 # Note that html2wt is considerably more difficult if we use <b> in
15228 # the test case, instead of <big>
15229 !! test
15230 Ensure that HTML adoption agency algorithm is properly implemented.
15231 !! wikitext
15232 <big>X<big>Y</big>Z</big>
15233 !! html
15234 <p><big>X<big>Y</big>Z</big>
15235 </p>
15236 !! end
15237
15238 # This was bug 41545 in the PHP parser.
15239 # Note that tidy doesn't handle this correctly.
15240 !! test
15241 Nesting of <kbd>
15242 !! wikitext
15243 <kbd>X<kbd>Y</kbd>Z</kbd>
15244 !! html
15245 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15246 </p>
15247 !! end
15248
15249 # The following cases were bug 51081 in the PHP parser.
15250 # Note that there are some other nestable tags (b, i, etc) which are
15251 # not covered; see bug 51081 for discussion.
15252
15253 # Note that tidy doesn't handle this correctly.
15254 !! test
15255 Nesting of <em>
15256 !! wikitext
15257 <em>X<em>Y</em>Z</em>
15258 !! html
15259 <p><em>X<em>Y</em>Z</em>
15260 </p>
15261 !! end
15262
15263 # Note that tidy doesn't handle this correctly.
15264 !! test
15265 Nesting of <strong>
15266 !! wikitext
15267 <strong>X<strong>Y</strong>Z</strong>
15268 !! html
15269 <p><strong>X<strong>Y</strong>Z</strong>
15270 </p>
15271 !! end
15272
15273 !! test
15274 Nesting of <q>
15275 !! wikitext
15276 <q>X<q>Y</q>Z</q>
15277 !! html+tidy
15278 <p><q>X<q>Y</q>Z</q></p>
15279 !! end
15280
15281 # Note that tidy doesn't handle this correctly.
15282 !! test
15283 Nesting of <ruby>
15284 !! wikitext
15285 <ruby>X<ruby>Y</ruby>Z</ruby>
15286 !! html
15287 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15288 </p>
15289 !! end
15290
15291 # Note that tidy doesn't handle this correctly.
15292 !! test
15293 Nesting of <bdo>
15294 !! wikitext
15295 <bdo>X<bdo>Y</bdo>Z</bdo>
15296 !! html
15297 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15298 </p>
15299 !! end
15300
15301
15302 ###
15303 ### Media links
15304 ###
15305
15306 !! test
15307 Media link
15308 !! wikitext
15309 [[Media:Foobar.jpg]]
15310 !! html
15311 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15312 </p>
15313 !! end
15314
15315 !! test
15316 Media link with text
15317 !! wikitext
15318 [[Media:Foobar.jpg|A neat file to look at]]
15319 !! html
15320 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15321 </p>
15322 !! end
15323
15324 # FIXME: this is still bad HTML tag nesting
15325 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15326 !! test
15327 Media link with nasty text
15328 !! wikitext
15329 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15330 !! html
15331 <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>
15332
15333 !! html+tidy
15334 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15335 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15336 !! end
15337
15338 !! test
15339 Media link to nonexistent file (bug 1702)
15340 !! wikitext
15341 [[Media:No such.jpg]]
15342 !! html
15343 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15344 </p>
15345 !! end
15346
15347 !! test
15348 Image link to nonexistent file (bug 1850 - good)
15349 !! wikitext
15350 [[File:No_such.jpg]]
15351 !! html/php
15352 <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>
15353 </p>
15354 !! html/parsoid
15355 <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>
15356 !! end
15357
15358 !! test
15359 :Image link to nonexistent file (bug 1850 - bad)
15360 !! wikitext
15361 [[:Image:No such.jpg]]
15362 !! html/php
15363 <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>
15364 </p>
15365 !! html/parsoid
15366 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15367 !! end
15368
15369
15370
15371 !! test
15372 Character reference normalization in link text (bug 1938)
15373 !! wikitext
15374 [[Main Page|this&that]]
15375 !! html
15376 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15377 </p>
15378 !!end
15379
15380 !! article
15381 אַ
15382 !! text
15383 Test for unicode normalization
15384
15385 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15386 !! endarticle
15387
15388 !! test
15389 (bug 19451) Links should refer to the normalized form.
15390 !! wikitext
15391 [[&#xFB2E;]]
15392 [[&#x5d0;&#x5b7;]]
15393 [[&#x5d0;ַ]]
15394 [[א&#x5b7;]]
15395 [[אַ]]
15396 !! html
15397 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15398 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15399 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15400 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15401 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15402 </p>
15403 !! end
15404
15405 !! test
15406 Empty attribute crash test (bug 2067)
15407 !! wikitext
15408 <font color="">foo</font>
15409 !! html
15410 <p><font color="">foo</font>
15411 </p>
15412 !! end
15413
15414 !! test
15415 Empty attribute crash test single-quotes (bug 2067)
15416 !! wikitext
15417 <font color=''>foo</font>
15418 !! html
15419 <p><font color="">foo</font>
15420 </p>
15421 !! end
15422
15423 !! test
15424 Attribute test: equals, then nothing
15425 !! wikitext
15426 <font color=>foo</font>
15427 !! html
15428 <p><font>foo</font>
15429 </p>
15430 !! end
15431
15432 !! test
15433 Attribute test: unquoted value
15434 !! wikitext
15435 <font color=x>foo</font>
15436 !! html
15437 <p><font color="x">foo</font>
15438 </p>
15439 !! end
15440
15441 !! test
15442 Attribute test: unquoted but illegal value (hash)
15443 !! wikitext
15444 <font color=#x>foo</font>
15445 !! html
15446 <p><font color="#x">foo</font>
15447 </p>
15448 !! end
15449
15450 # Parsoid does not serialize to empty attribute syntax,
15451 # so wt2wt and html2wt cases are skipped
15452 !! test
15453 Attribute test: no value (T54330)
15454 !! options
15455 parsoid=wt2html,html2html
15456 !! wikitext
15457 <font color>foo</font>
15458 !! html/php
15459 <p><font color="">foo</font>
15460 </p>
15461 !! html/parsoid
15462 <p><font color="">foo</font></p>
15463 !! end
15464
15465 !! test
15466 Bug 2095: link with three closing brackets
15467 !! wikitext
15468 [[Main Page]]]
15469 !! html/php
15470 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15471 </p>
15472 !! html/parsoid
15473 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15474 !! end
15475
15476 !! test
15477 Bug 2095: link with pipe and three closing brackets
15478 !! wikitext
15479 [[Main Page|link]]]
15480 !! html/php
15481 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15482 </p>
15483 !! html/parsoid
15484 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15485 !! end
15486
15487 !! test
15488 Bug 2095: link with pipe and three closing brackets, version 2
15489 !! wikitext
15490 [[Main Page|[http://example.com/]]]
15491 !! html/php
15492 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15493 </p>
15494 !! html/parsoid
15495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15496 !! end
15497
15498
15499 ###
15500 ### Safety
15501 ###
15502
15503 !! article
15504 Template:Dangerous attribute
15505 !! text
15506 " onmouseover="alert(document.cookie)
15507 !! endarticle
15508
15509 !! article
15510 Template:Dangerous style attribute
15511 !! text
15512 border-size: expression(alert(document.cookie))
15513 !! endarticle
15514
15515 !! article
15516 Template:Div style
15517 !! text
15518 <div style="float: right; {{{1}}}">Magic div</div>
15519 !! endarticle
15520
15521 !! test
15522 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15523 !! wikitext
15524 <div title="{{test}}"></div>
15525 !! html
15526 <div title="This is a test template"></div>
15527
15528 !! end
15529
15530 # Parsoid has enough context to handle this case
15531 !! test
15532 Bug 2304: HTML attribute safety (dangerous template; 2309)
15533 !! wikitext
15534 <div title="{{dangerous attribute}}"></div>
15535 !! html/php
15536 <div title=""></div>
15537
15538 !! html/parsoid
15539 <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>
15540 !! end
15541
15542 !! test
15543 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15544 !! wikitext
15545 <div style="{{dangerous style attribute}}"></div>
15546 !! html
15547 <div style="/* insecure input */"></div>
15548
15549 !! end
15550
15551 !! test
15552 Bug 2304: HTML attribute safety (safe parameter; 2309)
15553 !! wikitext
15554 {{div style|width: 200px}}
15555 !! html
15556 <div style="float: right; width: 200px">Magic div</div>
15557
15558 !! end
15559
15560 !! test
15561 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15562 !! wikitext
15563 {{div style|width: expression(alert(document.cookie))}}
15564 !! html
15565 <div style="/* insecure input */">Magic div</div>
15566
15567 !! end
15568
15569 !! test
15570 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15571 !! wikitext
15572 {{div style|"><script>alert(document.cookie)</script>}}
15573 !! html
15574 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15575
15576 !! end
15577
15578 !! test
15579 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15580 !! wikitext
15581 {{div style|" ><script>alert(document.cookie)</script>}}
15582 !! html
15583 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15584
15585 !! end
15586
15587 !! test
15588 Bug 2304: HTML attribute safety (link)
15589 !! wikitext
15590 <div title="[[Main Page]]"></div>
15591 !! html
15592 <div title="&#91;&#91;Main Page]]"></div>
15593
15594 !! end
15595
15596 !! test
15597 Bug 2304: HTML attribute safety (italics)
15598 !! wikitext
15599 <div title="''foobar''"></div>
15600 !! html
15601 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15602
15603 !! end
15604
15605 !! test
15606 Bug 2304: HTML attribute safety (bold)
15607 !! wikitext
15608 <div title="'''foobar'''"></div>
15609 !! html
15610 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15611
15612 !! end
15613
15614
15615 !! test
15616 Bug 2304: HTML attribute safety (ISBN)
15617 !! wikitext
15618 <div title="ISBN 1234567890"></div>
15619 !! html
15620 <div title="&#73;SBN 1234567890"></div>
15621
15622 !! end
15623
15624 !! test
15625 Bug 2304: HTML attribute safety (RFC)
15626 !! wikitext
15627 <div title="RFC 1234"></div>
15628 !! html
15629 <div title="&#82;FC 1234"></div>
15630
15631 !! end
15632
15633 !! test
15634 Bug 2304: HTML attribute safety (PMID)
15635 !! wikitext
15636 <div title="PMID 1234567890"></div>
15637 !! html
15638 <div title="&#80;MID 1234567890"></div>
15639
15640 !! end
15641
15642 !! test
15643 Bug 2304: HTML attribute safety (web link)
15644 !! wikitext
15645 <div title="http://example.com/"></div>
15646 !! html
15647 <div title="http&#58;//example.com/"></div>
15648
15649 !! end
15650
15651 !! test
15652 Bug 2304: HTML attribute safety (named web link)
15653 !! wikitext
15654 <div title="[http://example.com/ link]"></div>
15655 !! html
15656 <div title="&#91;http&#58;//example.com/ link]"></div>
15657
15658 !! end
15659
15660 !! test
15661 Bug 3244: HTML attribute safety (extension; safe)
15662 !! wikitext
15663 <div style="<nowiki>background:blue</nowiki>"></div>
15664 !! html
15665 <div style="background:blue"></div>
15666
15667 !! end
15668
15669 !! test
15670 Bug 3244: HTML attribute safety (extension; unsafe)
15671 !! wikitext
15672 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15673 !! html
15674 <div style="/* insecure input */"></div>
15675
15676 !! end
15677
15678 # More MSIE fun discovered by Tom Gilder
15679
15680 !! test
15681 MSIE CSS safety test: spurious slash
15682 !! wikitext
15683 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15684 !! html
15685 <div style="/* insecure input */">evil</div>
15686
15687 !! end
15688
15689 !! test
15690 MSIE CSS safety test: hex code
15691 !! wikitext
15692 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15693 !! html
15694 <div style="/* insecure input */">evil</div>
15695
15696 !! end
15697
15698 !! test
15699 MSIE CSS safety test: comment in url
15700 !! wikitext
15701 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15702 !! html
15703 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15704
15705 !! end
15706
15707 !! test
15708 MSIE CSS safety test: comment in expression
15709 !! wikitext
15710 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15711 !! html
15712 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15713
15714 !! end
15715
15716 !! test
15717 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15718 !! wikitext
15719 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15720 !! html
15721 <p style="/* invalid control char */">A</p>
15722
15723 !! end
15724
15725 !! test
15726 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15727 !! wikitext
15728 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15729 <div style="top:EXPRESSION(alert())">B</div>
15730 !! html
15731 <p style="/* insecure input */">A</p>
15732 <div style="/* insecure input */">B</div>
15733
15734 !! end
15735
15736 !! test
15737 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15738 !! wikitext
15739 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15740 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15741 !! html
15742 <div style="/* insecure input */">A</div>
15743 <p style="/* insecure input */">B</p>
15744
15745 !! end
15746
15747 !! test
15748 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15749 !! wikitext
15750 <div style="background-image:url⁽javascript:alert())">A</div>
15751 <div style="background-image:url₍javascript:alert())">B</div>
15752 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15753 !! html
15754 <div style="/* insecure input */">A</div>
15755 <div style="/* insecure input */">B</div>
15756 <p style="/* insecure input */">C</p>
15757
15758 !! end
15759
15760 !! test
15761 Opera -o-link CSS
15762 !! wikitext
15763 <div
15764 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;"
15765 style="-o-link:attr(title);-o-link-source:current">X</div>
15766 !! html
15767 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15768
15769 !! end
15770
15771 !! test
15772 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15773 !! wikitext
15774 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15775 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15776 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15777 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15778 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15779 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15780 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15781 !! html
15782 <p style="/* insecure input */">A</p>
15783 <p style="/* insecure input */">B</p>
15784 <p style="/* insecure input */">C</p>
15785 <p style="/* insecure input */">D</p>
15786 <p style="/* insecure input */">E</p>
15787 <p style="/* insecure input */">F</p>
15788 <p style="/* insecure input */">G</p>
15789
15790 !! end
15791
15792 !! test
15793 Table attribute legitimate extension
15794 !! wikitext
15795 {|
15796 !+ style="<nowiki>color:blue</nowiki>"| status
15797 |}
15798 !! html
15799 <table>
15800 <tr>
15801 <th style="color:blue"> status
15802 </th></tr></table>
15803
15804 !!end
15805
15806 !! test
15807 Table attribute safety
15808 !! wikitext
15809 {|
15810 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15811 |}
15812 !! html
15813 <table>
15814 <tr>
15815 <th style="/* insecure input */"> status
15816 </th></tr></table>
15817
15818 !! end
15819
15820 !! test
15821 CSS line continuation 1
15822 !! wikitext
15823 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15824 !! html
15825 <div style="/* insecure input */"></div>
15826
15827 !! end
15828
15829 !! test
15830 CSS line continuation 2
15831 !! wikitext
15832 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15833 !! html
15834 <div style="/* insecure input */"></div>
15835
15836 !! end
15837
15838 !! article
15839 Template:Identity
15840 !! text
15841 {{{1}}}
15842 !! endarticle
15843
15844 !! test
15845 Expansion of multi-line templates in attribute values (bug 6255)
15846 !! wikitext
15847 <div style="background: {{identity|#00FF00}}">-</div>
15848 !! html
15849 <div style="background: #00FF00">-</div>
15850
15851 !! end
15852
15853
15854 !! test
15855 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15856 !! wikitext
15857 <div style="background:
15858 #00FF00">-</div>
15859 !! html/php
15860 <div style="background: #00FF00">-</div>
15861
15862 !! html/parsoid
15863 <div style="background:
15864 #00FF00">-</div>
15865 !! end
15866
15867 !! test
15868 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15869 !! wikitext
15870 <div style="background: &#10;#00FF00">-</div>
15871 !! html
15872 <div style="background: &#10;#00FF00">-</div>
15873
15874 !! end
15875
15876 !! test
15877 evil <math>-wiki-tags without Extension:Math enabled
15878 !! wikitext
15879 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15880 !! html+tidy
15881 <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>
15882 !! end
15883
15884 ###
15885 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15886 ###
15887 !! test
15888 Parser hook: empty input
15889 !! wikitext
15890 <tag></tag>
15891 !! html/php
15892 <pre>
15893 ''
15894 array (
15895 )
15896 </pre>
15897
15898 !! end
15899
15900 !! test
15901 Parser hook: empty input using terminated empty elements
15902 !! wikitext
15903 <tag/>
15904 !! html/php
15905 <pre>
15906 NULL
15907 array (
15908 )
15909 </pre>
15910
15911 !! end
15912
15913 !! test
15914 Parser hook: empty input using terminated empty elements (space before)
15915 !! wikitext
15916 <tag />
15917 !! html/php
15918 <pre>
15919 NULL
15920 array (
15921 )
15922 </pre>
15923
15924 !! end
15925
15926 !! test
15927 Parser hook: basic input
15928 !! wikitext
15929 <tag>input</tag>
15930 !! html/php
15931 <pre>
15932 'input'
15933 array (
15934 )
15935 </pre>
15936
15937 !! end
15938
15939
15940 !! test
15941 Parser hook: case insensitive
15942 !! wikitext
15943 <TAG>input</TAG>
15944 !! html/php
15945 <pre>
15946 'input'
15947 array (
15948 )
15949 </pre>
15950
15951 !! end
15952
15953
15954 !! test
15955 Parser hook: case insensitive, redux
15956 !! wikitext
15957 <TaG>input</TAg>
15958 !! html/php
15959 <pre>
15960 'input'
15961 array (
15962 )
15963 </pre>
15964
15965 !! end
15966
15967 !! test
15968 Parser hook: nested tags
15969 !! options
15970 noxml
15971 !! wikitext
15972 <tag><tag></tag></tag>
15973 !! html/php
15974 <pre>
15975 '<tag>'
15976 array (
15977 )
15978 </pre>&lt;/tag&gt;
15979
15980 !! end
15981
15982 !! test
15983 Parser hook: basic arguments
15984 !! wikitext
15985 <tag width=200 height = "100" depth = '50' square></tag>
15986 !! html/php
15987 <pre>
15988 ''
15989 array (
15990 'width' => '200',
15991 'height' => '100',
15992 'depth' => '50',
15993 'square' => '',
15994 )
15995 </pre>
15996
15997 !! end
15998
15999 !! test
16000 Parser hook: argument containing a forward slash (bug 5344)
16001 !! wikitext
16002 <tag filename='/tmp/bla'></tag>
16003 !! html/php
16004 <pre>
16005 ''
16006 array (
16007 'filename' => '/tmp/bla',
16008 )
16009 </pre>
16010
16011 !! end
16012
16013 !! test
16014 Parser hook: empty input using terminated empty elements (bug 2374)
16015 !! wikitext
16016 <tag foo=bar/>text
16017 !! html/php
16018 <pre>
16019 NULL
16020 array (
16021 'foo' => 'bar',
16022 )
16023 </pre>text
16024
16025 !! end
16026
16027 # </tag> should be output literally since there is no matching tag that begins it
16028 !! test
16029 Parser hook: basic arguments using terminated empty elements (bug 2374)
16030 !! wikitext
16031 <tag width=200 height = "100" depth = '50' square/>
16032 other stuff
16033 </tag>
16034 !! html/php
16035 <pre>
16036 NULL
16037 array (
16038 'width' => '200',
16039 'height' => '100',
16040 'depth' => '50',
16041 'square' => '',
16042 )
16043 </pre>
16044 <p>other stuff
16045 &lt;/tag&gt;
16046 </p>
16047 !! end
16048
16049 ###
16050 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16051 ###
16052
16053 !! test
16054 Parser hook: static parser hook not inside a comment
16055 !! wikitext
16056 <statictag>hello, world</statictag>
16057 <statictag action=flush/>
16058 !! html/php
16059 <p>hello, world
16060 </p>
16061 !! end
16062
16063
16064 !! test
16065 Parser hook: static parser hook inside a comment
16066 !! wikitext
16067 <!-- <statictag>hello, world</statictag> -->
16068 <statictag action=flush/>
16069 !! html/php
16070 <p><br />
16071 </p>
16072 !! end
16073
16074 # Nested template calls; this case was broken by Parser.php rev 1.506,
16075 # since reverted.
16076
16077 !! article
16078 Template:One-parameter
16079 !! text
16080 (My parameter is: {{{1}}})
16081 !! endarticle
16082
16083 !! article
16084 Template:Map-one-parameter
16085 !! text
16086 {{{{{1}}}|{{{2}}}}}
16087 !! endarticle
16088
16089 !! test
16090 Nested template calls
16091 !! wikitext
16092 {{Map-one-parameter|One-parameter|param}}
16093 !! html
16094 <p>(My parameter is: param)
16095 </p>
16096 !! end
16097
16098
16099 ###
16100 ### Sanitizer
16101 ###
16102
16103 # HTML+Tidy effectively strips out the empty tags completely
16104 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16105 # which Tidy would have done for the PHP parser had there been content inside it.
16106 !! test
16107 Sanitizer: Closing of open tags
16108 !! wikitext
16109 <s></s><table></table>
16110 !! html
16111 <s></s><table></table>
16112
16113 !! html/parsoid
16114 <p><s></s></p><table></table>
16115 !! end
16116
16117 !! test
16118 Sanitizer: Closing of open but not closed tags
16119 !! wikitext
16120 <s>foo
16121 !! html
16122 <p><s>foo</s>
16123 </p>
16124 !! end
16125
16126 !! test
16127 Sanitizer: Closing of closed but not open tags
16128 !! options
16129 parsoid=wt2html
16130 !! wikitext
16131 </s>
16132 !! html/php+tidy
16133 !! html/parsoid
16134 !! end
16135
16136 !! test
16137 Sanitizer: Closing of closed but not open table tags
16138 !! options
16139 parsoid=wt2html
16140 !! wikitext
16141 Table not started</td></tr></table>
16142 !! html/php+tidy
16143 <p>Table not started</p>
16144 !! html/parsoid
16145 <p>Table not started</p>
16146 !! end
16147
16148 !! test
16149 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16150 !! wikitext
16151 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16152 !! html
16153 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16154 </p>
16155 !! end
16156
16157 # In HTML5, the restrictions are that id must contain at least one character,
16158 # and must not contain any space characters.
16159 !! test
16160 Sanitizer: Validating the contents of the id attribute (bug 4515)
16161 !! options
16162 disabled
16163 !! wikitext
16164 <br id="" /><br id="a space" />
16165 !! html
16166 Something ...
16167 !! end
16168
16169 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16170 !! test
16171 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16172 !! options
16173 disabled
16174 !! wikitext
16175 <br id="foo" /><br id="foo" />
16176 !! html
16177 Something need to be done. foo-2 ?
16178 !! end
16179
16180 !! test
16181 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16182 !! wikitext
16183 <div itemscope>
16184 <meta itemprop="hello" content="world">
16185 <meta http-equiv="refresh" content="5">
16186 <meta itemprop="hello" http-equiv="refresh" content="5">
16187 <link itemprop="hello" href="{{SERVER}}">
16188 <link rel="stylesheet" href="{{SERVER}}">
16189 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16190 </div>
16191 !! html
16192 <div itemscope="">
16193 <p> <meta itemprop="hello" content="world" />
16194 &lt;meta http-equiv="refresh" content="5"&gt;
16195 <meta itemprop="hello" content="5" />
16196 </p>
16197 <link itemprop="hello" href="http&#58;//example.org" />
16198 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16199 <link itemprop="hello" href="http&#58;//example.org" />
16200 </div>
16201
16202 !! end
16203
16204 !! test
16205 Language converter: output gets cut off unexpectedly (bug 5757)
16206 !! options
16207 language=zh
16208 !! wikitext
16209 this bit is safe: }-
16210
16211 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16212
16213 then we get cut off here: }-
16214
16215 all additional text is vanished
16216 !! html
16217 <p>this bit is safe: }-
16218 </p><p>but if we add a conversion instance: xxx
16219 </p><p>then we get cut off here: }-
16220 </p><p>all additional text is vanished
16221 </p>
16222 !! end
16223
16224 !! test
16225 Self closed html pairs (bug 5487)
16226 !! options
16227 !! wikitext
16228 <center><font id="bug" />Centered text</center>
16229 <div><font id="bug2" />In div text</div>
16230 !! html
16231 <center>&lt;font id="bug" /&gt;Centered text</center>
16232 <div>&lt;font id="bug2" /&gt;In div text</div>
16233
16234 !! end
16235
16236 #
16237 #
16238 #
16239
16240 !! test
16241 Punctuation: nbsp before exclamation
16242 !! wikitext
16243 C'est grave !
16244 !! html
16245 <p>C'est grave&#160;!
16246 </p>
16247 !! end
16248
16249 !! test
16250 Punctuation: CSS !important (bug 11874)
16251 !! wikitext
16252 <div style="width:50% !important">important</div>
16253 !! html
16254 <div style="width:50% !important">important</div>
16255
16256 !!end
16257
16258 !! test
16259 Punctuation: CSS ! important (bug 11874; with space after)
16260 !! wikitext
16261 <div style="width:50% ! important">important</div>
16262 !! html
16263 <div style="width:50% ! important">important</div>
16264
16265 !!end
16266
16267 !! test
16268 HTML bullet list, closed tags (bug 5497)
16269 !! wikitext
16270 <ul>
16271 <li>One</li>
16272 <li>Two</li>
16273 </ul>
16274 !! html/php
16275 <ul>
16276 <li>One</li>
16277 <li>Two</li>
16278 </ul>
16279
16280 !! html/parsoid
16281 <ul data-parsoid='{"stx":"html"}'>
16282 <li data-parsoid='{"stx":"html"}'>One</li>
16283 <li data-parsoid='{"stx":"html"}'>Two</li>
16284 </ul>
16285
16286 !! end
16287
16288 !! test
16289 HTML bullet list, unclosed tags (bug 5497)
16290 !! wikitext
16291 <ul>
16292 <li>One
16293 <li>Two
16294 </ul>
16295 !! html/php+tidy
16296 <ul>
16297 <li>One</li>
16298 <li>Two</li>
16299 </ul>
16300 !! html/parsoid
16301 <ul data-parsoid='{"stx":"html"}'>
16302 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16303 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16304 </ul>
16305
16306 !! end
16307
16308 !! test
16309 HTML ordered list, closed tags (bug 5497)
16310 !! wikitext
16311 <ol>
16312 <li>One</li>
16313 <li>Two</li>
16314 </ol>
16315 !! html/php
16316 <ol>
16317 <li>One</li>
16318 <li>Two</li>
16319 </ol>
16320
16321 !! html/parsoid
16322 <ol data-parsoid='{"stx":"html"}'>
16323 <li data-parsoid='{"stx":"html"}'>One</li>
16324 <li data-parsoid='{"stx":"html"}'>Two</li>
16325 </ol>
16326
16327 !! end
16328
16329 !! test
16330 HTML ordered list, unclosed tags (bug 5497)
16331 !! options
16332 !! wikitext
16333 <ol>
16334 <li>One
16335 <li>Two
16336 </ol>
16337 !! html/php+tidy
16338 <ol>
16339 <li>One</li>
16340 <li>Two</li>
16341 </ol>
16342 !! html/parsoid
16343 <ol data-parsoid='{"stx":"html"}'>
16344 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16345 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16346 </ol>
16347
16348 !! end
16349
16350 !! test
16351 HTML nested bullet list, closed tags (bug 5497)
16352 !! wikitext
16353 <ul>
16354 <li>One</li>
16355 <li>Two:
16356 <ul>
16357 <li>Sub-one</li>
16358 <li>Sub-two</li>
16359 </ul>
16360 </li>
16361 </ul>
16362 !! html
16363 <ul>
16364 <li>One</li>
16365 <li>Two:
16366 <ul>
16367 <li>Sub-one</li>
16368 <li>Sub-two</li>
16369 </ul>
16370 </li>
16371 </ul>
16372
16373 !! end
16374
16375 !! test
16376 HTML nested bullet list, open tags (bug 5497)
16377 !! wikitext
16378 <ul>
16379 <li>One
16380 <li>Two:
16381 <ul>
16382 <li>Sub-one
16383 <li>Sub-two
16384 </ul>
16385 </ul>
16386 !! html/php+tidy
16387 <ul>
16388 <li>One</li>
16389 <li>Two:
16390 <ul>
16391 <li>Sub-one</li>
16392 <li>Sub-two</li>
16393 </ul>
16394 </li>
16395 </ul>
16396 !! html/parsoid
16397 <ul>
16398 <li>One
16399 </li>
16400 <li>Two:
16401 <ul>
16402 <li>Sub-one
16403 </li>
16404 <li>Sub-two
16405 </li>
16406 </ul>
16407 </li>
16408 </ul>
16409
16410 !! end
16411
16412 !! test
16413 HTML nested ordered list, closed tags (bug 5497)
16414 !! wikitext
16415 <ol>
16416 <li>One</li>
16417 <li>Two:
16418 <ol>
16419 <li>Sub-one</li>
16420 <li>Sub-two</li>
16421 </ol>
16422 </li>
16423 </ol>
16424 !! html
16425 <ol>
16426 <li>One</li>
16427 <li>Two:
16428 <ol>
16429 <li>Sub-one</li>
16430 <li>Sub-two</li>
16431 </ol>
16432 </li>
16433 </ol>
16434
16435 !! end
16436
16437 !! test
16438 HTML nested ordered list, open tags (bug 5497)
16439 !! wikitext
16440 <ol>
16441 <li>One
16442 <li>Two:
16443 <ol>
16444 <li>Sub-one
16445 <li>Sub-two
16446 </ol>
16447 </ol>
16448 !! html/php
16449 <ol>
16450 <li>One
16451 <li>Two:
16452 <ol>
16453 <li>Sub-one
16454 <li>Sub-two
16455 </ol>
16456 </ol>
16457
16458 !! html/parsoid
16459 <ol>
16460 <li>One
16461 </li>
16462 <li>Two:
16463 <ol>
16464 <li>Sub-one
16465 </li>
16466 <li>Sub-two
16467 </li>
16468 </ol>
16469 </li>
16470 </ol>
16471
16472 !! end
16473
16474 !! test
16475 HTML ordered list item with parameters oddity
16476 !! wikitext
16477 <ol><li id="fragment">One</li>
16478 </ol>
16479 !! html
16480 <ol><li id="fragment">One</li>
16481 </ol>
16482
16483 !! end
16484
16485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16486 !!test
16487 bug 5918: autonumbering
16488 !! wikitext
16489 [http://first/] [http://second] [ftp://ftp]
16490
16491 ftp://inlineftp
16492
16493 [mailto:enclosed@mail.tld With target]
16494
16495 [mailto:enclosed@mail.tld]
16496
16497 mailto:inline@mail.tld
16498 !! html/php
16499 <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>
16500 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16501 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16502 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16503 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16504 </p>
16505 !! html/parsoid
16506 <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>
16507 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16508 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16509 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16510 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16511 !! end
16512
16513
16514 #
16515 # Security and HTML correctness
16516 # From Nick Jenkins' fuzz testing
16517 #
16518
16519 !! test
16520 Fuzz testing: Parser13
16521 !! wikitext
16522 {|
16523 | http://a|
16524 !! html
16525 <table>
16526 <tr>
16527 <td>
16528 </td>
16529 </tr>
16530 </table>
16531
16532 !! end
16533
16534 !! test
16535 Fuzz testing: Parser14
16536 !! wikitext
16537 == onmouseover= ==
16538 http://__TOC__
16539 !! html
16540 <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>
16541 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16542 <ul>
16543 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16544 </ul>
16545 </div>
16546
16547
16548 !! html+tidy
16549 <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>
16550 <p>http://</p>
16551 <div id="toc" class="toc">
16552 <div id="toctitle">
16553 <h2>Contents</h2>
16554 </div>
16555 <ul>
16556 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16557 </ul>
16558 </div>
16559 <p></p>
16560 !! end
16561
16562 !! test
16563 Fuzz testing: Parser14-table
16564 !! wikitext
16565 ==a==
16566 {| STYLE=__TOC__
16567 !! html
16568 <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>
16569 <table style="&#95;_TOC&#95;_">
16570 <tr><td></td></tr>
16571 </table>
16572
16573 !! html+tidy
16574 <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>
16575 <table style="__TOC__">
16576 <tr>
16577 <td></td>
16578 </tr>
16579 </table>
16580 !! end
16581
16582 # Known to produce bogus xml (extra </td>)
16583 !! test
16584 Fuzz testing: Parser16
16585 !! options
16586 noxml
16587 !! wikitext
16588 {|
16589 !https://||||||
16590 !! html
16591 <table>
16592 <tr>
16593 <th>https://</th>
16594 <th></th>
16595 <th></th>
16596 <th>
16597 </td>
16598 </tr>
16599 </table>
16600
16601 !! html+tidy
16602 <table>
16603 <tr>
16604 <th>https://</th>
16605 <th></th>
16606 <th></th>
16607 <th></th>
16608 </tr>
16609 </table>
16610 !! end
16611
16612 !! test
16613 Fuzz testing: Parser21
16614 !! wikitext
16615 {|
16616 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16617 |
16618 !! html
16619 <table>
16620 <tr>
16621 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16622 </th>
16623 <td>
16624 </td>
16625 </tr>
16626 </table>
16627
16628 !! end
16629
16630 !! test
16631 Fuzz testing: Parser22
16632 !! wikitext
16633 http://===r:::https://b
16634
16635 {|
16636 !! html
16637 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16638 </p>
16639 <table>
16640 <tr><td></td></tr>
16641 </table>
16642
16643 !! end
16644
16645 # Known to produce bad XML for now
16646 !! test
16647 Fuzz testing: Parser24
16648 !! options
16649 noxml
16650 !! wikitext
16651 {|
16652 {{{|
16653 <u CLASS=
16654 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16655 <br style="onmouseover='alert(document.cookie);' " />
16656
16657 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16658 |
16659 !! html
16660 <table>
16661 {{{|
16662 <u class="&#124;">}}}} &gt;
16663 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16664
16665 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16666 <tr>
16667 <td></u>
16668 </td>
16669 </tr>
16670 </table>
16671
16672 !! end
16673
16674 # Note: the current result listed for this is not what the original one was,
16675 # but the original bug was JavaScript injection, which is fixed in any case.
16676 # It's not clear that the original result listed was any more correct than the
16677 # current one. Original result:
16678 # <p>{{{|
16679 # </p>
16680 # <li class="&#124;&#124;">
16681 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16682 !!test
16683 Fuzz testing: Parser25 (bug 6055)
16684 !! wikitext
16685 {{{
16686 |
16687 <LI CLASS=||
16688 >
16689 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16690 !! html
16691 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16692 </p>
16693 !! end
16694
16695 !!test
16696 Fuzz testing: URL adjacent extension (with space, clean)
16697 !! wikitext
16698 http://example.com <nowiki>junk</nowiki>
16699 !! html/php
16700 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16701 </p>
16702 !! html/parsoid
16703 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16704 !! end
16705
16706 !!test
16707 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16708 !! wikitext
16709 http://example.com<nowiki>junk</nowiki>
16710 !! html/php
16711 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16712 </p>
16713 !! html/parsoid
16714 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16715 !! end
16716
16717 !!test
16718 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16719 !! wikitext
16720 http://example.com<pre>junk</pre>
16721 !! html/php
16722 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16723
16724 !! html/php+tidy
16725 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16726 <pre>
16727 junk
16728 </pre>
16729 !! html/parsoid
16730 <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>
16731 !!end
16732
16733 !!test
16734 Fuzz testing: image with bogus manual thumbnail
16735 !! wikitext
16736 [[Image:foobar.jpg|thumbnail= ]]
16737 !! html/php
16738 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16739
16740 !! html/parsoid
16741 <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>
16742 !!end
16743
16744 !! test
16745 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16746 !! wikitext
16747 <pre dir="&#10;"></pre>
16748 !! html
16749 <pre dir="&#10;"></pre>
16750
16751 !! end
16752
16753 !! test
16754 Parsing optional HTML elements (Bug 6171)
16755 !! options
16756 !! wikitext
16757 <table>
16758 <tr>
16759 <td> Some tabular data</td>
16760 <td> More tabular data ...
16761 <td> And yet som tabular data</td>
16762 </tr>
16763 </table>
16764 !! html
16765 <table>
16766 <tr>
16767 <td> Some tabular data</td>
16768 <td> More tabular data ...
16769 </td><td> And yet som tabular data</td>
16770 </tr>
16771 </table>
16772
16773 !! end
16774
16775 !! test
16776 Correct handling of <td>, <tr> (Bug 6171)
16777 !! options
16778 !! wikitext
16779 <table>
16780 <tr>
16781 <td> Some tabular data</td>
16782 <td> More tabular data ...</td>
16783 <td> And yet som tabular data</td>
16784 </tr>
16785 </table>
16786 !! html
16787 <table>
16788 <tr>
16789 <td> Some tabular data</td>
16790 <td> More tabular data ...</td>
16791 <td> And yet som tabular data</td>
16792 </tr>
16793 </table>
16794
16795 !! end
16796
16797
16798 !! test
16799 Parsing crashing regression (fr:JavaScript)
16800 !! wikitext
16801 </body></x>
16802 !! html
16803 <p>&lt;/body&gt;&lt;/x&gt;
16804 </p>
16805 !! end
16806
16807 !! test
16808 Inline wiki vs wiki block nesting
16809 !! wikitext
16810 '''Bold paragraph
16811
16812 New wiki paragraph
16813 !! html
16814 <p><b>Bold paragraph</b>
16815 </p><p>New wiki paragraph
16816 </p>
16817 !! end
16818
16819 # FIXME: The current php output is documented
16820 # and desired output is the parsoid target.
16821 !! test
16822 Inline HTML vs wiki block nesting
16823 !! wikitext
16824 <b>Bold paragraph
16825
16826 New wiki paragraph
16827 !! html/php
16828 <p><b>Bold paragraph
16829 </p><p>New wiki paragraph</b>
16830 </p>
16831 !! html/parsoid
16832 <p><b>Bold paragraph</b>
16833 </p><p>New wiki paragraph
16834 </p>
16835 !! end
16836
16837 # Original result was this:
16838 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16839 # </p>
16840 # While that might be marginally more intuitive, maybe, the six-apostrophe
16841 # construct is clearly pathological and the result stated here (which is what
16842 # the parser actually does) is about as reasonable as anything.
16843 !!test
16844 Mixing markup for italics and bold
16845 !! options
16846 !! wikitext
16847 '''bold''''''bold''bolditalics'''''
16848 !! html
16849 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16850 </p>
16851 !! end
16852
16853
16854 !! article
16855 Xyzzyx
16856 !! text
16857 Article for special page transclusion test
16858 !! endarticle
16859
16860 !! test
16861 Special page transclusion
16862 !! options
16863 !! wikitext
16864 {{Special:Prefixindex/Xyzzyx}}
16865 !! html
16866 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16867
16868 !! end
16869
16870 !! test
16871 Special page transclusion twice (bug 5021)
16872 !! options
16873 !! wikitext
16874 {{Special:Prefixindex/Xyzzyx}}
16875 {{Special:Prefixindex/Xyzzyx}}
16876 !! html
16877 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16878 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16879
16880 !! end
16881
16882 !! test
16883 Transclusion of default MediaWiki message
16884 !! wikitext
16885 {{MediaWiki:Mainpage}}
16886 !! html
16887 <p>Main Page
16888 </p>
16889 !! end
16890
16891 !! test
16892 Transclusion of nonexistent MediaWiki message
16893 !! wikitext
16894 {{MediaWiki:Mainpagexxx}}
16895 !! html
16896 <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>
16897 </p>
16898 !! end
16899
16900 !! test
16901 Transclusion of MediaWiki message with underscore
16902 !! wikitext
16903 {{MediaWiki:history_short}}
16904 !! html
16905 <p>History
16906 </p>
16907 !! end
16908
16909 !! test
16910 Transclusion of MediaWiki message with space
16911 !! wikitext
16912 {{MediaWiki:history short}}
16913 !! html
16914 <p>History
16915 </p>
16916 !! end
16917
16918 !! test
16919 Invalid header with following text
16920 !! wikitext
16921 = x = y
16922 !! html
16923 <p>= x = y
16924 </p>
16925 !! end
16926
16927
16928 !! test
16929 Section extraction test (section 0)
16930 !! options
16931 section=0
16932 !! wikitext
16933 start
16934 ==a==
16935 ===aa===
16936 ====aaa====
16937 ==b==
16938 ===ba===
16939 ===bb===
16940 ====bba====
16941 ===bc===
16942 ==c==
16943 ===ca===
16944 !! html/php
16945 start
16946 !! end
16947
16948 !! test
16949 Section extraction test (section 1)
16950 !! options
16951 section=1
16952 !! wikitext
16953 start
16954 ==a==
16955 ===aa===
16956 ====aaa====
16957 ==b==
16958 ===ba===
16959 ===bb===
16960 ====bba====
16961 ===bc===
16962 ==c==
16963 ===ca===
16964 !! html/php
16965 ==a==
16966 ===aa===
16967 ====aaa====
16968 !! end
16969
16970 !! test
16971 Section extraction test (section 2)
16972 !! options
16973 section=2
16974 !! wikitext
16975 start
16976 ==a==
16977 ===aa===
16978 ====aaa====
16979 ==b==
16980 ===ba===
16981 ===bb===
16982 ====bba====
16983 ===bc===
16984 ==c==
16985 ===ca===
16986 !! html/php
16987 ===aa===
16988 ====aaa====
16989 !! end
16990
16991 !! test
16992 Section extraction test (section 3)
16993 !! options
16994 section=3
16995 !! wikitext
16996 start
16997 ==a==
16998 ===aa===
16999 ====aaa====
17000 ==b==
17001 ===ba===
17002 ===bb===
17003 ====bba====
17004 ===bc===
17005 ==c==
17006 ===ca===
17007 !! html/php
17008 ====aaa====
17009 !! end
17010
17011 !! test
17012 Section extraction test (section 4)
17013 !! options
17014 section=4
17015 !! wikitext
17016 start
17017 ==a==
17018 ===aa===
17019 ====aaa====
17020 ==b==
17021 ===ba===
17022 ===bb===
17023 ====bba====
17024 ===bc===
17025 ==c==
17026 ===ca===
17027 !! html/php
17028 ==b==
17029 ===ba===
17030 ===bb===
17031 ====bba====
17032 ===bc===
17033 !! end
17034
17035 !! test
17036 Section extraction test (section 5)
17037 !! options
17038 section=5
17039 !! wikitext
17040 start
17041 ==a==
17042 ===aa===
17043 ====aaa====
17044 ==b==
17045 ===ba===
17046 ===bb===
17047 ====bba====
17048 ===bc===
17049 ==c==
17050 ===ca===
17051 !! html/php
17052 ===ba===
17053 !! end
17054
17055 !! test
17056 Section extraction test (section 6)
17057 !! options
17058 section=6
17059 !! wikitext
17060 start
17061 ==a==
17062 ===aa===
17063 ====aaa====
17064 ==b==
17065 ===ba===
17066 ===bb===
17067 ====bba====
17068 ===bc===
17069 ==c==
17070 ===ca===
17071 !! html/php
17072 ===bb===
17073 ====bba====
17074 !! end
17075
17076 !! test
17077 Section extraction test (section 7)
17078 !! options
17079 section=7
17080 !! wikitext
17081 start
17082 ==a==
17083 ===aa===
17084 ====aaa====
17085 ==b==
17086 ===ba===
17087 ===bb===
17088 ====bba====
17089 ===bc===
17090 ==c==
17091 ===ca===
17092 !! html/php
17093 ====bba====
17094 !! end
17095
17096 !! test
17097 Section extraction test (section 8)
17098 !! options
17099 section=8
17100 !! wikitext
17101 start
17102 ==a==
17103 ===aa===
17104 ====aaa====
17105 ==b==
17106 ===ba===
17107 ===bb===
17108 ====bba====
17109 ===bc===
17110 ==c==
17111 ===ca===
17112 !! html/php
17113 ===bc===
17114 !! end
17115
17116 !! test
17117 Section extraction test (section 9)
17118 !! options
17119 section=9
17120 !! wikitext
17121 start
17122 ==a==
17123 ===aa===
17124 ====aaa====
17125 ==b==
17126 ===ba===
17127 ===bb===
17128 ====bba====
17129 ===bc===
17130 ==c==
17131 ===ca===
17132 !! html/php
17133 ==c==
17134 ===ca===
17135 !! end
17136
17137 !! test
17138 Section extraction test (section 10)
17139 !! options
17140 section=10
17141 !! wikitext
17142 start
17143 ==a==
17144 ===aa===
17145 ====aaa====
17146 ==b==
17147 ===ba===
17148 ===bb===
17149 ====bba====
17150 ===bc===
17151 ==c==
17152 ===ca===
17153 !! html/php
17154 ===ca===
17155 !! end
17156
17157 !! test
17158 Section extraction test (nonexistent section 11)
17159 !! options
17160 section=11
17161 !! wikitext
17162 start
17163 ==a==
17164 ===aa===
17165 ====aaa====
17166 ==b==
17167 ===ba===
17168 ===bb===
17169 ====bba====
17170 ===bc===
17171 ==c==
17172 ===ca===
17173 !! html/php
17174 !! end
17175
17176 !! test
17177 Section extraction test with bogus heading (section 1)
17178 !! options
17179 section=1
17180 !! wikitext
17181 ==a==
17182 ==bogus== not a legal section
17183 ==b==
17184 !! html/php
17185 ==a==
17186 ==bogus== not a legal section
17187 !! end
17188
17189 !! test
17190 Section extraction test with bogus heading (section 2)
17191 !! options
17192 section=2
17193 !! wikitext
17194 ==a==
17195 ==bogus== not a legal section
17196 ==b==
17197 !! html/php
17198 ==b==
17199 !! end
17200
17201 !! test
17202 Section extraction test with comment after heading (section 1)
17203 !! options
17204 section=1
17205 !! wikitext
17206 ==a==
17207 ==b== <!-- -->
17208 ==c==
17209 !! html/php
17210 ==a==
17211 !! end
17212
17213 !! test
17214 Section extraction test with comment after heading (section 2)
17215 !! options
17216 section=2
17217 !! wikitext
17218 ==a==
17219 ==b== <!-- -->
17220 ==c==
17221 !! html/php
17222 ==b== <!-- -->
17223 !! end
17224
17225 !! test
17226 Section extraction test with bogus <nowiki> heading (section 1)
17227 !! options
17228 section=1
17229 !! wikitext
17230 ==a==
17231 ==bogus== <nowiki>not a legal section</nowiki>
17232 ==b==
17233 !! html/php
17234 ==a==
17235 ==bogus== <nowiki>not a legal section</nowiki>
17236 !! end
17237
17238 !! test
17239 Section extraction test with bogus <nowiki> heading (section 2)
17240 !! options
17241 section=2
17242 !! wikitext
17243 ==a==
17244 ==bogus== <nowiki>not a legal section</nowiki>
17245 ==b==
17246 !! html/php
17247 ==b==
17248 !! end
17249
17250 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17251 # instead of respecting commented sections
17252 !! test
17253 Section extraction prefixed by comment (section 1)
17254 !! options
17255 section=1
17256 !! wikitext
17257 <!-- -->==sec1==
17258 ==sec2==
17259 !! html/php
17260 ==sec2==
17261 !!end
17262
17263 !! test
17264 Section extraction prefixed by comment (section 2)
17265 !! options
17266 section=2
17267 !! wikitext
17268 <!-- -->==sec1==
17269 ==sec2==
17270 !! html/php
17271
17272 !!end
17273
17274 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17275 # instead of respecting HTML-style headings
17276 !! test
17277 Section extraction, mixed wiki and html (section 1)
17278 !! options
17279 section=1
17280 !! wikitext
17281 <h2>unmarked</h2>
17282 unmarked
17283 ==1==
17284 one
17285 ==2==
17286 two
17287 !! html/php
17288 ==1==
17289 one
17290 !! end
17291
17292 !! test
17293 Section extraction, mixed wiki and html (section 2)
17294 !! options
17295 section=2
17296 !! wikitext
17297 <h2>unmarked</h2>
17298 unmarked
17299 ==1==
17300 one
17301 ==2==
17302 two
17303 !! html/php
17304 ==2==
17305 two
17306 !! end
17307
17308
17309 # Formerly testing for bug 3342
17310 !! test
17311 Section extraction, heading surrounded by <noinclude>
17312 !! options
17313 section=1
17314 !! wikitext
17315 <noinclude>==unmarked==</noinclude>
17316 ==marked==
17317 !! html/php
17318 ==marked==
17319 !!end
17320
17321 # Test behavior of bug 19910
17322 !! test
17323 Sectiion with all-equals
17324 !! options
17325 section=2
17326 !! wikitext
17327 ===
17328 The line above must have a trailing space
17329 === <!--
17330 --> <!-- -->
17331 But just in case it doesn't...
17332 !! html/php
17333 === <!--
17334 --> <!-- -->
17335 But just in case it doesn't...
17336 !! end
17337
17338 !! test
17339 Section replacement test (section 0)
17340 !! options
17341 replace=0,"xxx"
17342 !! wikitext
17343 start
17344 ==a==
17345 ===aa===
17346 ====aaa====
17347 ==b==
17348 ===ba===
17349 ===bb===
17350 ====bba====
17351 ===bc===
17352 ==c==
17353 ===ca===
17354 !! html/php
17355 xxx
17356
17357 ==a==
17358 ===aa===
17359 ====aaa====
17360 ==b==
17361 ===ba===
17362 ===bb===
17363 ====bba====
17364 ===bc===
17365 ==c==
17366 ===ca===
17367 !! end
17368
17369 !! test
17370 Section replacement test (section 1)
17371 !! options
17372 replace=1,"xxx"
17373 !! wikitext
17374 start
17375 ==a==
17376 ===aa===
17377 ====aaa====
17378 ==b==
17379 ===ba===
17380 ===bb===
17381 ====bba====
17382 ===bc===
17383 ==c==
17384 ===ca===
17385 !! html/php
17386 start
17387 xxx
17388
17389 ==b==
17390 ===ba===
17391 ===bb===
17392 ====bba====
17393 ===bc===
17394 ==c==
17395 ===ca===
17396 !! end
17397
17398 !! test
17399 Section replacement test (section 2)
17400 !! options
17401 replace=2,"xxx"
17402 !! wikitext
17403 start
17404 ==a==
17405 ===aa===
17406 ====aaa====
17407 ==b==
17408 ===ba===
17409 ===bb===
17410 ====bba====
17411 ===bc===
17412 ==c==
17413 ===ca===
17414 !! html/php
17415 start
17416 ==a==
17417 xxx
17418
17419 ==b==
17420 ===ba===
17421 ===bb===
17422 ====bba====
17423 ===bc===
17424 ==c==
17425 ===ca===
17426 !! end
17427
17428 !! test
17429 Section replacement test (section 3)
17430 !! options
17431 replace=3,"xxx"
17432 !! wikitext
17433 start
17434 ==a==
17435 ===aa===
17436 ====aaa====
17437 ==b==
17438 ===ba===
17439 ===bb===
17440 ====bba====
17441 ===bc===
17442 ==c==
17443 ===ca===
17444 !! html/php
17445 start
17446 ==a==
17447 ===aa===
17448 xxx
17449
17450 ==b==
17451 ===ba===
17452 ===bb===
17453 ====bba====
17454 ===bc===
17455 ==c==
17456 ===ca===
17457 !! end
17458
17459 !! test
17460 Section replacement test (section 4)
17461 !! options
17462 replace=4,"xxx"
17463 !! wikitext
17464 start
17465 ==a==
17466 ===aa===
17467 ====aaa====
17468 ==b==
17469 ===ba===
17470 ===bb===
17471 ====bba====
17472 ===bc===
17473 ==c==
17474 ===ca===
17475 !! html/php
17476 start
17477 ==a==
17478 ===aa===
17479 ====aaa====
17480 xxx
17481
17482 ==c==
17483 ===ca===
17484 !! end
17485
17486 !! test
17487 Section replacement test (section 5)
17488 !! options
17489 replace=5,"xxx"
17490 !! wikitext
17491 start
17492 ==a==
17493 ===aa===
17494 ====aaa====
17495 ==b==
17496 ===ba===
17497 ===bb===
17498 ====bba====
17499 ===bc===
17500 ==c==
17501 ===ca===
17502 !! html/php
17503 start
17504 ==a==
17505 ===aa===
17506 ====aaa====
17507 ==b==
17508 xxx
17509
17510 ===bb===
17511 ====bba====
17512 ===bc===
17513 ==c==
17514 ===ca===
17515 !! end
17516
17517 !! test
17518 Section replacement test (section 6)
17519 !! options
17520 replace=6,"xxx"
17521 !! wikitext
17522 start
17523 ==a==
17524 ===aa===
17525 ====aaa====
17526 ==b==
17527 ===ba===
17528 ===bb===
17529 ====bba====
17530 ===bc===
17531 ==c==
17532 ===ca===
17533 !! html/php
17534 start
17535 ==a==
17536 ===aa===
17537 ====aaa====
17538 ==b==
17539 ===ba===
17540 xxx
17541
17542 ===bc===
17543 ==c==
17544 ===ca===
17545 !! end
17546
17547 !! test
17548 Section replacement test (section 7)
17549 !! options
17550 replace=7,"xxx"
17551 !! wikitext
17552 start
17553 ==a==
17554 ===aa===
17555 ====aaa====
17556 ==b==
17557 ===ba===
17558 ===bb===
17559 ====bba====
17560 ===bc===
17561 ==c==
17562 ===ca===
17563 !! html/php
17564 start
17565 ==a==
17566 ===aa===
17567 ====aaa====
17568 ==b==
17569 ===ba===
17570 ===bb===
17571 xxx
17572
17573 ===bc===
17574 ==c==
17575 ===ca===
17576 !! end
17577
17578 !! test
17579 Section replacement test (section 8)
17580 !! options
17581 replace=8,"xxx"
17582 !! wikitext
17583 start
17584 ==a==
17585 ===aa===
17586 ====aaa====
17587 ==b==
17588 ===ba===
17589 ===bb===
17590 ====bba====
17591 ===bc===
17592 ==c==
17593 ===ca===
17594 !! html/php
17595 start
17596 ==a==
17597 ===aa===
17598 ====aaa====
17599 ==b==
17600 ===ba===
17601 ===bb===
17602 ====bba====
17603 xxx
17604
17605 ==c==
17606 ===ca===
17607 !!end
17608
17609 !! test
17610 Section replacement test (section 9)
17611 !! options
17612 replace=9,"xxx"
17613 !! wikitext
17614 start
17615 ==a==
17616 ===aa===
17617 ====aaa====
17618 ==b==
17619 ===ba===
17620 ===bb===
17621 ====bba====
17622 ===bc===
17623 ==c==
17624 ===ca===
17625 !! html/php
17626 start
17627 ==a==
17628 ===aa===
17629 ====aaa====
17630 ==b==
17631 ===ba===
17632 ===bb===
17633 ====bba====
17634 ===bc===
17635 xxx
17636 !! end
17637
17638 !! test
17639 Section replacement test (section 10)
17640 !! options
17641 replace=10,"xxx"
17642 !! wikitext
17643 start
17644 ==a==
17645 ===aa===
17646 ====aaa====
17647 ==b==
17648 ===ba===
17649 ===bb===
17650 ====bba====
17651 ===bc===
17652 ==c==
17653 ===ca===
17654 !! html/php
17655 start
17656 ==a==
17657 ===aa===
17658 ====aaa====
17659 ==b==
17660 ===ba===
17661 ===bb===
17662 ====bba====
17663 ===bc===
17664 ==c==
17665 xxx
17666 !! end
17667
17668 !! test
17669 Section replacement test with initial whitespace (bug 13728)
17670 !! options
17671 replace=2,"xxx"
17672 !! wikitext
17673 Preformatted initial line
17674 ==a==
17675 ===a===
17676 !! html/php
17677 Preformatted initial line
17678 ==a==
17679 xxx
17680 !! end
17681
17682
17683 !! test
17684 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17685 !! options
17686 section=1
17687 !! wikitext
17688 ==a==
17689 a
17690 !! html/php
17691 ==a==
17692 a
17693 !! end
17694
17695 !! test
17696 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17697 !! options
17698 section=1
17699 !! wikitext
17700 ==a==
17701 a
17702 !! html/php
17703 ==a==
17704 a
17705 !! end
17706
17707
17708 !! test
17709 Section extraction, <pre> around bogus header (bug 10309)
17710 !! options
17711 noxml section=2
17712 !! wikitext
17713 == Section One ==
17714 <pre>
17715 =======
17716 </pre>
17717
17718 == Section Two ==
17719 stuff
17720 !! html/php
17721 == Section Two ==
17722 stuff
17723 !! end
17724
17725 !! test
17726 Section replacement, <pre> around bogus header (bug 10309)
17727 !! options
17728 noxml replace=2,"xxx"
17729 !! wikitext
17730 == Section One ==
17731 <pre>
17732 =======
17733 </pre>
17734
17735 == Section Two ==
17736 stuff
17737 !! html/php
17738 == Section One ==
17739 <pre>
17740 =======
17741 </pre>
17742
17743 xxx
17744 !! end
17745
17746
17747 !! test
17748 Handling of &#x0A; in URLs
17749 !! wikitext
17750 ** irc://&#x0A;a
17751 !! html/php
17752 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17753
17754 !! html/parsoid
17755 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17756 a">irc://
17757 a</a></li></ul></li></ul>
17758 !! end
17759
17760 !! test
17761 Handling of %0A in URLs
17762 !! wikitext
17763 ** irc://%0Aa
17764 !! html/php
17765 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17766
17767 !! html/parsoid
17768 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17769 !! end
17770
17771
17772 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17773 !! test
17774 5 quotes, code coverage +1 line
17775 !! options
17776 parsoid=wt2html
17777 !! wikitext
17778 '''''
17779 !! html/php
17780 !! html/parsoid
17781 <p><b><i></i></b></p>
17782 !! end
17783
17784 # same html as previous, but wikitext adjusted to match parsoid html2wt
17785 # note that wt2html and html2html will put the <i> before the <b>
17786 !! test
17787 5 quotes, code coverage +1 line w/ nowiki (1)
17788 !! options
17789 parsoid=wt2wt,html2wt
17790 !! wikitext
17791 '''''<nowiki/>'''''
17792 !! html/php
17793 <p><i></i>
17794 </p>
17795 !! html/parsoid
17796 <p><b><i></i></b></p>
17797 !! end
17798
17799 # same as previous, just swapping the <i> and <b>
17800 !! test
17801 5 quotes, code coverage +1 line w/ nowiki (2)
17802 !! wikitext
17803 '''''<nowiki/>'''''
17804 !! html/php
17805 <p><i></i>
17806 </p>
17807 !! html/parsoid
17808 <p><i><b></b></i></p>
17809 !! end
17810
17811 !! test
17812 Special:Search page linking.
17813 !! wikitext
17814 {{Special:search}}
17815 !! html
17816 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17817 </p>
17818 !! end
17819
17820 !! test
17821 {{!}} is a magic word
17822 !! wikitext
17823 {{!}} is a magic word there and {{!}} is still a magic word here
17824 !! html/php
17825 <p>| is a magic word there and | is still a magic word here
17826 </p>
17827 !! html/parsoid
17828 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
17829 !! end
17830
17831 !! test
17832 Say the magic word
17833 !! options
17834 title=[[Parser test]]
17835 !! wikitext
17836 * {{PAGENAME}}
17837 * {{PAGENAMEE}}
17838 * {{FULLPAGENAME}}
17839 * {{FULLPAGENAMEE}}
17840 * {{BASEPAGENAME}}
17841 * {{BASEPAGENAMEE}}
17842 * {{SUBPAGENAME}}
17843 * {{SUBPAGENAMEE}}
17844 * {{ROOTPAGENAME}}
17845 * {{ROOTPAGENAMEE}}
17846 * {{TALKPAGENAME}}
17847 * {{TALKPAGENAMEE}}
17848 * {{SUBJECTPAGENAME}}
17849 * {{SUBJECTPAGENAMEE}}
17850 * {{NAMESPACEE}}
17851 * {{NAMESPACE}}
17852 * {{NAMESPACENUMBER}}
17853 * {{TALKSPACE}}
17854 * {{TALKSPACEE}}
17855 * {{SUBJECTSPACE}}
17856 * {{SUBJECTSPACEE}}
17857 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17858 !! html
17859 <ul><li> Parser test</li>
17860 <li> Parser_test</li>
17861 <li> Parser test</li>
17862 <li> Parser_test</li>
17863 <li> Parser test</li>
17864 <li> Parser_test</li>
17865 <li> Parser test</li>
17866 <li> Parser_test</li>
17867 <li> Parser test</li>
17868 <li> Parser_test</li>
17869 <li> Talk:Parser test</li>
17870 <li> Talk:Parser_test</li>
17871 <li> Parser test</li>
17872 <li> Parser_test</li>
17873 <li> </li>
17874 <li> </li>
17875 <li> 0</li>
17876 <li> Talk</li>
17877 <li> Talk</li>
17878 <li> </li>
17879 <li> </li>
17880 <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>
17881
17882 !! end
17883 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17884
17885 !! test
17886 Gallery
17887 !! wikitext
17888 <gallery>
17889 image1.png |
17890 image2.gif|||||
17891
17892 image3|
17893 image4 |300px| centre
17894 image5.svg| http://///////
17895 [[x|xx]]]]
17896 * image6
17897 </gallery>
17898 !! html
17899 <ul class="gallery mw-gallery-traditional">
17900 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17901 <div class="thumb" style="height: 150px;">Image1.png</div>
17902 <div class="gallerytext">
17903 </div>
17904 </div></li>
17905 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17906 <div class="thumb" style="height: 150px;">Image2.gif</div>
17907 <div class="gallerytext">
17908 <p>||||
17909 </p>
17910 </div>
17911 </div></li>
17912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17913 <div class="thumb" style="height: 150px;">Image3</div>
17914 <div class="gallerytext">
17915 </div>
17916 </div></li>
17917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17918 <div class="thumb" style="height: 150px;">Image4</div>
17919 <div class="gallerytext">
17920 <p>300px| centre
17921 </p>
17922 </div>
17923 </div></li>
17924 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17925 <div class="thumb" style="height: 150px;">Image5.svg</div>
17926 <div class="gallerytext">
17927 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17928 </p>
17929 </div>
17930 </div></li>
17931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17932 <div class="thumb" style="height: 150px;">* image6</div>
17933 <div class="gallerytext">
17934 </div>
17935 </div></li>
17936 </ul>
17937
17938 !! end
17939
17940 !! test
17941 Gallery (with options)
17942 !! wikitext
17943 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17944 File:Nonexistent.jpg|caption
17945 File:Nonexistent.jpg
17946 image:foobar.jpg|some '''caption''' [[Main Page]]
17947 image:foobar.jpg
17948 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17949 </gallery>
17950 !! html
17951 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17952 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17953 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17954 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17955 <div class="gallerytext">
17956 <p>caption
17957 </p>
17958 </div>
17959 </div></li>
17960 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17961 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17962 <div class="gallerytext">
17963 </div>
17964 </div></li>
17965 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17966 <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>
17967 <div class="gallerytext">
17968 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17969 </p>
17970 </div>
17971 </div></li>
17972 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17973 <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>
17974 <div class="gallerytext">
17975 </div>
17976 </div></li>
17977 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17978 <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>
17979 <div class="gallerytext">
17980 <p>Blabla|blabla.
17981 </p>
17982 </div>
17983 </div></li>
17984 </ul>
17985
17986 !! end
17987
17988 !! test
17989 Gallery with link that has fragment
17990 !! wikitext
17991 <gallery>
17992 image:foobar.jpg|link=Main_Page
17993 image:foobar.jpg|link=Main_Page#section
17994 image:foobar.jpg|link=Main Page#section|caption
17995 </gallery>
17996 !! html
17997 <ul class="gallery mw-gallery-traditional">
17998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17999 <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>
18000 <div class="gallerytext">
18001 </div>
18002 </div></li>
18003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18004 <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>
18005 <div class="gallerytext">
18006 </div>
18007 </div></li>
18008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18009 <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>
18010 <div class="gallerytext">
18011 <p>caption
18012 </p>
18013 </div>
18014 </div></li>
18015 </ul>
18016
18017 !! end
18018
18019 !! test
18020 Gallery with wikitext inside caption
18021 !! wikitext
18022 <gallery>
18023 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18024 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18025 </gallery>
18026 !! html
18027 <ul class="gallery mw-gallery-traditional">
18028 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18029 <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>
18030 <div class="gallerytext">
18031 <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>
18032 </p>
18033 </div>
18034 </div></li>
18035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18036 <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>
18037 <div class="gallerytext">
18038 <p>This is a test template
18039 </p>
18040 </div>
18041 </div></li>
18042 </ul>
18043
18044 !! end
18045
18046 !! test
18047 gallery (with showfilename option)
18048 !! wikitext
18049 <gallery showfilename>
18050 File:Nonexistent.jpg|caption
18051 File:Nonexistent.jpg
18052 image:foobar.jpg|some '''caption''' [[Main Page]]
18053 File:Foobar.jpg
18054 </gallery>
18055 !! html
18056 <ul class="gallery mw-gallery-traditional">
18057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18058 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18059 <div class="gallerytext">
18060 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18061 caption
18062 </p>
18063 </div>
18064 </div></li>
18065 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18066 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18067 <div class="gallerytext">
18068 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18069 </p>
18070 </div>
18071 </div></li>
18072 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18073 <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>
18074 <div class="gallerytext">
18075 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18076 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18077 </p>
18078 </div>
18079 </div></li>
18080 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18081 <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>
18082 <div class="gallerytext">
18083 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18084 </p>
18085 </div>
18086 </div></li>
18087 </ul>
18088
18089 !! end
18090
18091 !! test
18092 Gallery (with namespace-less filenames)
18093 !! wikitext
18094 <gallery>
18095 File:Nonexistent.jpg
18096 Nonexistent.jpg
18097 image:foobar.jpg
18098 foobar.jpg
18099 </gallery>
18100 !! html
18101 <ul class="gallery mw-gallery-traditional">
18102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18103 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18104 <div class="gallerytext">
18105 </div>
18106 </div></li>
18107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18108 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18109 <div class="gallerytext">
18110 </div>
18111 </div></li>
18112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18113 <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>
18114 <div class="gallerytext">
18115 </div>
18116 </div></li>
18117 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18118 <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>
18119 <div class="gallerytext">
18120 </div>
18121 </div></li>
18122 </ul>
18123
18124 !! end
18125
18126 !! test
18127 HTML Hex character encoding (spells the word "JavaScript")
18128 !! options
18129 parsoid=wt2html,wt2wt,html2html
18130 !! wikitext
18131 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18132 !! html/php
18133 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18134 </p>
18135 !! html/php+tidy
18136 <p>JavaScript</p>
18137 !! html/parsoid
18138 <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>
18139 !! end
18140
18141 !! test
18142 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18143 !! wikitext
18144 &#xsee;&#XSEE;
18145 !! html/php
18146 <p>&amp;#xsee;&amp;#XSEE;
18147 </p>
18148 !! html/parsoid
18149 <p>&amp;#xsee;&amp;#XSEE;</p>
18150 !! end
18151
18152 !! test
18153 HTML Hex character encoding mixed case
18154 !! options
18155 parsoid=wt2html,wt2wt,html2html
18156 !! wikitext
18157 &#xEE;&#Xee;
18158 !! html/php
18159 <p>&#xee;&#xee;
18160 </p>
18161 !! html/php+tidy
18162 <p>îî</p>
18163 !! html/parsoid
18164 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18165 !! end
18166
18167 !! test
18168 __FORCETOC__ override
18169 !! wikitext
18170 __NEWSECTIONLINK__
18171 __FORCETOC__
18172 !! html/php
18173 <p><br />
18174 </p>
18175 !! end
18176
18177 !! test
18178 ISBN code coverage
18179 !! wikitext
18180 ISBN 978-0-1234-56&#x20;789
18181 !! html
18182 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18183 </p>
18184 !! html+tidy
18185 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18186 !! html/parsoid
18187 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18188 !! end
18189
18190 !! test
18191 ISBN followed by 5 spaces
18192 !! wikitext
18193 ISBN
18194 !! html
18195 <p>ISBN
18196 </p>
18197 !! end
18198
18199 !! test
18200 Double ISBN
18201 !! wikitext
18202 ISBN ISBN 1234567890
18203 !! html/php
18204 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18205 </p>
18206 !! html/parsoid
18207 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18208 !! end
18209
18210 # Uppercase X and lowercase x as well
18211 !! test
18212 ISBN with an X
18213 !! wikitext
18214 ISBN 3-462-04561-X
18215 ISBN 3-462-04561-x
18216 ISBN 080442957X
18217 ISBN 080442957x
18218 ISBN 978080442957X
18219 ISBN 978080442957x
18220 !! html/php
18221 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18222 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18223 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18224 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18225 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18226 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18227 </p>
18228 !! html/parsoid
18229 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18230 <a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18231 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18232 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18233 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18234 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18235 !! end
18236
18237 !! test
18238 ISBN with empty prefix (parsoid test)
18239 !! wikitext
18240 ISBN 1234567890
18241 !! html/php
18242 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18243 </p>
18244 !! html/parsoid
18245 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18246 !! end
18247
18248 !! test
18249 Bug 22905: <abbr> followed by ISBN followed by </a>
18250 !! wikitext
18251 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18252 !! html/php
18253 <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>
18254 </p>
18255 !! html/parsoid
18256 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18257 !! end
18258
18259 !! test
18260 Double RFC
18261 !! wikitext
18262 RFC RFC 1234
18263 !! html
18264 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18265 </p>
18266 !! end
18267
18268 !! test
18269 Double RFC with a wiki link
18270 !! wikitext
18271 RFC [[RFC 1234]]
18272 !! html
18273 <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>
18274 </p>
18275 !! end
18276
18277 !! test
18278 RFC code coverage
18279 !! wikitext
18280 RFC 983&#x20;987
18281 !! html
18282 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18283 </p>
18284 !! html+tidy
18285 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18286 !! end
18287
18288 !! test
18289 Centre-aligned image
18290 !! wikitext
18291 [[Image:foobar.jpg|centre]]
18292 !! html
18293 <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>
18294
18295 !!end
18296
18297 !! test
18298 None-aligned image
18299 !! wikitext
18300 [[Image:foobar.jpg|none]]
18301 !! html
18302 <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>
18303
18304 !!end
18305
18306 !! test
18307 Width + Height sized image (using px) (height is ignored)
18308 !! wikitext
18309 [[Image:foobar.jpg|640x480px]]
18310 !! html
18311 <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>
18312 </p>
18313 !!end
18314
18315 !! test
18316 Width-sized image (using px, no following whitespace)
18317 !! wikitext
18318 [[Image:foobar.jpg|640px]]
18319 !! html
18320 <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>
18321 </p>
18322 !!end
18323
18324 !! test
18325 Width-sized image (using px, with following whitespace - test regression from r39467)
18326 !! wikitext
18327 [[Image:foobar.jpg|640px ]]
18328 !! html
18329 <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>
18330 </p>
18331 !!end
18332
18333 !! test
18334 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18335 !! wikitext
18336 [[Image:foobar.jpg| 640px]]
18337 !! html
18338 <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>
18339 </p>
18340 !!end
18341
18342 !! test
18343 Image with page parameter
18344 !! options
18345 djvu
18346 !! wikitext
18347 [[File:LoremIpsum.djvu|page=2]]
18348 !! html/php
18349 <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>
18350 </p>
18351 !! html/parsoid
18352 <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>
18353 !! end
18354
18355 !! test
18356 Another italics / bold test
18357 !! wikitext
18358 ''' ''x'
18359 !! html
18360 <pre>'<i> </i>x'
18361 </pre>
18362 !!end
18363
18364 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18365 !! test
18366 dt/dd/dl test
18367 !! wikitext
18368 :;;;::
18369 !! html/php
18370 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18371
18372 !! html/parsoid
18373 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18374
18375 !!end
18376
18377
18378 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18379 !! test
18380 Images with the "|" character in the comment
18381 !! wikitext
18382 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18383 !! html/php
18384 <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>
18385
18386 !! html/parsoid
18387 <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>
18388 !! end
18389
18390 !! test
18391 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18392 !! wikitext
18393 <html><script>alert(1);</script></html>
18394 !! html
18395 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18396 </p>
18397 !! end
18398
18399 !! test
18400 HTML with raw HTML ($wgRawHtml==true)
18401 !! options
18402 wgRawHtml=1
18403 !! wikitext
18404 <html><script>alert(1);</script></html>
18405 !! html
18406 <p><script>alert(1);</script>
18407 </p>
18408 !! end
18409
18410 !! test
18411 Parents of subpages, one level up
18412 !! options
18413 subpage title=[[Subpage test/L1/L2/L3]]
18414 !! wikitext
18415 [[../|L2]]
18416 !! html
18417 <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>
18418 </p>
18419 !! end
18420
18421
18422 !! test
18423 Parents of subpages, one level up, not named
18424 !! options
18425 subpage title=[[Subpage test/L1/L2/L3]]
18426 !! wikitext
18427 [[../]]
18428 !! html
18429 <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>
18430 </p>
18431 !! end
18432
18433
18434
18435 !! test
18436 Parents of subpages, two levels up
18437 !! options
18438 subpage title=[[Subpage test/L1/L2/L3]]
18439 !! wikitext
18440 [[../../|L1]]2
18441
18442 [[../../|L1]]l
18443 !! html
18444 <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
18445 </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>
18446 </p>
18447 !! end
18448
18449 !! test
18450 Parents of subpages, two levels up, without trailing slash or name.
18451 !! options
18452 subpage title=[[Subpage test/L1/L2/L3]]
18453 !! wikitext
18454 [[../..]]
18455 !! html
18456 <p>[[../..]]
18457 </p>
18458 !! end
18459
18460 !! test
18461 Parents of subpages, two levels up, with lots of extra trailing slashes.
18462 !! options
18463 subpage title=[[Subpage test/L1/L2/L3]]
18464 !! wikitext
18465 [[../../////]]
18466 !! html
18467 <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>
18468 </p>
18469 !! end
18470
18471 !! article
18472 Subpage test/L1/L2/L3Sibling
18473 !! text
18474 Sibling article
18475 !! endarticle
18476
18477 !! test
18478 Transclusion of a sibling page (one level up)
18479 !! options
18480 subpage title=[[Subpage test/L1/L2/L3]]
18481 !! wikitext
18482 {{../L3Sibling}}
18483 !! html
18484 <p>Sibling article
18485 </p>
18486 !! end
18487
18488 !! test
18489 Transclusion of a child page
18490 !! options
18491 subpage title=[[Subpage test/L1/L2]]
18492 !! wikitext
18493 {{/L3Sibling}}
18494 !! html
18495 <p>Sibling article
18496 </p>
18497 !! end
18498
18499 !! test
18500 Non-transclusion because of too many up levels
18501 !! options
18502 subpage title=[[Subpage test/L1/L2/L3]]
18503 !! wikitext
18504 {{../../../../More than parent}}
18505 !! html
18506 <p>{{../../../../More than parent}}
18507 </p>
18508 !! end
18509
18510 !! test
18511 Definition list code coverage
18512 !! wikitext
18513 ; title : def
18514 ; title : def
18515 ;title: def
18516 !! html/php
18517 <dl><dt> title &#160;</dt>
18518 <dd> def</dd>
18519 <dt> title&#160;</dt>
18520 <dd> def</dd>
18521 <dt>title</dt>
18522 <dd> def</dd></dl>
18523
18524 !! html/parsoid
18525 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18526 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18527 <dt>title</dt><dd> def</dd></dl>
18528 !! end
18529
18530 !! test
18531 Don't fall for the self-closing div
18532 !! wikitext
18533 <div>hello world</div/>
18534 !! html
18535 <div>hello world</div>
18536
18537 !! end
18538
18539 !! test
18540 MSGNW magic word
18541 !! wikitext
18542 {{MSGNW:msg}}
18543 !! html/php
18544 <p>&#91;&#91;:Template:Msg&#93;&#93;
18545 </p>
18546 !! end
18547
18548 !! test
18549 RAW magic word
18550 !! wikitext
18551 {{RAW:QUERTY}}
18552 !! html
18553 <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>
18554 </p>
18555 !! end
18556
18557 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18558 !! test
18559 Always escape literal '>' in output, not just after '<'
18560 !! wikitext
18561 ><>
18562 !! html
18563 <p>&gt;&lt;&gt;
18564 </p>
18565 !! end
18566
18567 !! test
18568 Template caching
18569 !! wikitext
18570 {{Test}}
18571 {{Test}}
18572 !! html
18573 <p>This is a test template
18574 This is a test template
18575 </p>
18576 !! end
18577
18578
18579 !! article
18580 MediaWiki:Fake
18581 !! text
18582 ==header==
18583 !! endarticle
18584
18585 !! test
18586 Inclusion of !userCanEdit() content
18587 !! wikitext
18588 {{MediaWiki:Fake}}
18589 !! html
18590 <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>
18591
18592 !! end
18593
18594
18595 !! test
18596 Out-of-order TOC heading levels
18597 !! wikitext
18598 ==2==
18599 ======6======
18600 ===3===
18601 =1=
18602 =====5=====
18603 ==2==
18604 !! html
18605 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18606 <ul>
18607 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18608 <ul>
18609 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18610 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18611 </ul>
18612 </li>
18613 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18614 <ul>
18615 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18616 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18617 </ul>
18618 </li>
18619 </ul>
18620 </div>
18621
18622 <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>
18623 <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>
18624 <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>
18625 <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>
18626 <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>
18627 <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>
18628
18629 !! end
18630
18631
18632 !! test
18633 ISBN with a dummy number
18634 !! wikitext
18635 ISBN ---
18636 !! html
18637 <p>ISBN ---
18638 </p>
18639 !! end
18640
18641
18642 !! test
18643 ISBN with space-delimited number
18644 !! wikitext
18645 ISBN 92 9017 032 8
18646 !! html
18647 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18648 </p>
18649 !! end
18650
18651
18652 !! test
18653 ISBN with multiple spaces, no number
18654 !! wikitext
18655 ISBN foo
18656 !! html
18657 <p>ISBN foo
18658 </p>
18659 !! end
18660
18661
18662 !! test
18663 ISBN length
18664 !! wikitext
18665 ISBN 123456789
18666
18667 ISBN 1234567890
18668
18669 ISBN 12345678901
18670 !! html
18671 <p>ISBN 123456789
18672 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18673 </p><p>ISBN 12345678901
18674 </p>
18675 !! end
18676
18677
18678 !! test
18679 ISBN with trailing year (bug 8110)
18680 !! wikitext
18681 ISBN 1-234-56789-0 - 2006
18682
18683 ISBN 1 234 56789 0 - 2006
18684 !! html
18685 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18686 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18687 </p>
18688 !! end
18689
18690
18691 !! test
18692 anchorencode
18693 !! wikitext
18694 {{anchorencode:foo bar©#%n}}
18695 !! html
18696 <p>foo_bar.C2.A9.23.25n
18697 </p>
18698 !! end
18699
18700 !! test
18701 anchorencode trims spaces
18702 !! wikitext
18703 {{anchorencode: __pretty__please__}}
18704 !! html
18705 <p>pretty_please
18706 </p>
18707 !! end
18708
18709 !! test
18710 anchorencode deals with links
18711 !! wikitext
18712 {{anchorencode: [[hello|world]] [[hi]]}}
18713 !! html
18714 <p>world_hi
18715 </p>
18716 !! end
18717
18718 !! test
18719 anchorencode deals with templates
18720 !! wikitext
18721 {{anchorencode: {{Foo}} }}
18722 !! html
18723 <p>FOO
18724 </p>
18725 !! end
18726
18727 !! test
18728 anchorencode encodes like the TOC generator: (bug 18431)
18729 !! wikitext
18730 === _ +:.3A%3A&&amp;]] ===
18731 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18732 __NOEDITSECTION__
18733 !! html
18734 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18735 <p>.2B:.3A.253A.26.26.5D.5D
18736 </p>
18737 !! end
18738
18739 !! test
18740 Bug 6200: blockquotes and paragraph formatting
18741 !! wikitext
18742 <blockquote>
18743 foo
18744 </blockquote>
18745
18746 bar
18747
18748 baz
18749 !! html
18750 <blockquote>
18751 <p>foo
18752 </p>
18753 </blockquote>
18754 <p>bar
18755 </p>
18756 <pre>baz
18757 </pre>
18758 !! end
18759
18760 !! test
18761 Bug 8293: Use of center tag ruins paragraph formatting
18762 !! wikitext
18763 <center>
18764 foo
18765 </center>
18766
18767 bar
18768
18769 baz
18770 !! html
18771 <center>
18772 <p>foo
18773 </p>
18774 </center>
18775 <p>bar
18776 </p>
18777 <pre>baz
18778 </pre>
18779 !! end
18780
18781 !!test
18782 Parsing of overlapping (improperly nested) inline html tags
18783 !! wikitext
18784 <span><s>x</span></s>
18785 !! html/php
18786 <p><span><s>x&lt;/span&gt;</s></span>
18787 </p>
18788 !! html/parsoid
18789 <p><span><s>x</s></span>
18790 </p>
18791 !!end
18792
18793 ###
18794 ### Language variants related tests
18795 ###
18796 !! test
18797 Self-link in language variants
18798 !! options
18799 title=[[Dunav]] language=sr
18800 !! wikitext
18801 Both [[Dunav]] and [[Дунав]] are names for this river.
18802 !! html
18803 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18804 </p>
18805 !!end
18806
18807 !! article
18808 Дуна
18809 !! text
18810 content
18811 !! endarticle
18812
18813 !! test
18814 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18815 !! options
18816 title=[[Duna]] language=sr
18817 !! wikitext
18818 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18819 !! html
18820 <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.
18821 </p>
18822 !! end
18823
18824 !! test
18825 Link to a section of a variant of this title shouldn't be parsed as self-link
18826 !! options
18827 title=[[Duna]] language=sr
18828 !! wikitext
18829 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18830 !! html
18831 <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.
18832 </p>
18833 !! end
18834
18835 !! test
18836 Link to pages in language variants
18837 !! options
18838 language=sr
18839 !! wikitext
18840 Main Page can be written as [[Маин Паге]]
18841 !! html
18842 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18843 </p>
18844 !!end
18845
18846
18847 !! test
18848 Multiple links to pages in language variants
18849 !! options
18850 language=sr
18851 !! wikitext
18852 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18853 !! html
18854 <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>.
18855 </p>
18856 !!end
18857
18858
18859 !! test
18860 Simple template in language variants
18861 !! options
18862 language=sr
18863 !! wikitext
18864 {{тест}}
18865 !! html
18866 <p>This is a test template
18867 </p>
18868 !! end
18869
18870
18871 !! test
18872 Template with explicit namespace in language variants
18873 !! options
18874 language=sr
18875 !! wikitext
18876 {{Template:тест}}
18877 !! html
18878 <p>This is a test template
18879 </p>
18880 !! end
18881
18882
18883 !! test
18884 Basic test for template parameter in language variants
18885 !! options
18886 language=sr
18887 !! wikitext
18888 {{парамтест|param=foo}}
18889 !! html
18890 <p>This is a test template with parameter foo
18891 </p>
18892 !! end
18893
18894
18895 !! test
18896 Simple category in language variants
18897 !! options
18898 language=sr cat
18899 !! wikitext
18900 [[Category:МедиаWики Усер'с Гуиде]]
18901 !! html
18902 <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>
18903 !! end
18904
18905
18906 !! article
18907 Category:分类
18908 !! text
18909 blah
18910 !! endarticle
18911
18912 !! article
18913 Category:分類
18914 !! text
18915 blah
18916 !! endarticle
18917
18918 !! test
18919 Don't convert blue categorylinks to another variant (bug 33210)
18920 !! options
18921 language=zh cat
18922 !! wikitext
18923 [[A]][[Category:分类]]
18924 !! html
18925 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18926 !! end
18927
18928
18929 !! test
18930 Stripping -{}- tags (language variants)
18931 !! options
18932 language=sr
18933 !! wikitext
18934 Latin proverb: -{Ne nuntium necare}-
18935 !! html
18936 <p>Latin proverb: Ne nuntium necare
18937 </p>
18938 !! end
18939
18940
18941 !! test
18942 Prevent conversion with -{}- tags (language variants)
18943 !! options
18944 language=sr variant=sr-ec
18945 !! wikitext
18946 Latinski: -{Ne nuntium necare}-
18947 !! html
18948 <p>Латински: Ne nuntium necare
18949 </p>
18950 !! end
18951
18952
18953 !! test
18954 Prevent conversion of text with -{}- tags (language variants)
18955 !! options
18956 language=sr variant=sr-ec
18957 !! wikitext
18958 Latinski: -{Ne nuntium necare}-
18959 !! html
18960 <p>Латински: Ne nuntium necare
18961 </p>
18962 !! end
18963
18964
18965 !! test
18966 Prevent conversion of links with -{}- tags (language variants)
18967 !! options
18968 language=sr variant=sr-ec
18969 !! wikitext
18970 -{[[Main Page]]}-
18971 !! html
18972 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18973 </p>
18974 !! end
18975
18976
18977 !! test
18978 -{}- tags within headlines (within html for parserConvert())
18979 !! options
18980 language=sr variant=sr-ec
18981 !! wikitext
18982 == -{Naslov}- ==
18983 !! html
18984 <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>
18985
18986 !! end
18987
18988
18989 !! test
18990 Explicit definition of language variant alternatives
18991 !! options
18992 language=zh variant=zh-tw
18993 !! wikitext
18994 -{zh:China;zh-tw:Taiwan}-, not China
18995 !! html
18996 <p>Taiwan, not China
18997 </p>
18998 !! end
18999
19000
19001 !! test
19002 Conversion around HTML tags
19003 !! options
19004 language=sr variant=sr-ec
19005 !! wikitext
19006 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19007 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19008 !! html
19009 <p>
19010 <span title="ЛаCтин">ски</span>
19011 </p>
19012 !! end
19013
19014
19015 !! test
19016 Explicit session-wise language variant mapping (A flag and - flag)
19017 !! options
19018 language=zh variant=zh-tw
19019 !! wikitext
19020 Taiwan is not China.
19021 But -{A|zh:China;zh-tw:Taiwan}- is China,
19022 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19023 and -{China}- is China.
19024 !! html
19025 <p>Taiwan is not China.
19026 But Taiwan is Taiwan,
19027 (This should be stripped!)
19028 and China is China.
19029 </p>
19030 !! end
19031
19032 !! test
19033 Explicit session-wise language variant mapping (H flag for hide)
19034 !! options
19035 language=zh variant=zh-tw
19036 !! wikitext
19037 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19038 Taiwan is China.
19039 !! html
19040 <p>(This should be stripped!)
19041 Taiwan is Taiwan.
19042 </p>
19043 !! end
19044
19045 !! test
19046 Adding explicit conversion rule for title (T flag)
19047 !! options
19048 language=zh variant=zh-tw showtitle
19049 !! wikitext
19050 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19051 !! html
19052 Taiwan
19053 <p>Should be stripped!
19054 </p>
19055 !! end
19056
19057 !! test
19058 Testing that changing the language variant here in the tests actually works
19059 !! options
19060 language=zh variant=zh showtitle
19061 !! wikitext
19062 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19063 !! html
19064 China
19065 <p>Should be stripped!
19066 </p>
19067 !! end
19068
19069 !! test
19070 Recursive conversion of alt and title attrs shouldn't clear converter state
19071 !! options
19072 language=zh variant=zh-cn showtitle
19073 !! wikitext
19074 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19075 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19076 !! html
19077 China
19078 <p>
19079 Should be stripped<span title="Exclamation">!</span>
19080 </p>
19081 !! end
19082
19083 !! test
19084 Bug 24072: more test on conversion rule for title
19085 !! options
19086 language=zh variant=zh-tw showtitle
19087 !! wikitext
19088 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19089 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19090 !! html
19091 Taiwan
19092 <p>This should be stripped!
19093 This won't take interferes with the title rule.
19094 </p>
19095 !! end
19096
19097 !! test
19098 Partly disable title conversion if variant == main language code
19099 !! options
19100 language=zh variant=zh title=[[ZH]] showtitle
19101 !! wikitext
19102 -{T|zh-cn:CN;zh-tw:TW}-
19103 !! html
19104 ZH
19105 <p>
19106 </p>
19107 !! end
19108
19109 !! test
19110 Partly disable title conversion if variant == main language code, more
19111 !! options
19112 language=zh variant=zh title=[[ZH]] showtitle
19113 !! wikitext
19114 -{T|TW}-
19115 !! html
19116 ZH
19117 <p>
19118 </p>
19119 !! end
19120
19121 !! test
19122 Raw output of variant escape tags (R flag)
19123 !! options
19124 language=zh variant=zh-tw
19125 !! wikitext
19126 Raw: -{R|zh:China;zh-tw:Taiwan}-
19127 !! html
19128 <p>Raw: zh:China;zh-tw:Taiwan
19129 </p>
19130 !! end
19131
19132 !! test
19133 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19134 !! options
19135 language=zh variant=zh-cn
19136 !! input
19137 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19138 !! result
19139 <p>0
19140 </p>
19141 !! end
19142
19143 !! test
19144 Conversion rules from [numeric-only string] to [something else] (T48634)
19145 !! options
19146 language=zh variant=zh-cn
19147 !! input
19148 -{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
19149 !! result
19150 <p>D12345EE12345
19151 </p>
19152 !! end
19153
19154 !! test
19155 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19156 !! options
19157 language=zh variant=zh-cn
19158 !! input
19159 -{H|zh-cn:foo;zh-tw:;}-foobar
19160 !! result
19161 <p>foobar
19162 </p>
19163 !! end
19164
19165 !! test
19166 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19167 !! options
19168 language=zh variant=zh-cn
19169 !! input
19170 -{H|=>zh-cn:foo;}-foobar
19171 !! result
19172 <p>foobar
19173 </p>
19174 !! end
19175
19176 !! test
19177 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19178 !! options
19179 language=zh variant=zh-cn
19180 !! input
19181 -{H|}-foobar
19182 !! result
19183 <p>foobar
19184 </p>
19185 !! end
19186
19187 !! test
19188 Nested using of manual convert syntax
19189 !! options
19190 language=zh variant=zh-hk
19191 !! wikitext
19192 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19193 !! html
19194 <p>Nested: Hello Hong Kong!
19195 </p>
19196 !! end
19197
19198 !! test
19199 Proper conversion of text in external links
19200 !! options
19201 language=sr variant=sr-ec
19202 !! wikitext
19203 http://www.google.com
19204 gopher://www.google.com
19205 [http://www.google.com http://www.google.com]
19206 [gopher://www.google.com gopher://www.google.com]
19207 [https://www.google.com irc://www.google.com]
19208 [ftp://www.google.com www.google.com/ftp://dir]
19209 [//www.google.com www.google.com]
19210 !! html
19211 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19212 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19213 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19214 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19215 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19216 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19217 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19218 </p>
19219 !! end
19220
19221 !! test
19222 Do not convert roman numbers to language variants
19223 !! options
19224 language=sr variant=sr-ec
19225 !! wikitext
19226 Fridrih IV je car.
19227 !! html
19228 <p>Фридрих IV је цар.
19229 </p>
19230 !! end
19231
19232 !! test
19233 Unclosed language converter markup "-{"
19234 !! options
19235 language=sr
19236 !! wikitext
19237 -{T|hello
19238 !! html
19239 <p>-{T|hello
19240 </p>
19241 !! end
19242
19243 !! test
19244 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19245 !! options
19246 language=sr
19247 !! wikitext
19248 -{R|=&gt;}-
19249 !! html
19250 <p>=&gt;
19251 </p>
19252 !!end
19253
19254 !! test
19255 Don't break link parsing if language converter markup is in the caption.
19256 !! options
19257 language=sr variant=sr-ec
19258 !! wikitext
19259 [[Main Page|-{R|main page}-]]
19260 !! html
19261 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19262 </p>
19263 !! end
19264
19265 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19266 !! test
19267 Don't break image parsing if language converter markup is in the caption.
19268 !! options
19269 language=sr
19270 !! wikitext
19271 [[File:Foobar.jpg|-{R|caption}-]]
19272 !! html/parsoid
19273 <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>
19274 </p>
19275 !! end
19276
19277 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19278 !! test
19279 Don't break list handling if language converter markup is in the item.
19280 !! options
19281 language=zh variant=zh-cn
19282 !! wikitext
19283 ;-{zh-cn:AAA;zh-tw:BBB}-
19284 !! html/php
19285 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19286
19287 !! html/parsoid
19288 <dl><dt>AAA
19289 </dt></dl>
19290 !! end
19291
19292 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19293 !! test
19294 Don't break table handling if language converter markup is in the cell.
19295 !! options
19296 language=sr variant=sr-ec
19297 !! wikitext
19298 {|
19299 |-
19300 | -{R|B}-
19301 |}
19302 !! html/php
19303 <table>
19304
19305 <tr>
19306 <td>Б}-
19307 </td></tr></table>
19308
19309 !! html/parsoid
19310 <table>
19311
19312 <tr>
19313 <td> B
19314 </td></tr></table>
19315
19316 !! end
19317
19318 !! test
19319 Bug 529: Uncovered bullet
19320 !! wikitext
19321 * Foo {{bullet}}
19322 !! html
19323 <ul><li> Foo </li>
19324 <li> Bar</li></ul>
19325
19326 !! end
19327
19328 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19329 # Templates in Wikipedia rely on this behavior, as tidy has always been
19330 # enabled there. These tests are normally run *without* tidy, so specify the
19331 # full output here.
19332 # To test realistic parsing behavior, apply a tidy-like transformation to both
19333 # the expected output and your parser's output.
19334 !! test
19335 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19336 !! wikitext
19337 ******* Foo {{bullet}}
19338 !! html
19339 <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>
19340 <li> Bar</li></ul>
19341
19342 !! end
19343
19344 !! test
19345 Bug 529: Uncovered table already at line-start
19346 !! wikitext
19347 x
19348
19349 {{table}}
19350 y
19351 !! html
19352 <p>x
19353 </p>
19354 <table>
19355 <tr>
19356 <td> 1 </td>
19357 <td> 2
19358 </td></tr>
19359 <tr>
19360 <td> 3 </td>
19361 <td> 4
19362 </td></tr></table>
19363 <p>y
19364 </p>
19365 !! end
19366
19367 !! test
19368 Bug 529: Uncovered bullet in parser function result
19369 !! wikitext
19370 * Foo {{lc:{{bullet}} }}
19371 !! html
19372 <ul><li> Foo </li>
19373 <li> bar</li></ul>
19374
19375 !! end
19376
19377 !! test
19378 Bug 5678: Double-parsed template argument
19379 !! wikitext
19380 {{lc:{{{1}}}|hello}}
19381 !! html
19382 <p>{{{1}}}
19383 </p>
19384 !! end
19385
19386 !! test
19387 Bug 5678: Double-parsed template invocation
19388 !! wikitext
19389 {{lc:{{paramtest {{!}} param = hello }} }}
19390 !! html
19391 <p>{{paramtest | param = hello }}
19392 </p>
19393 !! end
19394
19395 !! test
19396 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19397 !! options
19398 language=cs
19399 title=[[Main Page]]
19400 !! wikitext
19401 {{PRVNÍVELKÉ:ěščř}}
19402 {{prvnívelké:ěščř}}
19403 {{PRVNÍMALÉ:ěščř}}
19404 {{prvnímalé:ěščř}}
19405 {{MALÁ:ěščř}}
19406 {{malá:ěščř}}
19407 {{VELKÁ:ěščř}}
19408 {{velká:ěščř}}
19409 !! html
19410 <p>Ěščř
19411 Ěščř
19412 ěščř
19413 ěščř
19414 ěščř
19415 ěščř
19416 ĚŠČŘ
19417 ĚŠČŘ
19418 </p>
19419 !! end
19420
19421 !! test
19422 Morwen/13: Unclosed link followed by heading
19423 !! wikitext
19424 [[link
19425 ==heading==
19426 !! html
19427 <p>[[link
19428 </p>
19429 <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>
19430
19431 !! end
19432
19433 !! test
19434 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19435 !! wikitext
19436 {{foo|
19437 =heading=
19438 !! html
19439 <p>{{foo|
19440 </p>
19441 <h1><span class="mw-headline" id="heading">heading</span></h1>
19442
19443 !! end
19444
19445 !! test
19446 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19447 !! wikitext
19448 {{foo|
19449 ==heading==
19450 !! html
19451 <p>{{foo|
19452 </p>
19453 <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>
19454
19455 !! end
19456
19457 !! test
19458 Tildes in comments
19459 !! options
19460 pst
19461 !! wikitext
19462 <!-- ~~~~ -->
19463 !! html
19464 <!-- ~~~~ -->
19465 !! end
19466
19467 !! test
19468 Paragraphs inside divs (no extra line breaks)
19469 !! wikitext
19470 <div>Line one
19471
19472 Line two</div>
19473 !! html
19474 <div>Line one
19475 Line two</div>
19476
19477 !! end
19478
19479 !! test
19480 Paragraphs inside divs (extra line break on open)
19481 !! wikitext
19482 <div>
19483 Line one
19484
19485 Line two</div>
19486 !! html
19487 <div>
19488 <p>Line one
19489 </p>
19490 Line two</div>
19491
19492 !! end
19493
19494 !! test
19495 Paragraphs inside divs (extra line break on close)
19496 !! wikitext
19497 <div>Line one
19498
19499 Line two
19500 </div>
19501 !! html
19502 <div>Line one
19503 <p>Line two
19504 </p>
19505 </div>
19506
19507 !! end
19508
19509 !! test
19510 Paragraphs inside divs (extra line break on open and close)
19511 !! wikitext
19512 <div>
19513 Line one
19514
19515 Line two
19516 </div>
19517 !! html
19518 <div>
19519 <p>Line one
19520 </p><p>Line two
19521 </p>
19522 </div>
19523
19524 !! end
19525
19526 !! test
19527 Nesting tags, paragraphs on lines which begin with <div>
19528 !! wikitext
19529 <div></div><strong>A
19530 B</strong>
19531 !! html/php+tidy
19532 <p><strong>A</strong></p>
19533 <p><strong>B</strong></p>
19534 !! html/parsoid
19535 <div></div>
19536 <p><strong>A
19537 B</strong>
19538 </p>
19539 !! end
19540
19541 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19542 !! test
19543 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19544 !! wikitext
19545 <blockquote>Line one
19546
19547 Line two</blockquote>
19548 !! html
19549 <blockquote>Line one
19550 Line two</blockquote>
19551
19552 !! html+tidy
19553 <blockquote>
19554 <p>Line one Line two</p>
19555 </blockquote>
19556 !! end
19557
19558 !! test
19559 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19560 !! wikitext
19561 <blockquote>
19562 Line one
19563
19564 Line two</blockquote>
19565 !! html
19566 <blockquote>
19567 <p>Line one
19568 </p>
19569 Line two</blockquote>
19570
19571 !! html+tidy
19572 <blockquote>
19573 <p>Line one</p>
19574 Line two</blockquote>
19575 !! end
19576
19577 !! test
19578 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19579 !! wikitext
19580 <blockquote>Line one
19581
19582 Line two
19583 </blockquote>
19584 !! html
19585 <blockquote>Line one
19586 <p>Line two
19587 </p>
19588 </blockquote>
19589
19590 !! html+tidy
19591 <blockquote>
19592 <p>Line one</p>
19593 <p>Line two</p>
19594 </blockquote>
19595 !! end
19596
19597 !! test
19598 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19599 !! wikitext
19600 <blockquote>
19601 Line one
19602
19603 Line two
19604 </blockquote>
19605 !! html
19606 <blockquote>
19607 <p>Line one
19608 </p><p>Line two
19609 </p>
19610 </blockquote>
19611
19612 !! html+tidy
19613 <blockquote>
19614 <p>Line one</p>
19615 <p>Line two</p>
19616 </blockquote>
19617 !! end
19618
19619 !! test
19620 Paragraphs inside blockquotes/divs (no extra line breaks)
19621 !! wikitext
19622 <blockquote><div>Line one
19623
19624 Line two</div></blockquote>
19625 !! html
19626 <blockquote><div>Line one
19627 Line two</div></blockquote>
19628
19629 !! end
19630
19631 !! test
19632 Paragraphs inside blockquotes/divs (extra line break on open)
19633 !! wikitext
19634 <blockquote><div>
19635 Line one
19636
19637 Line two</div></blockquote>
19638 !! html
19639 <blockquote><div>
19640 <p>Line one
19641 </p>
19642 Line two</div></blockquote>
19643
19644 !! end
19645
19646 !! test
19647 Paragraphs inside blockquotes/divs (extra line break on close)
19648 !! wikitext
19649 <blockquote><div>Line one
19650
19651 Line two
19652 </div></blockquote>
19653 !! html
19654 <blockquote><div>Line one
19655 <p>Line two
19656 </p>
19657 </div></blockquote>
19658
19659 !! end
19660
19661 !! test
19662 Paragraphs inside blockquotes/divs (extra line break on open and close)
19663 !! wikitext
19664 <blockquote><div>
19665 Line one
19666
19667 Line two
19668 </div></blockquote>
19669 !! html
19670 <blockquote><div>
19671 <p>Line one
19672 </p><p>Line two
19673 </p>
19674 </div></blockquote>
19675
19676 !! end
19677
19678 !! test
19679 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19680 !! options
19681 wgLinkHolderBatchSize=0
19682 !! wikitext
19683 [[meatball:1]]
19684 [[meatball:2]]
19685 [[meatball:3]]
19686 !! html
19687 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19688 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19689 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19690 </p>
19691 !! end
19692
19693 !! test
19694 Free external link invading image caption
19695 !! wikitext
19696 [[Image:Foobar.jpg|thumb|http://x|hello]]
19697 !! html
19698 <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>
19699
19700 !! end
19701
19702 !! test
19703 Bug 15196: localised external link numbers
19704 !! options
19705 language=fa
19706 !! wikitext
19707 [http://en.wikipedia.org/]
19708 !! html/php
19709 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19710 </p>
19711 !! html/parsoid
19712 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19713 !! end
19714
19715 !! test
19716 Multibyte character in padleft
19717 !! wikitext
19718 {{padleft:-Hello|7|Æ}}
19719 !! html
19720 <p>Æ-Hello
19721 </p>
19722 !! end
19723
19724 !! test
19725 Multibyte character in padright
19726 !! wikitext
19727 {{padright:Hello-|7|Æ}}
19728 !! html
19729 <p>Hello-Æ
19730 </p>
19731 !! end
19732
19733 !!test
19734 formatdate parser function
19735 !! wikitext
19736 {{#formatdate:2009-03-24}}
19737 !! html
19738 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19739 </p>
19740 !! end
19741
19742 !!test
19743 formatdate parser function, with default format
19744 !! wikitext
19745 {{#formatdate:2009-03-24|mdy}}
19746 !! html
19747 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19748 </p>
19749 !! end
19750
19751 !! test
19752 Spacing of numbers in formatted dates
19753 !! wikitext
19754 {{#formatdate:January 15}}
19755 !! html
19756 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19757 </p>
19758 !! end
19759
19760 !! test
19761 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
19762 !! options
19763 language=nl title=[[MediaWiki:Common.css]]
19764 !! wikitext
19765 {{#formatdate:2009-03-24|dmy}}
19766 !! html
19767 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19768 </p>
19769 !! end
19770
19771 #
19772 #
19773 #
19774
19775 #
19776 # Edit comments
19777 #
19778
19779 !! test
19780 Edit comment with link
19781 !! options
19782 comment
19783 !! wikitext
19784 I like the [[Main Page]] a lot
19785 !! html
19786 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19787 !!end
19788
19789 !! test
19790 Edit comment with link and link text
19791 !! options
19792 comment
19793 !! wikitext
19794 I like the [[Main Page|best pages]] a lot
19795 !! html
19796 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19797 !!end
19798
19799 !! test
19800 Edit comment with link and link text with suffix
19801 !! options
19802 comment
19803 !! wikitext
19804 I like the [[Main Page|best page]]s a lot
19805 !! html
19806 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19807 !!end
19808
19809 !! test
19810 Edit comment with section link (non-local, eg in history list)
19811 !! options
19812 comment title=[[Main Page]]
19813 !! wikitext
19814 /* External links */ removed bogus entries
19815 !! html
19816 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19817 !!end
19818
19819 !! test
19820 Edit comment with section link and text before it (non-local, eg in history list)
19821 !! options
19822 comment title=[[Main Page]]
19823 !! wikitext
19824 pre-comment text /* External links */ removed bogus entries
19825 !! html
19826 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>
19827 !!end
19828
19829 !! test
19830 Edit comment with section link (local, eg in diff view)
19831 !! options
19832 comment local title=[[Main Page]]
19833 !! wikitext
19834 /* External links */ removed bogus entries
19835 !! html
19836 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19837 !!end
19838
19839 !! test
19840 Edit comment with subpage link (bug 14080)
19841 !! options
19842 comment
19843 subpage
19844 title=[[Subpage test]]
19845 !! wikitext
19846 Poked at a [[/subpage]] here...
19847 !! html
19848 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19849 !!end
19850
19851 !! test
19852 Edit comment with subpage link and link text (bug 14080)
19853 !! options
19854 comment
19855 subpage
19856 title=[[Subpage test]]
19857 !! wikitext
19858 Poked at a [[/subpage|neat little page]] here...
19859 !! html
19860 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19861 !!end
19862
19863 !! test
19864 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19865 !! options
19866 comment
19867 title=[[Subpage test]]
19868 !! wikitext
19869 Poked at a [[/subpage]] here...
19870 !! html
19871 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...
19872 !!end
19873
19874 !! test
19875 Edit comment with bare anchor link (local, as on diff)
19876 !! options
19877 comment
19878 local
19879 title=[[Main Page]]
19880 !! wikitext
19881 [[#section]]
19882 !! html
19883 <a href="#section">#section</a>
19884 !! end
19885
19886 !! test
19887 Edit comment with bare anchor link (non-local, as on history)
19888 !! options
19889 comment
19890 title=[[Main Page]]
19891 !! wikitext
19892 [[#section]]
19893 !! html
19894 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19895 !! end
19896
19897 !! test
19898 Anchor starting with underscore
19899 !! wikitext
19900 [[#_ref|One]]
19901 !! html
19902 <p><a href="#_ref">One</a>
19903 </p>
19904 !! end
19905
19906 !! test
19907 Id starting with underscore
19908 !! wikitext
19909 <div id="_ref"></div>
19910 !! html
19911 <div id="_ref"></div>
19912
19913 !! end
19914
19915 !! test
19916 Space normalisation on autocomment (bug 22784)
19917 !! options
19918 comment
19919 title=[[Main Page]]
19920 !! wikitext
19921 /* __hello__world__ */
19922 !! html
19923 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19924 !! end
19925
19926 !! test
19927 percent-encoding and + signs in comments (Bug 26410)
19928 !! options
19929 comment
19930 !! wikitext
19931 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19932 !! html/php
19933 <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>
19934 !! end
19935
19936 # Parsoid doesn't support this yet: see bug 73581
19937 # but it *should* omit the 'src' attribute if the image is bad.
19938 # PHP side of tests was disabled in
19939 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19940 # because of issues in the PHP parserTests infrastructure
19941 # (but the output below is indeed what the PHP side emits)
19942 !! test
19943 Bad images - basic functionality
19944 !! wikitext
19945 [[File:Bad.jpg]]
19946 !! DISABLED/html/php
19947 !! html/parsoid
19948 <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>
19949 !! end
19950
19951 !! test
19952 Bad images - bug 16039: text after bad image disappears
19953 !! wikitext
19954 Foo bar
19955 [[File:Bad.jpg]]
19956 Bar foo
19957 !! DISABLED/html/php
19958 <p>Foo bar
19959 </p><p>Bar foo
19960 </p>
19961 !! html/parsoid
19962 <p>Foo bar
19963 <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>
19964 Bar foo</p>
19965 !! end
19966
19967 !! test
19968 Verify that displaytitle works (bug #22501) no displaytitle
19969 !! options
19970 showtitle
19971 !! config
19972 wgAllowDisplayTitle=true
19973 wgRestrictDisplayTitle=false
19974 !! wikitext
19975 this is not the the title
19976 !! html/php
19977 Parser test
19978 <p>this is not the the title
19979 </p>
19980 !! end
19981
19982 !! test
19983 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19984 !! options
19985 showtitle
19986 title=[[Screen]]
19987 !! config
19988 wgAllowDisplayTitle=true
19989 wgRestrictDisplayTitle=false
19990 !! wikitext
19991 this is not the the title
19992 {{DISPLAYTITLE:whatever}}
19993 !! html/php
19994 whatever
19995 <p>this is not the the title
19996 </p>
19997 !! end
19998
19999 !! test
20000 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20001 !! options
20002 showtitle
20003 title=[[Screen]]
20004 !! config
20005 wgAllowDisplayTitle=true
20006 wgRestrictDisplayTitle=true
20007 !! wikitext
20008 this is not the the title
20009 {{DISPLAYTITLE:whatever}}
20010 !! html/php
20011 Screen
20012 <p>this is not the the title
20013 </p>
20014 !! end
20015
20016 !! test
20017 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20018 !! options
20019 showtitle
20020 title=[[Screen]]
20021 !! config
20022 wgAllowDisplayTitle=true
20023 wgRestrictDisplayTitle=true
20024 !! wikitext
20025 this is not the the title
20026 {{DISPLAYTITLE:screen}}
20027 !! html/php
20028 screen
20029 <p>this is not the the title
20030 </p>
20031 !! end
20032
20033 !! test
20034 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20035 !! options
20036 showtitle
20037 title=[[Screen]]
20038 !! config
20039 wgAllowDisplayTitle=false
20040 !! wikitext
20041 this is not the the title
20042 {{DISPLAYTITLE:screen}}
20043 !! html/php
20044 Screen
20045 <p>this is not the the title
20046 <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>
20047 </p>
20048 !! end
20049
20050 !! test
20051 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20052 !! options
20053 showtitle
20054 title=[[Screen]]
20055 !! config
20056 wgAllowDisplayTitle=false
20057 !! wikitext
20058 this is not the the title
20059 !! html/php
20060 Screen
20061 <p>this is not the the title
20062 </p>
20063 !! end
20064
20065 !! test
20066 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20067 !! options
20068 showtitle
20069 title=[[Screen]]
20070 !! config
20071 wgAllowDisplayTitle=true
20072 wgRestrictDisplayTitle=true
20073 !! wikitext
20074 this is not the the title
20075 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20076 !! html/php
20077 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20078 <p>this is not the the title
20079 </p>
20080 !! end
20081
20082 !! test
20083 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20084 !! options
20085 showtitle
20086 title=[[Screen]]
20087 !! config
20088 wgAllowDisplayTitle=true
20089 wgRestrictDisplayTitle=true
20090 !! wikitext
20091 this is not the the title
20092 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20093 !! html/php
20094 <span style="color: red;">s</span>creen
20095 <p>this is not the the title
20096 </p>
20097 !! end
20098
20099 !! test
20100 Page status indicators: Empty name is invalid
20101 !! options
20102 showindicators
20103 !! wikitext
20104 <indicator name=" "></indicator>
20105 <indicator></indicator>
20106 !! html
20107 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20108 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20109 </p>
20110 !! end
20111
20112 !! test
20113 Page status indicators: Weird syntaxes that are okay
20114 !! options
20115 showindicators
20116 !! wikitext
20117 <indicator name="empty" />
20118 <indicator name="name"></indicator>
20119 !! html
20120 empty=
20121 name=
20122 <p><br />
20123 </p>
20124 !! end
20125
20126 !! test
20127 Page status indicators: Torture test
20128 !! options
20129 showindicators
20130 !! wikitext
20131 <indicator name="01">hello world</indicator>
20132 <indicator name="02">[[Main Page]]</indicator>
20133 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20134 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20135 <indicator name="05">* foo
20136 * bar</indicator>
20137 <indicator name="06"><nowiki>foo</nowiki></indicator>
20138 <indicator name="07"> Preformatted</indicator>
20139 <indicator name="08"><div>Broken tag</indicator>
20140 <indicator name="09">{| class=wikitable
20141 | cell
20142 |}</indicator>
20143 <indicator name="10">Two
20144
20145 paragraphs</indicator>
20146 !! html
20147 01=hello world
20148 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20149 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" />
20150 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>
20151 05=<ul><li> foo</li>
20152 <li> bar</li></ul>
20153
20154 06=foo
20155 07=<pre>Preformatted
20156 </pre>
20157 08=<div>Broken tag</div>
20158
20159 09=<table class="wikitable">
20160 <tr>
20161 <td> cell
20162 </td></tr></table>
20163
20164 10=<p>Two
20165 </p><p>paragraphs
20166 </p>
20167 <p><br />
20168 </p><p><br />
20169 </p><p><br />
20170 </p><p><br />
20171 </p><p><br />
20172 </p>
20173 !! end
20174
20175 !! test
20176 preload: check <noinclude> and <includeonly>
20177 !! options
20178 preload
20179 !! wikitext
20180 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20181 !! html/php
20182 Hello kind world.
20183 !! end
20184
20185 !! test
20186 preload: check <onlyinclude>
20187 !! options
20188 preload
20189 !! wikitext
20190 Goodbye <onlyinclude>Hello world</onlyinclude>
20191 !! html/php
20192 Hello world
20193 !! end
20194
20195 !! test
20196 preload: can pass tags through if we want to
20197 !! options
20198 preload
20199 !! wikitext
20200 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20201 !! html/php
20202 <includeonly>Hello world</includeonly>
20203 !! end
20204
20205 !! test
20206 preload: check that it doesn't try to do tricks
20207 !! options
20208 preload
20209 !! wikitext
20210 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20211 !! html/php
20212 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20213 !! end
20214
20215 !! test
20216 Play a bit with r67090 and bug 3158
20217 !! wikitext
20218 <div style="width:50% !important">&nbsp;</div>
20219 <div style="width:50%&nbsp;!important">&nbsp;</div>
20220 <div style="width:50%&#160;!important">&nbsp;</div>
20221 <div style="border : solid;">&nbsp;</div>
20222 !! html/php
20223 <div style="width:50% !important">&#160;</div>
20224 <div style="width:50% !important">&#160;</div>
20225 <div style="width:50% !important">&#160;</div>
20226 <div style="border&#160;: solid;">&#160;</div>
20227
20228 !! html/parsoid
20229 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20230 <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>
20231 <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>
20232 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20233
20234 !! end
20235
20236 !! test
20237 HTML5 data attributes
20238 !! wikitext
20239 <span data-foo="bar">Baz</span>
20240 <p data-abc-def_hij="">Quuz</p>
20241 !! html
20242 <p><span data-foo="bar">Baz</span>
20243 </p>
20244 <p data-abc-def_hij="">Quuz</p>
20245
20246 !! end
20247
20248 !! test
20249 percent-encoding and + signs in internal links (Bug 26410)
20250 !! wikitext
20251 [[User:+%]] [[Page+title%]]
20252 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20253 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20254 [[%33%45]] [[%33%45+]]
20255 !! html/php
20256 <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>
20257 <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>
20258 <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>
20259 <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>
20260 </p>
20261 !! html/parsoid
20262 <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>
20263 <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>
20264 <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>
20265 <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>
20266 !! end
20267
20268 !! test
20269 Special characters in embedded file links (bug 27679)
20270 !! wikitext
20271 [[File:Contains & ampersand.jpg]]
20272 [[File:Does not exist.jpg|Title with & ampersand]]
20273 !! html/php
20274 <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>
20275 <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>
20276 </p>
20277 !! html/parsoid
20278 <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>
20279 <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>
20280 !! end
20281
20282 !! test
20283 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20284 !! wikitext
20285 Text&apos;s been normalized?
20286 !! html
20287 <p>Text&#39;s been normalized?
20288 </p>
20289 !! end
20290
20291 !! test
20292 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20293 !! wikitext
20294 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20295 !! html
20296 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20297 </p>
20298 !! end
20299
20300 !! test
20301 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20302 !! wikitext
20303 [http://www.example.org/ ideograms]
20304 !! html
20305 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20306 </p>
20307 !! end
20308
20309 !! test
20310 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20311 !! wikitext
20312 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20313 !! html
20314 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20315 </p>
20316 !! end
20317
20318 !! article
20319 Mediawiki:loop1
20320 !! text
20321 {{Identical|A}}
20322 !! endarticle
20323
20324 !! article
20325 Mediawiki:loop2
20326 !! text
20327 {{Identical|B}}
20328 !! endarticle
20329
20330 !! article
20331 Template:Identical
20332 !! text
20333 {{int:loop1}}
20334 {{int:loop2}}
20335 !! endarticle
20336
20337 !! test
20338 Bug 31098 Template which includes system messages which includes the template
20339 !! wikitext
20340 {{Identical}}
20341 !! html
20342 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20343 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20344 </p>
20345 !! end
20346
20347 !! test
20348 Bug31490 Turkish: ucfirst 'blah'
20349 !! options
20350 language=tr
20351 !! wikitext
20352 {{ucfirst:blah}}
20353 !! html
20354 <p>Blah
20355 </p>
20356 !! end
20357
20358 !! test
20359 Bug31490 Turkish: ucfirst 'ix'
20360 !! options
20361 language=tr
20362 !! wikitext
20363 {{ucfirst:ix}}
20364 !! html
20365 <p>İx
20366 </p>
20367 !! end
20368
20369 !! test
20370 Bug31490 Turkish: lcfirst 'BLAH'
20371 !! options
20372 language=tr
20373 !! wikitext
20374 {{lcfirst:BLAH}}
20375 !! html
20376 <p>bLAH
20377 </p>
20378 !! end
20379
20380 !! test
20381 Bug31490 Turkish: ucfırst (with a dotless i)
20382 !! options
20383 language=tr
20384 !! wikitext
20385 {{ucfırst:blah}}
20386 !! html
20387 <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>
20388 </p>
20389 !! end
20390
20391 !! test
20392 Bug31490 ucfırst (with a dotless i) with English language
20393 !! options
20394 language=en
20395 !! wikitext
20396 {{ucfırst:blah}}
20397 !! html
20398 <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>
20399 </p>
20400 !! end
20401
20402 !! test
20403 Bug 26375: TOC with italics
20404 !! options
20405 title=[[Main Page]]
20406 !! wikitext
20407 __TOC__
20408 == ''Lost'' episodes ==
20409 !! html
20410 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20411 <ul>
20412 <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>
20413 </ul>
20414 </div>
20415
20416 <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>
20417
20418 !! end
20419
20420 !! test
20421 Bug 26375: TOC with bold
20422 !! options
20423 title=[[Main Page]]
20424 !! wikitext
20425 __TOC__
20426 == '''should be bold''' then normal text ==
20427 !! html
20428 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20429 <ul>
20430 <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>
20431 </ul>
20432 </div>
20433
20434 <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>
20435
20436 !! end
20437
20438 !! test
20439 Bug 33845: Headings become cursive in TOC when they contain an image
20440 !! options
20441 title=[[Main Page]]
20442 !! wikitext
20443 __TOC__
20444 == Image [[Image:foobar.jpg]] ==
20445 !! html
20446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20447 <ul>
20448 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20449 </ul>
20450 </div>
20451
20452 <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>
20453
20454 !! end
20455
20456 !! test
20457 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20458 !! options
20459 title=[[Main Page]]
20460 !! wikitext
20461 __TOC__
20462 == <blockquote>Quote</blockquote> ==
20463 !! html
20464 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20465 <ul>
20466 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20467 </ul>
20468 </div>
20469
20470 <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>
20471
20472 !! html+tidy
20473 <p></p>
20474 <div id="toc" class="toc">
20475 <div id="toctitle">
20476 <h2>Contents</h2>
20477 </div>
20478 <ul>
20479 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20480 </ul>
20481 </div>
20482 <p></p>
20483 <h2><span class="mw-headline" id="Quote"></span></h2>
20484 <blockquote>
20485 <p><span class="mw-headline" id="Quote">Quote</span></p>
20486 </blockquote>
20487 <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>
20488 !! end
20489
20490 !! test
20491 Unclosed tags in TOC
20492 !! options
20493 title=[[Main Page]]
20494 !! wikitext
20495 __TOC__
20496 == Proof: 2 < 3 ==
20497 <small>Hanc marginis exiguitas non caperet.</small>
20498 QED
20499 !! html
20500 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20501 <ul>
20502 <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>
20503 </ul>
20504 </div>
20505
20506 <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>
20507 <p><small>Hanc marginis exiguitas non caperet.</small>
20508 QED
20509 </p>
20510 !! end
20511
20512 !! test
20513 Multiple tags in TOC
20514 !! wikitext
20515 __TOC__
20516 == <i>Foo</i> <b>Bar</b> ==
20517
20518 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20519 !! html
20520 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20521 <ul>
20522 <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>
20523 <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>
20524 </ul>
20525 </div>
20526
20527 <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>
20528 <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>
20529
20530 !! html+tidy
20531 <p></p>
20532 <div id="toc" class="toc">
20533 <div id="toctitle">
20534 <h2>Contents</h2>
20535 </div>
20536 <ul>
20537 <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>
20538 <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>
20539 </ul>
20540 </div>
20541 <p></p>
20542 <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>
20543 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20544 <blockquote>
20545 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20546 </blockquote>
20547 <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>
20548 !! end
20549
20550 !! test
20551 Tags with parameters in TOC
20552 !! wikitext
20553 __TOC__
20554 == <sup class="in-h2">Hello</sup> ==
20555
20556 == <sup class="a > b">Evilbye</sup> ==
20557 !! html
20558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20559 <ul>
20560 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20561 <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>
20562 </ul>
20563 </div>
20564
20565 <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>
20566 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20567
20568 !! end
20569
20570 !! test
20571 span tags with directionality in TOC
20572 !! wikitext
20573 __TOC__
20574 == <span dir="ltr">C++</span> ==
20575
20576 == <span dir="rtl">זבנג!</span> ==
20577
20578 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20579
20580 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20581
20582 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20583 !! html
20584 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20585 <ul>
20586 <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>
20587 <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>
20588 <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>
20589 <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>
20590 <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>
20591 </ul>
20592 </div>
20593
20594 <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>
20595 <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>
20596 <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>
20597 <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>
20598 <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>
20599
20600 !! end
20601
20602 !! test
20603 Bug 72884: bdi element in ToC
20604 !! wikitext
20605 __TOC__
20606 == <bdi>test</bdi> ==
20607 !! html
20608 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20609 <ul>
20610 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20611 </ul>
20612 </div>
20613
20614 <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>
20615
20616 !! end
20617
20618 # Note that the html output does not have the <p></p>, but the
20619 # html+tidy output *does*. This is because the empty <p></p> is
20620 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20621 !! test
20622 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20623 !! wikitext
20624 __TOC__
20625 == x ==
20626 !! html
20627 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20628 <ul>
20629 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20630 </ul>
20631 </div>
20632
20633 <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>
20634
20635 !! html+tidy
20636 <p></p>
20637 <div id="toc" class="toc">
20638 <div id="toctitle">
20639 <h2>Contents</h2>
20640 </div>
20641 <ul>
20642 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20643 </ul>
20644 </div>
20645 <p></p>
20646 <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>
20647 !! end
20648
20649 !! article
20650 MediaWiki:Bug32057
20651 !! text
20652 == {{int:headline_sample}} ==
20653 !! endarticle
20654
20655 !! test
20656 Bug 32057: Title needed when expanding <h> nodes.
20657 !! options
20658 title=[[Main Page]]
20659 !! wikitext
20660 {{int:Bug32057}}
20661 !! html
20662 <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>
20663
20664 !! end
20665
20666 !! test
20667 Strip marker in urlencode
20668 !! wikitext
20669 {{urlencode:x<nowiki/>y}}
20670 {{urlencode:x<nowiki/>y|wiki}}
20671 {{urlencode:x<nowiki/>y|path}}
20672 {{urlencode:x<pre id="one">two</pre>y}}
20673 !! html
20674 <p>xy
20675 xy
20676 xy
20677 xy
20678 </p>
20679 !! end
20680
20681 !! test
20682 Strip marker in lc
20683 !! wikitext
20684 {{lc:x<nowiki/>y}}
20685 !! html
20686 <p>xy
20687 </p>
20688 !! end
20689
20690 !! test
20691 Strip marker in uc
20692 !! wikitext
20693 {{uc:x<nowiki/>y}}
20694 !! html
20695 <p>XY
20696 </p>
20697 !! end
20698
20699 !! test
20700 Strip marker in formatNum
20701 !! wikitext
20702 {{formatnum:1<nowiki/>2}}
20703 {{formatnum:1<nowiki/>2|R}}
20704 !! html
20705 <p>12
20706 12
20707 </p>
20708 !! end
20709
20710 !! test
20711 Check noCommafy in formatNum
20712 !! options
20713 language=be-tarask
20714 !! wikitext
20715 {{formatnum:123456.78}}
20716 {{formatnum:123456.78|NOSEP}}
20717 !! html
20718 <p>123 456,78
20719 123456.78
20720 </p>
20721 !! end
20722
20723 !! test
20724 Wrong option for formatNum (bug 56199)
20725 !! wikitext
20726 {{formatnum:1,234.56|Random}}
20727 {{formatnum:1,234.56|EVERYTHING}}
20728 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20729 !! html
20730 <p>1,234.56
20731 1,234.56
20732 1,234.56
20733 </p>
20734 !! end
20735
20736 !! test
20737 Strip marker in grammar
20738 !! options
20739 language=fi
20740 !! wikitext
20741 {{grammar:elative|foo<nowiki/>bar}}
20742 !! html
20743 <p>foobarista
20744 </p>
20745 !! end
20746
20747 !! test
20748 Strip marker in padleft
20749 !! wikitext
20750 {{padleft:|2|x<nowiki/>y}}
20751 !! html
20752 <p>xy
20753 </p>
20754 !! end
20755
20756 !! test
20757 Strip marker in padright
20758 !! wikitext
20759 {{padright:|2|x<nowiki/>y}}
20760 !! html
20761 <p>xy
20762 </p>
20763 !! end
20764
20765 !! test
20766 Strip marker in anchorencode
20767 !! wikitext
20768 {{anchorencode:x<nowiki/>y}}
20769 !! html
20770 <p>xy
20771 </p>
20772 !! end
20773
20774 !! test
20775 nowiki inside link inside heading (bug 18295)
20776 !! wikitext
20777 ==[[foo|x<nowiki>y</nowiki>z]]==
20778 !! html
20779 <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>
20780
20781 !! end
20782
20783 !! test
20784 new support for bdi element (bug 31817)
20785 !! wikitext
20786 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20787 !! html
20788 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20789
20790 !!end
20791
20792 !! test
20793 Ignore pipe between table row attributes
20794 !! wikitext
20795 {|
20796 | quux
20797 |- id=foo | style='color: red'
20798 | bar
20799 |}
20800 !! html
20801 <table>
20802 <tr>
20803 <td> quux
20804 </td></tr>
20805 <tr id="foo" style="color: red">
20806 <td> bar
20807 </td></tr></table>
20808
20809 !! end
20810
20811 !!test
20812 Gallery override link with WikiLink (bug 34852)
20813 !! wikitext
20814 <gallery>
20815 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20816 </gallery>
20817 !! html
20818 <ul class="gallery mw-gallery-traditional">
20819 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20820 <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>
20821 <div class="gallerytext">
20822 <p>caption
20823 </p>
20824 </div>
20825 </div></li>
20826 </ul>
20827
20828 !! end
20829
20830 !!test
20831 Gallery override link with absolute external link (bug 34852)
20832 !! wikitext
20833 <gallery>
20834 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20835 </gallery>
20836 !! html
20837 <ul class="gallery mw-gallery-traditional">
20838 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20839 <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>
20840 <div class="gallerytext">
20841 <p>caption
20842 </p>
20843 </div>
20844 </div></li>
20845 </ul>
20846
20847 !! end
20848
20849 !!test
20850 Gallery override link with malicious javascript (bug 34852)
20851 !! wikitext
20852 <gallery>
20853 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20854 </gallery>
20855 !! html
20856 <ul class="gallery mw-gallery-traditional">
20857 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20858 <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>
20859 <div class="gallerytext">
20860 <p>caption
20861 </p>
20862 </div>
20863 </div></li>
20864 </ul>
20865
20866 !! end
20867
20868 !!test
20869 Gallery with invalid title as link (bug 43964)
20870 !! wikitext
20871 <gallery>
20872 File:foobar.jpg|link=<
20873 </gallery>
20874 !! html
20875 <ul class="gallery mw-gallery-traditional">
20876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20877 <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>
20878 <div class="gallerytext">
20879 </div>
20880 </div></li>
20881 </ul>
20882
20883 !! end
20884
20885 !!test
20886 Language parser function
20887 !! wikitext
20888 {{#language:ar}}
20889 !! html
20890 <p>العربية
20891 </p>
20892 !! end
20893
20894 !!test
20895 Padleft and padright as substr
20896 !! wikitext
20897 {{padleft:|3|abcde}}
20898 {{padright:|3|abcde}}
20899 !! html
20900 <p>abc
20901 abc
20902 </p>
20903 !! end
20904
20905 !!test
20906 Special parser function
20907 !! wikitext
20908 {{#special:RandomPage}}
20909 {{#special:BaDtItLe}}
20910 {{#special:Foobar}}
20911 !! html
20912 <p>Special:Random
20913 Special:Badtitle
20914 Special:Foobar
20915 </p>
20916 !! end
20917
20918 !!test
20919 Bug 34939 - Case insensitive link parsing ([HttP://])
20920 !! wikitext
20921 [HttP://MediaWiki.Org/]
20922 !! html/php
20923 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20924 </p>
20925 !! html/parsoid
20926 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20927 !! end
20928
20929 !!test
20930 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20931 !! wikitext
20932 [HttP://MediaWiki.Org/ MediaWiki]
20933 !! html
20934 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20935 </p>
20936 !! end
20937
20938 !!test
20939 Bug 34939 - Case insensitive link parsing (HttP://)
20940 !! wikitext
20941 HttP://MediaWiki.Org/
20942 !! html/php
20943 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20944 </p>
20945 !! html/parsoid
20946 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20947 !! end
20948
20949 !!test
20950 Disable TOC
20951 !! options
20952 notoc
20953 !! wikitext
20954 Lead
20955 == Section 1 ==
20956 == Section 2 ==
20957 == Section 3 ==
20958 == Section 4 ==
20959 == Section 5 ==
20960 !! html
20961 <p>Lead
20962 </p>
20963
20964 <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>
20965 <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>
20966 <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>
20967 <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>
20968 <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>
20969
20970 !! end
20971
20972
20973 ###
20974 ### Parsoid-specific tests
20975 ### Parsoid-PHP parser incompatibilities
20976 ###
20977 !!test
20978 1. SOL-sensitive wikitext tokens as template-args
20979 !!options
20980 parsoid=wt2html,wt2wt
20981 !! wikitext
20982 {{echo|*a}}
20983 {{echo|#a}}
20984 {{echo|:a}}
20985 !! html
20986 <span about="#mwt1" typeof="mw:Transclusion">
20987 </span><ul about="#mwt1"><li>a</li>
20988 </ul>
20989 <span about="#mwt2" typeof="mw:Transclusion">
20990 </span><ol about="#mwt2"><li>a</li>
20991 </ol>
20992 <span about="#mwt3" typeof="mw:Transclusion">
20993 </span><dl about="#mwt3"><dd>a</dd>
20994 </dl>
20995 !!end
20996
20997 #### -----------------------------------------------------------------
20998 #### Parsoid-specific functionality tests
20999 #### -----------------------------------------------------------------
21000
21001 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21002 # We know wt2wt will fail, but we expect selser to pass.
21003 # Due to the nature of our testing, wt2wt and selser tests will enter the
21004 # blacklist and we'll catch selser regressions based on changes to the
21005 # blacklist entries for selser tests.
21006 !! test
21007 1. Bad treebuilder fixup of formatting elt is cleaned up
21008 !! options
21009 parsoid=wt2html,wt2wt
21010 !! wikitext
21011 {|
21012 |
21013 <small>
21014 [[Image:Foobar.jpg|right|Test]]
21015 </small>
21016 |}
21017 !! html/parsoid
21018 <table>
21019 <tbody><tr><td>
21020 <small>
21021 <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>
21022 </small>
21023 </td></tr>
21024 </tbody></table>
21025 !! end
21026
21027 !! test
21028 2. Bad treebuilder fixup of formatting elt is cleaned up
21029 !! options
21030 parsoid=wt2html,wt2wt
21031 !! wikitext
21032 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21033
21034 <small>[[Image:Foobar.jpg|right|300px]]</small>
21035 !! html/parsoid
21036
21037 <p><b>foo</b></p>
21038 <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>
21039 <p><b>bar</b></p>
21040 <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>
21041 !! end
21042
21043 !! test
21044 3. Bad treebuilder fixup of formatting elt is cleaned up
21045 !! options
21046 parsoid=wt2html,wt2wt
21047 !! wikitext
21048 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21049 !! html/parsoid
21050 <p><small><b>foo</b></small></p>
21051 <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>
21052 <p><small><b>bar</b></small></p>
21053 !! end
21054
21055 !! test
21056 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21057 !! options
21058 parsoid=wt2html,wt2wt
21059 !! wikitext
21060 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21061 !! html/parsoid
21062 <p><b><small></small></b></p>
21063 <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>
21064 <p></p>
21065 !! end
21066
21067 #### ----------------------------------------------------------------
21068 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21069 #### tags. Parsoid's output for these tags differs from that of the
21070 #### PHP parser.
21071 #### ----------------------------------------------------------------
21072
21073 !!test
21074 Ref: 1. ref-location should be replaced with an index span
21075 !!options
21076 parsoid
21077 !! wikitext
21078 A <ref>foo</ref>
21079 B <ref name="x">foo</ref>
21080 C <ref name="y" />
21081 <references />
21082 !! html
21083 <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>
21084 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>
21085 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>
21086 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21087 <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>
21088 <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>
21089 <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>
21090 </ol>
21091 !!end
21092
21093 !!test
21094 Ref: 2. ref-tags with identical names should all get the same index
21095 !!options
21096 parsoid
21097 !! wikitext
21098 A <ref name="x">foo</ref>
21099 B <ref name="x" />
21100 <references />
21101 !! html
21102 <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>
21103 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>
21104 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21105 <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>
21106 </ol>
21107 !!end
21108
21109 !!test
21110 Ref: 3. spaces in ref-names should be ignored
21111 !!options
21112 parsoid
21113 !! wikitext
21114 A <ref name="x">foo</ref>
21115 B <ref name=" x " />
21116 C <ref name= x />
21117 <references />
21118 !! html
21119 <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>
21120 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>
21121 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>
21122 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21123 <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>
21124 </ol>
21125 !!end
21126
21127 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21128 !!test
21129 Ref: 4. 'constructor' should be accepted as a valid ref-name
21130 !!options
21131 parsoid
21132 !! wikitext
21133 A <ref name="constructor">foo</ref>
21134 <references />
21135 !! html
21136 <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>
21137 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21138 <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>
21139 </ol>
21140 !!end
21141
21142 !!test
21143 Ref: 5. body should accept generic wikitext
21144 !!options
21145 parsoid
21146 !! wikitext
21147 A <ref>
21148 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21149 </ref>
21150
21151 <references />
21152 !! html
21153 <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>
21154
21155 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21156 <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>
21157 </span></li>
21158 </ol>
21159 !!end
21160
21161 !!test
21162 Ref: 6. indent-pres should not be output in ref-body
21163 !!options
21164 parsoid
21165 !! wikitext
21166 A <ref>
21167 foo
21168 bar
21169 baz
21170 </ref>
21171
21172 <references />
21173 !! html
21174 <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>
21175
21176 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21177 <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
21178 bar
21179 baz
21180 </span></li>
21181 </ol>
21182 !!end
21183
21184 !!test
21185 Ref: 7. No p-wrapping in ref-body
21186 !!options
21187 parsoid
21188 !! wikitext
21189 A <ref>
21190 foo
21191
21192 bar
21193
21194
21195 baz
21196
21197
21198
21199 booz
21200 </ref>
21201
21202 <references />
21203 !! html
21204 <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>
21205
21206 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21207 <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
21208
21209 bar
21210
21211
21212 baz
21213
21214
21215
21216 booz
21217 </span></li>
21218 </ol>
21219 !!end
21220
21221 !!test
21222 Ref: 8. transclusion wikitext has lower precedence
21223 !!options
21224 parsoid
21225 !! wikitext
21226 A <ref> foo {{echo|</ref> B C}}
21227
21228 <references />
21229 !! html
21230 <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>
21231 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21232 <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>
21233 </ol>
21234 !!end
21235
21236 !!test
21237 Ref: 9. unclosed comments should not leak out of ref-body
21238 !!options
21239 parsoid
21240 !! wikitext
21241 A <ref> foo <!--</ref> B C
21242 <references />
21243 !! html
21244 <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>
21245 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21246 <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>
21247 </ol>
21248 !!end
21249
21250 !!test
21251 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21252 !!options
21253 parsoid
21254 !! wikitext
21255 A <ref> <b> foo </ref> B C
21256
21257 <references />
21258 !! html
21259 <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>
21260
21261
21262 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21263 <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>
21264 </ol>
21265 !!end
21266
21267 !!test
21268 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21269 !!options
21270 parsoid
21271 !! wikitext
21272 A <ref>foo</ref> B
21273 C <ref>bar</ref> D
21274 <references />
21275 !! html
21276 <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
21277 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>
21278 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21279 <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>
21280 <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>
21281 </ol>
21282 !!end
21283
21284 !!test
21285 Ref: 12. ref-tags act as trailing newline migration barrier
21286 !! wikitext
21287 <!--the newline at the end of this line moves out of the p tag-->a
21288
21289 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21290 <ref />
21291
21292 c
21293 <references />
21294 !! html/parsoid
21295 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21296
21297
21298 <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>
21299 <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>
21300
21301 <p>c</p>
21302 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21303 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
21304 <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>
21305 !!end
21306
21307 !!test
21308 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21309 !!options
21310 parsoid
21311 !! wikitext
21312 <ref>foo</ref> A
21313 <ref>bar
21314 </ref> B
21315 <references />
21316 !! html
21317 <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
21318 <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>
21319 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21320 <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>
21321 <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
21322 </span></li>
21323 </ol>
21324 !!end
21325
21326 !!test
21327 Ref: 14. A nested ref-tag should be emitted as plain text
21328 !!options
21329 parsoid
21330 !! wikitext
21331 <ref>foo <ref>bar</ref> baz</ref>
21332
21333 <references />
21334 !! html
21335 <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>
21336 </p>
21337 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21338 <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>
21339 </ol>
21340 !!end
21341
21342 !!test
21343 Ref: 15. ref-tags with identical names should get identical indexes
21344 !!options
21345 parsoid
21346 !! wikitext
21347 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21348 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21349
21350 <references />
21351 !! html
21352 <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>
21353 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>
21354
21355 <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>
21356 </ol>
21357 !!end
21358
21359 ## We don't bother wt2wt-ing non-standard whitespace
21360 !!test
21361 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21362 !!options
21363 parsoid=wt2html
21364 !! wikitext
21365 A <ref >foo</ref >
21366
21367 <references />
21368 !! html
21369 <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>
21370 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21371 <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>
21372 !!end
21373
21374 !!test
21375 Ref: 17. Generate valid HTML5 id/about attributes
21376 !!options
21377 parsoid
21378 !!wikitext
21379 <ref name="a b">foo</ref>
21380
21381 <references />
21382 !!html
21383 <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>
21384 </p>
21385
21386 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21387 <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>
21388 </ol>
21389 !!end
21390
21391 !!test
21392 Ref: 18. T58916: Extension attributes should be parsed as plain text
21393 !!options
21394 parsoid
21395 !!wikitext
21396 <ref name="{{echo|a}}">foo</ref>
21397
21398 <references />
21399 !!html
21400 <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>
21401 </p>
21402
21403 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21404 <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>
21405 </ol>
21406 !!end
21407
21408 !!test
21409 Ref: 19. ref-tags with identical name encodings should get identical indexes
21410 !!options
21411 parsoid
21412 !! wikitext
21413 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21414
21415 <references />
21416 !! html
21417 <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>
21418 </p>
21419 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21420 <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>
21421 </ol>
21422 !!end
21423
21424 !!test
21425 Ref: 20. ref-tags with identical names but different content should keep it
21426 !!options
21427 parsoid
21428 !! wikitext
21429 A <ref name="foo">Foo one</ref>
21430 B <ref name="foo">Foo two</ref>
21431 C <ref name="foo" />
21432
21433 <references />
21434 !! html
21435 <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>
21436 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>
21437 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>
21438
21439 <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>
21440 </ol>
21441 !!end
21442
21443 !!test
21444 References: 1. references tag without any refs should be handled properly
21445 !! wikitext
21446 <references />
21447 !! html/parsoid
21448 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21449 !!end
21450
21451 !!test
21452 References: 2. references tag with group only outputs references from that group
21453 !! wikitext
21454 A <ref group="a">foo</ref>
21455 B <ref group="b">bar</ref>
21456 C <ref>baz</ref>
21457
21458 <references group="a" />
21459 <references />
21460 <references group="b" />
21461 !! html/parsoid
21462 <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>
21463 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>
21464 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>
21465
21466 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21467 <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>
21468 </ol>
21469 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21470 <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>
21471 </ol>
21472 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21473 <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>
21474 </ol>
21475 !!end
21476
21477 !!test
21478 References: 3. ref list should be cleared after processing references
21479 !! wikitext
21480 A <ref>foo</ref>
21481
21482 <references />
21483
21484 B <ref>bar</ref>
21485
21486 <references />
21487 !! html/parsoid
21488 <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>
21489
21490 <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>
21491 </ol>
21492
21493 <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>
21494
21495 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21496 <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>
21497 </ol>
21498 !!end
21499
21500 !!test
21501 References: 4. only referenced group should be cleared after processing references
21502 !! wikitext
21503 A <ref group="a">afoo</ref>
21504 B <ref>bfoo</ref>
21505
21506 <references group="a" />
21507
21508 C <ref>cfoo</ref>
21509
21510 <references />
21511 !! html/parsoid
21512 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21513 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21514
21515 <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>
21516 </ol>
21517
21518 <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>
21519
21520 <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>
21521 </ol>
21522 !!end
21523
21524 !!test
21525 References: 5. ref tags in references should be processed while ignoring all other content
21526 !! wikitext
21527 A <ref name="a" />
21528 B <ref name="b">bar</ref>
21529
21530 <references>
21531 <ref name="a">foo</ref>
21532 This should just get lost.
21533 </references>
21534 !! html/parsoid
21535 <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>
21536 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>
21537
21538
21539 <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>
21540 </ol>
21541 !!end
21542
21543 !!test
21544 References: 6. <references /> from a transclusion
21545 !! wikitext
21546 <ref>Foo</ref> {{echo|<references />}}
21547 !! html/parsoid
21548 <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>
21549 </ol>
21550 !!end
21551
21552 !! test
21553 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21554 !! wikitext
21555 A <ref>foo bar for a</ref>
21556 B <ref group="X" name="b" />
21557
21558 <references />
21559
21560 <references group="X">
21561 <ref name="b">foo</ref>
21562 </references>
21563 !! html/parsoid
21564 <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>
21565 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>
21566 </p>
21567
21568 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21569 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
21570 </ol>
21571
21572 <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"}}'>
21573 <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>
21574 </ol>
21575 !! end
21576
21577 !! test
21578 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21579 !! wikitext
21580 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21581 <references />
21582 !! html/parsoid
21583 <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>
21584 <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>
21585 </ol>
21586 !!end
21587
21588 # This test only works in wt2html now as the <references /> are always generated
21589 # unless selser is active. Once T72722 is fixed, we should add a changes test
21590 # here to ensure that unrelated changes don't add the new <references /> in
21591 # wt2wt.
21592 !! test
21593 References: 9. Generate missing references list at the end
21594 !! wikitext
21595 A <ref>foo</ref>
21596 B <ref group="inexistent">bar</ref>
21597 !! html/parsoid
21598 <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>
21599 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21600 <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>
21601 </ol>
21602 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21603 <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>
21604 </ol>
21605 !! end
21606
21607 !! test
21608 References: 10. New <references/> shouldn't be added for unrelated edits.
21609 !! options
21610 parsoid={
21611 "modes": ["selser"],
21612 "changes": [["#x", "remove"]],
21613 "selser": "noauto"
21614 }
21615 !! wikitext
21616 Unrelated text<span id="x"> that's going to disappear</span>.
21617 A <ref>foo</ref>
21618 !! wikitext/edited
21619 Unrelated text.
21620 A <ref>foo</ref>
21621 !!end
21622
21623 !! test
21624 Entities in ref name
21625 !! wikitext
21626 <ref name="test &amp; me">hi</ref>
21627 <references />
21628 !! html/parsoid
21629 <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>
21630 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21631 <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>
21632 </ol>
21633 !! end
21634
21635 # This test is wt2html only because we're permitting the serializer to produce
21636 # dirty diffs, normalizing the unclosed references to the self-closed version.
21637 !! test
21638 Generate references for unclosed references tag
21639 !! options
21640 parsoid=wt2html
21641 !! wikitext
21642 a<ref>foo</ref>
21643
21644 <references>
21645 !! html/parsoid
21646 <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>
21647 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21648 <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>
21649 !! end
21650
21651 !! test
21652 New reference serializes on its own line
21653 !! options
21654 parsoid=wt2wt,html2wt
21655 !! wikitext
21656 foo
21657 <references />
21658 !! html/parsoid
21659 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21660 !! end
21661
21662 #### ----------------------------------------------------------------
21663 #### Parsoid-only testing of Parsoid's impl of LST
21664 #### Not implemented yet, see
21665 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21666 #### ----------------------------------------------------------------
21667
21668 !!test
21669 LST Sections: 1. Simple section start and end
21670 !! wikitext
21671 <section begin="2011-05-16" />
21672 <section end="2014-04-10 (MW 1.23wmf22)" />
21673 !! html/parsoid
21674 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21675 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21676 !! end
21677
21678 #--------- Test stripping of empty nodes in template content ----------
21679 !!test
21680 Empty LI and TR nodes should be stripped from template content
21681 !!wikitext
21682 {{EmptyLITest}}
21683 {{EmptyTRTest}}
21684 !!html/parsoid
21685 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21686 <li>a</li>
21687 <li>b</li>
21688 </ul>
21689 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21690 <tbody>
21691 <tr>
21692 <td>foo</td>
21693 </tr>
21694 <tr>
21695 <td>bar</td>
21696 </tr>
21697 </tbody>
21698 </table>
21699 !!end
21700
21701 !!test
21702 Empty LI and TR nodes should not be stripped from top-level content
21703 !!wikitext
21704 * a
21705 *
21706 * b
21707 {|
21708 |-
21709 |-
21710 |foo
21711 |}
21712 !!html/parsoid
21713 <ul>
21714 <li> a</li>
21715 <li></li>
21716 <li> b</li>
21717 </ul>
21718 <table>
21719 <tbody>
21720 <tr></tr>
21721 <tr>
21722 <td>foo</td>
21723 </tr>
21724 </tbody>
21725 </table>
21726 !!end
21727
21728 !!test
21729 Empty TR nodes should not be stripped if they have any attributes set
21730 !!wikitext
21731 {{EmptyTRWithHTMLAttrTest}}
21732 !!html/parsoid
21733 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21734 <tr align="center"></tr>
21735 <tr><td>foo</td></tr>
21736 <tr align="center"></tr>
21737 <tr><td>bar</td></tr>
21738 </table>
21739 !!end
21740
21741 #### ----------------------------------------------------------------
21742 #### The following section of tests are primarily to test
21743 #### wikitext escaping capabilities of Parsoid. Given that
21744 #### escaping can be done any number of ways, the wikitext (input)
21745 #### is always adjusted to reflect how Parsoid adds nowiki
21746 #### escape tags.
21747 ####
21748 #### We are marking several tests as parsoid-only since the
21749 #### HTML in the result section is different from what the
21750 #### PHP parser generates for it.
21751 #### ----------------------------------------------------------------
21752
21753
21754 #### --------------- Headings ---------------
21755 #### 0. Unnested
21756 #### 1. Nested inside html <h1>=foo=</h1>
21757 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21758 #### 3. Nested inside html with wikitext split by html tags
21759 #### 4. No escape needed
21760 #### 5. Empty headings <h1></h1>
21761 #### 6. Heading chars in SOL context
21762 #### ----------------------------------------
21763 !! test
21764 Headings: 0. Unnested
21765 !! options
21766 parsoid
21767 !! wikitext
21768 <nowiki>=foo=</nowiki>
21769
21770 <nowiki> =foo= </nowiki>
21771 <!--cmt-->
21772 <nowiki>=foo=</nowiki>
21773
21774 =foo''a''<nowiki>=</nowiki>
21775 !! html
21776 <p><span typeof="mw:Nowiki">=foo=</span></p>
21777
21778 <p><span typeof="mw:Nowiki"> =foo= </span>
21779 <!--cmt-->
21780 <span typeof="mw:Nowiki">=foo=</span></p>
21781
21782 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21783 !!end
21784
21785 # New headings and existing headings are handled differently
21786 !! test
21787 Headings: 1. Nested inside html
21788 !! options
21789 parsoid=html2wt
21790 !! html/parsoid
21791 <h1>=foo=</h1>
21792 <h2>=foo=</h2>
21793 <h3>=foo=</h3>
21794
21795 <h1 data-parsoid=''>=foo=</h1>
21796 <h2 data-parsoid=''>=foo=</h2>
21797 <h3 data-parsoid=''>=foo=</h3>
21798 <h4 data-parsoid=''>=foo=</h4>
21799 <h5 data-parsoid=''>=foo=</h5>
21800 <h6 data-parsoid=''>=foo=</h6>
21801 !! wikitext
21802 = =foo= =
21803
21804 == =foo= ==
21805
21806 === =foo= ===
21807
21808 =<nowiki>=foo=</nowiki>=
21809 ==<nowiki>=foo=</nowiki>==
21810 ===<nowiki>=foo=</nowiki>===
21811 ====<nowiki>=foo=</nowiki>====
21812 =====<nowiki>=foo=</nowiki>=====
21813 ======<nowiki>=foo=</nowiki>======
21814
21815 !!end
21816
21817 !! test
21818 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21819 !! options
21820 parsoid=html2wt
21821 !! html/parsoid
21822 <h1>foo</h1>*bar
21823 <h1>foo</h1>=bar
21824 <h1>foo</h1>=bar=
21825 !! wikitext
21826 = foo =
21827 <nowiki>*</nowiki>bar
21828
21829 = foo =
21830 =bar
21831
21832 = foo =
21833 <nowiki>=bar=</nowiki>
21834 !!end
21835
21836 !! test
21837 Headings: 3. Nested inside html with wikitext split by html tags
21838 !! options
21839 parsoid=html2wt,wt2wt
21840 !! wikitext
21841 = ='''bold'''<nowiki>foo=</nowiki> =
21842 !! html/parsoid
21843 <h1>=<b>bold</b>foo=</h1>
21844 !!end
21845
21846 !! test
21847 Headings: 4a. No escaping needed (testing just h1 and h2)
21848 !! wikitext
21849 = =foo =
21850
21851 = foo= =
21852
21853 = =foo= =
21854
21855 = =foo= bar =
21856
21857 == =foo ==
21858
21859 == foo= ==
21860
21861 = = =
21862
21863 = ''=''foo= =
21864 !! html/parsoid
21865 <h1>=foo</h1>
21866 <h1>foo=</h1>
21867 <h1> =foo= </h1>
21868 <h1>=foo= bar</h1>
21869 <h2>=foo</h2>
21870 <h2>foo=</h2>
21871 <h1>=</h1>
21872 <h1><i>=</i>foo=</h1>
21873 !!end
21874
21875 !! test
21876 Headings: 4b. No escaping needed (inside p-tags)
21877 !! options
21878 parsoid=html2wt
21879 !! html/parsoid
21880 <p>===
21881 =foo= x
21882 =foo= <s></s>
21883 </p>
21884 !! wikitext
21885 ===
21886 =foo= x
21887 =foo= <s></s>
21888 !!end
21889
21890 !! test
21891 Headings: 5. Empty headings
21892 !! wikitext
21893 =<nowiki/>=
21894
21895 ==<nowiki/>==
21896
21897 ===<nowiki/>===
21898
21899 ====<nowiki/>====
21900
21901 =====<nowiki/>=====
21902
21903 ======<nowiki/>======
21904 !! html/parsoid
21905 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21906
21907 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21908
21909 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21910
21911 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21912
21913 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21914
21915 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21916 !!end
21917
21918 !! test
21919 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21920 !! wikitext
21921 <nowiki>=a=</nowiki>
21922
21923 <nowiki>=a=</nowiki>
21924
21925 <nowiki>=a=</nowiki>
21926
21927 <nowiki>=a=</nowiki>
21928 !! html/php
21929 <p>=a=
21930 </p><p>=a=
21931 </p><p>=a=
21932 </p><p>=a=
21933 </p>
21934 !! html/parsoid
21935 <p><span typeof="mw:Nowiki">=a=</span></p>
21936
21937 <p><span typeof="mw:Nowiki">=a=</span></p>
21938
21939 <p><span typeof="mw:Nowiki">=a=</span></p>
21940
21941 <p><span typeof="mw:Nowiki">=a=</span></p>
21942 !!end
21943
21944 !! test
21945 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21946 !! wikitext
21947 <nowiki>=a=
21948 b</nowiki>
21949
21950 <nowiki>=a=
21951 b</nowiki>
21952
21953 <nowiki>=a=
21954 b</nowiki>
21955
21956 <nowiki>=a=
21957 b</nowiki>
21958 !! html/php
21959 <p>=a=
21960 b
21961 </p><p>=a=
21962 b
21963 </p><p>=a=
21964 b
21965 </p><p>=a=
21966 b
21967 </p>
21968 !! html/parsoid
21969 <p><span typeof="mw:Nowiki">=a=
21970 b</span></p>
21971
21972 <p><span typeof="mw:Nowiki">=a=
21973 b</span></p>
21974
21975 <p><span typeof="mw:Nowiki">=a=
21976 b</span></p>
21977
21978 <p><span typeof="mw:Nowiki">=a=
21979 b</span></p>
21980 !!end
21981
21982 !! test
21983 Headings: 6c. Heading chars in SOL context (leading newline break)
21984 !! wikitext
21985 a
21986 <nowiki>=b=</nowiki>
21987 !! html/php
21988 <p>a
21989 =b=
21990 </p>
21991 !! html/parsoid
21992 <p>a
21993 <span typeof="mw:Nowiki">=b=</span>
21994 !!end
21995
21996 !! test
21997 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21998 !! wikitext
21999 <!--c0--><nowiki>=a=</nowiki>
22000
22001 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22002 !! html/php
22003 <p>=a=
22004 </p><p>=a=
22005 </p>
22006 !! html/parsoid
22007 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
22008
22009 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
22010 !!end
22011
22012 !! test
22013 Headings: 6d. Heading chars in SOL context (No escaping needed)
22014 !! options
22015 parsoid=html2wt
22016 !! html/parsoid
22017 =a=<div>b</div>
22018 !! wikitext
22019 =a=<div>b</div>
22020 !!end
22021
22022 !! test
22023 Headings: 7. Insert a newline between new content and headings
22024 !! options
22025 parsoid=html2wt
22026 !! html/parsoid
22027 <h2>NEW</h2>
22028 <p>new</p>
22029 <h2 data-parsoid='{}'>A</h2>
22030 <p data-parsoid='{}'>a</p>
22031 !! wikitext
22032 == NEW ==
22033 new
22034
22035 ==A==
22036 a
22037
22038 !! end
22039
22040 #### --------------- Lists ---------------
22041 #### 0. Outside nests (*foo, etc.)
22042 #### 1. Nested inside html <ul><li>*foo</li></ul>
22043 #### 2. Inside definition lists
22044 #### 3. Only bullets at start should be escaped
22045 #### 4. No escapes needed
22046 #### 5. No unnecessary escapes
22047 #### 6. Escape bullets in SOL position
22048 #### 7. Escape bullets in a multi-line context
22049 #### ----------------------------------------
22050
22051 !! test
22052 Lists: 0. Outside nests
22053 !! wikitext
22054 <nowiki>*</nowiki>foo
22055
22056 <nowiki>#</nowiki>foo
22057
22058 <nowiki>;Foo:</nowiki>bar
22059 !! html/php
22060 <p>*foo
22061 </p><p>#foo
22062 </p><p>;Foo:bar
22063 </p>
22064 !! html/parsoid
22065 <p><span typeof="mw:Nowiki">*</span>foo</p>
22066
22067 <p><span typeof="mw:Nowiki">#</span>foo</p>
22068
22069 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
22070 !!end
22071
22072 !! test
22073 Lists: 1. Nested inside html
22074 !! wikitext
22075 *<nowiki>*foo</nowiki>
22076
22077 *<nowiki>#foo</nowiki>
22078
22079 *<nowiki>:foo</nowiki>
22080
22081 *<nowiki>;foo</nowiki>
22082
22083 #<nowiki>*foo</nowiki>
22084
22085 #<nowiki>#foo</nowiki>
22086
22087 #<nowiki>:foo</nowiki>
22088
22089 #<nowiki>;foo</nowiki>
22090 !! html
22091 <ul><li>*foo</li></ul>
22092 <ul><li>#foo</li></ul>
22093 <ul><li>:foo</li></ul>
22094 <ul><li>;foo</li></ul>
22095 <ol><li>*foo</li></ol>
22096 <ol><li>#foo</li></ol>
22097 <ol><li>:foo</li></ol>
22098 <ol><li>;foo</li></ol>
22099
22100 !!end
22101
22102 !! test
22103 Lists: 2. Inside definition lists
22104 !! wikitext
22105 ;<nowiki>;foo</nowiki>
22106
22107 ;<nowiki>:foo</nowiki>
22108
22109 ;<nowiki>:foo</nowiki>
22110 :bar
22111
22112 :<nowiki>:foo</nowiki>
22113 !! html
22114 <dl><dt>;foo</dt></dl>
22115 <dl><dt>:foo</dt></dl>
22116 <dl><dt>:foo</dt>
22117 <dd>bar</dd></dl>
22118 <dl><dd>:foo</dd></dl>
22119
22120 !!end
22121
22122 !! test
22123 Lists: 3. Only bullets at start of text should be escaped
22124 !! wikitext
22125 *<nowiki>*foo*bar</nowiki>
22126
22127 *<nowiki>*foo</nowiki>''it''*bar
22128 !! html
22129 <ul><li>*foo*bar</li></ul>
22130 <ul><li>*foo<i>it</i>*bar</li></ul>
22131
22132 !!end
22133
22134 !! test
22135 Lists: 4. No escapes needed
22136 !! options
22137 parsoid
22138 !! wikitext
22139 *foo*bar
22140
22141 *''foo''*bar
22142
22143 *[[Foo]]: bar
22144
22145 *[[Foo]]*bar
22146 !! html
22147 <ul>
22148 <li>foo*bar
22149 </li>
22150 </ul>
22151 <ul>
22152 <li><i>foo</i>*bar
22153 </li>
22154 </ul>
22155 <ul>
22156 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22157 </li>
22158 </ul>
22159 <ul>
22160 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22161 </li>
22162 </ul>
22163 !!end
22164
22165 !! test
22166 Lists: 5. No unnecessary escapes
22167 !! wikitext
22168 * bar <span><nowiki>[[foo]]</nowiki></span>
22169
22170 * =bar <span><nowiki>[[foo]]</nowiki></span>
22171
22172 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22173
22174 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22175
22176 * =bar <span>foo]]</span>=
22177
22178 * <s></s>: a
22179
22180 * ''* foo''
22181 !! html
22182 <ul><li> bar <span>[[foo]]</span></li></ul>
22183 <ul><li> =bar <span>[[foo]]</span></li></ul>
22184 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22185 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22186 <ul><li> =bar <span>foo]]</span>=</li></ul>
22187 <ul><li> <s></s>: a</li></ul>
22188 <ul><li> <i>* foo</i></li></ul>
22189
22190 !!end
22191
22192 !! test
22193 Lists: 6. Escape bullets in SOL position
22194 !! options
22195 parsoid=html2wt
22196 !! html/parsoid
22197 <p><!--cmt-->*foo</p>
22198 !! wikitext
22199 <!--cmt--><nowiki>*</nowiki>foo
22200 !!end
22201
22202 !! test
22203 Lists: 7. Escape bullets in a multi-line context
22204 !! wikitext
22205 a
22206 <nowiki>*</nowiki>b
22207 !! html
22208 <p>a
22209 *b
22210 </p>
22211 !!end
22212
22213 !! test
22214 Lists: 8. Escape colons only if not present in tags
22215 !! options
22216 parsoid=html2wt
22217 !! html/parsoid
22218 <dl><dt>a:b<i>c:d</i></dt></dl>
22219 !! wikitext
22220 ; <nowiki>a:b</nowiki>''c:d''
22221 !! end
22222
22223 #### --------------- HRs ---------------
22224 #### 1. Single line
22225 #### -----------------------------------
22226
22227 !! test
22228 HRs: 1. Single line
22229 !! wikitext
22230 ----<nowiki>----</nowiki>
22231 ----=foo=
22232 ----*foo
22233 !! html+tidy
22234 <hr />
22235 <p>----</p>
22236 <hr />
22237 <p>=foo=</p>
22238 <hr />
22239 <p>*foo</p>
22240 !! end
22241
22242 #### --------------- Tables ---------------
22243 #### 1a. Simple example
22244 #### 1b. No escaping needed (!foo)
22245 #### 1c. No escaping needed (|foo)
22246 #### 1d. No escaping needed (|}foo)
22247 ####
22248 #### 2a. Nested in td (<td>foo|bar</td>)
22249 #### 2b. Nested in td (<td>foo||bar</td>)
22250 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22251 ####
22252 #### 3a. Nested in th (<th>foo!bar</th>)
22253 #### 3b. Nested in th (<th>foo!!bar</th>)
22254 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22255 ####
22256 #### 4a. Escape -
22257 #### 4b. Escape +
22258 #### 4c. No escaping needed
22259 #### --------------------------------------
22260
22261 !! test
22262 Tables: 1a. Simple example
22263 !! wikitext
22264 <nowiki>{|
22265 |}</nowiki>
22266 !! html
22267 <p>{|
22268 |}
22269 </p>
22270 !! end
22271
22272 !! test
22273 Tables: 1b. No escaping needed
22274 !! wikitext
22275 !foo
22276 !! html
22277 <p>!foo
22278 </p>
22279 !! end
22280
22281 !! test
22282 Tables: 1c. No escaping needed
22283 !! wikitext
22284 |foo
22285 !! html
22286 <p>|foo
22287 </p>
22288 !! end
22289
22290 !! test
22291 Tables: 1d. No escaping needed
22292 !! wikitext
22293 |}foo
22294 !! html
22295 <p>|}foo
22296 </p>
22297 !! end
22298
22299 !! test
22300 Tables: 2a. Nested in td
22301 !! options
22302 parsoid=html2wt
22303 !! html/parsoid
22304 <table><tbody><tr>
22305 <td>foo|bar</td></tr>
22306 <tr><td>x<div>a|b</div></td>
22307 </tbody></table>
22308 !! wikitext
22309 {|
22310 |<nowiki>foo|bar</nowiki>
22311 |-
22312 |x<div><nowiki>a|b</nowiki></div>
22313 |}
22314 !! html/php+tidy
22315 <table>
22316 <tr>
22317 <td>foo|bar</td>
22318 </tr>
22319 <tr>
22320 <td>x
22321 <div>a|b</div>
22322 </td>
22323 </tr>
22324 </table>
22325 !! end
22326
22327 !! test
22328 Tables: 2b. Nested in td
22329 !! options
22330 parsoid=html2wt
22331 !! html/parsoid
22332 <table><tbody><tr>
22333 <td>foo||bar</td>
22334 <td>a<i>b||c</i></td>
22335 <td>a<i><div>b||c</div></i></td>
22336 </tr></tbody></table>
22337 !! wikitext
22338 {|
22339 |<nowiki>foo||bar</nowiki>
22340 |a''<nowiki>b||c</nowiki>''
22341 |a''<div><nowiki>b||c</nowiki></div>''
22342 |}
22343 !! html/php
22344 <table>
22345 <tr>
22346 <td>foo||bar
22347 </td>
22348 <td>a<i>b||c</i>
22349 </td>
22350 <td>a<i><div>b||c</div></i>
22351 </td></tr></table>
22352
22353 !! end
22354
22355 !! test
22356 Tables: 2c. Nested in td -- no escaping needed
22357 !! wikitext
22358 {|
22359
22360 |foo!!bar
22361 |}
22362 !! html/*
22363 <table>
22364
22365 <tr>
22366 <td>foo!!bar
22367 </td></tr></table>
22368
22369 !! end
22370
22371 !! test
22372 Tables: 3a. Nested in th
22373 !! wikitext
22374 {|
22375
22376 !foo!bar
22377 |}
22378 !! html/*
22379 <table>
22380
22381 <tr>
22382 <th>foo!bar
22383 </th></tr></table>
22384
22385 !! end
22386
22387 !! test
22388 Tables: 3b. Nested in th
22389 !! options
22390 parsoid=html2wt
22391 !! html/parsoid
22392 <table><tbody>
22393 <tr><th>foo!!bar</th>
22394 <th><i>foo|bar</i></th>
22395 <th><i>foo!!bar</i></th>
22396 <th><i><span>foo!!bar</span></i></th>
22397 </tr></tbody></table>
22398 !! wikitext
22399 {|
22400 !<nowiki>foo!!bar</nowiki>
22401 !''<nowiki>foo|bar</nowiki>''
22402 !''<nowiki>foo!!bar</nowiki>''
22403 !''<span><nowiki>foo!!bar</nowiki></span>''
22404 |}
22405 !! html/php
22406 <table>
22407 <tr>
22408 <th>foo!!bar
22409 </th>
22410 <th><i>foo|bar</i>
22411 </th>
22412 <th><i>foo!!bar</i>
22413 </th>
22414 <th><i><span>foo!!bar</span></i>
22415 </th></tr></table>
22416
22417 !! end
22418
22419 !! test
22420 Tables: 3c. Nested in th
22421 !! options
22422 parsoid=html2wt
22423 !! html/parsoid
22424 <table><tbody>
22425 <tr><th>foo||bar</th>
22426 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22427 </tr></tbody></table>
22428 !! wikitext
22429 {|
22430 !<nowiki>foo||bar</nowiki>
22431 !<nowiki>foo||bar</nowiki>
22432 |}
22433 !! html/php
22434 <table>
22435 <tr>
22436 <th>foo||bar
22437 </th>
22438 <th>foo||bar
22439 </th></tr></table>
22440
22441 !! end
22442
22443 !! test
22444 Tables: 4a. Escape -
22445 !! options
22446 parsoid=html2wt
22447 !! html/*
22448 <table>
22449
22450 <tr>
22451 <th>-bar
22452 </th></tr>
22453 <tr>
22454 <td>-bar
22455 </td></tr></table>
22456
22457 !! wikitext
22458 {|
22459
22460 !-bar
22461
22462 |-
22463 |<nowiki>-bar</nowiki>
22464 |}
22465 !! end
22466
22467 !! test
22468 Tables: 4b. Escape +
22469 !! options
22470 parsoid=html2wt
22471 !! html/*
22472 <table>
22473
22474 <tr>
22475 <th>+bar
22476 </th></tr>
22477 <tr>
22478 <td>+bar
22479 </td></tr></table>
22480
22481 !! wikitext
22482 {|
22483
22484 !+bar
22485
22486 |-
22487 |<nowiki>+bar</nowiki>
22488 |}
22489 !! end
22490
22491 !! test
22492 Tables: 4c. No escaping needed
22493 !! wikitext
22494 {|
22495 |foo-bar
22496 |foo+bar
22497 |-
22498 |''foo''-bar
22499 |''foo''+bar
22500 |-
22501 |foo
22502 bar|baz
22503 +bar
22504 -bar
22505 |-
22506 |x
22507 <div>a|b</div>
22508 |}
22509 !! html/php
22510 <table>
22511 <tr>
22512 <td>foo-bar
22513 </td>
22514 <td>foo+bar
22515 </td></tr>
22516 <tr>
22517 <td><i>foo</i>-bar
22518 </td>
22519 <td><i>foo</i>+bar
22520 </td></tr>
22521 <tr>
22522 <td>foo
22523 <p>bar|baz
22524 +bar
22525 -bar
22526 </p>
22527 </td></tr>
22528 <tr>
22529 <td>x
22530 <div>a|b</div>
22531 </td></tr></table>
22532
22533 !! html/parsoid
22534 <table><tbody>
22535 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22536 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22537 <tr><td>foo
22538 <p>bar|baz
22539 +bar
22540 -bar</p></td></tr>
22541 <tr><td>x
22542 <div>a|b</div></td>
22543 </tbody></table>
22544 !! end
22545
22546 !! test
22547 Tables: 4d. No escaping needed
22548 !! wikitext
22549 {|
22550 |[[Foo]]-bar
22551 ||+1
22552 ||-2
22553 |}
22554 !! html/php
22555 <table>
22556 <tr>
22557 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22558 </td>
22559 <td>+1
22560 </td>
22561 <td>-2
22562 </td></tr></table>
22563
22564 !! html/parsoid
22565 <table>
22566 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22567 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22568 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22569 </tbody></table>
22570 !! end
22571
22572 !! test
22573 Tables: Digest broken attributes on table and tr tag
22574 !! options
22575 parsoid=wt2html
22576 !! wikitext
22577 {| || |} ++
22578 |- || || ++ --
22579 |- > [
22580 |}
22581 !! html
22582 <table>
22583 <tbody>
22584 <tr></tr>
22585 <tr></tr>
22586 </tbody></table>
22587 !! end
22588
22589 !! test
22590 T97430: Don't emit empty nowiki pairs around marker meta tags
22591 !! options
22592 parsoid=html2wt
22593 !! html/parsoid
22594 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22595 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22596 !! wikitext
22597 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22598 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22599 !! end
22600
22601 !! test
22602 Unclosed xmlish element in table line shouldn't eat end delimiters
22603 !! wikitext
22604 {|
22605 | <foo
22606 | bar>
22607 |}
22608 !! html/php
22609 <table>
22610 <tr>
22611 <td> &lt;foo
22612 </td>
22613 <td> bar&gt;
22614 </td></tr></table>
22615
22616 !! html/parsoid
22617 <table>
22618 <tbody><tr><td> &lt;foo</td>
22619 <td> bar></td></tr>
22620 </tbody></table>
22621 !! end
22622
22623 #### --------------- Links ----------------
22624 #### 1. Quote marks in link text
22625 #### 2. Wikilinks: Escapes needed
22626 #### 3. Wikilinks: No escapes needed
22627 #### 4. Extlinks: Escapes needed
22628 #### 5. Extlinks: No escapes needed
22629 #### --------------------------------------
22630 !! test
22631 Links 1. WikiLinks: No escapes needed
22632 !! wikitext
22633 [[Foo|Foo''boo'']]
22634 [[Foo|[Foobar]]]
22635 [[Foo|x [Foobar] x]]
22636 !! html/php
22637 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22638 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22639 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22640 </p>
22641 !! html/parsoid
22642 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22643 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22644 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22645 !! end
22646
22647 !! test
22648 Links 2. WikiLinks: Escapes needed
22649 !! options
22650 parsoid=html2wt
22651 !! html/parsoid
22652 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22653 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22654 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22655 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22656 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22657 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22658 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22659 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22660 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22661 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22662 !! wikitext
22663 [[Foo|<nowiki>Foobar]</nowiki>]]
22664 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22665 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22666 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22667 [[Foo|<nowiki>|Bar</nowiki>]]
22668 [[Foo|<nowiki>]]bar</nowiki>]]
22669 [[Foo|<nowiki>[[bar</nowiki>]]
22670 [[Foo|<nowiki>x [[ y</nowiki>]]
22671 [[Foo|<nowiki>x ]] y</nowiki>]]
22672 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22673 !! html/php
22674 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22675 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22676 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22677 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22678 <a href="/wiki/Foo" title="Foo">|Bar</a>
22679 <a href="/wiki/Foo" title="Foo">]]bar</a>
22680 <a href="/wiki/Foo" title="Foo">[[bar</a>
22681 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22682 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22683 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22684 </p>
22685 !! end
22686
22687 !! test
22688 Links 3. WikiLinks: No escapes needed
22689 !! wikitext
22690 [[Foo|[Foobar]]
22691 [[Foo|foo|bar]]
22692 !! html/php
22693 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22694 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22695 </p>
22696 !! html/parsoid
22697 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22698 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22699 !! end
22700
22701 !! test
22702 Links 4. ExtLinks: Escapes needed
22703 !! options
22704 parsoid=html2wt
22705 !! html/parsoid
22706 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22707 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22708 <p>[http://google.com]</p>
22709 <p>[http://google.com google]</p>
22710 !! wikitext
22711 [http://google.com <nowiki>[google]</nowiki>]
22712 [http://google.com <nowiki>google]</nowiki>]
22713
22714 <nowiki>[http://google.com]</nowiki>
22715
22716 <nowiki>[http://google.com google]</nowiki>
22717
22718 !! html/php
22719 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22720 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22721 </p><p>[http://google.com]
22722 </p><p>[http://google.com google]
22723 </p>
22724 !! end
22725
22726 !! test
22727 Links 5. ExtLinks: No escapes needed
22728 !! wikitext
22729 [http://google.com [google]
22730 !! html/php
22731 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22732 </p>
22733 !! html/parsoid
22734 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22735 !! end
22736
22737 !! test
22738 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22739 !! html/parsoid
22740 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22741 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22742 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22743 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22744 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22745 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22746 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22747 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22748 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22749 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22750 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22751 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22752 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22753 </p>
22754 !! wikitext
22755 x<nowiki/>http://example.com<nowiki/>y
22756 http://example.com<nowiki/>?x
22757 http://example.com<nowiki/>&x
22758 http://example.com<nowiki/>'x
22759 http://example.com<nowiki/>,x
22760 http://example.com<nowiki/>.x
22761 http://example.com<nowiki/>;x
22762 http://example.com<nowiki/>:x
22763 http://example.com<nowiki/>;x
22764 http://example.com<nowiki/>!x
22765 http://example.com<nowiki/>=x
22766 http://example.com<nowiki/>(x)
22767 http://example.com(x<nowiki/>)
22768 !! end
22769
22770 !! test
22771 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22772 !! html/parsoid
22773 <p>x
22774 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22775 y
22776 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22777 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22778 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22779 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22780 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22781 </p>
22782 !! wikitext
22783 x
22784 http://example.com
22785 y
22786 "http://example.com"
22787 (http://example.com)
22788 (http://example.com) foo
22789 http://example.com,
22790 http://example.com, foo
22791 !! html/php
22792 <p>x
22793 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22794 y
22795 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22796 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22797 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22798 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22799 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22800 </p>
22801 !! end
22802
22803 !! test
22804 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22805 !! html/parsoid
22806 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22807 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22808 !! wikitext
22809 http://example.com.,;:!?\
22810 -http://example.com:
22811 !! html/php
22812 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22813 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22814 </p>
22815 !! end
22816
22817 !! test
22818 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22819 !! html/parsoid
22820 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22821 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22822 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22823 !! wikitext
22824 RFC 123<nowiki/>4
22825 RFC 123<nowiki/>y
22826 X<nowiki/>RFC 123<nowiki/>y
22827 !! end
22828
22829 !! test
22830 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22831 !! html/parsoid
22832 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22833 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22834 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22835 </p>
22836 !! wikitext
22837 RFC 123?foo
22838 RFC 123&foo
22839 -RFC 123-
22840 !! html/php
22841 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22842 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22843 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22844 </p>
22845 !! end
22846
22847 !! test
22848 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22849 !! html/parsoid
22850 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22851 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22852 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22853 !! wikitext
22854 PMID 123<nowiki/>4
22855 PMID 123<nowiki/>y
22856 X<nowiki/>PMID 123<nowiki/>y
22857 !! end
22858
22859 !! test
22860 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22861 !! html/parsoid
22862 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22863 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22864 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22865 </p>
22866 !! wikitext
22867 PMID 123?foo
22868 PMID 123&foo
22869 -PMID 123-
22870 !! html/php
22871 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22872 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22873 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22874 </p>
22875 !! end
22876
22877 !! test
22878 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22879 !! html/parsoid
22880 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22881 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22882 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22883 </p>
22884 !! wikitext
22885 ISBN 1234567890<nowiki/>1
22886 ISBN 1234567890<nowiki/>x
22887 a<nowiki/>ISBN 1234567890<nowiki/>b
22888 !! end
22889
22890 !! test
22891 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22892 !! html/parsoid
22893 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22894 !! wikitext
22895 -ISBN 1234567890's
22896 !! html/php
22897 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22898 </p>
22899 !! end
22900
22901 !! test
22902 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22903 !! options
22904 parsoid=html2wt
22905 !! html/*
22906 <p>this is not a link: http://example.com
22907 </p>
22908 !! wikitext
22909 <nowiki>this is not a link: http://example.com</nowiki>
22910 !! end
22911
22912 !! test
22913 Links 15. Link trails can't become link prefixes.
22914 !! options
22915 language=is
22916 !! wikitext
22917 [[Söfnuður]]-[[00]]
22918 !! html/php
22919 <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>
22920 </p>
22921 !! html/parsoid
22922 <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>
22923 !! end
22924
22925 #### --------------- Quotes ---------------
22926 #### 1. Quotes inside <b> and <i>
22927 #### 2. Link fragments separated by <i> and <b> tags
22928 #### 3. Link fragments inside <i> and <b>
22929 #### 4. No escaping needed
22930 #### --------------------------------------
22931 !! test
22932 1a. Quotes inside <b> and <i>
22933 !! options
22934 parsoid=html2wt,wt2wt
22935 !! wikitext
22936 ''<nowiki/>'foo'''
22937 ''<nowiki>''foo''</nowiki>''
22938 ''<nowiki>'''foo'''</nowiki>''
22939 ''foo''<nowiki/>'s
22940 '''<nowiki/>'foo''''
22941 '''<nowiki>''foo''</nowiki>'''
22942 '''<nowiki>'''foo'''</nowiki>'''
22943 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22944 '''foo'''<nowiki/>'s
22945 '''foo''
22946 ''foo''<nowiki/>'
22947 ''foo'''<nowiki/>'
22948 '''foo''<nowiki/>'
22949 ''''foo'''
22950 '''foo'''<nowiki/>'
22951 ''''foo'''<nowiki/>'
22952 ''fools'<span> errand</span>''
22953 ''<span>fool</span>'s errand''
22954 '<nowiki/>''foo'' bar '''baz''
22955 a|!*#-:;+-~[]{}b'''x''
22956 !! html/*
22957 <p><i>'foo'</i>
22958 <i>''foo''</i>
22959 <i>'''foo'''</i>
22960 <i>foo</i>'s
22961 <b>'foo'</b>
22962 <b>''foo''</b>
22963 <b>'''foo'''</b>
22964 <b>foo'<i>bar'</i>baz</b>
22965 <b>foo</b>'s
22966 '<i>foo</i>
22967 <i>foo</i>'
22968 <i>foo'</i>'
22969 '<i>foo</i>'
22970 '<b>foo</b>
22971 <b>foo</b>'
22972 '<b>foo</b>'
22973 <i>fools'<span> errand</span></i>
22974 <i><span>fool</span>'s errand</i>
22975 '<i>foo</i> bar '<i>baz</i>
22976 a|!*#-:;+-~[]{}b'<i>x</i>
22977 </p>
22978 !! end
22979
22980 !! test
22981 1b. Quotes inside <b> and <i> with other tags on same line
22982 !! options
22983 parsoid=html2wt,wt2wt
22984 !! wikitext
22985 '''a'' foo ''[[bar]]''
22986 ''a''' foo ''[[bar]]''
22987 ''a''' foo '''{{echo|[[bar]]}}'''
22988 [[foo]] x'''[[bar]]''
22989 '''foo'' <ref>test</ref>
22990 '''foo'' <div title="name">test</div>
22991 '''foo'' and <br> bar
22992 <references />
22993 !! html
22994 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22995 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22996 <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>
22997 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22998 '<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>
22999 '<i>foo</i> <div title="name">test</div>
23000 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23001 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23002 <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>
23003 </ol>
23004 !! end
23005
23006 !! test
23007 2. Link fragments separated by <i> and <b> tags
23008 !! wikitext
23009 [[''foo''<nowiki>hello]]</nowiki>
23010
23011 [['''foo'''<nowiki>hello]]</nowiki>
23012 !! html
23013 <p>[[<i>foo</i>hello]]
23014 </p><p>[[<b>foo</b>hello]]
23015 </p>
23016 !! end
23017
23018 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23019 # this is one of the shortcomings of this format
23020 !! test
23021 3. Link fragments inside <i> and <b>
23022 !! wikitext
23023 ''[[foo''<nowiki>]]</nowiki>
23024
23025 '''[[foo'''<nowiki>]]</nowiki>
23026 !! html
23027 <p><i>[[foo</i>]]
23028 </p><p><b>[[foo</b>]]
23029 </p>
23030 !! end
23031
23032 !! test
23033 4. No escaping needed
23034 !! wikitext
23035 '<span>''bar''</span>'
23036 '<span>'''bar'''</span>'
23037 'a:b'foo
23038 !! html
23039 <p>'<span><i>bar</i></span>'
23040 '<span><b>bar</b></span>'
23041 'a:b'foo
23042 </p>
23043 !! end
23044
23045 #### ----------- Paragraphs ---------------
23046 #### 1. No unnecessary escapes
23047 #### --------------------------------------
23048
23049 !! test
23050 1. No unnecessary escapes
23051 !! wikitext
23052 bar <span><nowiki>[[foo]]</nowiki></span>
23053
23054 =bar <span><nowiki>[[foo]]</nowiki></span>
23055
23056 [[bar <span><nowiki>[[foo]]</nowiki></span>
23057
23058 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23059
23060 =bar <span>foo]]</span><nowiki>=</nowiki>
23061 !! html
23062 <p>bar <span>[[foo]]</span>
23063 </p><p>=bar <span>[[foo]]</span>
23064 </p><p>[[bar <span>[[foo]]</span>
23065 </p><p>]]bar <span>[[foo]]</span>
23066 </p><p>=bar <span>foo]]</span>=
23067 </p>
23068 !!end
23069
23070 #### ----------------------- PRE --------------------------
23071 #### 1. Leading whitespace in SOL context should be escaped
23072 #### ------------------------------------------------------
23073 !! test
23074 1. Leading whitespace in SOL context should be escaped
23075 !! options
23076 parsoid
23077 !! wikitext
23078 <nowiki> </nowiki>a
23079
23080 <nowiki> </nowiki> a
23081
23082 <nowiki> </nowiki>a(tab)
23083
23084 <nowiki> </nowiki> a
23085 <!--cmt-->
23086 <nowiki> </nowiki> a
23087
23088 a
23089 <nowiki> </nowiki>b
23090
23091 a
23092 <nowiki> </nowiki>b
23093
23094 a
23095 <nowiki> </nowiki> b
23096 !! html
23097 <p> a</p>
23098 <p> a</p>
23099 <p> a(tab)</p>
23100 <p> a</p>
23101 <p><!--cmt--> a</p>
23102 <p>a
23103 b</p>
23104 <p>a
23105 b</p>
23106 <p>a
23107 b</p>
23108 !! end
23109
23110 !! test
23111 2. Leading whitespace in non-indent-pre contexts should not be escaped
23112 !! options
23113 parsoid
23114 !! wikitext
23115 foo <ref>''a''
23116 b</ref>
23117 <references />
23118 !! html
23119 <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>
23120 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23121 <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>
23122 b</span></li>
23123 </ol>
23124 !! end
23125
23126 !! test
23127 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23128 !! options
23129 parsoid
23130 !! wikitext
23131 <blockquote>
23132 a
23133 <span>b</span>
23134 c
23135 </blockquote>
23136 !! html
23137 <blockquote>
23138 <p>
23139 a
23140 <span>b</span>
23141 c</p>
23142 </blockquote>
23143 !! end
23144
23145 !! test
23146 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23147 !! options
23148 parsoid
23149 !! wikitext
23150 [[File:Foobar.jpg|thumb|caption]]
23151 !! html/parsoid
23152 <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>
23153 !! end
23154
23155 !! test
23156 5. Nowiki escaping should account for indent-pres
23157 !! options
23158 parsoid=html2wt
23159 !! html/parsoid
23160 <pre>==foo==</pre>
23161 !! wikitext
23162 ==foo==
23163 !! end
23164
23165 !!test
23166 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23167 !! options
23168 parsoid
23169 !! wikitext
23170 * foo
23171 * bar
23172 !! html
23173 <pre>
23174 * foo
23175 * bar
23176 </pre>
23177 !! end
23178
23179 #### --------------- Behavior Switches --------------------
23180
23181 !! test
23182 1. Valid behavior switches should be escaped
23183 !! options
23184 parsoid=html2wt
23185 !! html/parsoid
23186 __TOC__
23187 <i>__TOC__</i>
23188 !! wikitext
23189 <nowiki>__TOC__</nowiki>
23190 ''<nowiki>__TOC__</nowiki>''
23191 !! end
23192
23193 !! test
23194 2. Invalid behavior switches should not be escaped
23195 !! options
23196 parsoid=html2wt
23197 !! html/parsoid
23198 __TOO__
23199 __|__
23200 !! wikitext
23201 __TOO__
23202 __|__
23203 !! end
23204
23205 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23206 !! test
23207 Behavior switches should be SOL-transparent
23208 !! wikitext
23209 __TOC__
23210
23211 <!-- this one's bogus -->
23212 __TOO__
23213
23214 __TOC__ foo
23215
23216 __TOC__ bar
23217 !! html/parsoid
23218 <meta property="mw:PageProp/toc" />
23219
23220 <!-- this one's bogus -->
23221 <pre>__TOO__</pre>
23222
23223 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23224
23225 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23226 !! end
23227
23228 #### --------------- HTML tags ---------------
23229 #### 1. a tags
23230 #### 2. other tags
23231 #### 3. multi-line html tag
23232 #### 4. extension tags
23233 #### -----------------------------------------
23234 !! test
23235 1. a tags
23236 !! options
23237 parsoid
23238 !! wikitext
23239 <a href="http://google.com">google</a>
23240 !! html
23241 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23242 !! end
23243
23244 !! test
23245 2. other tags
23246 !! wikitext
23247 * <nowiki><div>foo</div></nowiki>
23248 * <nowiki><div style="color:red">foo</div></nowiki>
23249 * <nowiki><td></nowiki>
23250 !! html
23251 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23252 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23253 <li> &lt;td&gt;</li></ul>
23254
23255 !! end
23256
23257 !! test
23258 3. multi-line html tag
23259 !! wikitext
23260 <nowiki><div
23261 >foo</div
23262 ></nowiki>
23263 !! html
23264 <p>&lt;div
23265 &gt;foo&lt;/div
23266 &gt;
23267 </p>
23268 !! end
23269
23270 !! test
23271 4. extension tags
23272 !! wikitext
23273 <nowiki><ref>foo</ref></nowiki>
23274
23275 <nowiki><ref>bar</nowiki>
23276
23277 baz<nowiki></ref></nowiki>
23278 !! html
23279 <p>&lt;ref&gt;foo&lt;/ref&gt;
23280 </p><p>&lt;ref&gt;bar
23281 </p><p>baz&lt;/ref&gt;
23282 </p>
23283 !! end
23284
23285 #### --------------- Others ---------------
23286 !! test
23287 Escaping nowikis
23288 !! wikitext
23289 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23290 !! html
23291 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23292 </p>
23293 !! end
23294
23295 ## The quote-char in the input is necessary for triggering the bug
23296 !! test
23297 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23298 !! options
23299 parsoid=wt2wt,html2wt
23300 !! wikitext
23301 foo's bar :
23302 !! html
23303 <p>foo's bar :</p>
23304 !! end
23305
23306 !! test
23307
23308 Tag-like HTML structures are passed through as text
23309 !! wikitext
23310 <x y>
23311
23312 <x.y>
23313
23314 <x-y>
23315
23316 1>2
23317
23318 x<y
23319
23320 a>b
23321
23322 1<d e>f
23323 !! html
23324 <p>&lt;x y&gt;
23325 </p><p>&lt;x.y&gt;
23326 </p><p>&lt;x-y&gt;
23327 </p><p>1&gt;2
23328 </p><p>x&lt;y
23329 </p><p>a&gt;b
23330 </p><p>1&lt;d e&gt;f
23331 </p>
23332 !! end
23333
23334 !! test
23335 HTML tag with necessary entities in attributes
23336 !! wikitext
23337 <span title="&amp;amp;">foo</span>
23338 !! html
23339 <p><span title="&amp;amp;">foo</span>
23340 </p>
23341 !! end
23342
23343 !! test
23344 HTML tag with 'unnecessary' entity encoding in attributes
23345 !! wikitext
23346 <span title="&amp;">foo</span>
23347 !! html
23348 <p><span title="&amp;">foo</span>
23349 </p>
23350 !! end
23351
23352 !! test
23353 HTML tag with broken attribute value quoting
23354 !! wikitext
23355 <span title="Hello world>Foo</span>
23356 !! html/php
23357 <p><span>Foo</span>
23358 </p>
23359 !! html/parsoid
23360 <p><span title="Hello world">Foo</span>
23361 </p>
23362 !! end
23363
23364 !! test
23365 Parsoid-only: HTML tag with broken attribute value quoting
23366 !! options
23367 parsoid
23368 !! wikitext
23369 <span title="Hello world>Foo</span>
23370 !! html
23371 <p><span title="Hello world">Foo</span>
23372 </p>
23373 !! end
23374
23375 !! test
23376 Table with broken attribute value quoting
23377 !! wikitext
23378 {|
23379 | title="Hello world|Foo
23380 |}
23381 !! html/php
23382 <table>
23383 <tr>
23384 <td>Foo
23385 </td></tr></table>
23386
23387 !! html/parsoid
23388 <table>
23389 <tr>
23390 <td title="Hello world">Foo
23391 </td></tr></table>
23392
23393 !! end
23394
23395 !! test
23396 Table with broken attribute value quoting on consecutive lines
23397 !! wikitext
23398 {|
23399 | title="Hello world|Foo
23400 | style="color:red|Bar
23401 |}
23402 !! html/php
23403 <table>
23404 <tr>
23405 <td>Foo
23406 </td>
23407 <td>Bar
23408 </td></tr></table>
23409
23410 !! html/parsoid
23411 <table><tbody>
23412 <tr>
23413 <td title="Hello world">Foo
23414 </td><td style="color: red">Bar
23415 </td></tr></tbody></table>
23416
23417 !! end
23418
23419 !! test
23420 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23421 !! options
23422 parsoid
23423 !! wikitext
23424 {{}}
23425 !! html
23426 {{}}
23427 !! end
23428
23429 !! test
23430 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23431 !! options
23432 parsoid
23433 !! wikitext
23434 }}{{
23435 !! html
23436 }}{{
23437 !! end
23438
23439 !!test
23440 Accept empty td cell attribute
23441 !! wikitext
23442 {|
23443 | align="center" | foo || |
23444 |}
23445 !! html
23446 <table>
23447 <tr>
23448 <td align="center"> foo </td>
23449 <td>
23450 </td></tr></table>
23451
23452 !!end
23453
23454 !!test
23455 Non-empty attributes in th-cells
23456 !! wikitext
23457 {|
23458 ! Foo !! style="color: red" | Bar
23459 |}
23460 !! html
23461 <table>
23462 <tr>
23463 <th> Foo </th>
23464 <th style="color: red"> Bar
23465 </th></tr></table>
23466
23467 !!end
23468
23469 !!test
23470 Accept empty attributes in th-cells
23471 !! wikitext
23472 {|
23473 !| foo !!| bar
23474 |}
23475 !! html
23476 <table>
23477 <tr>
23478 <th> foo </th>
23479 <th> bar
23480 </th></tr></table>
23481
23482 !!end
23483
23484 !!test
23485 Empty table rows go away
23486 !! wikitext
23487 {|
23488 | Hello
23489 | there
23490 |- class="foo"
23491 |-
23492 |}
23493 !! html
23494 <table>
23495 <tr>
23496 <td> Hello
23497 </td>
23498 <td> there
23499 </td></tr>
23500
23501 </table>
23502
23503 !! end
23504
23505 ###
23506 ### Parsoid-centric tests for testing RTing of inter-element separators
23507 ### Edge cases not tested by existing parser tests and specific to
23508 ### Parsoid-specific serialization strategies.
23509 ###
23510
23511 !!test
23512 RT-ed inter-element separators should be valid separators
23513 !! wikitext
23514 {|
23515 |- [[foo]]
23516 |}
23517 !! html
23518 <table>
23519
23520 </table>
23521
23522 !!end
23523
23524 # Parsoid-only since PHP parser relies on Tidy for correct output
23525 !!test
23526 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23527 !!options
23528 parsoid
23529 !! wikitext
23530 {|
23531 |<small>foo
23532 bar
23533 |}
23534
23535 {|
23536 |<small>foo<small>
23537 |}
23538 !! html
23539 <table>
23540 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23541 <p>bar</p></small></td></tr>
23542 </tbody></table>
23543
23544 <table>
23545 <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>
23546 </tbody></table>
23547 !!end
23548
23549 # Note that the "style" attribute is really a template parameter here.
23550 # The = would have to be {{=}} if you wanted the literal.
23551 !!test
23552 Empty TD followed by TD with tpl-generated attribute
23553 !! wikitext
23554 {|
23555 |-
23556 |
23557 |{{echo|style='color:red'}}|foo
23558 |}
23559 !! html
23560 <table>
23561
23562 <tr>
23563 <td>
23564 </td>
23565 <td>foo
23566 </td></tr></table>
23567
23568 !!end
23569
23570 !!test
23571 Indented table with an empty td
23572 !! wikitext
23573 {|
23574 |-
23575 |
23576 |foo
23577 |}
23578 !! html
23579 <table>
23580
23581 <tr>
23582 <td>
23583 </td>
23584 <td>foo
23585 </td></tr></table>
23586
23587 !!end
23588
23589 ## We have some newline diffs RT-ing this edge case
23590 ## and it is not important enough -- we seem to be emitting
23591 ## at most 2 newlines after a </tr> and this is unrelated to
23592 ## the issue from T85627 that this is testing.
23593 !!test
23594 Indented table with blank lines in between (T85627)
23595 !! options
23596 parsoid=wt2html
23597 !! wikitext
23598 {|
23599 |foo
23600
23601
23602 |}
23603 !! html
23604 <table>
23605
23606 <tr>
23607 <td>foo
23608 </td></tr></table>
23609
23610 !!end
23611
23612 !!test
23613 Indented block & table
23614 !! wikitext
23615 <div>foo</div>
23616 {|
23617 |foo
23618 |}
23619 !! html/php
23620 <div>foo</div>
23621 <table>
23622 <tr>
23623 <td>foo
23624 </td></tr></table>
23625
23626 !! html/parsoid
23627 <div data-parsoid='{"stx":"html"}'>foo</div>
23628 <table><tbody>
23629 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23630 </tbody></table>
23631 !!end
23632
23633 !! test
23634 Indent and comment before table row
23635 !! wikitext
23636 {|
23637 <!--hi-->|-
23638 | there
23639 |}
23640 !! html/php
23641 <table>
23642
23643 <tr>
23644 <td> there
23645 </td></tr></table>
23646
23647 !! html/parsoid
23648 <table>
23649 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23650 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23651 </tbody></table>
23652 !! end
23653
23654 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23655 !!test
23656 Empty TR followed by a template-generated TR
23657 !!options
23658 parsoid
23659 !! wikitext
23660 {|
23661 |-
23662 {{echo|<tr><td>foo</td></tr>}}
23663 |}
23664 !! html
23665 <table>
23666 <tbody>
23667 <tr></tr>
23668 <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}}]}'>
23669 <td>foo</td></tr>
23670 </tbody></table>
23671 !!end
23672
23673 ## PHP and parsoid output differ for this, and since this is primarily
23674 ## for testing Parsoid's serializer, marking this Parsoid only
23675 !!test
23676 Empty TR followed by mixed-ws-comment line should RT correctly
23677 !!options
23678 parsoid
23679 !! wikitext
23680 {|
23681 |-
23682 <!--c-->
23683 |-
23684 <!--c--> <!--d-->
23685 |}
23686 !! html
23687 <table>
23688 <tbody>
23689 <tr></tr>
23690 <!--c-->
23691 <tr>
23692 <!--c--> </tr><!--d-->
23693 </tbody></table>
23694
23695 !!end
23696
23697 !!test
23698 Multi-line image caption generated by templates with/without trailing newlines
23699 !! wikitext
23700 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23701 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23702 !! html/parsoid
23703 <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>
23704 <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>
23705 !!end
23706
23707 !! test
23708 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23709 !! options
23710 parsoid=html2wt
23711 !! html/parsoid
23712 <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>
23713
23714 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23715 !! wikitext
23716 <includeonly>foo</includeonly>
23717 new para
23718
23719 [[Category:Foo]]
23720
23721 = new heading =
23722 !! end
23723
23724 ## PHP emits broken html for this, and since this is primarily
23725 ## a Parsoid serializer test, marking this Parsoid only
23726 !!test
23727 Improperly nested inline or quotes tags with whitespace in between
23728 !! wikitext
23729 <span> <s>x</span> </s>
23730 ''' ''x''' ''
23731 !! html/parsoid
23732 <p><span> <s>x</s></span><s> </s>
23733 <b> <i>x</i></b><i> </i>
23734 </p>
23735 !!end
23736
23737 !!test
23738 Encapsulate protected attributes from wt
23739 !! wikitext
23740 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23741 !! html/parsoid
23742 <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>
23743 </body>
23744 !!end
23745
23746 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23747 ## Having nested or stray pre tags results in the attempt to add duplicates,
23748 ## causing an assertion fail. This test tries to prevent that situation.
23749 !!test
23750 Ensure ParagraphWrapper can deal with stray closing pre tags
23751 !!options
23752 parsoid=wt2html
23753 !! wikitext
23754 plain text</pre>
23755 !! html/parsoid
23756 plain text
23757 !!end
23758
23759 !!test
23760 1. Ensure fostered text content is wrapped in element nodes
23761 !!options
23762 parsoid=wt2html
23763 !! wikitext
23764 <table>hi</table><table>ho</table>
23765 !! html/parsoid
23766 <p>hi</p>
23767 <table></table>
23768 <p>ho</p>
23769 <table></table>
23770 !!end
23771
23772 !!test
23773 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23774 !!options
23775 parsoid=wt2html,wt2wt
23776 !! wikitext
23777 <table>
23778 <tr> || ||
23779 <td> a
23780 </table>
23781 !! html/parsoid
23782 <p> || ||
23783 </p><table>
23784 <tbody><tr><td> a</td></tr>
23785 </tbody></table>
23786 !!end
23787
23788 !!test
23789 Encapsulation properly handles null DSR information from foster box
23790 !!options
23791 parsoid=wt2html,wt2wt
23792 !! wikitext
23793 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23794 !! html/parsoid
23795 <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>
23796 !!end
23797
23798 !!test
23799 1. Encapsulate foster-parented transclusion content
23800 !!options
23801 parsoid=wt2wt,wt2html
23802 !! wikitext
23803 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23804 !! html/parsoid
23805 <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>
23806 <tbody>
23807 <tr>
23808 <td>bar</td>
23809 </tr>
23810 </tbody>
23811 </table>
23812 !!end
23813
23814 !!test
23815 2. Encapsulate foster-parented transclusion content
23816 !!options
23817 parsoid=wt2wt,wt2html
23818 !! wikitext
23819 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23820 !! html/parsoid
23821 <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>
23822 <table>
23823 <tbody>
23824 <tr>
23825 <td>bar</td>
23826 </tr>
23827 </tbody>
23828 </table>
23829 !!end
23830
23831 !!test
23832 3. Encapsulate foster-parented transclusion content
23833 !!options
23834 parsoid=wt2wt,wt2html
23835 !! wikitext
23836 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23837 !! html/parsoid
23838 <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;]}">
23839 <p>foo</p>
23840 </div>
23841 <table>
23842 <tbody>
23843 <tr>
23844 <td>bar</td>
23845 </tr>
23846 </tbody>
23847 </table>
23848 !!end
23849
23850 !!test
23851 4. Encapsulate foster-parented transclusion content
23852 !!options
23853 parsoid=wt2wt,wt2html
23854 !! wikitext
23855 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23856 !! html/parsoid
23857 <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;]}">
23858 <p>foo</p>
23859 </div>
23860 <table>
23861 <tbody>
23862 <tr>
23863 <td>bar</td>
23864 </tr>
23865 </tbody>
23866 </table>
23867 !!end
23868
23869 !!test
23870 5. Encapsulate foster-parented transclusion content
23871 !!options
23872 parsoid=wt2wt,wt2html
23873 !! wikitext
23874 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23875 !! html/parsoid
23876 <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>
23877 <table>
23878 <tbody>
23879 <tr>
23880 <td>
23881 <div>
23882 <p>foo</p>
23883 </div>
23884 </td>
23885 </tr>
23886 </tbody>
23887 </table>
23888 !!end
23889
23890 !!test
23891 6. Encapsulate foster-parented transclusion content
23892 !!options
23893 parsoid=wt2wt,wt2html
23894 !! wikitext
23895 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23896 !! html/parsoid
23897 <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>
23898 <table>
23899 <tbody>
23900 <tr>
23901 <td>
23902 <div>
23903 <p>foo</p>
23904 </div>
23905 </td>
23906 </tr>
23907 </tbody>
23908 </table>
23909 <p>ok</p>
23910 !!end
23911
23912 !!test
23913 7. Encapsulate foster-parented transclusion content
23914 !!options
23915 parsoid=wt2wt,wt2html
23916 !! wikitext
23917 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23918 !! html/parsoid
23919 <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>
23920 <table>
23921 <tbody>
23922 <tr>
23923 <td>bar</td>
23924 </tr>
23925 </tbody>
23926 </table>
23927 !!end
23928
23929 # Note that the wt is broken on purpose: the = should be {{=}} if you
23930 # don't want it to be a template parameter key.
23931 !!test
23932 8. Encapsulate foster-parented transclusion content
23933 !!options
23934 parsoid=wt2wt,wt2html
23935 !! wikitext
23936 {{echo|a
23937 }}{|{{echo|style='color:red'}}
23938 |-
23939 |b
23940 |}
23941 !! html/parsoid
23942 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23943 <span> </span>
23944 <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>
23945 <table>
23946 <tbody>
23947 <tr>
23948 <td>b</td>
23949 </tr>
23950 </tbody>
23951 </table>
23952 !!end
23953
23954 !!test
23955 9. Encapsulate foster-parented transclusion content
23956 !!options
23957 parsoid=wt2wt,wt2html
23958 !! wikitext
23959 <table>{{echo|hi</table>hello}}
23960 !! html/parsoid
23961 <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>
23962 !!end
23963
23964 !!test
23965 Table in fosterable position
23966 !!options
23967 parsoid=wt2html,wt2wt
23968 !! wikitext
23969 {{OpenTable}}
23970 <div>
23971 {|
23972 |}
23973 </div>
23974 |}
23975 !! html/parsoid
23976 <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">
23977 </span>
23978 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23979
23980 <table>
23981 </table>
23982 !!end
23983
23984 # Parsoid only for bug 64747
23985 !! test
23986 Properly encapsulate empty-content transclusions in fosterable positions
23987 !! wikitext
23988 <table>
23989 {{#if:|
23990 <td>foo</td>
23991 }}
23992 </table>
23993 !! html/parsoid
23994 <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":["","","",""]}]]}'>
23995
23996 </table>
23997 !! end
23998
23999 !!test
24000 Support <object> element with .data attribute
24001 !!options
24002 parsoid=html2wt
24003 !! html/parsoid
24004 <object data="test.swf"></object>
24005 !! wikitext
24006 <object data="test.swf"></object>
24007 !!end
24008
24009 !! test
24010 Don't block XML namespace declaration
24011 !! wikitext
24012 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24013 !! html/php
24014 <p><span>MediaWiki</span>
24015 </p>
24016 !! html/parsoid
24017 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24018 !! end
24019
24020 # -----------------------------------------------------------------
24021 # The following section of tests are primarily to spec requirements
24022 # around serialization of new/edited content.
24023 #
24024 # All these tests are marked Parsoid html2wt and html2html only
24025 # ----------------------------------------------------------------
24026
24027 # 'mi' is a localinterwiki prefix as well as a language
24028 !! test
24029 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24030 !! options
24031 parsoid=html2wt
24032 !! html/parsoid
24033 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24034 !! wikitext
24035 [[Foo]]
24036 !! end
24037
24038 # See T93839
24039 !! test
24040 New wikilinks should be serialized properly
24041 !! options
24042 parsoid=html2wt
24043 !! html/parsoid
24044 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24045 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24046 !! wikitext
24047 [[Foo]]
24048 [[Foo]]
24049 !! end
24050
24051 !! test
24052 New wiki links (href variations)
24053 !! options
24054 parsoid=html2wt
24055 !! html/parsoid
24056 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24057 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24058 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24059 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24060 !! wikitext
24061 [[Foo_bar]]
24062 [[Foo_bar]]
24063 [[Foo_bar]]
24064 [[Toxine bactérienne]]
24065 !! end
24066
24067 !! test
24068 New wiki links (content string variations)
24069 !! options
24070 parsoid=html2wt
24071 !! html/parsoid
24072 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24073 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24074 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24075 !! wikitext
24076 [[Foo_bar]]
24077 [[Foo bar]]
24078 [[Foo_bar|./Foo_bar]]
24079 !! end
24080
24081 !! test
24082 New category links (href variations)
24083 !! options
24084 parsoid=html2wt
24085 !! html/parsoid
24086 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24087 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24088 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24089 !! wikitext
24090 [[Category:Toxine bactérienne]]
24091 [[Category:Toxine bactérienne]]
24092 [[Category:Toxine bactérienne]]
24093 !! end
24094
24095 !! test
24096 New sol transparent links don't need indent-pre nowiki protection
24097 !! options
24098 parsoid=html2wt
24099 language=de
24100 !! html/parsoid
24101 <link rel="mw:PageProp/redirect" href="./Main_Page">
24102 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24103 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24104 !! wikitext
24105 #WEITERLEITUNG [[Main Page]]
24106 <!-- this is good --> [[Category:Good]]
24107 <!-- this is great --> [[Kategorie:Great]]
24108 !! end
24109
24110 !! test
24111 New interlanguage links (href variations)
24112 !! options
24113 parsoid=html2wt
24114 !! html/parsoid
24115 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24116 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24117 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24118 !! wikitext
24119 [[es:Toxine bactérienne]]
24120 [[es:Toxine_bactérienne]]
24121 [[es:Toxine_bactérienne]]
24122 !! end
24123
24124 !! test
24125 Image: Modifying size of an image (1)
24126 !! options
24127 parsoid={
24128 "modes": ["wt2wt"],
24129 "changes": [
24130 ["img[height]", "attr", "height", "22"],
24131 ["img[width]", "attr", "width", "200"]
24132 ]
24133 }
24134 !! wikitext
24135 [[Image:Foobar.jpg|230x230px]]
24136 !! wikitext/edited
24137 [[Image:Foobar.jpg|200x200px]]
24138 !!end
24139
24140 !! test
24141 Image: Modifying size of an image (2)
24142 !! options
24143 parsoid={
24144 "modes": ["wt2wt"],
24145 "changes": [
24146 ["img[height]", "attr", "height", "100"],
24147 ["img[width]", "attr", "width", "500"]
24148 ]
24149 }
24150 !! wikitext
24151 [[Image:Foobar.jpg|230x230px]]
24152 !! wikitext/edited
24153 [[Image:Foobar.jpg|500x500px]]
24154 !!end
24155
24156 # Change in size is ignored so long as class='mw-default-size'
24157 !! test
24158 Image: Modifying size of an image (3)
24159 !! options
24160 parsoid={
24161 "modes": ["wt2wt"],
24162 "changes": [
24163 ["figure[class]", "removeClass", "mw-default-size"],
24164 ["figure img", "attr", "height", "19"],
24165 ["figure img", "attr", "width", "170"]
24166 ]
24167 }
24168 !! wikitext
24169 [[Image:Foobar.jpg|thumb]]
24170 !! wikitext/edited
24171 [[Image:Foobar.jpg|thumb|170x170px]]
24172 !!end
24173
24174 !! test
24175 Image: Modifying alignment of an image (bug 48665)
24176 !! options
24177 parsoid={
24178 "modes": ["wt2wt"],
24179 "changes": [
24180 ["figure[class]", "removeClass", "mw-halign-right"],
24181 ["figure[class]", "addClass", "mw-halign-left"]
24182 ]
24183 }
24184 !! wikitext
24185 [[Image:Foobar.jpg|thumb|caption|right]]
24186 !! wikitext/edited
24187 [[Image:Foobar.jpg|thumb|caption|left]]
24188 !! end
24189
24190 !! test
24191 Image: Modifying mw-default-size of an frameless image (bug 62805)
24192 !! options
24193 parsoid={
24194 "modes": ["wt2wt"],
24195 "changes": [
24196 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24197 ]
24198 }
24199 !! wikitext
24200 [[Image:Foobar.jpg|frameless|right]]
24201 !! wikitext/edited
24202 [[Image:Foobar.jpg|frameless|right|220x220px]]
24203 !! end
24204
24205 !! test
24206 Image: Modifying valign of an image (bug 49221)
24207 !! options
24208 parsoid={
24209 "modes": ["wt2wt"],
24210 "changes": [
24211 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24212 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24213 ]
24214 }
24215 !! wikitext
24216 [[File:Foobar.jpg|20px|middle]]
24217 !! wikitext/edited
24218 [[File:Foobar.jpg|20px|text-top]]
24219 !! end
24220
24221 !! test
24222 Image: Modifying alt attribute of an image (bug 56400)
24223 !! options
24224 parsoid={
24225 "modes": ["wt2wt"],
24226 "changes": [
24227 ["img[alt]", "attr", "alt", "some alternate edited text"]
24228 ]
24229 }
24230 !! wikitext
24231 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24232 !! wikitext/edited
24233 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24234 !!end
24235
24236 !! test
24237 Image: Modifying caption of an image
24238 !! options
24239 parsoid={
24240 "modes": ["wt2wt"],
24241 "changes": [
24242 ["figcaption", "text", "new caption"]
24243 ]
24244 }
24245 !! wikitext
24246 [[Image:Foobar.jpg|thumb|original caption]]
24247 !! wikitext/edited
24248 [[Image:Foobar.jpg|thumb|new caption]]
24249 !!end
24250
24251 !! test
24252 Image: empty alt attribute (bug 48924)
24253 !! options
24254 parsoid
24255 !! wikitext
24256 [[File:Foobar.jpg|thumb|alt=|bar]]
24257 !! html
24258 <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>
24259 !! end
24260
24261 !! test
24262 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24263 !! options
24264 parsoid=html2wt
24265 language=ar
24266 disabled
24267 !! html/parsoid
24268 <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>
24269 !! wikitext
24270 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24271 !! end
24272
24273 !! test
24274 Image: Block level image should have \n before and after
24275 !! wikitext
24276 123
24277 [[File:Foobar.jpg|right|thumb|150x150px]]
24278 456
24279 !! html/parsoid
24280 <p>123</p>
24281 <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>
24282 <p>456</p>
24283 !!end
24284
24285 !! test
24286 Image: New block level image should have \n before and after (existing content)
24287 !! wikitext
24288 123
24289 [[File:Foobar.jpg|right|thumb|150x150px]]
24290 456
24291 !! html/parsoid
24292 <p>123</p>
24293 <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>
24294 <p>456</p>
24295 !!end
24296
24297 !! test
24298 Image: upright option (parsoid)
24299 !! wikitext
24300 [[File:Foobar.jpg|thumb|upright|caption]]
24301 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24302 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24303 !! html/parsoid
24304 <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>
24305 <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>
24306 <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>
24307 !!end
24308
24309 !! test
24310 Image: upright option is ignored on inline and frame images (parsoid)
24311 !! wikitext
24312 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24313 !! html/parsoid
24314 <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>
24315 !!end
24316
24317 !! test
24318 Image: from basic HTML (1)
24319 !! options
24320 parsoid=html2wt
24321 !! html/parsoid
24322 <span typeof="mw:Image">
24323 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24324 </span>
24325 !! wikitext
24326 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24327 !! end
24328
24329 !! test
24330 Image: from basic HTML (2)
24331 !! options
24332 parsoid=html2wt
24333 !! html/parsoid
24334 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24335 !! wikitext
24336 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24337 !! end
24338
24339 !! test
24340 Image: from basic HTML (3)
24341 !! options
24342 parsoid=html2wt
24343 !! html/parsoid
24344 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24345 !! wikitext
24346 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24347 !! end
24348
24349 !! test
24350 Image: from basic HTML (4)
24351 !! options
24352 parsoid=html2wt
24353 !! html/parsoid
24354 <img src="./File:Foobar.jpg">
24355 !! wikitext
24356 [[File:Foobar.jpg|link=]]
24357 !! end
24358
24359 !! test
24360 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24361 !! options
24362 parsoid=html2wt
24363 !! html/parsoid
24364 <ul>
24365 <li><p>foo</p></li>
24366 </ul>
24367 !! wikitext
24368 * foo
24369 !! end
24370
24371 !! test
24372 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24373 !! options
24374 parsoid=html2wt
24375 !! html/parsoid
24376 <ul> <li>foo</li></ul>
24377 !! wikitext
24378 * foo
24379 !! end
24380
24381 !! test
24382 Don't strip leading whitespace when handling indent-pre suppressing tags
24383 !! options
24384 parsoid=html2wt
24385 !! html/parsoid
24386 <table>
24387 <tr><td> indented row</td></tr>
24388 </table>
24389 <blockquote><p>
24390 <b>This is very bold of you!</b>
24391 </p>
24392 <table><tr><td>
24393 indented cell (no pre-wrapping!)
24394 </td></tr></table>
24395 </blockquote>
24396 <p>foo</p>
24397 <div>bar</div>
24398 !! wikitext
24399 {|
24400 | indented row
24401 |}
24402 <blockquote>
24403 '''This is very bold of you!'''
24404
24405 {|
24406 |
24407 indented cell (no pre-wrapping!)
24408 |}
24409 </blockquote>
24410 foo
24411 <div>bar</div>
24412 !! end
24413
24414 !! test
24415 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24416 !! options
24417 parsoid=html2wt
24418 !! html/parsoid
24419 <p>foo</p>
24420 <span>bar</span>
24421
24422 <span>foo2
24423 </span>bar2
24424
24425 <div>foo</div>
24426 <span>bar</span>
24427
24428 <div>
24429 <span>foo</span>
24430 </div>
24431 !! wikitext
24432 foo
24433 <nowiki> </nowiki><span>bar</span>
24434
24435 <span>foo2
24436 <nowiki> </nowiki></span>bar2
24437
24438 <div>foo</div>
24439 <nowiki> </nowiki><span>bar</span>
24440
24441 <div>
24442 <nowiki> </nowiki><span>foo</span>
24443 </div>
24444 !! end
24445
24446 !! test
24447 Lists: Dont insert newlines in a serialized list item.
24448 !! options
24449 parsoid=html2wt
24450 !! html/parsoid
24451 <ul><li>a<br>b</li><li>c</li></ul>
24452 !! wikitext
24453 * a<br>b
24454 * c
24455 !! end
24456
24457 !! test
24458 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24459 !! options
24460 parsoid={
24461 "modes": ["html2wt"],
24462 "scrubWikitext": false
24463 }
24464 !! html/parsoid
24465 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24466 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24467
24468 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24469 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24470
24471 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24472
24473 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24474 !! wikitext
24475 == hello there [[Category:A1]] ==
24476
24477 == [[Category:A2]] hi pal ==
24478
24479 == <!--foo--> [[Category:A3]] how goes it ==
24480
24481 == it goes well [[Category:A4]] <!--bar--> ==
24482
24483 ==howdy [[Category:A5]] ==
24484
24485 == __TOC__ ok ==
24486 !! end
24487
24488 !! test
24489 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24490 !! options
24491 parsoid={
24492 "modes": ["html2wt"],
24493 "scrubWikitext": true
24494 }
24495 !! html/parsoid
24496 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24497 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24498
24499 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24500 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24501
24502 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24503 !! wikitext
24504 == hello there ==
24505 [[Category:A1]]
24506 [[Category:A2]]
24507
24508 == hi pal ==
24509
24510 <!--foo--> [[Category:A3]]
24511
24512 == how goes it ==
24513
24514 == it goes well ==
24515 [[Category:A4]] <!--bar-->
24516
24517 __TOC__
24518
24519 == ok ==
24520 !! end
24521
24522 !! test
24523 Headings: Don't hoist metas that come from templates
24524 !! options
24525 parsoid={
24526 "modes": ["html2wt"],
24527 "scrubWikitext": true
24528 }
24529 !! html/parsoid
24530 <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>
24531 !! wikitext
24532 == {{echo|foo [[Category:Foo]]}} ==
24533 !! end
24534
24535 !! test
24536 Headings: Category in ref isn't hoisted
24537 !! options
24538 parsoid={
24539 "modes": ["html2wt"],
24540 "scrubWikitext": true
24541 }
24542 !! html/parsoid
24543 <h2> foo <span about="#mwt2" class="reference" 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">[1]</a></span> </h2>
24544
24545 <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>
24546 !! wikitext
24547 == foo <ref>bar
24548 [[Category:Baz]] </ref> ==
24549
24550 <references />
24551 !! end
24552
24553 !! test
24554 Parsoid: Serialize positional parameters with = in them as named parameter
24555 !! options
24556 parsoid=html2wt
24557 !! html/parsoid
24558 <p about="#mwt1" typeof="mw:Transclusion"
24559 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24560
24561 <p about="#mwt1" typeof="mw:Transclusion"
24562 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24563
24564 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24565 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24566 <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>
24567 !! wikitext
24568 {{echo|1 = f=oo}}
24569
24570 {{echo|1 = f=oo|2 = bar}}
24571
24572 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24573 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24574 {{echo|<nowiki>f=oo</nowiki>|bar}}
24575 !! end
24576
24577 !! test
24578 Parsoid: Serialize positional parameters with = in extlink as named parameter
24579 !! options
24580 parsoid=html2wt
24581 !! html/parsoid
24582 <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>
24583 !! wikitext
24584 {{echo|1 = http://stuff?is=ok}}
24585 !! end
24586
24587 !! test
24588 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24589 !! options
24590 parsoid=html2wt
24591 !! html/parsoid
24592 <div>a<p>b</p></div>
24593 <div>a
24594 <p>b</p></div>
24595 <div>
24596 a
24597 <p>b</p></div>
24598 !! wikitext
24599 <div>a
24600 b
24601 </div>
24602 <div>a
24603 b
24604 </div>
24605 <div>
24606 a
24607
24608 b
24609 </div>
24610 !! end
24611
24612 !! test
24613 Substrings resembling wikitext in hrefs should not get nowiki escapes
24614 !! options
24615 parsoid=html2wt
24616 !! html/parsoid
24617 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24618 !! wikitext
24619 [[Foo''bar''baz]]
24620 !! end
24621
24622 !! test
24623 Enforce single-line context in the serializer
24624 !! options
24625 parsoid=html2wt
24626 !! html/parsoid
24627 <h2>testing
24628 123</h2>
24629
24630 <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">
24631 </span><span about="#mwt1">you</span> </h2>
24632
24633 <h2> foo <span about="#mwt2" class="reference" 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">[1]</a></span> </h2>
24634
24635 <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
24636 there</span></li></ol>
24637
24638 <ul><li>asd
24639 sdf</li></ul>
24640
24641 <ul><li>foo
24642 bar
24643 baz</li>
24644 <li>foo <b>bar</b>
24645 baz</li></ul>
24646
24647 <dl><dt>hi
24648 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24649 ho</dd></dl>
24650
24651 <dl><dd> <table>
24652 <tbody><tr><td> ha
24653 ha
24654 ha</td></tr>
24655 </tbody></table></dd></dl>
24656 !! wikitext
24657 == testing 123 ==
24658
24659 == hi {{bogus|there
24660 you}} ==
24661
24662 == foo <ref>hello
24663 there</ref> ==
24664
24665 <references />
24666
24667 * asd sdf
24668
24669 * foo bar baz
24670 * foo '''bar''' baz
24671
24672 ; hi ho : hi ho
24673
24674 : {|
24675 | ha
24676 ha
24677 ha
24678 |}
24679 !! end
24680
24681 !! test
24682 Serialize new placeholder space without spans
24683 !! options
24684 parsoid=html2wt
24685 !! html/parsoid
24686 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24687
24688 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24689
24690 <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>
24691 !! wikitext
24692 foo : bar
24693
24694 foo : bar
24695
24696 <ref>foo : bar</ref>ok
24697 !! end
24698
24699
24700 #-----------------------
24701 # Tag minimization tests
24702 #-----------------------
24703
24704 !! test
24705 1. I/B quote minimization: wikitext-only tags should be combined
24706 !! options
24707 parsoid=html2wt
24708 !! html/parsoid
24709 <p><i>A</i><i>B</i></p>
24710 <p><b>A</b><b>B</b></p>
24711 <p><i>A</i><b><i>B</i></b></p>
24712 <p><b>A</b><i><b>B</b></i></p>
24713 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24714 <p><i><b>A</b></i><i><b>B</b></i></p>
24715 <p><i><b>A</b></i><b><i>B</i></b></p>
24716 <p><b><i>A</i></b><i><b>B</b></i></p>
24717 !! wikitext
24718 ''AB''
24719
24720 '''AB'''
24721
24722 ''A'''B'''''
24723
24724 '''A''B'''''
24725
24726 '''A''BC''D'''
24727
24728 '''''AB'''''
24729
24730 '''''AB'''''
24731
24732 '''''AB'''''
24733 !! end
24734
24735 !! test
24736 2. I/B quote minimization: wikitext and html tags should not be combined
24737 !! options
24738 parsoid=html2wt
24739 !! html/parsoid
24740 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24741 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24742 !! wikitext
24743 ''A''<i>B</i>
24744
24745 ''A''<nowiki/>'''<i>B</i>'''
24746 !! end
24747
24748 !! test
24749 3. I/B quote minimization: templated content stops minimization
24750 !! options
24751 parsoid=html2wt
24752 !! html/parsoid
24753 <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>
24754 <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>
24755 !! wikitext
24756 ''A''{{echo|''B''}}
24757
24758 ''A''{{echo|'''''B'''''}}
24759 !! end
24760
24761 !! test
24762 4. I/B quote minimization: new content should be mimimized with adjacent old content
24763 !! options
24764 parsoid=html2wt
24765 !! html/parsoid
24766 <p><i>A</i><i>B</i></p>
24767 <p><b>A</b><b>B</b></p>
24768 <p><i>A</i><b><i>B</i></b></p>
24769 !! wikitext
24770 ''AB''
24771
24772 '''AB'''
24773
24774 ''A'''B'''''
24775 !! end
24776
24777 !! test
24778 5a. Merge adjacent quote nodes if they've been edited
24779 !! options
24780 parsoid={
24781 "modes": ["wt2wt", "selser"],
24782 "changes": [
24783 ["p", "contents", "remove", ":contains('b')"]
24784 ]
24785 }
24786 !! wikitext
24787 ''a''b''c''
24788 !! wikitext/edited
24789 ''ac''
24790 !! end
24791
24792 !! test
24793 5b. Merge adjacent quote nodes if they've been edited
24794 !! options
24795 parsoid={
24796 "modes": ["wt2wt", "selser"],
24797 "changes": [
24798 ["#x", "remove"]
24799 ]
24800 }
24801 !! wikitext
24802 ''a''<span id="x">b</span>''c''
24803 !! wikitext/edited
24804 ''ac''
24805 !! end
24806
24807 !! test
24808 1. Merge adjacent link nodes as long as at least one element is new
24809 !! options
24810 parsoid={
24811 "modes": ["html2wt"],
24812 "scrubWikitext": true
24813 }
24814 !! html/parsoid
24815 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24816 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24817 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24818 !! wikitext
24819 [[Football]]
24820 [[Football]]
24821 [[Football|Foot]][[Football|ball]]
24822 !! end
24823
24824 !! test
24825 2. Merge adjacent link nodes and enable additional normalizations
24826 !! options
24827 parsoid={
24828 "modes": ["html2wt"],
24829 "scrubWikitext": true
24830 }
24831 !! html/parsoid
24832 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24833 !! wikitext
24834 [[Football|''Football'']]
24835 !! end
24836
24837 !! test
24838 3. Don't merge adjacent link nodes if scrubWikitext is false
24839 !! options
24840 parsoid={
24841 "modes": ["html2wt"],
24842 "scrubWikitext": false
24843 }
24844 !! html/parsoid
24845 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24846 !! wikitext
24847 [[Football|Foot]][[Football|ball]]
24848 !! end
24849
24850 #------------------------------
24851 # End of tag minimization tests
24852 #------------------------------
24853
24854 !!test
24855 Bug 54262: New entities
24856 !! options
24857 parsoid=html2wt
24858 !! html/parsoid
24859 <span typeof="mw:Entity">&nbsp;</span>
24860 !! wikitext
24861 &nbsp;
24862 !! end
24863
24864 ## Note that there is no wikitext output for 'unknownproperty' ##
24865 ## Unknown magic words are silently dropped ##
24866
24867 !! test
24868 Magic words
24869 !! options
24870 parsoid=html2wt
24871 !! html/parsoid
24872 <meta property='mw:PageProp/toc' />
24873 <meta property='mw:PageProp/notoc' />
24874 <meta property='mw:PageProp/forcetoc' />
24875 <meta property='mw:PageProp/index' />
24876 <meta property='mw:PageProp/noindex' />
24877 <meta property='mw:PageProp/nogallery' />
24878 <meta property='mw:PageProp/noeditsection' />
24879 <meta property='mw:PageProp/notitleconvert' />
24880 <meta property='mw:PageProp/nocontentconvert' />
24881 <meta property='mw:PageProp/unknownproperty' />
24882 !! wikitext
24883 __TOC__
24884 __NOTOC__
24885 __FORCETOC__
24886 __INDEX__
24887 __NOINDEX__
24888 __NOGALLERY__
24889 __NOEDITSECTION__
24890 __NOTITLECONVERT__
24891 __NOCONTENTCONVERT__
24892 !! end
24893
24894 !! test
24895 Consecutive <pre>s should not get merged
24896 !! options
24897 parsoid=html2wt,html2html
24898 !! html/parsoid
24899 <pre>a</pre><pre>b</pre>
24900
24901 <pre>c
24902 </pre><pre>
24903 d</pre>
24904
24905 <pre>e
24906
24907 </pre><pre>
24908
24909 f</pre>
24910 !! wikitext
24911 a
24912
24913 b
24914
24915 c
24916
24917 d
24918
24919 e
24920
24921
24922
24923 f
24924 !! end
24925
24926 !! test
24927 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24928 !! options
24929 parsoid=html2wt
24930 !! html/parsoid
24931 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24932 !! wikitext
24933 [[Special:BookSources/1234567890|ISBN 1234567895]]
24934 !! end
24935
24936 !! test
24937 Edited RFC links not serializable as RFC links should serialize as extlinks
24938 !! options
24939 parsoid=html2wt
24940 !! html/parsoid
24941 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24942 !! wikitext
24943 [//tools.ietf.org/html/rfc123 New RFC]
24944 !! end
24945
24946 !! test
24947 Edited PMID links not serializable as PMID links should serialize as extlinks
24948 !! options
24949 parsoid=html2wt
24950 !! html/parsoid
24951 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24952 !! wikitext
24953 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24954 !! end
24955
24956 !! test
24957 WTS of autolinks with trailing/surrounding context
24958 !! options
24959 parsoid=html2wt
24960 !! html/parsoid
24961 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24962 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24963 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24964 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24965 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24966 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24967 !! wikitext
24968 http://cscott.net<nowiki/>'''foo'''
24969
24970 http://cscott.net<b>foo</b>
24971
24972 '''http://cscott.net<nowiki/>'''
24973
24974 '''http://cscott.net '''
24975
24976 '''http://cscott.net<nowiki/>x'''
24977
24978 http://cscott.net<nowiki/>x
24979 !! end
24980
24981 !! test
24982 WTS of autolinks with nowikis (round-trip)
24983 !! wikitext
24984 x<nowiki/>http://cscott.net<nowiki/>x
24985 !! html/parsoid
24986 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24987 !! end
24988
24989 # this is the "easy" test because it leaves in place all the
24990 # data-parsoid information indicating this is an autolink
24991 !! test
24992 WTS of autolinks with escapes (editing)
24993 !! options
24994 parsoid={
24995 "modes": ["wt2wt"],
24996 "changes": [
24997 [ "meta", "remove" ]
24998 ]
24999 }
25000 !! wikitext
25001 x<nowiki/>http://cscott.net<nowiki/>x
25002 !! wikitext/edited
25003 x<nowiki/>http://cscott.net<nowiki/>x
25004 !! end
25005
25006 !! test
25007 WTS of edited autolink-like text (T103364)
25008 !! options
25009 parsoid={
25010 "modes": ["wt2wt"],
25011 "changes": [
25012 [ "span[typeof]", "removeAttr", "typeof" ]
25013 ]
25014 }
25015 !! wikitext
25016 Not a link: <nowiki>http://example.com</nowiki>.
25017 !! wikitext/edited
25018 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25019 !! end
25020
25021 !! test
25022 WTS of newly-authored autolink-like text (T103364)
25023 !! options
25024 parsoid=html2wt
25025 !! html/parsoid
25026 <p>http://example.com is not a link.</p>
25027 !! wikitext
25028 <nowiki>http://example.com is not a link.</nowiki>
25029 !! end
25030
25031 !! test
25032 WTS of autolink-like text after an autolink (T108563)
25033 !! options
25034 parsoid=html2wt
25035 !! html/parsoid
25036 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25037 !! wikitext
25038 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25039 !! end
25040
25041 !! test
25042 Edited Redirect link should emit a non-piped wikitext link
25043 !! options
25044 parsoid=html2wt
25045 !! html/parsoid
25046 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25047 !! wikitext
25048 #REDIRECT [[Bar]]
25049 !! end
25050
25051 !! test
25052 T75121: Infer extension name from typeOf if data-mw is not present
25053 !! options
25054 parsoid=html2wt
25055 !! html/parsoid
25056 <div typeOf="mw:Extension/foo"></div>
25057 !! wikitext
25058 <foo />
25059 !! end
25060
25061 # Note that the <p> wrapping isn't present in PHP parser output
25062 # The important thing for this test is that P-wrapping doesn't
25063 # interfere with the <nowiki> protection for leading - in <td>
25064 # (which isn't necessary for <th>).
25065 !! test
25066 T88318: p-wrapped dash in table.
25067 !! options
25068 parsoid=html2wt,wt2wt
25069 !! html/parsoid
25070 <table><tbody>
25071 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25072 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25073 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25074 </tbody></table>
25075 !! wikitext
25076 {|
25077 !-
25078 !-
25079 |-
25080 |<nowiki>-</nowiki>
25081 |<nowiki>- </nowiki>
25082 |-
25083 |<small>-</small>
25084 |<br>
25085 -
25086 |<br>
25087 -
25088 |}
25089 !! html/php+tidy
25090 <table>
25091 <tr>
25092 <th>-</th>
25093 <th>-</th>
25094 </tr>
25095 <tr>
25096 <td>-</td>
25097 <td>-</td>
25098 </tr>
25099 <tr>
25100 <td><small>-</small></td>
25101 <td><br />
25102 <p>-</p>
25103 </td>
25104 <td><br />
25105 <p>-</p>
25106 </td>
25107 </tr>
25108 </table>
25109 !! end
25110
25111 !! test
25112 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25113 !! options
25114 parsoid=html2wt
25115 !! html/parsoid
25116 <table id='mwAb'>
25117 <td id='mwAc'>foo</td>
25118 <td id='serialize-this'>bar</td>
25119 </table>
25120 !! wikitext
25121 {|
25122 |foo
25123 | id="serialize-this" |bar
25124 |}
25125 !! end
25126
25127 !! test
25128 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25129 !! options
25130 parsoid=html2wt
25131 !! html/parsoid
25132 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25133 !! wikitext
25134 <div id="hello">ok</div>
25135 !! end
25136
25137 !! test
25138 WTS change modes
25139 !! options
25140 parsoid={
25141 "modes": ["wt2wt"],
25142 "changes": [
25143 [ "#xyz", "before", "<b>before</b> stuff " ],
25144 [ "#xyz", "after", " stuff <i>after</i>" ],
25145 [ "#xyz", "html", "x <b>y</b> z" ]
25146 ]
25147 }
25148 !! wikitext
25149 <span id="xyz">hello</span>
25150 !! wikitext/edited
25151 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25152 !! end
25153
25154 !! test
25155 Never serialize a-tag as html, regardless of what data-parsoid has to say
25156 !! options
25157 parsoid=html2wt
25158 !! html/parsoid
25159 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25160 !! wikitext
25161 [[Foo]]
25162 !! end
25163
25164 ## SSS FIXME: This is broken output nevertheless.
25165 ## What might be a reasonable non-broken output for this?
25166 ## This is an edge case unlikely to be seen in production
25167 ## that I am not wasting more time on this right now.
25168 !! test
25169 Never serialize a-tag as html, no matter what attributes it has
25170 !! options
25171 parsoid=html2wt
25172 !! html/parsoid
25173 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25174 !! wikitext
25175 [http://boo.org http://boohoo.org]
25176 !! end
25177
25178 # Misnested is an indication that selser can reuse the source but these have
25179 # shown to sneak through on occasion. See T101768.
25180 # The original wikitext here is: [http://test.com [[one]] two three]
25181 !! test
25182 Strip span tags added to mark as misnested
25183 !! options
25184 parsoid=html2wt
25185 !! html/parsoid
25186 <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>
25187 !! wikitext
25188 [http://test.com][[one]] two three
25189 !! end
25190
25191 # --------------------------------------------
25192 # Tests spec'ing wikitext serialization norms |
25193 # --------------------------------------------
25194
25195 !! test
25196 Lists: Add space after bullets
25197 !! options
25198 parsoid=html2wt
25199 !! html/parsoid
25200 <ul>
25201 <li>foo</li>
25202 <li> bar</li>
25203 <li><span> baz</span></li>
25204 </ul>
25205 !! wikitext
25206 * foo
25207 * bar
25208 * <span> baz</span>
25209 !! end
25210
25211 !! test
25212 1. Headings: Add space before/after == (T53744)
25213 !! options
25214 parsoid=html2wt
25215 !! html/parsoid
25216 <h2>foo</h2>
25217 <h2> bar</h2>
25218 <h2>baz </h2>
25219 <h2><span> baz</span></h2>
25220 !! wikitext
25221 == foo ==
25222
25223 == bar ==
25224
25225 == baz ==
25226
25227 == <span> baz</span> ==
25228 !! end
25229
25230 !! test
25231 2. Headings: Add space before/after == even after hoisted content
25232 !! options
25233 parsoid={
25234 "modes": ["html2wt"],
25235 "scrubWikitext": true
25236 }
25237 !! html/parsoid
25238 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25239 !! wikitext
25240 [[Category:A2]]
25241
25242 == ok ==
25243 !! end
25244
25245 !! test
25246 1. Headings: suppress newly created empty headings
25247 !! options
25248 parsoid={
25249 "modes": ["html2wt"],
25250 "scrubWikitext": true
25251 }
25252 !! html/parsoid
25253 <h2></h2>
25254 !! wikitext
25255 !! end
25256
25257 !! test
25258 2. Headings: don't suppress empty headings if scrubWikitext is false
25259 !! options
25260 parsoid=html2wt
25261 !! html/parsoid
25262 <h2></h2>
25263 !! wikitext
25264 ==<nowiki/>==
25265 !! end
25266
25267 !! test
25268 3. Headings: suppress empty headings on edits
25269 !! options
25270 parsoid={
25271 "modes": ["selser"],
25272 "scrubWikitext": true,
25273 "changes": [
25274 [ "#x", "remove"]
25275 ]
25276 }
25277 !! wikitext
25278 ==<span id="x">foo</span>==
25279 !! wikitext/edited
25280 !! end
25281
25282 !! test
25283 1. WT Quote Tags: suppress newly created empty style tags
25284 !! options
25285 parsoid={
25286 "modes": ["html2wt"],
25287 "scrubWikitext": true
25288 }
25289 !! html/parsoid
25290 <i></i><b></b>
25291 !! wikitext
25292 !! end
25293
25294 !! test
25295 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25296 !! options
25297 parsoid=html2wt
25298 !! html/parsoid
25299 <i></i><b></b>
25300 !! wikitext
25301 ''<nowiki/>'''''<nowiki/>'''
25302 !! end
25303
25304 !! test
25305 3. WT Quote Tags: suppress empty style tags on edits
25306 !! options
25307 parsoid={
25308 "modes": ["selser"],
25309 "scrubWikitext": true,
25310 "changes": [
25311 [ "#x", "remove"]
25312 ]
25313 }
25314 !! wikitext
25315 '''<span id="x">foo</span>'''
25316 !! wikitext/edited
25317 !! end
25318
25319 !! test
25320 1. Anchors: suppress newly created empty anchors
25321 !! options
25322 parsoid={
25323 "modes": ["html2wt"],
25324 "scrubWikitext": true
25325 }
25326 !! html/parsoid
25327 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25328 !! wikitext
25329 !! end
25330
25331 !! test
25332 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25333 !! options
25334 parsoid={
25335 "modes": ["html2wt"],
25336 "scrubWikitext": false
25337 }
25338 !! html/parsoid
25339 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25340 !! wikitext
25341 [[Test|<nowiki/>]]
25342 !! end
25343
25344 !! test
25345 3. Anchors: suppress empty anchors on edits
25346 !! options
25347 parsoid={
25348 "modes": ["selser"],
25349 "scrubWikitext": true,
25350 "changes": [
25351 [ "#x", "remove"]
25352 ]
25353 }
25354 !! wikitext
25355 [[Test|<span id="x">foo</span>]]
25356 !! wikitext/edited
25357 !! end
25358
25359 !! test
25360 3a. Anchors: do not suppress numbered extlinks
25361 !! options
25362 parsoid={
25363 "modes": ["wt2wt"],
25364 "scrubWikitext": true
25365 }
25366 !! wikitext
25367 [http://foo.com]
25368 !! html/parsoid
25369 <a rel="mw:ExtLink" href="http://foo.com"></a>
25370 !! end
25371
25372 !! test
25373 3b. Anchors: do not suppress numbered extlinks
25374 !! options
25375 parsoid={
25376 "modes": ["wt2wt"],
25377 "scrubWikitext": true,
25378 "changes": [
25379 [ "#x", "remove"]
25380 ]
25381 }
25382 !! wikitext
25383 [http://foo.com <span id="x">foo</span>]
25384 !! wikitext/edited
25385 [http://foo.com]
25386 !! end
25387
25388 !!test
25389 Normalizations should be restricted to edited content
25390 !!options
25391 parsoid={
25392 "modes": ["selser"],
25393 "scrubWikitext": true,
25394 "changes": [
25395 [ "h1", "before", "<i></i>"]
25396 ]
25397 }
25398 !!wikitext
25399 a
25400 = =
25401 b
25402 !!wikitext/edited
25403 a
25404 = =
25405 b
25406 !!end
25407
25408 !! test
25409 1. Multiple normalizations (html2wt)
25410 !! options
25411 parsoid={
25412 "modes": ["html2wt"],
25413 "scrubWikitext": true
25414 }
25415 !! html
25416 <h2><i></i></h2>
25417 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25418 </a><b><i></i></b>x</p>
25419 !! wikitext
25420
25421 [[foo]]
25422 x
25423
25424 !! end
25425
25426 !! test
25427 2. Multiple normalizations (selser)
25428 !! options
25429 parsoid={
25430 "modes": ["selser"],
25431 "scrubWikitext": true,
25432 "changes": [
25433 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25434 ]
25435 }
25436 !! wikitext
25437 <span id="x">foo</span>
25438 !! wikitext/edited
25439 <span id="x">foo</span>
25440
25441 x
25442 !! end
25443
25444 !! test
25445 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25446 !! options
25447 parsoid={
25448 "modes": ["html2wt"],
25449 "scrubWikitext": true
25450 }
25451 !! html/parsoid
25452 <p> hi</p>
25453 <p> hello</p>
25454 !! wikitext
25455 hi
25456
25457 hello
25458 !! end
25459
25460 !! test
25461 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25462 !! options
25463 parsoid=html2wt
25464 !! html/parsoid
25465 <p> hi</p>
25466 <p> hello</p>
25467 !! wikitext
25468 <nowiki> </nowiki>hi
25469
25470 <nowiki> </nowiki> hello
25471 !! end
25472
25473 !! test
25474 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25475 !! options
25476 parsoid={
25477 "modes": ["html2wt"],
25478 "scrubWikitext": true
25479 }
25480 !! html/parsoid
25481 <p>Foo
25482 bar
25483 baz</p>
25484
25485 <table><tr><td>Foo
25486 bar
25487 baz bang</td></tr></table>
25488
25489 <p><!--boo--> foo
25490 bar</p>
25491
25492 <p> foo
25493 bar<span>boo</span></p>
25494 !! wikitext
25495 Foo
25496 bar
25497 baz
25498
25499 {|
25500 |Foo
25501 bar
25502 baz bang
25503 |}
25504
25505 <!--boo-->foo
25506 bar
25507
25508 foo
25509 bar<span>boo</span>
25510 !! end
25511
25512 !! test
25513 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25514 !! options
25515 parsoid={
25516 "modes": ["selser"],
25517 "scrubWikitext": true,
25518 "changes": [
25519 [ "p", "html", " a\n b" ]
25520 ]
25521 }
25522 !! wikitext
25523 xyz
25524 !! wikitext/edited
25525 a
25526 b
25527 !! end
25528
25529 !! test
25530 1. New links that end in spaces
25531 !! options
25532 parsoid={
25533 "modes": ["html2wt"],
25534 "scrubWikitext": false
25535 }
25536 !! html/parsoid
25537 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25538 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25539 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25540 !! wikitext
25541 [[Berlin ]]<nowiki/>is the capital of Germany.
25542
25543 [[Foo ]]'''bar'''
25544
25545 [[Boston ]] is a city.
25546 !! end
25547
25548 !! test
25549 2. New links that end in spaces
25550 !! options
25551 parsoid={
25552 "modes": ["html2wt"],
25553 "scrubWikitext": true
25554 }
25555 !! html/parsoid
25556 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25557 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25558 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25559 !! wikitext
25560 [[Berlin]] is the capital of Germany.
25561
25562 [[Foo]] '''bar'''
25563
25564 [[Boston]] is a city.
25565 !! end
25566
25567 !! test
25568 1. Table cells with escapable prefixes
25569 !! options
25570 parsoid={
25571 "modes": ["html2wt"],
25572 "scrubWikitext": false
25573 }
25574 !! html
25575 <table>
25576 <tr><td>a</td></tr>
25577 <tr><td>-</td></tr>
25578 <tr><td>+</td></tr>
25579 </table>
25580 !! wikitext
25581 {|
25582 |a
25583 |-
25584 |<nowiki>-</nowiki>
25585 |-
25586 |<nowiki>+</nowiki>
25587 |}
25588 !! end
25589
25590 !! test
25591 2. Table cells with escapable prefixes
25592 !! options
25593 parsoid={
25594 "modes": ["html2wt"],
25595 "scrubWikitext": true
25596 }
25597 !! html
25598 <table>
25599 <tr><td>a</td></tr>
25600 <tr><td>-</td></tr>
25601 <tr><td>+</td></tr>
25602 </table>
25603 !! wikitext
25604 {|
25605 |a
25606 |-
25607 | -
25608 |-
25609 | +
25610 |}
25611 !! end
25612
25613 !! test
25614 3a. Table cells with escapable prefixes after edits
25615 !! options
25616 parsoid={
25617 "modes": ["selser"],
25618 "scrubWikitext": true,
25619 "changes": [
25620 [ "table tbody tr:first-child td:first-child", "remove"]
25621 ]
25622 }
25623 !! wikitext
25624 {|
25625 |a||-
25626 |}
25627 !! wikitext/edited
25628 {|
25629 | -
25630 |}
25631 !! end
25632
25633 !! test
25634 3b. Table cells with escapable prefixes after edits
25635 !! options
25636 parsoid={
25637 "modes": ["selser"],
25638 "scrubWikitext": true,
25639 "changes": [
25640 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25641 [ "#x", "remove" ]
25642 ]
25643 }
25644 !! wikitext
25645 {|
25646 |pqr
25647 |<span id="x">foo</span>+
25648 |}
25649 !! wikitext/edited
25650 {|
25651 | -
25652 | +
25653 |}
25654 !! end
25655
25656 # FIXME: This test will fail because
25657 # normalization doesn't realize that the id attribute
25658 # will eliminate the escapable scenario
25659 !! test
25660 4a. Table cells without escapable prefixes after edits
25661 !! options
25662 parsoid={
25663 "modes": ["selser"],
25664 "scrubWikitext": true,
25665 "changes": [
25666 [ "#x", "html", "-" ]
25667 ]
25668 }
25669 !! wikitext
25670 {|
25671 | id="x" |abcd
25672 |}
25673 !! wikitext/edited
25674 {|
25675 | id="x" |-
25676 |}
25677 !! end
25678
25679 ## This tests normalizer's ability to discriminate between
25680 ## cells having identical content.
25681 !! test
25682 4b. Table cells without escapable prefixes after edits
25683 !! options
25684 parsoid={
25685 "modes": ["selser"],
25686 "scrubWikitext": true,
25687 "changes": [
25688 [ "td", "html", "-" ]
25689 ]
25690 }
25691 !! wikitext
25692 {|
25693 |a||b
25694 |}
25695 !! wikitext/edited
25696 {|
25697 | -||-
25698 |}
25699 !! end
25700
25701 ## This tests normalizer's ability to not be tripped by
25702 ## comments (and whitespace)
25703 !! test
25704 4c. Table cells without escapable prefixes after edits
25705 !! options
25706 parsoid={
25707 "modes": ["selser"],
25708 "scrubWikitext": true,
25709 "changes": [
25710 [ "table tbody tr td:first-child", "remove" ]
25711 ]
25712 }
25713 !! wikitext
25714 {|
25715 |-
25716 <!--foo--> |a||-
25717 |}
25718 !! wikitext/edited
25719 {|
25720 |-
25721 <!--foo--> | -
25722 |}
25723 !! end
25724
25725 ## This tests normalizer's ability to handle HTML cells
25726 !! test
25727 4d. Table cells without escapable prefixes after edits
25728 !! options
25729 parsoid={
25730 "modes": ["selser"],
25731 "scrubWikitext": true,
25732 "changes": [
25733 [ "td", "html", "-" ]
25734 ]
25735 }
25736 !! wikitext
25737 <table>
25738 <tr><td>a</td></tr>
25739 </table>
25740 !! wikitext/edited
25741 <table>
25742 <tr><td>-</td></tr>
25743 </table>
25744 !! end
25745
25746 # ---------------------------------------------------
25747 # End of tests spec'ing wikitext serialization norms |
25748 # ---------------------------------------------------
25749
25750 # -----------------------------------------------------------------
25751 # End of section for Parsoid-only html2wt tests for serialization
25752 # of new content
25753 # -----------------------------------------------------------------
25754
25755 # -----------------------------------------------------------------
25756 # The following section of tests are primarily to spec behavior of
25757 # the selective serializer. All these tests have manual selser
25758 # changes. The automated selser changes for all tests handle the
25759 # wide variation of changes, but these tests here capture specs
25760 # deterministically.
25761 # ----------------------------------------------------------------
25762
25763 ## T90517
25764 !! test
25765 Selser: New comments should not be lost
25766 !! options
25767 parsoid={
25768 "modes": ["selser"],
25769 "changes": [
25770 [ "#a", "after", "<!--c1-->" ],
25771 [ "#b", "before", "<!--c2-->" ]
25772 ]
25773 }
25774 !! wikitext
25775 <span id="a">a</span>
25776
25777 <span id="b">b</span>
25778 !! wikitext/edited
25779 <span id="a">a</span><!--c1-->
25780
25781 <!--c2--><span id="b">b</span>
25782 !! end
25783
25784 ## T89383
25785 !! test
25786 Selser: Check for validity of DSR before using it
25787 !! options
25788 parsoid={
25789 "modes": ["selser"],
25790 "changes": [
25791 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25792 ]
25793 }
25794 !! wikitext
25795 <span id="a">a</span>
25796 !! wikitext/edited
25797 {{DISPLAYTITLE:foo}}
25798 <span id="a">a</span>
25799 !! end
25800
25801 !! test
25802 1. DOMDiff: Changes to <ref> content should be looked up using id
25803 !! options
25804 parsoid={
25805 "modes": ["selser"],
25806 "changes": [
25807 ["#X", "after", "bar"],
25808 ["#Y", "after", "baz"]
25809 ]
25810 }
25811 !! wikitext
25812 X <ref><span id="X">foo</span></ref>
25813 Y <ref name="a" />
25814 <references>
25815 <ref name="a"><span id="Y">foo</span></ref>
25816 </references>
25817 !! wikitext/edited
25818 X <ref><span id="X">foo</span>bar</ref>
25819 Y <ref name="a" />
25820 <references>
25821 <ref name="a"><span id="Y">foo</span>baz</ref>
25822 </references>
25823 !! end
25824
25825 !! test
25826 2. DOMDiff: Changes to <ref> content should be looked up using id
25827 !! options
25828 parsoid={
25829 "modes": ["selser"],
25830 "changes": [
25831 ["#Z", "after", "bar"]
25832 ]
25833 }
25834 !! wikitext
25835 A <ref>foo bar for a</ref>
25836 B <ref group="X" name="b" />
25837
25838 <references />
25839
25840 <references group="X">
25841 <ref name="b"><span id="Z">foo</span></ref>
25842 </references>
25843 !! wikitext/edited
25844 A <ref>foo bar for a</ref>
25845 B <ref group="X" name="b" />
25846
25847 <references />
25848
25849 <references group="X">
25850 <ref name="b"><span id="Z">foo</span>bar</ref>
25851 </references>
25852 !! end