Merge "When aborting EnhancedRC block line, block should reflect that"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1522 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1534 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html/php
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! html/parsoid
2068 <p> This is not
2069 preformatted text.</p>
2070 <pre>This is preformatted text.
2071 So is this.</pre>
2072 !! end
2073
2074 !! test
2075 Space before tab needs nowiki pre protection
2076 !! options
2077 parsoid=html2wt
2078 !! html/parsoid
2079 <p> a</p>
2080 !! wikitext
2081 <nowiki> </nowiki> a
2082 !! end
2083
2084 !! test
2085 Ident preformatting with inline content
2086 !! wikitext
2087 a
2088 ''b''
2089 !! html
2090 <pre>a
2091 <i>b</i>
2092 </pre>
2093 !! end
2094
2095 !! test
2096 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2097 !! wikitext
2098 <pre><nowiki>
2099 <b>
2100 <cite>
2101 <em>
2102 </nowiki></pre>
2103 !! html
2104 <pre>
2105 &lt;b&gt;
2106 &lt;cite&gt;
2107 &lt;em&gt;
2108 </pre>
2109
2110 !! end
2111
2112 !! test
2113 Regression with preformatted in <center>
2114 !! wikitext
2115 <center>
2116 Blah
2117 </center>
2118 !! html
2119 <center>
2120 <pre>Blah
2121 </pre>
2122 </center>
2123
2124 !! end
2125
2126 !! test
2127 Bug 52763: Preformatted in <blockquote>
2128 !! wikitext
2129 <blockquote>
2130 Blah
2131 {|
2132 |
2133 indented cell (no pre-wrapping!)
2134 |}
2135 </blockquote>
2136 !! html
2137 <blockquote>
2138 <p> Blah
2139 </p>
2140 <table>
2141 <tr>
2142 <td>
2143 <p> indented cell (no pre-wrapping!)
2144 </p>
2145 </td></tr></table>
2146 </blockquote>
2147
2148 !! end
2149
2150 !! test
2151 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2152 !! wikitext
2153 <blockquote>
2154 Foo
2155
2156 Bar
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo
2161 </p><p>Bar
2162 </p>
2163 </blockquote>
2164
2165 !! end
2166
2167 !! test
2168 Bug 15491: <ins>/<del> in blockquote
2169 !! wikitext
2170 <blockquote>
2171 Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>
2175 <p>Foo <del>bar</del> <ins>baz</ins> quux
2176 </p>
2177 </blockquote>
2178
2179 !! end
2180
2181 # Note that the p-wrapping is newline sensitive, which could be
2182 # considered a bug: tidy will wrap only the 'Foo' in the example
2183 # below in a <p> tag. (see comment 23-25 of bug #6200)
2184 !! test
2185 Bug 15491: <ins>/<del> in blockquote (2)
2186 !! wikitext
2187 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2188 </blockquote>
2189 !! html
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192
2193 !! html+tidy
2194 <blockquote>
2195 <p>Foo</p>
2196 <del>bar</del> <ins>baz</ins> quux</blockquote>
2197 !! end
2198
2199 !! test
2200 <pre> with attributes (bug 3202)
2201 !! wikitext
2202 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2203 !! html
2204 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2205
2206 !! end
2207
2208 !! test
2209 <pre> with width attribute (bug 3202)
2210 !! wikitext
2211 <pre width="8">Narrow screen goodies</pre>
2212 !! html
2213 <pre width="8">Narrow screen goodies</pre>
2214
2215 !! end
2216
2217 !! test
2218 <pre> with forbidden attribute (bug 3202)
2219 !! wikitext
2220 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2221 !! html
2222 <pre width="8">Narrow screen goodies</pre>
2223
2224 !! end
2225
2226 !! test
2227 Entities inside <pre>
2228 !! wikitext
2229 <pre>&lt;</pre>
2230 !! html
2231 <pre>&lt;</pre>
2232
2233 !! end
2234
2235 !! test
2236 <pre> with forbidden attribute values (bug 3202)
2237 !! wikitext
2238 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2239 !! html
2240 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2241
2242 !! end
2243
2244 !! test
2245 <nowiki> inside <pre> (bug 13238)
2246 !! wikitext
2247 <pre>
2248 <nowiki>
2249 </pre>
2250 <pre>
2251 <nowiki></nowiki>
2252 </pre>
2253 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2254 !! html
2255 <pre>
2256 &lt;nowiki&gt;
2257 </pre>
2258 <pre>
2259
2260 </pre>
2261 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2262
2263 !! end
2264
2265 !! test
2266 <nowiki> and <pre> preference (first one wins)
2267 !! wikitext
2268 <pre>
2269 <nowiki>
2270 </pre>
2271 </nowiki>
2272 </pre>
2273
2274 <nowiki>
2275 <pre>
2276 <nowiki>
2277 </pre>
2278 </nowiki>
2279 </pre>
2280
2281 !! html/php
2282 <pre>
2283 &lt;nowiki&gt;
2284 </pre>
2285 <p>&lt;/nowiki&gt;
2286 &lt;/pre&gt;
2287 </p><p>
2288 &lt;pre&gt;
2289 &lt;nowiki&gt;
2290 &lt;/pre&gt;
2291
2292 &lt;/pre&gt;
2293 </p>
2294 !! html/parsoid
2295 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2296 </pre>
2297 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2298 &lt;/pre></p>
2299
2300 <p><span typeof="mw:Nowiki">
2301 &lt;pre>
2302 &lt;nowiki>
2303 &lt;/pre>
2304 </span>
2305 &lt;/pre></p>
2306 !! end
2307
2308 !! test
2309 </pre> inside nowiki
2310 !! wikitext
2311 <nowiki></pre></nowiki>
2312 !! html
2313 <p>&lt;/pre&gt;
2314 </p>
2315 !! end
2316
2317 # Parsoid doesn't strip empty tags, like Tidy does.
2318 !! test
2319 Empty pre; pre inside other HTML tags (bug 54946)
2320 !! options
2321 parsoid=wt2html,wt2wt
2322 !! wikitext
2323 a
2324
2325 <div><pre>
2326 foo
2327 </pre></div>
2328 <pre></pre>
2329 !! html/php
2330 <p>a
2331 </p>
2332 <div><pre>
2333 foo
2334 </pre></div>
2335 <pre></pre>
2336
2337 !! html/php+tidy
2338 <p>a</p>
2339 <div>
2340 <pre>
2341 foo
2342 </pre></div>
2343 !! html/parsoid
2344 <p>a</p>
2345
2346 <div><pre>foo
2347 </pre></div>
2348 <pre></pre>
2349 !! end
2350
2351 !! test
2352 HTML pre followed by indent-pre
2353 !! wikitext
2354 <pre>foo</pre>
2355 bar
2356 !! html
2357 <pre>foo</pre>
2358 <pre>bar
2359 </pre>
2360 !! end
2361
2362 # Note that tidy removes the empty <p> tags from the start and end.
2363 # Parsoid does not, by design.
2364 !!test
2365 Block tag pre
2366 !! wikitext
2367 <p><pre>foo</pre></p>
2368 !! html/php+tidy
2369 <pre>
2370 foo
2371 </pre>
2372 !! html/parsoid
2373 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2374 !!end
2375
2376 !!test
2377 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2378 !! wikitext
2379 {{echo|}}
2380 !! html
2381
2382 !!end
2383
2384 !!test
2385 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2386 !! wikitext
2387 {{echo|
2388 foo}}
2389 !! html
2390 <p>foo
2391 </p>
2392 !!end
2393
2394 !! test
2395 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2396 !! wikitext
2397 {{echo|a
2398 b}}
2399 !! html
2400 <pre>a
2401 </pre>
2402 <p>b
2403 </p>
2404 !!end
2405
2406 !! test
2407 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2408 !! wikitext
2409 {{echo|a
2410 b
2411 c
2412 d
2413 e
2414 }}
2415 !! html
2416 <pre>a
2417 </pre>
2418 <p>b
2419 c
2420 </p>
2421 <pre>d
2422 </pre>
2423 <p>e
2424 </p>
2425 !!end
2426
2427 !!test
2428 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2429 !! wikitext
2430 {{echo| foo}}
2431
2432 {{echo| foo}}{{echo| bar}}
2433
2434 {{echo| foo}}
2435 {{echo| bar}}
2436
2437 {{echo|<!--cmt--> foo}}
2438
2439 <!--cmt-->{{echo| foo}}
2440
2441 {{echo|{{echo| }}bar}}
2442 !! html
2443 <pre>foo
2444 </pre>
2445 <pre>foo bar
2446 </pre>
2447 <pre>foo
2448 bar
2449 </pre>
2450 <pre>foo
2451 </pre>
2452 <pre>foo
2453 </pre>
2454 <pre>bar
2455 </pre>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo| }}a
2462
2463 {{echo|
2464 }}a
2465
2466 {{echo|
2467 b}}
2468
2469 {{echo|a
2470 }}b
2471
2472 {{echo|a
2473 }} b
2474 !! html
2475 <pre>a
2476 </pre>
2477 <p><br />
2478 </p>
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>b
2484 </pre>
2485 <p>a
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 !!end
2494
2495 !! test
2496 Pres with newline attributes
2497 !! wikitext
2498 <pre class="one
2499 two">hi</pre>
2500 !! html/php
2501 <pre class="one two">hi</pre>
2502
2503 !! html/parsoid
2504 <pre class="one
2505 two" data-parsoid='{"stx":"html"}'>hi</pre>
2506 !! end
2507
2508 !! test
2509 Things that look like <pre> tags aren't treated as such
2510 !! wikitext
2511 Barack Obama <President> of the United States
2512 <President></President>
2513 !! html
2514 <p>Barack Obama &lt;President&gt; of the United States
2515 &lt;President&gt;&lt;/President&gt;
2516 </p>
2517 !! end
2518
2519 ## PHP parser discards the "<pre " string
2520 !! test
2521 Handle broken pre-like tags (bug 64025)
2522 !! options
2523 parsoid=wt2html
2524 !! wikitext
2525 {{echo|<pre <pre>x</pre>}}
2526
2527 <table><pre </table>
2528 !! html/php
2529 <pre>x</pre>
2530 <table><pre></pre></table>
2531
2532 !! html/parsoid
2533 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2534
2535
2536 <p>&lt;pre </p>
2537
2538 <table></table>
2539 !! end
2540
2541 !! test
2542 Parsoid: handle pre with space after attribute
2543 !! options
2544 parsoid=wt2html
2545 !! wikitext
2546 <pre style="width:50%;" >{{echo|foo}}</pre>
2547 !! html/php
2548 <pre style="width:50%;">{{echo|foo}}</pre>
2549
2550 !! html/parsoid
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552 !! end
2553
2554 # TODO / maybe: fix wt2wt for this
2555 !! test
2556 Parsoid: Don't paragraph-wrap fosterable content
2557 !! options
2558 parsoid=wt2html
2559 !! wikitext
2560 {|
2561 <td></td>
2562 <td></td>
2563
2564
2565
2566 |}
2567 !! html
2568 <table>
2569
2570 <tbody>
2571 <tr>
2572 <td></td>
2573
2574 <td></td></tr>
2575
2576
2577
2578 </tbody></table>
2579 !! end
2580
2581 !! test
2582 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2583 !! options
2584 parsoid=wt2html
2585 !! wikitext
2586 {|
2587 <td>
2588 <td>
2589 </td>
2590
2591
2592
2593 |}
2594 !! html
2595 <table>
2596
2597 <tbody>
2598 <tr>
2599 <td></td>
2600
2601 <td>
2602 </td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609
2610 #--------------------------------------------------------------------
2611 # Transclusion parameter whitespace stripping tests
2612 # Behavior is different for positional and named parameters
2613 #--------------------------------------------------------------------
2614 !! test
2615 Templates: Strip leading and trailing whitespace from named-param values
2616 !! wikitext
2617 {{echo|1= a }}
2618
2619 {{echo|1= {{echo|b}} }}
2620
2621 {{echo| 1 =
2622 c }}
2623
2624 {{echo| 1 =
2625 * d
2626 }}
2627 !! html
2628 <p>a
2629 </p><p>b
2630 </p><p>c
2631 </p>
2632 <ul><li> d</li></ul>
2633
2634 !! end
2635
2636 !! test
2637 Templates: Don't strip whitespace from positional-param values
2638 !! wikitext
2639 {{echo|a }}
2640
2641 {{echo|{{echo|b}} }}
2642
2643 {{echo| c
2644 }}
2645
2646 {{echo| {{echo|d}}
2647 }}
2648
2649 {{echo|
2650 e}}
2651
2652 {{echo|
2653 * f}}
2654
2655 {{echo|
2656 }}g
2657 !! html
2658 <p>a
2659 </p><p>b
2660 </p>
2661 <pre>c
2662 </pre>
2663 <p><br />
2664 </p>
2665 <pre>d
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>e
2670 </pre>
2671 <p><br />
2672 </p>
2673 <ul><li> f</li></ul>
2674 <p><br />
2675 </p>
2676 <pre>g
2677 </pre>
2678 !! end
2679
2680 !! test
2681 Templates: Handle empty comment-and-ws-only lines correctly
2682 !! wikitext
2683 {{echo|foo
2684 <!--should be ignored-->
2685 <!--should be ignored as well-->
2686 bar}}
2687 !! html
2688 <p>foo
2689 bar
2690 </p>
2691 !! end
2692
2693 !! test
2694 Templates: Handle comments in the target
2695 !! wikitext
2696 {{echo
2697 <!-- should be ignored -->
2698 |foo}}
2699
2700 {{echo<!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->|foo}}
2704
2705 {{<!-- should be ignored -->echo|foo}}
2706 !!html/parsoid
2707 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2708
2709 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2710
2711 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714 !!end
2715
2716 !! test
2717 Templates: Handle comments in parameter names (bug 67657)
2718 !! wikitext
2719 {{echo|1
2720 <!-- should be ignored -->
2721 =foo}}
2722
2723 {{echo|
2724 <!-- should be ignored -->
2725 1 = foo}}
2726
2727 {{echo|1<!-- should be ignored --> = foo}}
2728
2729 {{echo|<!-- should be ignored -->1 = foo}}
2730 !!html/parsoid
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2732
2733 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2734
2735 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2736
2737 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2738 !!end
2739
2740 !! test
2741 Templates: Other wikitext in parameter names (bug 67657)
2742 !! wikitext
2743 {{echo|''1''=foo}}
2744 !!html/parsoid
2745 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2746 !!html/php
2747 <p>{{{1}}}
2748 </p>
2749 !!end
2750
2751 #--------------------------------------------------------------------
2752 # Transclusion parameter escaping tests
2753 #--------------------------------------------------------------------
2754 !! test
2755 Templates: Parsoid parameter escaping test 1
2756 !! wikitext
2757 {{echo|[foo]|{{echo|[bar]}}}}
2758 !! html/php+tidy
2759 <p>[foo]</p>
2760 !! html/parsoid
2761 <p about="#mwt1" typeof="mw:Transclusion"
2762 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2763 !! end
2764
2765 !! test
2766 Parsoid: Pipes in external links in template parameter
2767 !! wikitext
2768 {{echo|[{{echo|http://example.com}} link]}}
2769 !! html/php+tidy
2770 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2771 !! html/parsoid
2772 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2773 !! end
2774
2775 !! test
2776 Parsoid: pipe in transclusion parameter
2777 !! wikitext
2778 {{echo|http://foo.com/a&#124;b}}
2779 !! html/php+tidy
2780 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2781 !! html/parsoid
2782 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2783 typeof="mw:Transclusion"
2784 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in external link target and content in template parameter
2789 !! options
2790 parsoid=html2wt,wt2wt
2791 !! wikitext
2792 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2793 !! html/php+tidy
2794 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2795 !! html/parsoid
2796 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2797 typeof="mw:Transclusion"
2798 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2799 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2800 !! end
2801
2802 !! test
2803 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2804 !! options
2805 parsoid
2806 !! wikitext
2807 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2808 !! html
2809 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2810 !! end
2811
2812 !! test
2813 Templates: Don't escape already nowiki-escaped text in template parameters
2814 !! options
2815 parsoid=html2wt,wt2wt
2816 !! wikitext
2817 {{echo|foo<nowiki>|</nowiki>bar}}
2818 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2819 {{echo|<nowiki></nowiki>}}
2820 !! html/php+tidy
2821 <p>foo|bar &lt;div&gt;</p>
2822 !! html/parsoid
2823 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2824 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2825 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2826 </p>
2827 !! end
2828
2829 ## Bug 52824
2830 !! test
2831 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|{{echo|1=bar}}}}
2836 !! html/php+tidy
2837 <p>bar</p>
2838 !! html/parsoid
2839 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2840 !! end
2841
2842 ## Bug 56733
2843 !! test
2844 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2845 !! wikitext
2846 {{echo|a : b}}
2847 !! html/php+tidy
2848 <p>a&#160;: b</p>
2849 !! html/parsoid
2850 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2851 !! end
2852
2853 ## Bug T73412
2854 !! test
2855 Templates: Preserve blank parameter names
2856 !! wikitext
2857 {{echo|=foo}}
2858 !! html/php+tidy
2859 <p>{{{1}}}</p>
2860 !! html/parsoid
2861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2862 !! end
2863
2864 !! test
2865 Templates: Preserve blank parameter names in other positions
2866 !! wikitext
2867 {{blank_param|bar|=foo}}
2868 !! html/php+tidy
2869 <p>bar foo</p>
2870 !! html/parsoid
2871 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2872 foo</p>
2873 !! end
2874
2875 ###
2876 ### Parsoid-centric tests for testing RT edge cases for pre
2877 ###
2878
2879 !!test
2880 1a. Indent-Pre and Comments
2881 !! wikitext
2882 a
2883 <!--a-->
2884 c
2885 !! html
2886 <pre>a
2887 </pre>
2888 <p>c
2889 </p>
2890 !!end
2891
2892 !!test
2893 1b. Indent-Pre and Comments
2894 !! wikitext
2895 a
2896 <!--a-->
2897 c
2898 !! html
2899 <pre>a
2900 </pre>
2901 <p>c
2902 </p>
2903 !!end
2904
2905 !!test
2906 1c. Indent-Pre and Comments
2907 !! wikitext
2908 <!--a--> a
2909
2910 <!--a--> a
2911 !! html
2912 <pre> a
2913 </pre>
2914 <pre> a
2915 </pre>
2916 !!end
2917
2918 !!test
2919 1d. Indent-Pre and Comments
2920 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2921 !! wikitext
2922 <!--a--> a
2923
2924 <!--b-->b
2925 !! html
2926 <pre>a
2927 </pre>
2928 <pre>b
2929 </pre>
2930 !!end
2931
2932 !!test
2933 2a. Indent-Pre and tables
2934 !! wikitext
2935 {|
2936 |-
2937 !h1!!h2
2938 |foo||bar
2939 |}
2940 !! html
2941 <table>
2942
2943 <tr>
2944 <th>h1</th>
2945 <th>h2
2946 </th>
2947 <td>foo</td>
2948 <td>bar
2949 </td></tr></table>
2950
2951 !!end
2952
2953 !!test
2954 2b. Indent-Pre and tables
2955 !! wikitext
2956 {|
2957 |-
2958 |foo
2959 |}
2960 !! html
2961 <table>
2962
2963 <tr>
2964 <td>foo
2965 </td></tr></table>
2966
2967 !!end
2968
2969 !!test
2970 2c. Indent-Pre and tables (bug 42252)
2971 !! wikitext
2972 {|
2973 |+ foo
2974 ! | bar
2975 |}
2976 !! html
2977 <table>
2978 <caption> foo
2979 </caption>
2980 <tr>
2981 <th> bar
2982 </th></tr></table>
2983
2984 !!end
2985
2986 !!test
2987 2d. Indent-Pre and tables
2988 !! wikitext
2989 a
2990 {|
2991 | b
2992 |}
2993 !! html/php
2994 <pre>a
2995 </pre>
2996 <table>
2997 <tr>
2998 <td> b
2999 </td></tr></table>
3000
3001 !! html/parsoid
3002 <pre>a</pre>
3003 <table>
3004 <tbody><tr><td> b</td></tr>
3005 </tbody></table>
3006 !!end
3007
3008 !!test
3009 2e. Indent-Pre and table-line syntax
3010 !! wikitext
3011 a
3012 | b
3013 | c
3014 !! html/php
3015 <pre>a
3016 | b
3017 | c
3018 </pre>
3019 !!end
3020
3021 !!test
3022 2f. Indent-pre started by table-line syntax
3023 !! wikitext
3024 a
3025 | b
3026 | c
3027 !! html/php
3028 <p>a
3029 </p>
3030 <pre>| b
3031 | c
3032 </pre>
3033 !! html/parsoid
3034 <p>a</p>
3035 <pre>
3036 | b
3037 | c</pre>
3038 !!end
3039
3040 !!test
3041 3a. Indent-Pre and block tags (single-line html)
3042 !! wikitext
3043 a <p> foo </p>
3044 b <div> foo </div>
3045 c <blockquote> foo </blockquote>
3046 <span> foo </span>
3047 !! html
3048 a <p> foo </p>
3049 b <div> foo </div>
3050 c <blockquote> foo </blockquote>
3051 <pre><span> foo </span>
3052 </pre>
3053 !! html/parsoid
3054 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3055 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3056 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3057 <pre><span> foo </span>
3058 </pre>
3059 !! html+tidy
3060 <p>a</p>
3061 <p>foo</p>
3062 <p>b</p>
3063 <div>foo</div>
3064 <p>c</p>
3065 <blockquote>
3066 <p>foo</p>
3067 </blockquote>
3068 <pre>
3069 <span> foo </span>
3070 </pre>
3071 !! end
3072
3073 !!test
3074 3b. Indent-Pre and block tags (multi-line html)
3075 !! wikitext
3076 a <span>foo</span>
3077 b <div> foo </div>
3078 !! html
3079 <pre>a <span>foo</span>
3080 </pre>
3081 b <div> foo </div>
3082
3083 !! html/parsoid
3084 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3085 b <div data-parsoid='{"stx":"html"}'> foo </div>
3086 !! html+tidy
3087 <pre>
3088 a <span>foo</span>
3089 </pre>
3090 <p>b</p>
3091 <div>foo</div>
3092 !!end
3093
3094 !!test
3095 3c. Indent-Pre and block tags (pre-content on separate line)
3096 !! wikitext
3097 <p>
3098 foo
3099 </p>
3100
3101 <div>
3102 foo
3103 </div>
3104
3105 <center>
3106 foo
3107 </center>
3108
3109 <blockquote>
3110 foo
3111 </blockquote>
3112
3113 <blockquote>
3114 <pre>
3115 foo
3116 </pre>
3117 </blockquote>
3118
3119 <table><tr><td>
3120 foo
3121 </td></tr></table>
3122
3123 <ul><li>
3124 foo
3125 </li></ul>
3126
3127 !! html
3128 <p>
3129 foo
3130 </p>
3131 <div>
3132 <pre>foo
3133 </pre>
3134 </div>
3135 <center>
3136 <pre>foo
3137 </pre>
3138 </center>
3139 <blockquote>
3140 <p> foo
3141 </p>
3142 </blockquote>
3143 <blockquote>
3144 <pre>
3145 foo
3146 </pre>
3147 </blockquote>
3148 <table><tr><td>
3149 <pre>foo
3150 </pre>
3151 </td></tr></table>
3152 <ul><li>
3153 foo
3154 </li></ul>
3155
3156 !!end
3157
3158 !!test
3159 4. Indent-Pre and extension tags
3160 !! wikitext
3161 a <gallery>
3162 File:foobar.jpg
3163 </gallery>
3164 !! html
3165 a <ul class="gallery mw-gallery-traditional">
3166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3167 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3168 <div class="gallerytext">
3169 </div>
3170 </div></li>
3171 </ul>
3172
3173 !! html+tidy
3174 <p>a</p>
3175 <ul class="gallery mw-gallery-traditional">
3176 <li class="gallerybox" style="width: 155px">
3177 <div style="width: 155px">
3178 <div class="thumb" style="width: 150px;">
3179 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3180 </div>
3181 <div class="gallerytext"></div>
3182 </div>
3183 </li>
3184 </ul>
3185 !!end
3186
3187 !! test
3188 Table wikitext syntax outside wiki-tables
3189 !! wikitext
3190 a
3191 ! not a table heading
3192 |- not a table row
3193 | not a table cell
3194 | class="foo bar" | baz
3195 b
3196 |}
3197 |-
3198 c
3199 !! html
3200 <p>a
3201 ! not a table heading
3202 |- not a table row
3203 | not a table cell
3204 | class="foo bar" | baz
3205 b
3206 |}
3207 |-
3208 c
3209 </p>
3210 !! end
3211
3212 !!test
3213 Render paragraphs when indent-pre is suppressed in blocklevels
3214 !! wikitext
3215 <blockquote>
3216 foo
3217
3218 bar
3219 </blockquote>
3220 !! html
3221 <blockquote>
3222 <p> foo
3223 </p><p> bar
3224 </p>
3225 </blockquote>
3226
3227 !!end
3228
3229 !!test
3230 4. Multiple spaces at start-of-line
3231 !! wikitext
3232 <p> foo </p>
3233 foo
3234 {|
3235 |foo
3236 |}
3237 !! html
3238 <p> foo </p>
3239 <pre> foo
3240 </pre>
3241 <table>
3242 <tr>
3243 <td>foo
3244 </td></tr></table>
3245
3246 !!end
3247
3248 ## NOTE: the leading white-space chars on empty line are significant
3249 !! test
3250 5a. White-space in indent-pre
3251 !! wikitext
3252 a<br />
3253
3254 b
3255 !! html
3256 <pre>a<br />
3257
3258 b
3259 </pre>
3260 !! end
3261
3262 ## NOTE: the leading white-space chars on empty line are significant
3263 !! test
3264 5b. White-space in indent-pre
3265 !! wikitext
3266 a
3267
3268 b
3269
3270
3271 c
3272 !! html
3273 <pre>a
3274
3275 b
3276
3277
3278 c
3279 </pre>
3280 !! end
3281
3282 !! test
3283 5c. White-space in indent-pre
3284 !! wikitext
3285 ''a''
3286 ''b''
3287 ''c''
3288 !! html
3289 <pre><i>a</i>
3290 <i>b</i>
3291 <i>c</i>
3292 </pre>
3293 !! end
3294
3295 !! test
3296 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3297 !! wikitext
3298 a
3299
3300 <!-- continue -->
3301 b
3302
3303 c
3304
3305 d
3306 !! html
3307 <pre>a
3308
3309 b
3310 </pre>
3311 <pre>c
3312
3313 </pre>
3314 <p>d
3315 </p>
3316 !! end
3317
3318 !! test
3319 7a. Indent-pre and category links
3320 !! options
3321 parsoid=wt2html,wt2wt
3322 !! wikitext
3323 [[Category:foo]] <!-- No pre-wrapping -->
3324 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3325 !! html/php+tidy
3326 !! html/parsoid
3327 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3328 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3329 !! end
3330
3331 !! test
3332 7b. Indent-pre and category links
3333 !! options
3334 parsoid=wt2html,wt2wt
3335 !! wikitext
3336 [[Category:foo]] a
3337 [[Category:foo]] {{echo|b}}
3338 !! html
3339 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3340 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3341 !! end
3342
3343 !! test
3344 Indent-Pre: Newlines in comments shouldn't affect sol state
3345 !! wikitext
3346 a <!--
3347 foo
3348 --> b
3349 !! html/php+tidy
3350 <p>a b</p>
3351 !! html/parsoid
3352 <p>a <!--
3353 foo
3354 --> b</p>
3355 !! end
3356
3357 ###
3358 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3359 ###
3360
3361 !!test
3362 HTML-pre: 1. embedded newlines
3363 !! wikitext
3364 <pre>foo</pre>
3365
3366 <pre>
3367 foo
3368 </pre>
3369
3370 <pre>
3371
3372 foo
3373 </pre>
3374
3375 <pre>
3376
3377
3378 foo
3379 </pre>
3380 !! html/php+tidy
3381 <pre>
3382 foo
3383 </pre>
3384 <pre>
3385 foo
3386 </pre>
3387 <pre>
3388
3389 foo
3390 </pre>
3391 <pre>
3392
3393
3394 foo
3395 </pre>
3396 !! html/parsoid
3397 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3398
3399 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3400 foo
3401 </pre>
3402
3403 <pre data-parsoid='{"stx":"html"}'>
3404
3405 foo
3406 </pre>
3407
3408 <pre data-parsoid='{"stx":"html"}'>
3409
3410
3411 foo
3412 </pre>
3413 !!end
3414
3415 !! test
3416 HTML-pre: big spaces
3417 !! wikitext
3418 <pre>
3419
3420
3421
3422
3423 haha
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 </pre>
3434 !! html/php+tidy
3435 <pre>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! html/parsoid
3452 <pre data-parsoid='{"stx":"html"}'>
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 </pre>
3468 !! end
3469
3470 !!test
3471 HTML-pre: 2: indented text
3472 !! wikitext
3473 <pre>
3474 foo
3475 </pre>
3476 !! html
3477 <pre>
3478 foo
3479 </pre>
3480
3481 !!end
3482
3483 !!test
3484 HTML-pre: 3: other wikitext
3485 !! wikitext
3486 <pre>
3487 * foo
3488 # bar
3489 = no-h =
3490 '' no-italic ''
3491 [[ NoLink ]]
3492 </pre>
3493 !! html/php
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501
3502 !! html/parsoid
3503 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509 !!end
3510
3511 ###
3512 ### Definition lists
3513 ###
3514 !! test
3515 Simple definition
3516 !! wikitext
3517 ; name : Definition
3518 !! html
3519 <dl><dt> name&#160;</dt>
3520 <dd> Definition</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Definition list for indentation only
3526 !! wikitext
3527 : Indented text
3528 !! html
3529 <dl><dd> Indented text</dd></dl>
3530
3531 !! end
3532
3533 !! test
3534 Definition list with no space
3535 !! wikitext
3536 ;name:Definition
3537 !! html
3538 <dl><dt>name</dt>
3539 <dd>Definition</dd></dl>
3540
3541 !!end
3542
3543 !! test
3544 Definition list with URL link
3545 !! wikitext
3546 ; http://example.com/ : definition
3547 !! html
3548 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3549 <dd> definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list with bracketed URL link
3555 !! wikitext
3556 ;[http://www.example.com/ Example]:Something about it
3557 !! html
3558 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3559 <dd>Something about it</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition list with wikilink containing colon
3565 !! wikitext
3566 ; [[Help:FAQ]]: The least-read page on Wikipedia
3567 !! html
3568 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3569 <dd> The least-read page on Wikipedia</dd></dl>
3570
3571 !! end
3572
3573 # At Brion's and JeLuF's insistence... :)
3574 !! test
3575 Definition list with news link containing colon
3576 !! wikitext
3577 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3578 !! html/php
3579 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3580 <dd> This isn't even a real newsgroup!</dd></dl>
3581
3582 !! html/parsoid
3583 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3584 !! end
3585
3586 !! test
3587 Malformed definition list with colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3590 !! html
3591 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3592
3593 !! end
3594
3595 !! test
3596 Definition lists: colon in external link text
3597 !! wikitext
3598 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3599 !! html
3600 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3601 <dd> OK, I made that up</dd></dl>
3602
3603 !! end
3604
3605 !! test
3606 Definition lists: colon in HTML attribute
3607 !! wikitext
3608 ;<b style="display: inline">bold</b>
3609 !! html
3610 <dl><dt><b style="display: inline">bold</b></dt></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition lists: self-closed tag
3616 !! wikitext
3617 ;one<br/>two : two-line fun
3618 !! html
3619 <dl><dt>one<br />two&#160;</dt>
3620 <dd> two-line fun</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Bug 11748: Literal closing tags
3626 !! wikitext
3627 <dl>
3628 <dt>test 1</dt>
3629 <dd>test test test test test</dd>
3630 <dt>test 2</dt>
3631 <dd>test test test test test</dd>
3632 </dl>
3633 !! html
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3645 !! wikitext
3646 <ul><li>
3647 ; term : description
3648 * unordered
3649 </li></ul>
3650 !! html
3651 <ul><li>
3652 <dl><dt> term&#160;</dt>
3653 <dd> description</dd></dl>
3654 <ul><li> unordered</li></ul>
3655 </li></ul>
3656
3657 !! end
3658
3659 !! test
3660
3661 Definition list with empty definition and following paragraph
3662 !! wikitext
3663 ; term:
3664 Paragraph text
3665 !! html
3666 <dl><dt> term</dt>
3667 <dd></dd></dl>
3668 <p>Paragraph text
3669 </p>
3670 !! end
3671
3672 !! test
3673 Nested definition lists using html syntax
3674 !! wikitext
3675 <dl><dt>x</dt>
3676 <dd>a</dd>
3677 <dd>b</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition Lists: No nesting: Multiple dd's
3683 !! wikitext
3684 ;x
3685 :a
3686 :b
3687 !! html
3688 <dl><dt>x</dt>
3689 <dd>a</dd>
3690 <dd>b</dd></dl>
3691
3692 !! end
3693
3694 !! test
3695 Definition Lists: Indentation: Regular
3696 !! wikitext
3697 :i1
3698 ::i2
3699 :::i3
3700 !! html
3701 <dl><dd>i1
3702 <dl><dd>i2
3703 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3704
3705 !! end
3706
3707 !! test
3708 Definition Lists: Indentation: Missing 1st level
3709 !! wikitext
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd><dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Multi-level indent
3720 !! wikitext
3721 :::i3
3722 !! html
3723 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Hacky use to indent tables
3729 !! wikitext
3730 ::{|
3731 |foo
3732 |bar
3733 |}
3734 this text
3735 should be left alone
3736 !! html
3737 <dl><dd><dl><dd><table>
3738 <tr>
3739 <td>foo
3740 </td>
3741 <td>bar
3742 </td></tr></table></dd></dl></dd></dl>
3743 <p>this text
3744 should be left alone
3745 </p>
3746 !! end
3747
3748 !! test
3749 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3750 !! wikitext
3751 <!-- foo -->
3752 ::{|
3753 |foo
3754 |bar
3755 |}<!-- bar -->
3756 this text
3757 should be left alone
3758 !! html/parsoid
3759 <!-- foo -->
3760 <dl><dd><dl><dd><table><tr>
3761 <td>foo</td>
3762 <td>bar</td>
3763 </tr></table><!-- bar --></dd></dl></dd></dl>
3764 <p>this text
3765 should be left alone</p>
3766 !! end
3767
3768 !! test
3769 Definition Lists: Hacky use to indent tables, with comment before table
3770 !! wikitext
3771 ::<!-- foo -->{|
3772 |foo
3773 |}
3774 !! html/parsoid
3775 <dl><dd><dl><dd><!-- foo --><table><tr>
3776 <td>foo</td>
3777 </tr></table></dd></dl></dd></dl>
3778 !! end
3779
3780 # The trailing whitespace in this test is to catch a regression in
3781 # Parsoid after T54473.
3782 !! test
3783 Definition Lists: Hacky use to indent tables (WS-insensitive)
3784 !! wikitext
3785 : {|
3786 |a
3787 |}
3788 !! html/php
3789 <dl><dd><table>
3790 <tr>
3791 <td>a
3792 </td></tr></table></dd></dl>
3793
3794 !! html/parsoid
3795 <dl><dd> <table>
3796 <tbody><tr><td>a</td></tr>
3797 </tbody></table> </dd></dl>
3798 !! end
3799
3800 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3801 ## as an empty dt item. It also ignores all but the last ";" when followed
3802 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3803 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3804 ## ";"s.
3805 ##
3806 ## Ex: ";;t2 ::d2" is transformed into:
3807 ##
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>
3811 ## <dl>
3812 ## <dt></dt>
3813 ## <dd>d2</dd>
3814 ## </dl>
3815 ## </dd>
3816 ## </dl>
3817 ##
3818 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3819 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3820 ##
3821 ## <dl>
3822 ## <dt>
3823 ## <dl>
3824 ## <dt>t2 </dt>
3825 ## <dd>:d2</dd>
3826 ## </dl>
3827 ## </dt>
3828 ## </dl>
3829 ##
3830 ## All Parsoid only definition list tests have this difference.
3831 ##
3832 ## See also: https://phabricator.wikimedia.org/T8569
3833 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3834
3835 !! test
3836 Table / list interaction: indented table with lists in table contents
3837 !! wikitext
3838 :{|
3839 |-
3840 | a
3841 * b
3842 |-
3843 | c
3844 * d
3845 |}
3846 !! html
3847 <dl><dd><table>
3848
3849 <tr>
3850 <td> a
3851 <ul><li> b</li></ul>
3852 </td></tr>
3853 <tr>
3854 <td> c
3855 <ul><li> d</li></ul>
3856 </td></tr></table></dd></dl>
3857
3858 !! end
3859
3860 !!test
3861 Table / list interaction: lists nested in tables nested in indented lists
3862 !! wikitext
3863 :{|
3864 |
3865 :a
3866 :b
3867 |
3868 *c
3869 *d
3870 |}
3871
3872 *e
3873 *f
3874 !! html
3875 <dl><dd><table>
3876 <tr>
3877 <td>
3878 <dl><dd>a</dd>
3879 <dd>b</dd></dl>
3880 </td>
3881 <td>
3882 <ul><li>c</li>
3883 <li>d</li></ul>
3884 </td></tr></table></dd></dl>
3885 <ul><li>e</li>
3886 <li>f</li></ul>
3887
3888 !!end
3889
3890 !! test
3891 Definition Lists: Nesting: Multi-level (Parsoid only)
3892 !! options
3893 parsoid
3894 !! wikitext
3895 ;t1 :d1
3896 ;;t2 ::d2
3897 ;;;t3 :::d3
3898 !! html
3899 <dl>
3900 <dt>t1 </dt>
3901 <dd>d1</dd>
3902 <dt>
3903 <dl>
3904 <dt>t2 </dt>
3905 <dd>:d2</dd>
3906 <dt>
3907 <dl>
3908 <dt>t3 </dt>
3909 <dd>::d3</dd>
3910 </dl>
3911 </dt>
3912 </dl>
3913 </dt>
3914 </dl>
3915
3916
3917 !! end
3918
3919
3920 !! test
3921 Definition Lists: Nesting: Test 2 (Parsoid only)
3922 !! wikitext
3923 ;t1
3924 ::d2
3925 !! html/php+tidy
3926 <dl>
3927 <dt>t1</dt>
3928 <dd>
3929 <dl>
3930 <dd>d2</dd>
3931 </dl>
3932 </dd>
3933 </dl>
3934 !! html/parsoid
3935 <dl>
3936 <dt>t1</dt>
3937 <dd>
3938 <dl>
3939 <dd>d2</dd>
3940 </dl>
3941 </dd>
3942 </dl>
3943
3944 !! end
3945
3946
3947 !! test
3948 Definition Lists: Nesting: Test 3 (Parsoid only)
3949 !! wikitext
3950 :;t1
3951 ::::d2
3952 !! html/php+tidy
3953 <dl>
3954 <dd>
3955 <dl>
3956 <dt>t1</dt>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 !! html/parsoid
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dt>t1</dt>
3974 <dd>
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dd>d2</dd>
3979 </dl>
3980 </dd>
3981 </dl>
3982 </dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986
3987 !! end
3988
3989
3990 !! test
3991 Definition Lists: Nesting: Test 4
3992 !! wikitext
3993 ::;t3
3994 :::d3
3995 !! html
3996 <dl><dd><dl><dd><dl><dt>t3</dt>
3997 <dd>d3</dd></dl></dd></dl></dd></dl>
3998
3999 !! end
4000
4001
4002 ## The Parsoid team believes the following three test exposes a
4003 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4004 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4005 ## It also exposes a "misfeature" in tidy, which doesn't like
4006 ## <dl> tags with a single <dt> child; it converts the <dt> into
4007 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4008 !! test
4009 Definition Lists: Mixed Lists: Test 1
4010 !! wikitext
4011 :;* foo
4012 ::* bar
4013 :; baz
4014 !! html/php
4015 <dl><dd><dl><dt><ul><li> foo</li>
4016 <li> bar</li></ul></dt></dl>
4017 <dl><dt> baz</dt></dl></dd></dl>
4018
4019 !! html/php+tidy
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <ul>
4025 <li>foo</li>
4026 <li>bar</li>
4027 </ul>
4028 </dd>
4029 </dl>
4030 <dl>
4031 <dt>baz</dt>
4032 </dl>
4033 </dd>
4034 </dl>
4035 !! html/parsoid
4036 <dl>
4037 <dd><dl>
4038 <dt><ul>
4039 <li> foo
4040 </li>
4041 </ul></dt>
4042 <dd><ul>
4043 <li> bar
4044 </li>
4045 </ul></dd>
4046 <dt> baz</dt>
4047 </dl></dd>
4048 </dl>
4049 !! end
4050
4051 !! test
4052 Definition Lists: Mixed Lists: Test 2
4053 !! wikitext
4054 *: d1
4055 *: d2
4056 !! html
4057 <ul><li><dl><dd> d1</dd>
4058 <dd> d2</dd></dl></li></ul>
4059
4060 !! end
4061
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 3
4065 !! wikitext
4066 *::: d1
4067 *::: d2
4068 !! html
4069 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 4
4077 !! wikitext
4078 *;d1 :d2
4079 *;d3 :d4
4080 !! html
4081 <ul><li><dl><dt>d1&#160;</dt>
4082 <dd>d2</dd>
4083 <dt>d3&#160;</dt>
4084 <dd>d4</dd></dl></li></ul>
4085
4086 !! end
4087
4088
4089 !! test
4090 Definition Lists: Mixed Lists: Test 5
4091 !! wikitext
4092 *:d1
4093 *:: d2
4094 !! html
4095 <ul><li><dl><dd>d1
4096 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 6
4103 !! wikitext
4104 #*:d1
4105 #*::: d3
4106 !! html
4107 <ol><li><ul><li><dl><dd>d1
4108 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 7
4115 !! wikitext
4116 :* d1
4117 :* d2
4118 !! html
4119 <dl><dd><ul><li> d1</li>
4120 <li> d2</li></ul></dd></dl>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 8
4127 !! wikitext
4128 :* d1
4129 ::* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li></ul>
4132 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 9
4139 !! wikitext
4140 *;foo :bar
4141 !! html
4142 <ul><li><dl><dt>foo&#160;</dt>
4143 <dd>bar</dd></dl></li></ul>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 10
4150 !! wikitext
4151 *#;foo :bar
4152 !! html
4153 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ol></li></ul>
4155
4156 !! end
4157
4158 # The Parsoid team disagrees with the PHP parser's seemingly-random
4159 # rules regarding dd/dt on the next two tests. Parsoid is more
4160 # consistent, and recognizes the shared nesting and keeps the
4161 # still-open tags around until the nesting is complete.
4162 # (And tidy again converts <dt> to <dd> before 'bar'.)
4163
4164 !! test
4165 Definition Lists: Mixed Lists: Test 11
4166 !! wikitext
4167 *#*#;*;;foo :bar
4168 *#*#;boo :baz
4169 !! html/php
4170 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4171 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4172 <dl><dt>boo&#160;</dt>
4173 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4174
4175 !! html/php+tidy
4176 <ul>
4177 <li>
4178 <ol>
4179 <li>
4180 <ul>
4181 <li>
4182 <ol>
4183 <li>
4184 <dl>
4185 <dt>foo&#160;</dt>
4186 <dd>
4187 <ul>
4188 <li>
4189 <dl>
4190 <dd>
4191 <dl>
4192 <dt>bar</dt>
4193 </dl>
4194 </dd>
4195 </dl>
4196 </li>
4197 </ul>
4198 </dd>
4199 </dl>
4200 <dl>
4201 <dt>boo&#160;</dt>
4202 <dd>baz</dd>
4203 </dl>
4204 </li>
4205 </ol>
4206 </li>
4207 </ul>
4208 </li>
4209 </ol>
4210 </li>
4211 </ul>
4212 !! html/parsoid
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <ul>
4218 <li>
4219 <ol>
4220 <li>
4221 <dl>
4222 <dt>
4223 <ul>
4224 <li>
4225 <dl>
4226 <dt>
4227 <dl>
4228 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4229 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4230 </dl></dt>
4231 </dl></li>
4232 </ul></dt>
4233 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4234 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4235 </dl></li>
4236 </ol></li>
4237 </ul></li>
4238 </ol></li>
4239 </ul>
4240 !! end
4241
4242
4243 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4244 # From whitelist:
4245 # * The test is wrong, there are two colons where there should be :;
4246 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4247 !! test
4248 Definition Lists: Weird Ones: Test 1
4249 !! wikitext
4250 *#;*::;; foo : bar (who uses this?)
4251 !! html/php
4252 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4253 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4254
4255 !! html/php+tidy
4256 <ul>
4257 <li>
4258 <ol>
4259 <li>
4260 <dl>
4261 <dt>foo&#160;</dt>
4262 <dd>
4263 <ul>
4264 <li>
4265 <dl>
4266 <dd>
4267 <dl>
4268 <dd>
4269 <dl>
4270 <dd>
4271 <dl>
4272 <dt>bar (who uses this?)</dt>
4273 </dl>
4274 </dd>
4275 </dl>
4276 </dd>
4277 </dl>
4278 </dd>
4279 </dl>
4280 </li>
4281 </ul>
4282 </dd>
4283 </dl>
4284 </li>
4285 </ol>
4286 </li>
4287 </ul>
4288 !! html/parsoid
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dd>
4299 <dl>
4300 <dd>
4301 <dl>
4302 <dt>
4303 <dl>
4304 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4305 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4306 </dl></dt>
4307 </dl></dd>
4308 </dl></dd>
4309 </dl></li>
4310 </ul></dt>
4311 </dl></li>
4312 </ol></li>
4313 </ul>
4314 !! end
4315
4316 !! test
4317 Definition Lists: colons occurring in tags
4318 !! wikitext
4319 ;a:b
4320 ;'''a:b'''
4321 ;<i>a:b</i>
4322 ;<span>a:b</span>
4323 ;<div>a:b</div>
4324 ;<div>a
4325 :b</div>
4326 ;{{echo|a:b}}
4327 ;{{echo|''a:b''}}
4328 ;;;''a:b''
4329 !! html+tidy
4330 <dl>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><b>a:b</b></dt>
4334 <dt><i>a:b</i></dt>
4335 <dt><span>a:b</span></dt>
4336 <dd>
4337 <div>a:b</div>
4338 </dd>
4339 <dd>
4340 <div>a
4341 <dl>
4342 <dd>b</dd>
4343 </dl>
4344 </div>
4345 </dd>
4346 <dt>a</dt>
4347 <dd>b</dd>
4348 <dt><i>a:b</i></dt>
4349 </dl>
4350 <dl>
4351 <dd>
4352 <dl>
4353 <dd>
4354 <dl>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 </dd>
4358 </dl>
4359 </dd>
4360 </dl>
4361 !! html/parsoid
4362 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4363 <dt><b>a:b</b></dt>
4364 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4365 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4366 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4367 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4368 <dd>b</dd>
4369 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4370 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4371 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4372 !! end
4373
4374 !! test
4375 Definition Lists: colons and tables 1
4376 !! wikitext
4377 :{|
4378 | x
4379 |}
4380 :{|
4381 | y
4382 |}
4383 !! html
4384 <dl><dd><table>
4385 <tr>
4386 <td> x
4387 </td></tr></table></dd></dl>
4388 <dl><dd><table>
4389 <tr>
4390 <td> y
4391 </td></tr></table></dd></dl>
4392
4393 !! end
4394
4395 # Parsoid's output (as documented below) differs from php's in this case.
4396 # This is probably a bug. If we fixup parsoid to match php's output, the
4397 # above test should pass and the below test case can be removed. It is
4398 # unclear which output is more desirable.
4399
4400 !! test
4401 Definition Lists: colons and tables 2
4402 !! wikitext
4403 :{|
4404 | x
4405 |}
4406 :{|
4407 | y
4408 |}
4409 !! html/parsoid
4410 <dl><dd><table>
4411 <tr>
4412 <td> x
4413 </td></tr></table></dd>
4414 <dd><table>
4415 <tr>
4416 <td> y
4417 </td></tr></table></dd></dl>
4418 !! end
4419
4420 !! test
4421 Definition Lists: template interaction
4422 !! wikitext
4423 ::{{definition_list}}
4424
4425 :one
4426 ::{{definition_list}}
4427 :::two
4428 :::three
4429 ::four
4430 !! html/parsoid
4431 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4432 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4433
4434 <dl><dd data-parsoid='{}'>one
4435 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4436 </span><dd about="#mwt2">two
4437 <dl><dd>two</dd>
4438 <dd>three</dd></dl></dd>
4439 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4440 !! end
4441
4442
4443 ###
4444 ### External links
4445 ###
4446 !! test
4447 External links: non-bracketed
4448 !! wikitext
4449 Non-bracketed: http://example.com
4450 !! html
4451 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4452 </p>
4453 !! end
4454
4455 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4456 !! test
4457 External links: numbered
4458 !! wikitext
4459 Numbered: [http://example.com]
4460 Numbered: [http://example.net]
4461 Numbered: [http://example.com]
4462 !! html/php
4463 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4464 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4466 </p>
4467 !! html/parsoid
4468 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4469 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4470 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4471 !!end
4472
4473 !! test
4474 External links: specified text
4475 !! wikitext
4476 Specified text: [http://example.com link]
4477 !! html
4478 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 External links: trail
4484 !! wikitext
4485 Linktrails should not work for external links: [http://example.com link]s
4486 !! html
4487 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4488 </p>
4489 !! end
4490
4491 !! test
4492 External links: dollar sign in URL
4493 !! wikitext
4494 http://example.com/1$2345
4495 !! html
4496 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4497 </p>
4498 !! end
4499
4500 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4501 !! test
4502 External links: dollar sign in URL (autonumber)
4503 !! wikitext
4504 [http://example.com/1$2345]
4505 !! html/php
4506 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4507 </p>
4508 !! html/parsoid
4509 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4510 !!end
4511
4512 !! test
4513 External links: open square bracket forbidden in URL (bug 4377)
4514 !! options
4515 parsoid=wt2html,wt2wt,html2html
4516 !! wikitext
4517 http://example.com/1[2345
4518 !! html/php
4519 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4520 </p>
4521 !! html/parsoid
4522 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4523 !! end
4524
4525 !! test
4526 External links: open square bracket forbidden in URL (named) (bug 4377)
4527 !! options
4528 parsoid=wt2html,html2html
4529 !! wikitext
4530 [http://example.com/1[2345]
4531 !! html/php
4532 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4533 </p>
4534 !! html/parsoid
4535 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4536 !!end
4537
4538 # parsoid adds a space before the link name
4539 !! test
4540 External links: open square bracket forbidden in URL (named) (bug 4377)
4541 Parsoid variant.
4542 !! wikitext
4543 [http://example.com/1 [2345]
4544 !! html
4545 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4546 </p>
4547 !!end
4548
4549 !! test
4550 External links: nowiki in URL link text (bug 6230)
4551 !! wikitext
4552 [http://example.com/ <nowiki>''example site''</nowiki>]
4553 !! html
4554 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4555 </p>
4556 !! end
4557
4558 !! test
4559 External links: newline forbidden in text (bug 6230 regression check)
4560 !! wikitext
4561 [http://example.com/ first
4562 second]
4563 !! html
4564 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4565 second]
4566 </p>
4567 !!end
4568
4569 !! test
4570 External links: Pipe char between url and text
4571 !! wikitext
4572 [http://example.com | link]
4573 !! html
4574 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4575 </p>
4576 !!end
4577
4578 !! test
4579 External links: protocol-relative URL in brackets
4580 !! wikitext
4581 [//example.com/ Test]
4582 !! html
4583 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4584 </p>
4585 !! end
4586
4587 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4588 !! test
4589 External links: protocol-relative URL in brackets without text
4590 !! wikitext
4591 [//example.com]
4592 !! html/php
4593 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4594 </p>
4595 !! html/parsoid
4596 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4597 !! end
4598
4599 !! test
4600 External links: protocol-relative URL in free text is left alone
4601 !! wikitext
4602 //example.com/Foo
4603 !! html
4604 <p>//example.com/Foo
4605 </p>
4606 !!end
4607
4608 !! test
4609 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4610 !! wikitext
4611 foo//example.com/Foo
4612 !! html
4613 <p>foo//example.com/Foo
4614 </p>
4615 !! end
4616
4617 !! test
4618 External links: with no contents
4619 !! wikitext
4620 [http://en.wikipedia.org/wiki/Foo]
4621
4622 [[wikipedia:Foo|Bar]]
4623
4624 [[wikipedia:Foo|<span>Bar</span>]]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4627 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4628 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4629 </p>
4630 !! html/parsoid
4631 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4632 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4633 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4634 !! end
4635
4636 !! test
4637 External links: Free with trailing punctuation
4638 !! wikitext
4639 http://example.com,
4640 http://example.com;
4641 http://example.com\
4642 http://example.com.
4643 http://example.com:
4644 http://example.com!
4645 http://example.com?
4646 http://example.com)
4647 http://example.com/url_with_(brackets)
4648 (http://example.com/url_without_brackets)
4649 http://example.com/url_with_entity&nbsp;
4650 http://example.com/url_with_entity&#xA0;
4651 http://example.com/url_with_entity&#160;
4652 http://example.com/url_with_entity&lt;
4653 http://example.com/url_with_entity&#x3C;
4654 http://example.com/url_with_entity&#60;
4655 !! html/php
4656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4657 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4658 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4659 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4661 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4664 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4665 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4666 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4667 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4668 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4669 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4670 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4671 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4672 </p>
4673 !! html/parsoid
4674 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4675 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4676 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4677 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4678 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4679 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4680 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4681 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4682 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4683 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4684 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4685 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4686 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4687 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4688 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4689 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4690 !! end
4691
4692 !! test
4693 External links: Lone protocols are never linked (T105697)
4694 !! wikitext
4695 http://
4696 http://;
4697 (http://)
4698 bitcoin:
4699 bitcoin:;
4700 (bitcoin:)
4701 !! html
4702 <p>http://
4703 http://;
4704 (http://)
4705 bitcoin:
4706 bitcoin:;
4707 (bitcoin:)
4708 </p>
4709 !! end
4710
4711 !! test
4712 External links: No preceding word characters allowed (bug 65278)
4713 !! wikitext
4714 NOPEhttp://example.com
4715 N0http://example.com
4716 ok:http://example.com
4717 ok-http://example.com
4718 !! html
4719 <p>NOPEhttp://example.com
4720 N0http://example.com
4721 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4722 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4723 </p>
4724 !! end
4725
4726 !! test
4727 External image
4728 !! wikitext
4729 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4730 !! html
4731 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4732 </p>
4733 !! end
4734
4735 !! test
4736 External image from https
4737 !! wikitext
4738 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4739 !! html
4740 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4741 </p>
4742 !! end
4743
4744 !! test
4745 External image (when not allowed)
4746 !! options
4747 wgAllowExternalImages=0
4748 !! wikitext
4749 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4750 !! html
4751 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4752 </p>
4753 !! end
4754
4755 !! test
4756 Link to non-http image, no img tag
4757 !! wikitext
4758 Link to non-http image, no img tag: ftp://example.com/test.jpg
4759 !! html
4760 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4761 </p>
4762 !! end
4763
4764 !! test
4765 External links: terminating separator
4766 !! wikitext
4767 Terminating separator: http://example.com/thing,
4768 !! html
4769 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4770 </p>
4771 !! end
4772
4773 !! test
4774 External links: intervening separator
4775 !! wikitext
4776 Intervening separator: http://example.com/1,2,3
4777 !! html
4778 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4779 </p>
4780 !! end
4781
4782 !! test
4783 External links: old bug with URL in query
4784 !! wikitext
4785 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4786 !! html
4787 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4788 </p>
4789 !! end
4790
4791 !! test
4792 External links: old URL-in-URL bug, mixed protocols
4793 !! wikitext
4794 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4795 !! html
4796 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4797 </p>
4798 !!end
4799
4800 !! test
4801 External links: URL in text
4802 !! wikitext
4803 URL in text: [http://example.com http://example.com]
4804 !! html
4805 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: Clickable images
4811 !! wikitext
4812 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4813 !! html/php
4814 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4815 </p>
4816 !! html/parsoid
4817 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4818 !! end
4819
4820 !! test
4821 External links: raw ampersand
4822 !! wikitext
4823 Old &amp; use: http://x&y
4824 !! html
4825 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4826 </p>
4827 !! end
4828
4829 !! test
4830 External links: encoded ampersand
4831 !! wikitext
4832 Old &amp; use: http://x&amp;y
4833 !! html/php
4834 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4835 </p>
4836 !! html/parsoid
4837 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4838 !! end
4839
4840 !! test
4841 External links: encoded equals (bug 6102)
4842 !! wikitext
4843 http://example.com/?foo&#61;bar
4844 !! html/php
4845 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4846 </p>
4847 !! html/parsoid
4848 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4849 !! end
4850
4851 ##
4852 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4853 ## does it number them. As discussed in bug 53505, we can identify
4854 ## autonumbered links via CSS.
4855 ##
4856
4857 !! test
4858 External links: [raw ampersand]
4859 !! wikitext
4860 Old &amp; use: [http://x&y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4869 # mode will return the [raw ampersand] wikitext
4870 !! test
4871 External links: [encoded ampersand]
4872 !! options
4873 parsoid=wt2html,wt2wt,html2html
4874 !! wikitext
4875 Old &amp; use: [http://x&amp;y]
4876 !! html/php
4877 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4878 </p>
4879 !! html/parsoid
4880 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4881 !! end
4882
4883 !! test
4884 External links: [raw equals]
4885 !! wikitext
4886 [http://example.com/?foo=bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # note that parsoid html is identical to [raw equals] case; so html2wt
4895 # mode will return the [raw equals] wikitext
4896 !! test
4897 External links: [encoded equals] (bug 6102)
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://example.com/?foo&#61;bar]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4907 !! end
4908
4909 # xxx parsoid strips the IDN character, so the round-trip tests will
4910 # obviously fail and are disabled. --cscott
4911 !! test
4912 External links: [IDN ignored character reference in hostname; strip it right off]
4913 !! options
4914 parsoid=wt2html,wt2wt,html2html
4915 !! wikitext
4916 [http://e&zwnj;xample.com/]
4917 !! html/php
4918 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4919 </p>
4920 !! html/parsoid
4921 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4922 !! end
4923
4924 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4925 # Where an external link could easily circumvent the sanitization of the text of
4926 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4927 # test demands a higher standard. That's a bit strange.
4928 #
4929 # Example:
4930 #
4931 # http://e‌xample.com -> [http://example.com|http://example.com]
4932 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4933 #
4934 # The first example is sanitized, but the second is not. Any security benefits
4935 # from this production are trivial to circumvent. Either remove this test and
4936 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4937 # the test accordingly.
4938 #
4939 # All our love,
4940 # The Parsoid team.
4941 # xxx parsoid strips the IDN character, so the round-trip tests will
4942 # obviously fail and are disabled. --cscott
4943 !! test
4944 External links: IDN ignored character reference in hostname; strip it right off
4945 !! options
4946 parsoid=wt2html,html2html
4947 !! wikitext
4948 http://e&zwnj;xample.com/
4949 !! html/php
4950 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4951 </p>
4952 !! html/parsoid
4953 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4954 !! end
4955
4956 !! test
4957 External links: www.jpeg.org (bug 554)
4958 !! wikitext
4959 http://www.jpeg.org
4960 !! html
4961 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4962 </p>
4963 !! end
4964
4965 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4966 !! test
4967 External links: URL within URL (original bug 2)
4968 !! wikitext
4969 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4975 !! end
4976
4977 !! test
4978 BUG 361: URL inside bracketed URL
4979 !! wikitext
4980 [http://www.example.com/foo http://www.example.com/bar]
4981 !! html
4982 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4983 </p>
4984 !! end
4985
4986 !! test
4987 BUG 361: URL within URL, not bracketed
4988 !! wikitext
4989 http://www.example.com/foo?=http://www.example.com/bar
4990 !! html
4991 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4992 </p>
4993 !! end
4994
4995 !! test
4996 BUG 289: ">"-token in URL-tail
4997 !! wikitext
4998 http://www.example.com/<hello>
4999 !! html
5000 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5001 </p>
5002 !!end
5003
5004 !! test
5005 BUG 289: literal ">"-token in URL-tail
5006 !! wikitext
5007 http://www.example.com/<b>html</b>
5008 !! html/php
5009 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5010 </p>
5011 !! html/parsoid
5012 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5013 !! end
5014
5015 !! test
5016 BUG 289: ">"-token in bracketed URL
5017 !! wikitext
5018 [http://www.example.com/<hello> stuff]
5019 !! html
5020 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5021 </p>
5022 !!end
5023
5024 !! test
5025 BUG 289: literal ">"-token in bracketed URL
5026 !! wikitext
5027 [http://www.example.com/<b>html</b> stuff]
5028 !! html
5029 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5030 </p>
5031 !!end
5032
5033 !! test
5034 BUG 289: literal double quote at end of URL
5035 !! wikitext
5036 http://www.example.com/"hello"
5037 !! html
5038 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5039 </p>
5040 !!end
5041
5042 !! test
5043 BUG 289: literal double quote in bracketed URL
5044 !! wikitext
5045 [http://www.example.com/"hello" stuff]
5046 !! html
5047 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5048 </p>
5049 !!end
5050
5051 !! test
5052 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5053 !! wikitext
5054 [http://www.example.com test]
5055 !! html
5056 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5057 </p>
5058 !! end
5059
5060 !! test
5061 External links: link text with spaces
5062 !! wikitext
5063 [http://www.example.com a b c]
5064 [http://www.example.com ''a'' ''b'']
5065 !! html
5066 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5067 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5068 </p>
5069 !! end
5070
5071 !! test
5072 External links: wiki links within external link (Bug 3695)
5073 !! wikitext
5074 [http://example.com [[wikilink]] embedded in ext link]
5075 !! html/php
5076 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5077 </p>
5078 !! html/parsoid
5079 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5080 !! end
5081
5082 !! test
5083 BUG 787: Links with one slash after the url protocol are invalid
5084 !! wikitext
5085 http:/example.com
5086
5087 [http:/example.com title]
5088 !! html
5089 <p>http:/example.com
5090 </p><p>[http:/example.com title]
5091 </p>
5092 !! end
5093
5094 !! test
5095 Bracketed external links with template-generated invalid target
5096 !! wikitext
5097 [{{echo|http:/example.com}} title]
5098 !! html
5099 <p>[http:/example.com title]
5100 </p>
5101 !! end
5102
5103 !! test
5104 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5105 !! wikitext
5106 ''[http://example.com text'']
5107 [http://example.com '''text]'''
5108 ''Something [http://example.com in italic'']
5109 ''Something [http://example.com mixed''''', even bold]'''
5110 '''''Now [http://example.com both''''']
5111 !! html
5112 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5113 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5114 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5115 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5116 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5117 </p>
5118 !! end
5119
5120
5121 !! test
5122 Bug 4781: %26 in URL
5123 !! wikitext
5124 http://www.example.com/?title=AT%26T
5125 !! html/php
5126 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5127 </p>
5128 !! html/parsoid
5129 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5130 !! end
5131
5132 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5133 # % is actually legal in HTML5. Any change in output would need testing though.
5134 !! test
5135 Bug 4781, 5267: %25 in URL
5136 !! wikitext
5137 http://www.example.com/?title=100%25_Bran
5138 !! html/php
5139 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5140 </p>
5141 !! html/parsoid
5142 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5143 !! end
5144
5145 !! test
5146 Bug 4781, 5267: %28, %29 in URL
5147 !! wikitext
5148 http://www.example.com/?title=Ben-Hur_%281959_film%29
5149 !! html/php
5150 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5151 </p>
5152 !! html/parsoid
5153 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5154 !! end
5155
5156
5157 !! test
5158 Bug 4781: %26 in autonumber URL
5159 !! wikitext
5160 [http://www.example.com/?title=AT%26T]
5161 !! html/php
5162 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5163 </p>
5164 !! html/parsoid
5165 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5166 !! end
5167
5168 !! test
5169 Bug 4781, 5267: %26 in autonumber URL
5170 !! wikitext
5171 [http://www.example.com/?title=100%25_Bran]
5172 !! html/php
5173 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5177 !! end
5178
5179 !! test
5180 Bug 4781, 5267: %28, %29 in autonumber URL
5181 !! wikitext
5182 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5183 !! html/php
5184 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5185 </p>
5186 !! html/parsoid
5187 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in bracketed URL
5193 !! wikitext
5194 [http://www.example.com/?title=AT%26T link]
5195 !! html/php
5196 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5200 !! end
5201
5202 !! test
5203 Bug 4781, 5267: %25 in bracketed URL
5204 !! wikitext
5205 [http://www.example.com/?title=100%25_Bran link]
5206 !! html
5207 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5208 </p>
5209 !! end
5210
5211 !! test
5212 Bug 4781, 5267: %28, %29 in bracketed URL
5213 !! wikitext
5214 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5215 !! html/php
5216 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5217 </p>
5218 !! html/parsoid
5219 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a period in the anchor. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar#baz. bang]
5226
5227 [//foo.org/bar. bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5235 !! end
5236
5237 !! test
5238 External link containing a single quote. (bug 63947)
5239 !! wikitext
5240 [//foo.org/bar'baz]
5241
5242 [//foo.org/bar'baz bang]
5243 !! html/php
5244 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5245 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5246 </p>
5247 !! html/parsoid
5248 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5250 !! end
5251
5252 !! test
5253 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5254 !! wikitext
5255 Some [http://example.com/ pretty ''italics'' and stuff]!
5256 !! html
5257 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5258 </p>
5259 !! end
5260
5261 !! test
5262 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5263 !! wikitext
5264 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5265 !! html
5266 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5267 </p>
5268 !! end
5269
5270 !! test
5271 External link containing double-single-quotes with no space separating the url from text in italics
5272 !! wikitext
5273 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5274 !! html/php
5275 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5276 </p>
5277 !! html/php+tidy
5278 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5281 !! end
5282
5283 !! test
5284 External link with comments in link text
5285 !! wikitext
5286 [http://www.google.com Google <!-- comment -->]
5287 !! html/php
5288 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5289 </p>
5290 !! html/parsoid
5291 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5292 !! end
5293
5294 !! test
5295 External link to bare IPv4 address
5296 !! wikitext
5297 [http://192.168.0.1 Link]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5300 </p>
5301 !! html/parsoid
5302 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5303 !! end
5304
5305 !! test
5306 URL-encoding in URL functions (single parameter)
5307 !! wikitext
5308 {{localurl:Some page|amp=&}}
5309 !! html
5310 <p>/index.php?title=Some_page&amp;amp=&amp;
5311 </p>
5312 !! end
5313
5314 !! test
5315 URL-encoding in URL functions (multiple parameters)
5316 !! wikitext
5317 {{localurl:Some page|q=?&amp=&}}
5318 !! html
5319 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5320 </p>
5321 !! end
5322
5323 !! test
5324 Brackets in urls
5325 !! wikitext
5326 http://example.com/index.php?foozoid%5B%5D=bar
5327
5328 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5329 !! html/php
5330 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5331 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5332 </p>
5333 !! html/parsoid
5334 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5335
5336 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5337 !! end
5338
5339 !! test
5340 IPv6 urls, autolink format (T23261)
5341 !! wikitext
5342 http://[2404:130:0:1000::187:2]/index.php
5343
5344 Examples from RFC 2373, section 2.2:
5345 * http://[1080::8:800:200C:417A]/unicast
5346 * http://[FF01::101]/multicast
5347 * http://[::1]/loopback
5348 * http://[::]/unspecified
5349 * http://[::13.1.68.3]/ipv4compat
5350 * http://[::FFFF:129.144.52.38]/ipv4compat
5351
5352 Examples from RFC 2732, section 2:
5353 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5354 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5355 * http://[3ffe:2a00:100:7031::1]
5356 * http://[1080::8:800:200C:417A]/foo
5357 * http://[::192.9.5.5]/ipng
5358 * http://[::FFFF:129.144.52.38]:80/index.html
5359 * http://[2010:836B:4179::836B:4179]
5360
5361 !! html/php
5362 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5363 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5364 </p>
5365 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5366 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5367 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5368 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5369 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5371 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5372 </p>
5373 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5375 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5376 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5377 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5380
5381 !! html/parsoid
5382 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5383
5384 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5385 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5386 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5387 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5388 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5389 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5390 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5391
5392 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5393 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5394 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5395 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5396 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5397 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5398 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5399 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5400 !! end
5401
5402 !! test
5403 IPv6 urls, bracketed format (T23261)
5404 !! wikitext
5405 [http://[2404:130:0:1000::187:2]/index.php test]
5406
5407 Examples from RFC 2373, section 2.2:
5408 * [http://[1080::8:800:200C:417A] unicast]
5409 * [http://[FF01::101] multicast]
5410 * [http://[::1]/ loopback]
5411 * [http://[::] unspecified]
5412 * [http://[::13.1.68.3] ipv4compat]
5413 * [http://[::FFFF:129.144.52.38] ipv4compat]
5414
5415 Examples from RFC 2732, section 2:
5416 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5417 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5418 * [http://[3ffe:2a00:100:7031::1] 3]
5419 * [http://[1080::8:800:200C:417A]/foo 4]
5420 * [http://[::192.9.5.5]/ipng 5]
5421 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5422 * [http://[2010:836B:4179::836B:4179] 7]
5423
5424 !! html/php
5425 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5426 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5427 </p>
5428 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5429 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5430 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5431 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5432 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5433 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5434 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5435 </p>
5436 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5437 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5438 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5439 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5440 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5441 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5442 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5443
5444 !! html/parsoid
5445 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5446
5447 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5448 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5450 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5451 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5452 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5453 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5454
5455 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5456 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5461 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5462 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5463 !! end
5464
5465 !! test
5466 Non-extlinks in brackets
5467 !! wikitext
5468 [foo]
5469 [foo bar]
5470 [foo ''bar'']
5471 [fool's] errand
5472 [fool's errand]
5473 [{{echo|foo}}]
5474 [{{echo|foo}} bar]
5475 [{{echo|foo}} ''bar'']
5476 [{{echo|foo}}l's] errand
5477 [{{echo|foo}}l's errand]
5478 [url={{echo|foo}}]
5479 [url=http://example.com]
5480 [http:// bare protocols don't count]
5481 !! html/php
5482 <p>[foo]
5483 [foo bar]
5484 [foo <i>bar</i>]
5485 [fool's] errand
5486 [fool's errand]
5487 [foo]
5488 [foo bar]
5489 [foo <i>bar</i>]
5490 [fool's] errand
5491 [fool's errand]
5492 [url=foo]
5493 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5494 [http:// bare protocols don't count]
5495 </p>
5496 !! html/parsoid
5497 <p>[foo]
5498 [foo bar]
5499 [foo <i>bar</i>]
5500 [fool's] errand
5501 [fool's errand]
5502 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5503 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5504 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5505 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5506 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5507 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5508 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5509 [http:// bare protocols don't count]</p>
5510 !! end
5511
5512 !! test
5513 Percent encoding in external links
5514 !! wikitext
5515 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5516 !! html/php
5517 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5518 </p>
5519 !! html/parsoid
5520 <p><a rel="mw:ExtLink"
5521 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5522 !! end
5523
5524 !! test
5525 Use url link syntax for links where the content is equal the link target
5526 !! wikitext
5527 http://example.com
5528 !! html/php
5529 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5530 </p>
5531 !! html/parsoid
5532 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5533 !! end
5534
5535 !! test
5536 Parenthesis in external links, especially URL links
5537 !! wikitext
5538 http://example.com)
5539
5540 http://example.com/test)
5541
5542 http://example.com/(test)
5543
5544 http://example.com/((test)
5545
5546 (http://example.com/(test))
5547
5548 (http://example.com/(test)))))
5549
5550 http://example.com/a)b
5551
5552 [http://example.com) foo]
5553 !! html/php
5554 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5555 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5556 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5557 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5558 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5559 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5560 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5561 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5562 </p>
5563 !! html/parsoid
5564 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5565 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5566 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5567 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5568 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5569 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5570 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5571 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5572 !! end
5573
5574 !! test
5575 Parenthesis in external links, w/ transclusion or comment
5576 !! wikitext
5577 (http://example.com/{{echo|hi}})
5578
5579 (http://example.com<!-- hi -->)
5580 !! html/php
5581 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5582 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5583 </p>
5584 !! html/parsoid
5585 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5586
5587 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5588 !! end
5589
5590 !! test
5591 Serialize <a> tags with invalid link targets as plain text
5592 !! options
5593 parsoid=html2wt
5594 !! html/parsoid
5595 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5596 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5597 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5598 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5599 !! wikitext
5600 text
5601 <nowiki>*</nowiki>text
5602 <nowiki>[[foo]]</nowiki>
5603 <nowiki>*a [[foo]]</nowiki>
5604 !! end
5605
5606 !! test
5607 mw:ExtLink -vs- mw:WikiLink (T94723)
5608 !! options
5609 parsoid=html2wt
5610 !! html/parsoid
5611 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5612 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5613 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5614 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5615 <p>
5616 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5617 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5618 </p>
5619 !! wikitext
5620 [[Foo|Bar]]
5621 [[Foo|Bar]]
5622 [[wikipedia:Foo|Bar]]
5623 [[wikipedia:Foo|Bar]]
5624
5625 [[wikipedia:European_Robin|European Robin]]
5626 [[wikipedia:European_Robin|European Robin]]
5627 !! end
5628
5629 !! test
5630 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5631 !! options
5632 parsoid=wt2wt
5633 !! wikitext
5634 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5635 !! html/parsoid
5636 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5637 !! end
5638
5639
5640 ###
5641 ### Quotes
5642 ###
5643
5644 !! test
5645 Quotes
5646 !! wikitext
5647 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5648
5649 Normal text. '''''Bold italic text.''''' Normal text.
5650 !! html
5651 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5652 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5653 </p>
5654 !! end
5655
5656
5657 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5658 # parser strips. The wikitext contains just the first half of the bold
5659 # quote pair.
5660 !! test
5661 Unclosed and unmatched quotes
5662 !! wikitext
5663 '''''Bold italic text '''with bold deactivated''' in between.'''''
5664
5665 '''''Bold italic text ''with italic deactivated'' in between.'''''
5666
5667 '''Bold text..
5668
5669 ..spanning two paragraphs (should not work).'''
5670
5671 '''Bold tag left open
5672
5673 ''Italic tag left open
5674
5675 Normal text.
5676
5677 <!-- Unmatching number of opening, closing tags: -->
5678 '''This year''''s election ''should'' beat '''last year''''s.
5679
5680 ''Tom'''s car is bigger than ''Susan'''s.
5681
5682 Plain ''italic'''s plain
5683 !! html/php
5684 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5685 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5686 </p><p><b>Bold text..</b>
5687 </p><p>..spanning two paragraphs (should not work).
5688 </p><p><b>Bold tag left open</b>
5689 </p><p><i>Italic tag left open</i>
5690 </p><p>Normal text.
5691 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5692 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5693 </p><p>Plain <i>italic'</i>s plain
5694 </p>
5695 !! html/parsoid
5696 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5697 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5698 </p><p><b>Bold text..</b>
5699 </p><p>..spanning two paragraphs (should not work).<b></b>
5700 </p><p><b>Bold tag left open</b>
5701 </p><p><i>Italic tag left open</i>
5702 </p><p>Normal text.
5703 </p>
5704 <!-- Unmatching number of opening, closing tags: -->
5705 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5706 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5707 </p><p>Plain <i>italic'</i>s plain
5708 </p>
5709 !! end
5710
5711 ###
5712 ### Tables
5713 ###
5714 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5715 ###
5716
5717 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5718 # is the bare minimum required by the spec, see:
5719 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5720 # Parsoid team replies: empty table tags are legal in HTML5
5721 !! test
5722 A table with no data.
5723 !! options
5724 parsoid=wt2html
5725 !! wikitext
5726 {||}
5727 !! html/php
5728
5729 !! html/parsoid
5730 <table></table>
5731
5732 !! end
5733
5734 !! test
5735 A table with stray table end tags on start tag line (wt2html)
5736 !! options
5737 parsoid=wt2html
5738 !! wikitext
5739 {|style="color: red;"|}
5740
5741 {|style="color: red;" |}
5742 |foo
5743 |}
5744
5745 {|style="color: red;"|} id="foo"
5746 |foo
5747 |}
5748
5749 {|style="color: red;" |} id="foo"
5750 |foo
5751 |}
5752 !! html
5753 <table style="color: red;"></table>
5754
5755 <table style="color: red;">
5756 <tbody><tr>
5757 <td>foo</td>
5758 </tr></tbody>
5759 </table>
5760
5761 <table style="color: red;" id="foo">
5762 <tbody><tr>
5763 <td>foo</td>
5764 </tr></tbody>
5765 </table>
5766
5767 <table style="color: red;" id="foo">
5768 <tbody><tr>
5769 <td>foo</td>
5770 </tr></tbody>
5771 </table>
5772
5773 !! end
5774
5775 !! test
5776 A table with no data (take 2)
5777 !! wikitext
5778 {|
5779 |}
5780 !! html/parsoid
5781 <table></table>
5782 !! end
5783
5784 # A table with nothing but a caption is invalid XHTML, we might want to render
5785 # this as <p>caption</p>
5786 # Parsoid team replies: table with only a caption is legal in HTML5
5787 !! test
5788 A table with nothing but a caption
5789 !! wikitext
5790 {|
5791 |+ caption
5792 |}
5793 !! html/php
5794 <table>
5795 <caption> caption
5796 </caption><tr><td></td></tr></table>
5797
5798 !! html/parsoid
5799 <table><caption> caption</caption></table>
5800 !! end
5801
5802 !! test
5803 A table with caption with default-spaced attributes and a table row
5804 !! wikitext
5805 {|
5806 |+ style="color: red;" | caption1
5807 |-
5808 | foo
5809 |}
5810 !! html
5811 <table>
5812 <caption style="color: red;"> caption1
5813 </caption>
5814 <tr>
5815 <td> foo
5816 </td></tr></table>
5817
5818 !! end
5819
5820 !! test
5821 A table with captions with non-default spaced attributes and a table row
5822 !! wikitext
5823 {|
5824 |+style="color: red;"|caption2
5825 |+ style="color: red;"| caption3
5826 |-
5827 | foo
5828 |}
5829 !! html
5830 <table>
5831 <caption style="color: red;">caption2
5832 </caption>
5833 <caption style="color: red;"> caption3
5834 </caption>
5835 <tr>
5836 <td> foo
5837 </td></tr></table>
5838
5839 !! end
5840
5841 !! test
5842 Table td-cell syntax variations
5843 !! wikitext
5844 {|
5845 | foo bar foo | baz
5846 | foo bar foo || baz
5847 | style='color:red;' | baz
5848 | style='color:red;' || baz
5849 |}
5850 !! html
5851 <table>
5852 <tr>
5853 <td> baz
5854 </td>
5855 <td> foo bar foo </td>
5856 <td> baz
5857 </td>
5858 <td style="color:red;"> baz
5859 </td>
5860 <td> style='color:red;' </td>
5861 <td> baz
5862 </td></tr></table>
5863
5864 !! end
5865
5866 !! test
5867 Simple table
5868 !! wikitext
5869 {|
5870 | 1 || 2
5871 |-
5872 | 3 || 4
5873 |}
5874 !! html
5875 <table>
5876 <tr>
5877 <td> 1 </td>
5878 <td> 2
5879 </td></tr>
5880 <tr>
5881 <td> 3 </td>
5882 <td> 4
5883 </td></tr></table>
5884
5885 !! end
5886
5887 !! test
5888 Simple table but with multiple dashes for row wikitext
5889 !! wikitext
5890 {|
5891 | foo
5892 |-----
5893 | bar
5894 |}
5895 !! html
5896 <table>
5897 <tr>
5898 <td> foo
5899 </td></tr>
5900 <tr>
5901 <td> bar
5902 </td></tr></table>
5903
5904 !! end
5905
5906 !! test
5907 Multiplication table
5908 !! wikitext
5909 {| border="1" cellpadding="2"
5910 |+Multiplication table
5911 |-
5912 ! &times; !! 1 !! 2 !! 3
5913 |-
5914 ! 1
5915 | 1 || 2 || 3
5916 |-
5917 ! 2
5918 | 2 || 4 || 6
5919 |-
5920 ! 3
5921 | 3 || 6 || 9
5922 |-
5923 ! 4
5924 | 4 || 8 || 12
5925 |-
5926 ! 5
5927 | 5 || 10 || 15
5928 |}
5929 !! html
5930 <table border="1" cellpadding="2">
5931 <caption>Multiplication table
5932 </caption>
5933 <tr>
5934 <th> &#215; </th>
5935 <th> 1 </th>
5936 <th> 2 </th>
5937 <th> 3
5938 </th></tr>
5939 <tr>
5940 <th> 1
5941 </th>
5942 <td> 1 </td>
5943 <td> 2 </td>
5944 <td> 3
5945 </td></tr>
5946 <tr>
5947 <th> 2
5948 </th>
5949 <td> 2 </td>
5950 <td> 4 </td>
5951 <td> 6
5952 </td></tr>
5953 <tr>
5954 <th> 3
5955 </th>
5956 <td> 3 </td>
5957 <td> 6 </td>
5958 <td> 9
5959 </td></tr>
5960 <tr>
5961 <th> 4
5962 </th>
5963 <td> 4 </td>
5964 <td> 8 </td>
5965 <td> 12
5966 </td></tr>
5967 <tr>
5968 <th> 5
5969 </th>
5970 <td> 5 </td>
5971 <td> 10 </td>
5972 <td> 15
5973 </td></tr></table>
5974
5975 !! end
5976
5977 !! test
5978 Accept "||" in table headings
5979 !! wikitext
5980 {|
5981 !h1 || h2
5982 |}
5983 !! html
5984 <table>
5985 <tr>
5986 <th>h1 </th>
5987 <th> h2
5988 </th></tr></table>
5989
5990 !! end
5991
5992 !! test
5993 Accept "!!" in table data
5994 !! wikitext
5995 {|
5996 | Foo!! ||
5997 |}
5998 !! html
5999 <table>
6000 <tr>
6001 <td> Foo!! </td>
6002 <td>
6003 </td></tr></table>
6004
6005 !! html/parsoid
6006 <table>
6007 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6008 </tbody></table>
6009 !! end
6010
6011 !! test
6012 Accept "||" in indented table headings
6013 !! wikitext
6014 :{|
6015 !h1 || h2
6016 |}
6017 !! html
6018 <dl><dd><table>
6019 <tr>
6020 <th>h1 </th>
6021 <th> h2
6022 </th></tr></table></dd></dl>
6023
6024 !! end
6025
6026 !! test
6027 Accept "!!" in templates
6028 !! wikitext
6029 {|
6030 !a {{echo|b!!c}}
6031 |}
6032 !! html/php
6033 <table>
6034 <tr>
6035 <th>a b</th>
6036 <th>c
6037 </th></tr></table>
6038
6039 !! html/parsoid
6040 <table>
6041 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6042 !! end
6043
6044 !! test
6045 Accept "!!" in table headings after newline
6046 !! wikitext
6047 {|
6048 !a
6049 b!!c
6050 |}
6051 !! html/php
6052 <table>
6053 <tr>
6054 <th>a
6055 <p>b!!c
6056 </p>
6057 </th></tr></table>
6058
6059 !! html/parsoid
6060 <table>
6061 <tbody><tr><th>a
6062 <p>b!!c</p></th></tr>
6063 </tbody></table>
6064 !! end
6065
6066 !! test
6067 Accept "!!" in table data of mixed wikitext / html syntax
6068 !! wikitext
6069 {|
6070 !a
6071 <tr><td>b!!c</td></tr>
6072 |}
6073 !! html+tidy
6074 <table>
6075 <tr>
6076 <th>a</th>
6077 </tr>
6078 <tr>
6079 <td>b!!c</td>
6080 </tr>
6081 </table>
6082 !! html/parsoid
6083 <table>
6084 <tbody><tr><th>a</th></tr>
6085 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6086 </tbody></table>
6087 !! end
6088
6089 !! test
6090 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6091 !! wikitext
6092 {|
6093 !| h1
6094 || a
6095 |}
6096 !! html
6097 <table>
6098 <tr>
6099 <th> h1
6100 </th>
6101 <td> a
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !!test
6107 Accept "| !" at start of line in tables (ignore !-attribute)
6108 !! wikitext
6109 {|
6110 |-
6111 | !style="color:red" | bar
6112 |}
6113 !! html
6114 <table>
6115
6116 <tr>
6117 <td> bar
6118 </td></tr></table>
6119
6120 !!end
6121
6122 !!test
6123 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6124 !! wikitext
6125 {|
6126 |-
6127 |style='color:red;'|+1
6128 |style='color:blue;'|-1
6129 |-
6130 | 1 || 2 || 3
6131 | 1 ||+2 ||-3
6132 |-
6133 | +1
6134 | -1
6135 |}
6136 !! html
6137 <table>
6138
6139 <tr>
6140 <td style="color:red;">+1
6141 </td>
6142 <td style="color:blue;">-1
6143 </td></tr>
6144 <tr>
6145 <td> 1 </td>
6146 <td> 2 </td>
6147 <td> 3
6148 </td>
6149 <td> 1 </td>
6150 <td>+2 </td>
6151 <td>-3
6152 </td></tr>
6153 <tr>
6154 <td> +1
6155 </td>
6156 <td> -1
6157 </td></tr></table>
6158
6159 !!end
6160
6161 !! test
6162 Table rowspan
6163 !! wikitext
6164 {| border=1
6165 | Cell 1, row 1
6166 |rowspan=2| Cell 2, row 1 (and 2)
6167 | Cell 3, row 1
6168 |-
6169 | Cell 1, row 2
6170 | Cell 3, row 2
6171 |}
6172 !! html
6173 <table border="1">
6174 <tr>
6175 <td> Cell 1, row 1
6176 </td>
6177 <td rowspan="2"> Cell 2, row 1 (and 2)
6178 </td>
6179 <td> Cell 3, row 1
6180 </td></tr>
6181 <tr>
6182 <td> Cell 1, row 2
6183 </td>
6184 <td> Cell 3, row 2
6185 </td></tr></table>
6186
6187 !! end
6188
6189 !! test
6190 Nested table
6191 !! wikitext
6192 {| border=1
6193 | &alpha;
6194 |
6195 {| bgcolor=#ABCDEF border=2
6196 |nested
6197 |-
6198 |table
6199 |}
6200 |the original table again
6201 |}
6202 !! html
6203 <table border="1">
6204 <tr>
6205 <td> &#945;
6206 </td>
6207 <td>
6208 <table bgcolor="#ABCDEF" border="2">
6209 <tr>
6210 <td>nested
6211 </td></tr>
6212 <tr>
6213 <td>table
6214 </td></tr></table>
6215 </td>
6216 <td>the original table again
6217 </td></tr></table>
6218
6219 !! end
6220
6221 !! test
6222 Invalid attributes in table cell (bug 1830)
6223 !! wikitext
6224 {|
6225 |Cell:|broken
6226 |}
6227 !! html
6228 <table>
6229 <tr>
6230 <td>broken
6231 </td></tr></table>
6232
6233 !! end
6234
6235 !! test
6236 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6237 !! wikitext
6238 {|
6239 | title="foo" |bar
6240 | title="foo<nowiki>|</nowiki>" |bar
6241 | title="foo<nowiki>|</nowiki>" bar
6242 |}
6243 !! html/php
6244 <table>
6245 <tr>
6246 <td title="foo">bar
6247 </td>
6248 <td title="foo&#124;">bar
6249 </td>
6250 <td> title="foo|" bar
6251 </td></tr></table>
6252
6253 !! html/parsoid
6254 <table>
6255 <tbody><tr><td title="foo">bar</td>
6256 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6257 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6258 </tbody></table>
6259 !! end
6260
6261 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6262 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6263 # *2wt modes will fail.
6264 !! test
6265 Table security: embedded pipes
6266 !! options
6267 parsoid=wt2html,html2html
6268 !! wikitext
6269 {|
6270 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6271 !! html/php
6272 <table>
6273 <tr>
6274 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6275 <td>]" onmouseover="alert(document.cookie)"&gt;test
6276 </td>
6277 </tr>
6278 </table>
6279
6280 !! html/parsoid
6281 <table><tbody>
6282 <tr>
6283 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6284 !! end
6285
6286 # FIXME: The output seems broken. Filed as T110268.
6287 !! test
6288 ! and || in td attributes should not be parsed as <th>/<td>
6289 !! options
6290 parsoid=wt2html
6291 !! wikitext
6292 {|
6293 | style="color: red !important;" data-contrived="put this here ||" | foo
6294 |}
6295 !! html/php
6296 <table>
6297 <tr>
6298 <td> style="color: red !important;" data-contrived="put this here </td>
6299 <td> foo
6300 </td></tr></table>
6301
6302 !! html/parsoid
6303 <table>
6304 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6305 </tbody></table>
6306 !! end
6307
6308 !! test
6309 Indented table markup mixed with indented pre content (proposed in bug 6200)
6310 !! wikitext
6311 <table>
6312 <tr>
6313 <td>
6314 Text that should be rendered preformatted
6315 </td>
6316 </tr>
6317 </table>
6318 !! html
6319 <table>
6320 <tr>
6321 <td>
6322 <pre>Text that should be rendered preformatted
6323 </pre>
6324 </td>
6325 </tr>
6326 </table>
6327
6328 !! end
6329
6330 !! test
6331 1. Template-generated table cell attributes and cell content
6332 !! wikitext
6333 {|
6334 |{{table_attribs}}
6335 | {{table_attribs}}
6336 || {{table_attribs_5}}
6337 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6338 |align=center {{table_attribs}}
6339 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6340 |}
6341 !! html
6342 <table>
6343 <tr>
6344 <td style="color:red;">Foo
6345 </td>
6346 <td style="color:red;">Foo
6347 </td>
6348 <td> style="color:red;"</td>
6349 <td>Bar
6350 </td>
6351 <td style="color:red;">Foo
6352 </td>
6353 <td align="center" style="color:red;">Foo
6354 </td>
6355 <td align="center" style="color:red;">Foo
6356 </td></tr></table>
6357
6358 !! end
6359
6360 !! test
6361 2. Template-generated table cell attributes and cell content
6362 !! wikitext
6363 {|
6364 |{{table_attribs_2}}
6365 |}
6366 !! html/php
6367 <table>
6368 <tr>
6369 <td style="color:red;">Foo
6370 </td>
6371 <td>Bar</td>
6372 <td>Baz
6373 </td></tr></table>
6374
6375 !! html/parsoid
6376 <table>
6377 <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>
6378 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6379 </tbody></table>
6380 !! end
6381
6382 !! test
6383 3. Template-generated table cell attributes and cell content
6384 !! wikitext
6385 {|
6386 !align=center {{table_header_cells}}
6387 |-
6388 |align=center {{table_cells}}
6389 |}
6390 !! html/php
6391 <table>
6392 <tr>
6393 <th align="center" style="color:red;">Foo</th>
6394 <th style="color:red;"><i>Bar</i></th>
6395 <th style="color:brown;"><i>Foo</i> and Baz
6396 </th></tr>
6397 <tr>
6398 <td align="center" style="color:red;">Foo</td>
6399 <td style="color:red;"><i>Bar</i></td>
6400 <td style="color:brown;"><i>Foo</i> and Baz
6401 </td></tr></table>
6402
6403 !! html/parsoid
6404 <table>
6405 <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>
6406 <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>
6407 </tbody></table>
6408 !! end
6409
6410 !! test
6411 4. Template-generated table cell attributes and cell content inside a templated table
6412 !! wikitext
6413 {{tbl-start}}
6414 !align=center {{table_header_cells}}
6415 |-
6416 |align=center {{table_cells}}
6417 {{tbl-end}}
6418 !! html/php
6419 <table>
6420 <tr>
6421 <th align="center" style="color:red;">Foo</th>
6422 <th style="color:red;"><i>Bar</i></th>
6423 <th style="color:brown;"><i>Foo</i> and Baz
6424 </th></tr>
6425 <tr>
6426 <td align="center" style="color:red;">Foo</td>
6427 <td style="color:red;"><i>Bar</i></td>
6428 <td style="color:brown;"><i>Foo</i> and Baz
6429 </td></tr></table>
6430
6431 !! html/parsoid
6432 <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}}]}'>
6433 <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>
6434 <tr>
6435 <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>
6436 </tbody></table>
6437 !! end
6438
6439 ## Edge case fix to prevent future regressions
6440 !! test
6441 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6442 !! wikitext
6443 {|
6444 |{{table_attribs_7}}
6445 |}
6446 <references />
6447 !! html/parsoid
6448 <table>
6449 <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>
6450 </tbody></table>
6451 <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>
6452 !! end
6453
6454 !! test
6455 Table with row followed by newlines and table heading
6456 !! wikitext
6457 {|
6458 |-
6459
6460 ! foo
6461 |}
6462 !! html
6463 <table>
6464
6465
6466 <tr>
6467 <th> foo
6468 </th></tr></table>
6469
6470 !! end
6471
6472 !! test
6473 Table with empty line following the start tag
6474 !! wikitext
6475 {|
6476
6477 |-
6478 | foo
6479 |}
6480 !! html
6481 <table>
6482
6483
6484 <tr>
6485 <td> foo
6486 </td></tr></table>
6487
6488 !! end
6489
6490 # FIXME: Preserve the attribute properly (with an empty string as value) in
6491 # the PHP parser. Parsoid implements the behavior below.
6492 !! test
6493 Table attributes with empty value
6494 !! wikitext
6495 {|
6496 | style=| hello
6497 |}
6498 !! html/parsoid
6499 <table>
6500 <tbody>
6501 <tr>
6502 <td style=""> hello
6503 </td></tr></tbody></table>
6504
6505 !! end
6506
6507 !! test
6508 Wikitext table with a lot of comments
6509 !! wikitext
6510 {|
6511 <!-- c0 -->
6512 | foo
6513 <!-- c1 -->
6514 |-<!-- c2 -->
6515 <!-- c3 -->
6516 |<!-- c4 -->
6517 <!-- c5 -->
6518 |}
6519 !! html
6520 <table>
6521 <tr>
6522 <td> foo
6523 </td></tr>
6524 <tr>
6525 <td>
6526 </td></tr></table>
6527
6528 !! end
6529
6530 !! test
6531 Wikitext table comments represented in parsoid dom
6532 !! wikitext
6533 {|<!--c1--><!--c2-->
6534 |-<!--c3-->
6535 | x
6536 |}
6537 !! html/php+tidy
6538 <table>
6539 <tr>
6540 <td>x</td>
6541 </tr>
6542 </table>
6543 !! html/parsoid
6544 <table><!--c1--><!--c2-->
6545 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6546 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6547 </tbody></table>
6548 !! end
6549
6550 !! test
6551 Wikitext table with double-line table cell
6552 !! wikitext
6553 {|
6554 |a
6555 b
6556 |}
6557 !! html
6558 <table>
6559 <tr>
6560 <td>a
6561 <p>b
6562 </p>
6563 </td></tr></table>
6564
6565 !! end
6566
6567 !! test
6568 Table cell with a single comment
6569 !! wikitext
6570 {|
6571 | <!-- c1 -->
6572 | a
6573 |}
6574 !! html
6575 <table>
6576 <tr>
6577 <td>
6578 </td>
6579 <td> a
6580 </td></tr></table>
6581
6582 !! end
6583
6584 !! test
6585 Table-cell after a comment-only-empty-line
6586 !! wikitext
6587 {|
6588 |a
6589 <!--c1-->
6590 <!--c2-->| b
6591 |}
6592 !! html
6593 <table>
6594 <tr>
6595 <td>a
6596 </td>
6597 <td> b
6598 </td></tr></table>
6599
6600 !! html/parsoid
6601 <table>
6602 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6603 <!--c1-->
6604 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6605 </tbody></table>
6606
6607 !! end
6608
6609 !! test
6610 Build table with {{!}}
6611 !! wikitext
6612 {{{!}} class="wikitable"
6613 ! header
6614 ! second header
6615 {{!}}- style="color:red;"
6616 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6617 {{!}}}
6618 !! html
6619 <table class="wikitable">
6620 <tr>
6621 <th> header
6622 </th>
6623 <th> second header
6624 </th></tr>
6625 <tr style="color:red;">
6626 <td> data </td>
6627 <td style="color:red;"> second data
6628 </td></tr></table>
6629
6630 !! end
6631
6632 !! test
6633 Build table with pipe as data
6634 !! wikitext
6635 {| class="wikitable"
6636 ! header
6637 ! second header
6638 |- style="color:red;"
6639 | data || style="color:red;" | second data
6640 |-
6641 | style="color:red;" | data with | || style="color:red;" | second data with |
6642 |-
6643 || data with | ||| second data with |
6644 |}
6645 !! html
6646 <table class="wikitable">
6647 <tr>
6648 <th> header
6649 </th>
6650 <th> second header
6651 </th></tr>
6652 <tr style="color:red;">
6653 <td> data </td>
6654 <td style="color:red;"> second data
6655 </td></tr>
6656 <tr>
6657 <td style="color:red;"> data with | </td>
6658 <td style="color:red;"> second data with |
6659 </td></tr>
6660 <tr>
6661 <td> data with | </td>
6662 <td> second data with |
6663 </td></tr></table>
6664
6665 !! end
6666
6667 !! test
6668 Build table with wikilink
6669 !! wikitext
6670 {| class="wikitable"
6671 ! header || second header
6672 |- style="color:red;"
6673 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6674 |-
6675 | data || second data [[Main Page|link|text with pipe]]
6676 |}
6677 !! html
6678 <table class="wikitable">
6679 <tr>
6680 <th> header </th>
6681 <th> second header
6682 </th></tr>
6683 <tr style="color:red;">
6684 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6685 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6686 </td></tr>
6687 <tr>
6688 <td> data </td>
6689 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6690 </td></tr></table>
6691
6692 !! end
6693
6694 # The expected HTML structure in this test is debatable. The PHP parser does
6695 # not parse this kind of table at all. The main focus for Parsoid is on
6696 # round-tripping, so this output is ok for now. TODO: revisit!
6697 !! test
6698 Wikitext table with html-syntax row
6699 !! wikitext
6700 {|
6701 |-
6702 <td>foo</td>
6703 |}
6704 !! html/parsoid
6705 <table>
6706 <tbody>
6707 <tr>
6708 <td>foo</td></tr></tbody></table>
6709 !! end
6710
6711 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6712 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6713 ## PHP parser, which tidy then compounds by fostering the content
6714 ## entirely out of the table. Parsoid recognizes the table context
6715 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6716 ## depends on PHP's treatment of broken table markup!
6717 !! test
6718 Implicit <td> after a |-
6719 !! options
6720 parsoid=wt2html,html2html
6721 !! wikitext
6722 {|
6723 |-
6724 a
6725 |}
6726 !! html/php
6727 <table>
6728
6729 a
6730 </table>
6731
6732 !! html/php+tidy
6733 <p>a</p>
6734 !! html/parsoid
6735 <table>
6736 <tr><td>a</td></tr>
6737 </table>
6738 !! end
6739
6740 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6741 !! test
6742 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6743 !! options
6744 parsoid=wt2html,html2html
6745 !! wikitext
6746 {|
6747 |-
6748 |
6749 a
6750 |-
6751 b
6752 |}
6753 !! html/php
6754 <table>
6755
6756 <tr>
6757 <td>
6758 <pre>a
6759 </pre>
6760 </td></tr>
6761 b
6762 </table>
6763
6764 !! html/php+tidy
6765 <p>b</p>
6766 <table>
6767 <tr>
6768 <td>
6769 <pre>
6770 a
6771 </pre></td>
6772 </tr>
6773 </table>
6774 !! html/parsoid
6775 <table>
6776 <tbody>
6777 <tr><td><pre>a</pre></td></tr>
6778 <tr><td> b</td></tr>
6779 </tbody>
6780 </table>
6781 !! end
6782
6783 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6784 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6785 !! test
6786 Lists should be recognized in an implicit <td> context
6787 !! options
6788 parsoid=wt2html,html2html
6789 !! wikitext
6790 {|
6791 |-
6792 *a
6793 |}
6794 !! html/php
6795 <table>
6796
6797 <ul><li>a</li></ul>
6798 </table>
6799
6800 !! html/php+tidy
6801 <ul>
6802 <li>a</li>
6803 </ul>
6804 !! html/parsoid
6805 <table>
6806 <tr>
6807 <td><ul>
6808 <li>a</li>
6809 </ul></td>
6810 </tr>
6811 </table>
6812 !! end
6813
6814 !! test
6815 Table cells not properly parsed in an implicit-td context
6816 !! wikitext
6817 {|
6818 |-
6819 {{table_attribs_4}} || a || b
6820 |}
6821 !! html/php+tidy
6822 <table>
6823 <tr>
6824 <td style="background-color:#DC241f;" width="10px"></td>
6825 <td>a</td>
6826 <td>b</td>
6827 </tr>
6828 </table>
6829 !! html/parsoid
6830 <table>
6831 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6832 <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>
6833 </tbody></table>
6834 !! end
6835
6836 !! test
6837 Parsoid: Round-trip tables directly followed by content (bug 51219)
6838 !! options
6839 parsoid=wt2html,wt2wt
6840 !! wikitext
6841 {|
6842 |foo
6843 |} bar
6844
6845 {|
6846 |baz
6847 |}<b>quux</b>
6848 !! html+tidy
6849 <table>
6850 <tr>
6851 <td>foo</td>
6852 </tr>
6853 </table>
6854 <p>bar</p>
6855 <table>
6856 <tr>
6857 <td>baz</td>
6858 </tr>
6859 </table>
6860 <p><b>quux</b></p>
6861 !! end
6862
6863 !! test
6864 Parsoid: Default to a newline after tables in new content (bug 51219)
6865 !! options
6866 parsoid=html2wt
6867 !! html/parsoid
6868 <table><tbody>
6869 <tr><td>foo</td></tr></tbody></table> bar
6870 <table><tbody>
6871 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6872 !! wikitext
6873 {|
6874 |foo
6875 |}
6876 <nowiki> </nowiki>bar
6877 {|
6878 |baz
6879 |}
6880 '''quux'''
6881 !! end
6882
6883 !! test
6884 Parsoid: newline inducing block nodes don't suppress <nowiki>
6885 !! options
6886 parsoid=html2wt
6887 !! html/parsoid
6888 a<h1>foo</h1>
6889 !! wikitext
6890 <nowiki> </nowiki>a
6891
6892 = foo =
6893 !! end
6894
6895 !! test
6896 Parsoid: Row-syntax table headings followed by comment & table cells
6897 !! options
6898 parsoid=wt2html,wt2wt
6899 !! wikitext
6900 {|
6901 ! foo || bar
6902 <!-- foo --> || baz || quux
6903 |}
6904 !! html/php
6905 <table>
6906 <tr>
6907 <th> foo </th>
6908 <th> bar
6909 </th>
6910 <td> baz </td>
6911 <td> quux
6912 </td></tr></table>
6913
6914 !! html/parsoid
6915 <table>
6916 <tbody><tr><th> foo </th><th> bar
6917 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6918 </tbody></table>
6919 !! end
6920
6921 !!test
6922 Parsoid: Recover better from broken table attributes
6923 !!options
6924 parsoid=wt2html
6925 !!wikitext
6926 {| class="foo
6927 | class="bar" |
6928 foo
6929 |}
6930 !!html/php+tidy
6931 <table class="foo">
6932 <tr>
6933 <td class="bar">
6934 <p>foo</p>
6935 </td>
6936 </tr>
6937 </table>
6938 !!html/parsoid
6939 <table class="foo">
6940 <tr>
6941 <td class="bar">
6942 <p>foo</p></td></tr>
6943 </tbody></table>
6944 !!end
6945
6946 !! test
6947 Tables: Digest broken attributes on table and tr tag
6948 !! options
6949 parsoid=wt2html
6950 !! wikitext
6951 {| || |} ++
6952 |- || || ++ --
6953 |- > [
6954 |}
6955 !! html
6956 <table>
6957 <tbody>
6958 <tr></tr>
6959 <tr></tr>
6960 </tbody></table>
6961 !! end
6962
6963 !! test
6964 Strip unsupported table tags
6965 !! options
6966 parsoid=html2wt
6967 !! html/parsoid
6968 <table>
6969 <thead>
6970 <tr>
6971 <th>Month</th>
6972 <th>Savings</th>
6973 </tr>
6974 </thead>
6975 <tbody>
6976 <tr>
6977 <td>January</td>
6978 <td>$100</td>
6979 </tr>
6980 <tr>
6981 <td>February</td>
6982 <td>$80</td>
6983 </tr>
6984 </tbody>
6985 <tfoot>
6986 <tr>
6987 <td>Sum</td>
6988 <td>$180</td>
6989 </tr>
6990 </tfoot>
6991 </table>
6992 !! wikitext
6993 {|
6994
6995 !Month
6996 !Savings
6997
6998 |January
6999 |$100
7000
7001 |-
7002 |February
7003 |$80
7004
7005 |Sum
7006 |$180
7007
7008 |}
7009 !! end
7010
7011 !!test
7012 Testing serialization after deletion of table cells
7013 !!options
7014 parsoid={
7015 "modes": ["wt2wt", "selser"],
7016 "changes": [
7017 ["#x", "remove"]
7018 ]
7019 }
7020 !!wikitext
7021 {|
7022 !h1 !!h2 !!h3
7023 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7024 |}
7025 !! wikitext/edited
7026 {|
7027 !h1 !!h2 !!h3
7028 |c2 |||c3
7029 |}
7030 !!end
7031
7032 ###
7033 ### Internal links
7034 ###
7035 !! test
7036 Plain link, capitalized
7037 !! wikitext
7038 [[Main Page]]
7039 !! html
7040 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7041 </p>
7042 !! end
7043
7044 !! test
7045 Plain link, uncapitalized
7046 !! wikitext
7047 [[main Page]]
7048 !! html
7049 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7050 </p>
7051 !! end
7052
7053 !! test
7054 Piped link
7055 !! wikitext
7056 [[Main Page|The Main Page]]
7057 !! html
7058 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7059 </p>
7060 !! end
7061
7062 !! test
7063 Piped link with comment in link text
7064 !! wikitext
7065 [[Main Page|The Main<!--front--> Page]]
7066 !! html
7067 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7068 </p>
7069 !! end
7070
7071 !! test
7072 Piped link with multiple pipe characters in link text
7073 !! wikitext
7074 [[Main Page||The|Main|Page|]]
7075 !! html/php
7076 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7077 </p>
7078 !! html/parsoid
7079 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7080 !! end
7081
7082 !! test
7083 Broken link
7084 !! wikitext
7085 [[Zigzagzogzagzig]]
7086 !! html
7087 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7088 </p>
7089 !! end
7090
7091 !! test
7092 Broken link with fragment
7093 !! wikitext
7094 [[Zigzagzogzagzig#zug]]
7095 !! html
7096 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7097 </p>
7098 !! end
7099
7100 !! test
7101 Special page link with fragment
7102 !! wikitext
7103 [[Special:Version#anchor]]
7104 !! html
7105 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7106 </p>
7107 !! end
7108
7109 !! test
7110 Nonexistent special page link with fragment
7111 !! wikitext
7112 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7113 !! html
7114 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7115 </p>
7116 !! end
7117
7118 !! test
7119 Link with prefix
7120 !! wikitext
7121 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7122 !! html
7123 <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>
7124 </p>
7125 !! end
7126
7127 !! test
7128 Link with suffix
7129 !! wikitext
7130 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7131 !! html
7132 <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>!!!
7133 </p>
7134 !! end
7135
7136 !! article
7137 prefixed article
7138 !! text
7139 Some text
7140 !! endarticle
7141
7142 !! test
7143 Bug 43661: Piped links with identical prefixes
7144 !! wikitext
7145 [[prefixed article|prefixed articles with spaces]]
7146
7147 [[prefixed article|prefixed articlesaoeu]]
7148
7149 [[Main Page|Main Page test]]
7150 !! html
7151 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7152 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7153 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7154 </p>
7155 !! end
7156
7157
7158 !! test
7159 Link with HTML entity in suffix / tail
7160 !! wikitext
7161 [[Main Page]]&quot;, [[Main Page]]&#97;
7162 !! html/php
7163 <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;
7164 </p>
7165 !! html/parsoid
7166 <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>
7167 !! end
7168
7169 !! test
7170 Link with 3 brackets
7171 !! wikitext
7172 [[[Main Page]]]
7173 Foo [[[Main Page]]]
7174 !! html
7175 <p>[[[Main Page]]]
7176 Foo [[[Main Page]]]
7177 </p>
7178 !! end
7179
7180 !! test
7181 Link with 4 brackets
7182 !! wikitext
7183 [[[[Main Page]]]]
7184 !! html
7185 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7186 </p>
7187 !! end
7188
7189 !! test
7190 Piped link with 3 brackets
7191 !! wikitext
7192 [[[main page|the main page]]]
7193 !! html
7194 <p>[[[main page|the main page]]]
7195 </p>
7196 !! end
7197
7198 !! test
7199 Piped link with extlink-like text
7200 !! wikitext
7201 [[Main Page|[bar]]]
7202 [[Main Page|This is a [bar]]]
7203 !! html/php
7204 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7205 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7206 </p>
7207 !! html/parsoid
7208 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7209 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7210 !! end
7211
7212 !! test
7213 Link with multiple pipes
7214 !! wikitext
7215 [[Main Page|The|Main|Page]]
7216 !! html
7217 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7218 </p>
7219 !! end
7220
7221 # Note that parsoid does not munge anchor text; all non-space
7222 # characters are valid in HTML5 ids.
7223 !! test
7224 Anchor containing a #. (bug 63430)
7225 !! wikitext
7226 [[Main Page#And#Link]]
7227 !! html/php
7228 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7229 </p>
7230 !! html/parsoid
7231 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7232 !! end
7233
7234 !! test
7235 Link to namespaces
7236 !! wikitext
7237 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7238 !! html
7239 <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>
7240 </p>
7241 !! end
7242
7243 !! test
7244 Link with space in namespace
7245 !! wikitext
7246 [[User talk:Foo bar]]
7247 !! html
7248 <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>
7249 </p>
7250 !! end
7251
7252 !! article
7253 MemoryAlpha:AlphaTest
7254 !! text
7255 This is an article in the MemoryAlpha namespace
7256 (which shadows the memoryalpha interwiki link).
7257 !! endarticle
7258
7259 !! test
7260 Namespace takes precedence over interwiki link (bug 51680)
7261 !! wikitext
7262 [[MemoryAlpha:AlphaTest]]
7263 !! html
7264 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7265 </p>
7266 !! end
7267
7268 # The previous test doesn't work correctly in html2*, due to not recognizing the
7269 # link as an internal one. This one checks for the correct behavior.
7270 !! test
7271 Link to namespace preferred over interwiki with correct rel attribute
7272 !! options
7273 parsoid=html2wt,html2html
7274 !! html/parsoid
7275 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7276 !! wikitext
7277 [[MemoryAlpha:AlphaTest]]
7278 !! end
7279
7280 !! test
7281 Piped link to namespace
7282 !! wikitext
7283 [[Meta:Disclaimers|The disclaimers]]
7284 !! html
7285 <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>
7286 </p>
7287 !! end
7288
7289 !! test
7290 Link containing }
7291 !! wikitext
7292 [[Usually caused by a typo (oops}]]
7293 !! html
7294 <p>[[Usually caused by a typo (oops}]]
7295 </p>
7296 !! end
7297
7298 !! article
7299 7% Solution
7300 !! text
7301 Just a test of an article title containing a percent.
7302 !! endarticle
7303
7304 !! test
7305 Link containing % (not as a hex sequence)
7306 !! wikitext
7307 [[7% Solution]]
7308 !! html/php
7309 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7310 </p>
7311 !! html/parsoid
7312 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7313 !! end
7314
7315 # note that the parsoid HTML is identical to the previous test output,
7316 # so the previous test ensures that the html2wt mode will generate the
7317 # "not as a hex sequence" wikitext.
7318 !! test
7319 Link containing % as a single hex sequence interpreted to char
7320 !! options
7321 parsoid=wt2wt,wt2html,html2html
7322 !! wikitext
7323 [[7%25 Solution]]
7324 !! html/php
7325 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7326 </p>
7327 !! html/parsoid
7328 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7329 !!end
7330
7331 !! test
7332 Link containing % as a double hex sequence interpreted to hex sequence
7333 !! wikitext
7334 [[7%2525 Solution]]
7335 !! html
7336 <p>[[7%2525 Solution]]
7337 </p>
7338 !!end
7339
7340 # note that parsoid does not munge anchor text; all non-space
7341 # characters are valid in HTML5 anchors.
7342 !! test
7343 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7344 Example for such a section: == < ==
7345 !! wikitext
7346 [[%23%3c]][[%23%3e]]
7347 !! html/php
7348 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7349 </p>
7350 !! html/parsoid
7351 <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>
7352 !! end
7353
7354 !! test
7355 Link containing "<#" and ">#" as a hex sequences
7356 !! wikitext
7357 [[%3c%23]][[%3e%23]]
7358 !! html
7359 <p>[[%3c%23]][[%3e%23]]
7360 </p>
7361 !! end
7362
7363 !! test
7364 Link containing an equals sign
7365 !! wikitext
7366 [[Special:BookSources/isbn=4-00-026157-6]]
7367 !! html/php
7368 <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>
7369 </p>
7370 !! html/parsoid
7371 <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>
7372 !! end
7373
7374 !! article
7375 Foo~bar
7376 !! text
7377 Just a test of an article title containing a tilde.
7378 !! endarticle
7379
7380 # note that links containing signatures, like [[Foo~~~~]], are
7381 # massaged by the pre-save transform (PST) and so the tildes are never
7382 # seen by the parser.
7383 !! test
7384 Link containing a tilde
7385 !! wikitext
7386 [[Foo~bar]]
7387 !! html/php
7388 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7389 </p>
7390 !! html/parsoid
7391 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7392 !! end
7393
7394 !! test
7395 Link containing double-single-quotes '' (bug 4598)
7396 !! wikitext
7397 [[Lista d''e paise d''o munno]]
7398 !! html/php
7399 <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>
7400 </p>
7401 !! html/parsoid
7402 <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>
7403 !! end
7404
7405 !! test
7406 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7407 !! wikitext
7408 Some [[Link|pretty ''italics'' and stuff]]!
7409 !! html/php
7410 <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>!
7411 </p>
7412 !! html/parsoid
7413 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7414 !! end
7415
7416 !! test
7417 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7418 !! wikitext
7419 ''Some [[Link|pretty ''italics'' and stuff]]!''
7420 !! html
7421 <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>
7422 </p>
7423 !! end
7424
7425 !! test
7426 Link with double quotes in title part (literal) and alternate part (interpreted)
7427 !! wikitext
7428 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7429
7430 [[''Pentecoste'']]
7431
7432 [[''Pentecoste''|Pentecoste]]
7433
7434 [[''Pentecoste''|''Pentecoste'']]
7435 !! html/php
7436 <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>
7437 </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>
7438 </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>
7439 </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>
7440 </p>
7441 !! html/parsoid
7442 <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>
7443 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7444 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7445 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7446 !! end
7447
7448 !! test
7449 Broken image links with HTML captions (bug 39700)
7450 !! wikitext
7451 [[File:Nonexistent|<script></script>]]
7452 [[File:Nonexistent|100x100px|<script></script>]]
7453 [[File:Nonexistent|&lt;]]
7454 [[File:Nonexistent|a<i>b</i>c]]
7455 !! html/php
7456 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7457 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7458 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7459 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7460 </p>
7461 !! html/parsoid
7462 <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>
7463 <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>
7464 <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>
7465 <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>
7466 !! end
7467
7468 !! test
7469 Plain link to URL
7470 !! wikitext
7471 [[http://www.example.com]]
7472 !! html/php
7473 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7474 </p>
7475 !! html/parsoid
7476 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7477 !! end
7478
7479 !! test
7480 Plain link to URL with link text
7481 !! wikitext
7482 [[http://www.example.com Link text]]
7483 !! html
7484 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7485 </p>
7486 !! end
7487
7488 !! test
7489 Plain link to protocol-relative URL
7490 !! wikitext
7491 [[//www.example.com]]
7492 !! html/php
7493 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7494 </p>
7495 !! html/parsoid
7496 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7497 !! end
7498
7499 !! test
7500 Plain link to protocol-relative URL with link text
7501 !! wikitext
7502 [[//www.example.com Link text]]
7503 !! html
7504 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7505 </p>
7506 !! end
7507
7508 !! test
7509 Plain link to page with question mark in title
7510 !! wikitext
7511 [[A?b]]
7512
7513 [[A?b|Baz]]
7514 !! html
7515 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7516 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7517 </p>
7518 !! end
7519
7520
7521 # I'm fairly sure the expected result here is wrong.
7522 # We want these to be URL links, not pseudo-pages with URLs for titles....
7523 # However the current output is also pretty screwy.
7524 #
7525 # ----
7526 # I'm changing it to match the current output--it arguably makes more
7527 # sense in the light of the test above. Old expected result was:
7528 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7529 #</p>
7530 # But I think this test is bordering on "garbage in, garbage out" anyway.
7531 # -- wtm
7532 !! test
7533 Piped link to URL
7534 !! wikitext
7535 Piped link to URL: [[http://www.example.com|an example URL]]
7536 !! html/php
7537 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7538 </p>
7539 !! html/parsoid
7540 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7541 !! end
7542
7543 !! test
7544 BUG 2: [[page|http://url/]] should link to page, not http://url/
7545 !! wikitext
7546 [[Main Page|http://url/]]
7547 !! html/php
7548 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7549 </p>
7550 !! html/parsoid
7551 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7552 !! end
7553
7554 # Parsoid does not mark self-links, by design.
7555 !! test
7556 BUG 337: Escaped self-links should be bold
7557 !! options
7558 title=[[Bug462]]
7559 !! wikitext
7560 [[Bu&#103;462]] [[Bug462]]
7561 !! html/php
7562 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7563 </p>
7564 !! html/php+tidy
7565 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7566 !! html/parsoid
7567 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7568 !! end
7569
7570 !! test
7571 Self-link to section should not be bold
7572 !! options
7573 title=[[Main Page]]
7574 !! wikitext
7575 [[Main Page#section]]
7576 !! html
7577 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7578 </p>
7579 !! end
7580
7581 !! article
7582 00
7583 !! text
7584 This is 00.
7585 !! endarticle
7586
7587 !!test
7588 Self-link to numeric title
7589 !!options
7590 title=[[0]]
7591 !! wikitext
7592 [[0]]
7593 !! html
7594 <p><strong class="selflink">0</strong>
7595 </p>
7596 !!end
7597
7598 !!test
7599 Link to numeric-equivalent title
7600 !!options
7601 title=[[0]]
7602 !! wikitext
7603 [[00]]
7604 !! html
7605 <p><a href="/wiki/00" title="00">00</a>
7606 </p>
7607 !!end
7608
7609 !! test
7610 <nowiki> inside a link
7611 !! wikitext
7612 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7613 !! html
7614 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7615 </p>
7616 !! end
7617
7618 !! test
7619 Non-breaking spaces in title
7620 !! wikitext
7621 [[&nbsp; Main &nbsp; Page &nbsp;]]
7622 !! html
7623 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7624 </p>
7625 !!end
7626
7627 !! test
7628 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7629 !! options
7630 language=ca
7631 !! wikitext
7632 '''[[Main Page]]'''
7633 !! html
7634 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7635 </p>
7636 !! end
7637
7638 !! test
7639 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7640 !! options
7641 language=ca
7642 !! wikitext
7643 ''[[Main Page]]''
7644 !! html
7645 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7646 </p>
7647 !! end
7648
7649 !! test
7650 Internal link with en linktrail: no apostrophes (bug 27473)
7651 !! options
7652 language=en
7653 !! wikitext
7654 [[Something]]'nice
7655 !! html
7656 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7657 </p>
7658 !! end
7659
7660 !! test
7661 Internal link with ca linktrail with apostrophes (bug 27473)
7662 !! options
7663 language=ca
7664 !! wikitext
7665 [[Something]]'nice
7666 !! html
7667 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7668 </p>
7669 !! end
7670
7671 !! test
7672 Internal link with kaa linktrail with apostrophes (bug 27473)
7673 !! options
7674 language=kaa
7675 !! wikitext
7676 [[Something]]'nice
7677 !! html
7678 <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>
7679 </p>
7680 !! end
7681
7682 !! test
7683 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7684 !! wikitext
7685 [[User:Foo/Test/63636:Bar|Test]]
7686 !! html/php
7687 <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>
7688 </p>
7689 !! html/parsoid
7690 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7691 !! end
7692
7693 !! test
7694 Purely hash wikilink
7695 !! options
7696 title=[[User:test/123]]
7697 !! wikitext
7698 [[#a|b]]
7699 !! html/php
7700 <p><a href="#a">b</a>
7701 </p>
7702 !! html/parsoid
7703 <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>
7704 !! end
7705
7706 !! test
7707 1. Interaction of linktrail and template encapsulation
7708 !! options
7709 parsoid
7710 !! wikitext
7711 {{echo|[[Foo]]}}l
7712 !! html
7713 <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>
7714 !! end
7715
7716 !! test
7717 2. Interaction of linktrail and template encapsulation
7718 !! options
7719 parsoid
7720 !! wikitext
7721 {{echo|Some [[Fool]]}}s
7722 !! html
7723 <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>
7724 !! end
7725
7726 !! test
7727 3. Interaction of linktrail and template encapsulation
7728 !! options
7729 parsoid
7730 !! wikitext
7731 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7732 !! html
7733 <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>
7734 !! end
7735
7736 !! article
7737 Söfnuður
7738 !! text
7739 Test.
7740 !! endarticle
7741
7742 !! test
7743 Internal link with is link prefix
7744 !! options
7745 language=is
7746 !! wikitext
7747 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7748 !! html
7749 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7750 </p>
7751 !! end
7752
7753 !! article
7754 Mótmælendatrú
7755 !! text
7756 Test.
7757 !! endarticle
7758
7759 !! test
7760 Internal link with is link trail and link prefix
7761 !! options
7762 language=is
7763 !! wikitext
7764 [[mótmælendatrú|xxx]]ar
7765 [[mótmælendatrú]]ar
7766 mótmælenda[[söfnuður]]
7767 mótmælenda[[söfnuður|söfnuðir]]
7768 mótmælenda[[söfnuður|söfnuðir]]xxx
7769 !! html
7770 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7771 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7772 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7773 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7774 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7775 </p>
7776 !! end
7777
7778 !! test
7779 Parsoid link trail escaping
7780 !! options
7781 parsoid=html2wt,html2html
7782 !! html/parsoid
7783 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7784 !! wikitext
7785 [[apple]]<nowiki/>s
7786 !! end
7787
7788 !! test
7789 Parsoid link prefix escaping
7790 !! options
7791 language=is
7792 parsoid=html2wt,html2html
7793 !! html/parsoid
7794 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7795 !! wikitext
7796 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7797 !! end
7798
7799 !! test
7800 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7801 !! wikitext
7802 [[Foo| bar]]
7803
7804 [[Foo| ''bar'']]
7805
7806 [http://wp.org foo]
7807
7808 [http://wp.org ''foo'']
7809 !! html
7810 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7811 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7812 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7813 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7814 </p>
7815 !! end
7816
7817 !! test
7818 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7819 !! options
7820 parsoid
7821 !! wikitext
7822 [[Foo|{{echo|a}} b {{echo|c}}]]
7823 !! html
7824 <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>
7825 !! end
7826
7827 !! test
7828 Link with angle bracket after anchor
7829 !! wikitext
7830 [[Foo#<bar>]]
7831 !! html/php
7832 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7833 </p>
7834 !! html/parsoid
7835 <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>
7836 !! end
7837
7838 ###
7839 ### Interwiki links (see maintenance/interwiki.sql)
7840 ###
7841
7842 !! test
7843 Inline interwiki link
7844 !! options
7845 parsoid=wt2html,wt2wt,html2html
7846 !! wikitext
7847 [[MeatBall:SoftSecurity]]
7848 !! html/php
7849 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7850 </p>
7851 !! html/parsoid
7852 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7853 !! end
7854
7855 !! test
7856 Inline interwiki link with empty title (bug 2372)
7857 !! options
7858 parsoid=wt2html,wt2wt,html2html
7859 !! wikitext
7860 [[MeatBall:]]
7861 !! html/php
7862 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7863 </p>
7864 !! html/parsoid
7865 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7866 !! end
7867
7868 !! test
7869 Interwiki link encoding conversion (bug 1636)
7870 !! wikitext
7871 *[[Wikipedia:ro:Olteni&#0355;a]]
7872 *[[Wikipedia:ro:Olteni&#355;a]]
7873 !! html
7874 <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>
7875 <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>
7876
7877 !! html+tidy
7878 <ul>
7879 <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>
7880 <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>
7881 </ul>
7882 !! end
7883
7884 !! test
7885 Interwiki link with fragment (bug 2130)
7886 !! wikitext
7887 [[MeatBall:SoftSecurity#foo]]
7888 !! html
7889 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7890 </p>
7891 !! end
7892
7893 # Ideally the wikipedia: prefix here should be proto-relative too
7894 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7895 # define the 'en' prefix, and originally the test used 'wikipedia',
7896 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7897 # article.
7898 !! test
7899 Different interwiki prefixes mapping to the same URL
7900 !! wikitext
7901 [[:en:Foo]]
7902
7903 [[:en:Foo|Foo]]
7904
7905 [[wikipedia:Foo]]
7906
7907 [[:wikipedia:Foo|Foo]]
7908
7909 [[wikipedia:en:Foo]]
7910
7911 [[:wikipedia:en:Foo]]
7912
7913 [[ wikiPEdia :Foo]]
7914 !! html/parsoid
7915 <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>
7916
7917 <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>
7918
7919 <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>
7920
7921 <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>
7922
7923 <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>
7924
7925 <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>
7926
7927 <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>
7928 !! end
7929
7930 !! test
7931 Interwiki links that cannot be represented in wiki syntax
7932 !! wikitext
7933 [[meatball:ok]]
7934 [[meatball:ok#foo|ok with fragment]]
7935 [[meatball:ok_as_well?|ok ending with ? mark]]
7936 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7937 [http://de.wikipedia.org/wiki/#foo is just fragment]
7938
7939 !! html/php
7940 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7941 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7942 <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>
7943 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7944 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7948 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7949 <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>
7950 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7951 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7952 !! end
7953
7954 !! test
7955 Interwiki links: trail
7956 !! wikitext
7957 [[wikipedia:Foo|Ba]]r
7958 !! html/php
7959 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7960 </p>
7961 !! html/parsoid
7962 <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>
7963 !! end
7964
7965 !! test
7966 Local interwiki link
7967 !! options
7968 parsoid=wt2html,wt2wt,html2html
7969 !! wikitext
7970 [[local:Template:Foo]]
7971 !! html/php
7972 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7973 </p>
7974 !! html/parsoid
7975 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7976 !! end
7977
7978 # Parsoid does not mark self-links, by design.
7979 !! test
7980 Local interwiki link: self-link to current page
7981 !! options
7982 title=[[Main Page]]
7983 parsoid=wt2html,wt2wt,html2html
7984 !! wikitext
7985 [[local:Main Page]]
7986 !! html/php
7987 <p><strong class="selflink">local:Main Page</strong>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7991 !! end
7992
7993 !! test
7994 Local interwiki link: prefix only (bug 64167)
7995 !! options
7996 parsoid=wt2html,wt2wt,html2html
7997 !! wikitext
7998 [[local:]]
7999 !! html/php
8000 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8001 </p>
8002 !! html/parsoid
8003 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8004 !! end
8005
8006 !! test
8007 Local interwiki link: with additional interwiki prefix (bug 61357)
8008 !! options
8009 parsoid=wt2html,wt2wt,html2html
8010 !! wikitext
8011 [[local:meatball:Hello]]
8012 !! html/php
8013 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8014 </p>
8015 !! html/parsoid
8016 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8017 !! end
8018
8019 !! test
8020 Multiple local interwiki link prefixes
8021 !! wikitext
8022 [[local:local:local:local:mi:local:Foo]]
8023 !! options
8024 parsoid=wt2html,wt2wt,html2html
8025 !! html/php
8026 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8027 </p>
8028 !! html/parsoid
8029 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8030 !! end
8031
8032 ###
8033 ### Interlanguage links
8034 ### Language links (so that searching for '### language' matches..)
8035 ###
8036
8037 !! test
8038 Interlanguage link
8039 !! options
8040 parsoid=wt2html,wt2wt,html2html
8041 !! wikitext
8042 Blah blah blah
8043 [[zh:Chinese]]
8044 !! html/php
8045 <p>Blah blah blah
8046 </p>
8047 !! html/parsoid
8048 <p>Blah blah blah</p>
8049 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8050 !! end
8051
8052 !! test
8053 Interlanguage link with spacing
8054 !! options
8055 parsoid=wt2html,wt2wt,html2html
8056 !! wikitext
8057 Blah blah blah
8058 [[ zh : Chinese ]]
8059 !! html/php
8060 <p>Blah blah blah
8061 </p>
8062 !! html/parsoid
8063 <p>Blah blah blah</p>
8064 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8065 !! end
8066
8067 !! test
8068 Double interlanguage link
8069 !! options
8070 parsoid=wt2html,wt2wt,html2html
8071 !! wikitext
8072 Blah blah blah
8073 [[es:Spanish]]
8074 [[zh:Chinese]]
8075 !! html/php
8076 <p>Blah blah blah
8077 </p>
8078 !! html/parsoid
8079 <p>Blah blah blah</p>
8080 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8081 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8082 !! end
8083
8084 !! test
8085 Interlanguage link variations
8086 !! options
8087 parsoid=wt2html,wt2wt,html2html
8088 !! wikitext
8089 Blah blah blah
8090 [[ es :Spanish]]
8091 [[ ZH :Chinese]]
8092 [[es:Foo_bar]]
8093 !! html/php
8094 <p>Blah blah blah
8095 </p>
8096 !! html/parsoid
8097 <p>Blah blah blah</p>
8098 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8099 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8100 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8101 !! end
8102
8103 !! test
8104 Space and question mark encoding in interlanguage links (T95473)
8105 !! options
8106 parsoid=wt2html,wt2wt,html2html
8107 !! wikitext
8108 Blah blah blah
8109 [[es:Foo bar?]]
8110 !! html/php
8111 <p>Blah blah blah
8112 </p>
8113 !! html/parsoid
8114 <p>Blah blah blah</p>
8115 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8116 !! end
8117
8118 !! test
8119 Interlanguage link, with prefix links
8120 !! options
8121 language=ln
8122 !! wikitext
8123 Blah blah blah
8124 [[zh:Chinese]]
8125 !! html/php
8126 <p>Blah blah blah
8127 </p>
8128 !! html/parsoid
8129 <p>Blah blah blah</p>
8130 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8131 !! end
8132
8133 !! test
8134 Double interlanguage link, with prefix links (bug 8897)
8135 !! options
8136 language=ln
8137 !! wikitext
8138 Blah blah blah
8139 [[es:Spanish]]
8140 [[zh:Chinese]]
8141 !! html/php
8142 <p>Blah blah blah
8143 </p>
8144 !! html/parsoid
8145 <p>Blah blah blah</p>
8146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8147 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8148 !! end
8149
8150 !! test
8151 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8152 !! wikitext
8153 Blah blah blah
8154 [[mul:Article]]
8155 !! html/php
8156 <p>Blah blah blah
8157 </p>
8158 !! html/parsoid
8159 <p>Blah blah blah</p>
8160 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8161 !! end
8162
8163 !! test
8164 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8165 !! options
8166 language=ln
8167 !! wikitext
8168 [[WW&nbsp;II]]
8169 !! html
8170 <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>
8171 </p>
8172 !! end
8173
8174 !! test
8175 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8176 !! options
8177 parsoid=html2wt
8178 !! html/parsoid
8179 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8180 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8181 !! wikitext
8182 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8183
8184 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8185 !! end
8186
8187 !! test
8188 Parsoid: handle constructor well
8189 !! wikitext
8190 [[constructor]]
8191
8192 [[constructor:foo]]
8193 !! html/php
8194 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8195 </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>
8196 </p>
8197 !! html/parsoid
8198 <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>
8199
8200 <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>
8201 !! end
8202
8203 !! article
8204 ko:
8205 !! text
8206 Test.
8207 !! endarticle
8208
8209 # Note that `ko` isn't a known interlanguage prefix
8210 !! test
8211 Parsoid: recognize interlanguage links without a target page
8212 !! options
8213 ill
8214 !! wikitext
8215 [[es:]]
8216
8217 [[ko:]]
8218 !! html/php
8219 es:
8220 !! html/parsoid
8221 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8222
8223 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8224 !! end
8225
8226 # Note that `ko` isn't a known interwiki prefix
8227 !! test
8228 Parsoid: recognize interwiki links without a target page
8229 !! options
8230 parsoid=wt2html,wt2wt,html2html
8231 !! wikitext
8232 [[:es:]]
8233
8234 [[:ko:]]
8235 !! html/php
8236 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8237 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8238 </p>
8239 !! html/parsoid
8240 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8241 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8242 !! end
8243
8244 !! test
8245 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8246 !! wikitext
8247 [[mi:Foo]]
8248 !! html/php
8249 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8250 </p>
8251 !! html/parsoid
8252 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8253 !! end
8254
8255 !! test
8256 Interlanguage link with preceding local interwiki link (bug 68085)
8257 !! options
8258 parsoid=wt2html,wt2wt,html2html
8259 !! wikitext
8260 Blah blah blah
8261 [[local:es:Spanish]]
8262 !! html/php
8263 <p>Blah blah blah
8264 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8265 </p>
8266 !! html/parsoid
8267 <p>Blah blah blah
8268 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8269 !! end
8270
8271 !! test
8272 Looks like an interlanguage link, but is actually a local interwiki
8273 !! options
8274 parsoid=wt2html,wt2wt,html2html
8275 !! wikitext
8276 Blah blah blah
8277 [[mi:Template:Foo]]
8278 !! html/php
8279 <p>Blah blah blah
8280 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8281 </p>
8282 !! html/parsoid
8283 <p>Blah blah blah
8284 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8285 !! end
8286
8287 ###
8288 ### Redirects, Parsoid-only
8289 ###
8290
8291 !! test
8292 1. Simple redirect to page
8293 !! wikitext
8294 #REDIRECT [[Main Page]]
8295 !! html/parsoid
8296 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8297 !! end
8298
8299 !! test
8300 2. Other redirect variants
8301 !! wikitext
8302 #REDIRECT [[Main_Page]]
8303 !! html/parsoid
8304 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8305 !! end
8306
8307 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8308 # This tests the Parsoid bail-out code.
8309 !! test
8310 3. Other redirect variants
8311 !! wikitext
8312 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8313 !! html/parsoid
8314 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8315 !! end
8316
8317 !! test
8318 4. Redirect to a templated destination
8319 !! wikitext
8320 #REDIRECT [[{{echo|Foo}}bar]]
8321 !! html/parsoid
8322 <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"}]]}'/>
8323 !! end
8324
8325 !! test
8326 Empty redirect
8327 !! options
8328 parsoid=wt2html,wt2wt
8329 !! wikitext
8330 #REDIRECT [[]]
8331 !! html/parsoid
8332 <ol>
8333 <li>REDIRECT [[]]</li></ol>
8334 !! end
8335
8336 !! test
8337 Optional colon in #REDIRECT
8338 !! options
8339 # the colon is archaic syntax. we support it for wt2html, but we
8340 # don't care that it roundtrips back to the modern syntax.
8341 parsoid=wt2html,html2html
8342 !! wikitext
8343 #REDIRECT:[[Main Page]]
8344 !! html/parsoid
8345 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8346 !! end
8347
8348 !! test
8349 Whitespace in #REDIRECT with optional colon
8350 !! options
8351 # the colon and gratuitous whitespace is archaic syntax. we support
8352 # it for wt2html, but we don't care that it roundtrips back to the
8353 # modern syntax (without extra whitespace)
8354 parsoid=wt2html,html2html
8355 !! wikitext
8356
8357 #REDIRECT
8358 :
8359 [[Main Page]]
8360 !! html/parsoid
8361 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8362 !! end
8363
8364 !! test
8365 Piped link in #REDIRECT
8366 !! options
8367 # content after piped link is ignored. we support this syntax,
8368 # but don't care that the piped link is lost when we roundtrip this.
8369 parsoid=wt2html
8370 !! wikitext
8371 #REDIRECT [[Main Page|bar]]
8372 !! html/parsoid
8373 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8374 !! end
8375
8376 !! test
8377 Redirect to category (T104502)
8378 !! options
8379 parsoid=wt2html,wt2wt
8380 !! wikitext
8381 #REDIRECT [[Category:Foo]]
8382 !! html/parsoid
8383 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8384 !! end
8385
8386 !! test
8387 Redirect to category with URL encoding (T104502)
8388 !! options
8389 parsoid=wt2html
8390 !! wikitext
8391 #REDIRECT [[Category%3AFoo]]
8392 !! html/parsoid
8393 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8394 !! end
8395
8396 !! test
8397 Redirect to category page
8398 !! wikitext
8399 #REDIRECT [[:Category:Foo]]
8400 !! html/parsoid
8401 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8402 !! end
8403
8404 !! test
8405 Redirect to image page (1)
8406 !! wikitext
8407 #REDIRECT [[File:Wiki.png]]
8408 !! html/parsoid
8409 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8410 !! end
8411
8412 !! test
8413 Redirect to image page (2)
8414 !! wikitext
8415 #REDIRECT [[Image:Wiki.png]]
8416 !! html/parsoid
8417 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8418 !! end
8419
8420 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8421 # Next test confirms this.
8422 !! test
8423 Redirect to language (1) (T104918)
8424 !! options
8425 parsoid=wt2html,wt2wt,html2html
8426 !! wikitext
8427 #REDIRECT [[en:File:Wiki.png]]
8428 !! html/parsoid
8429 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8430 !! end
8431
8432 !! test
8433 Redirect to language (2) (T104918)
8434 !! wikitext
8435 #REDIRECT [[:en:File:Wiki.png]]
8436 !! html/parsoid
8437 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8438 !! end
8439
8440 !! test
8441 Redirect to interwiki (T104918)
8442 !! wikitext
8443 #REDIRECT [[meatball:File:Wiki.png]]
8444 !! html/parsoid
8445 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8446 !! end
8447
8448 !! test
8449 Non-English #REDIRECT
8450 !! options
8451 language=is
8452 !! wikitext
8453 #TILVÍSUN [[Main Page]]
8454 !! html/parsoid
8455 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8456 !! end
8457
8458 !! test
8459 Redirect syntax under text isn't considered a redirect
8460 !! wikitext
8461 some text
8462 #redirect [[Main Page]]
8463 !! html/parsoid
8464 <p>some text</p>
8465 <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>
8466 !! end
8467
8468 # FIXME: Should hoist the redirect to the top of the page and ensure there
8469 # is only one.
8470 !! test
8471 New redirect
8472 !! options
8473 parsoid=html2wt
8474 !! html/parsoid
8475 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8476 !! wikitext
8477 Foo
8478 #REDIRECT [[Foo]]
8479 !! end
8480
8481 ##
8482 ## XHTML tidiness
8483 ###
8484
8485 !! test
8486 <br> to <br />
8487 !! wikitext
8488 1<br>2<br />3
8489 !! html
8490 <p>1<br />2<br />3
8491 </p>
8492 !! end
8493
8494 !! test
8495 Broken br tag sanitization
8496 !! wikitext
8497 </br>
8498 !! html/php
8499 <p>&lt;/br&gt;
8500 </p>
8501 !! end
8502
8503 # TODO: Fix html2html mode (bug 51055)!
8504 !! test
8505 Parsoid: Broken br tag recognition
8506 !! options
8507 parsoid=wt2html
8508 !! wikitext
8509 </br>
8510
8511 <br/ >
8512 !! html+tidy
8513 <p><br /></p>
8514 <p><br /></p>
8515 !! end
8516
8517 !! test
8518 Incorrecly removing closing slashes from correctly formed XHTML
8519 !! wikitext
8520 <br style="clear:both;" />
8521 !! html
8522 <p><br style="clear:both;" />
8523 </p>
8524 !! end
8525
8526 !! test
8527 Failing to transform badly formed HTML into correct XHTML
8528 !! wikitext
8529 <br style="clear: left;">
8530 <br style="clear: right;">
8531 <br style="clear: both;">
8532 !! html
8533 <p><br style="clear: left;" />
8534 <br style="clear: right;" />
8535 <br style="clear: both;" />
8536 </p>
8537 !!end
8538
8539 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8540 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8541 !! test
8542 Handling html with a div self-closing tag
8543 !! wikitext
8544 <div title />
8545 <div title/>
8546 <div title/ >
8547 <div title=bar />
8548 <div title=bar/>
8549 <div title=bar/ >
8550 !! html/php
8551 <p>&lt;div title /&gt;
8552 &lt;div title/&gt;
8553 </p>
8554 <div>
8555 <p>&lt;div title=bar /&gt;
8556 &lt;div title=bar/&gt;
8557 </p>
8558 <div title="bar/"></div>
8559 </div>
8560
8561 !! html/parsoid
8562 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8563 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8564 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8565 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8566 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8567 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8568 !! end
8569
8570 !! test
8571 Handling html with a br self-closing tag
8572 !! wikitext
8573 <br title />
8574 <br title/>
8575 <br title/ >
8576 <br title=bar />
8577 <br title=bar/>
8578 <br title=bar/ >
8579 !! html/php
8580 <p><br title="" />
8581 <br title="" />
8582 <br />
8583 <br title="bar" />
8584 <br title="bar" />
8585 <br title="bar/" />
8586 </p>
8587 !! html/parsoid
8588 <p><br title="" />
8589 <br title="" />
8590 <br title="" />
8591 <br title="bar" />
8592 <br title="bar" />
8593 <br title="bar/" />
8594 </p>
8595 !! end
8596
8597 !! test
8598 Horizontal ruler (should it add that extra space?)
8599 !! wikitext
8600 <hr>
8601 <hr >
8602 foo <hr
8603 > bar
8604 !! html+tidy
8605 <hr />
8606 <hr />
8607 <p>foo</p>
8608 <hr />
8609 <p>bar</p>
8610 !! end
8611
8612 !! test
8613 Horizontal ruler -- 4+ dashes render hr
8614 !! wikitext
8615 ----
8616 !! html
8617 <hr />
8618
8619 !! end
8620
8621 !! test
8622 Horizontal ruler -- eats additional dashes on the same line
8623 !! wikitext
8624 ---------
8625 !! html
8626 <hr />
8627
8628 !! end
8629
8630 !! test
8631 Horizontal ruler -- does not collapse dashes on consecutive lines
8632 !! wikitext
8633 ----
8634 ----
8635 !! html
8636 <hr />
8637 <hr />
8638
8639 !! end
8640
8641 !! test
8642 Horizontal ruler -- <4 dashes render as plain text
8643 !! wikitext
8644 ---
8645 !! html
8646 <p>---
8647 </p>
8648 !! end
8649
8650 !! test
8651 Horizontal ruler -- Supports content following dashes on same line
8652 !! wikitext
8653 ---- Foo
8654 !! html
8655 <hr /> Foo
8656
8657 !! html+tidy
8658 <hr />
8659 <p>Foo</p>
8660 !! end
8661
8662 ###
8663 ### Block-level elements
8664 ###
8665 !! test
8666 Common list
8667 !! wikitext
8668 *Common list
8669 * item 2
8670 *item 3
8671 !! html
8672 <ul><li>Common list</li>
8673 <li> item 2</li>
8674 <li>item 3</li></ul>
8675
8676 !! end
8677
8678 !! test
8679 Numbered list
8680 !! wikitext
8681 #Numbered list
8682 #item 2
8683 # item 3
8684 !! html
8685 <ol><li>Numbered list</li>
8686 <li>item 2</li>
8687 <li> item 3</li></ol>
8688
8689 !! end
8690
8691 !! test
8692 Mixed list
8693 !! wikitext
8694 *Mixed list
8695 *# with numbers
8696 ** and bullets
8697 *# and numbers
8698 *bullets again
8699 **bullet level 2
8700 ***bullet level 3
8701 ***#Number on level 4
8702 **bullet level 2
8703 **#Number on level 3
8704 **#Number on level 3
8705 *#number level 2
8706 *Level 1
8707 *** Level 3
8708 #** Level 3, but ordered
8709 !! html
8710 <ul><li>Mixed list
8711 <ol><li> with numbers</li></ol>
8712 <ul><li> and bullets</li></ul>
8713 <ol><li> and numbers</li></ol></li>
8714 <li>bullets again
8715 <ul><li>bullet level 2
8716 <ul><li>bullet level 3
8717 <ol><li>Number on level 4</li></ol></li></ul></li>
8718 <li>bullet level 2
8719 <ol><li>Number on level 3</li>
8720 <li>Number on level 3</li></ol></li></ul>
8721 <ol><li>number level 2</li></ol></li>
8722 <li>Level 1
8723 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8724 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8725
8726 !! end
8727
8728 !! test
8729 Nested lists 1
8730 !! wikitext
8731 *foo
8732 **bar
8733 !! html
8734 <ul><li>foo
8735 <ul><li>bar</li></ul></li></ul>
8736
8737 !! end
8738
8739 !! test
8740 Nested lists 2
8741 !! wikitext
8742 **foo
8743 *bar
8744 !! html
8745 <ul><li><ul><li>foo</li></ul></li>
8746 <li>bar</li></ul>
8747
8748 !! end
8749
8750 !! test
8751 Nested lists 3 (first element empty)
8752 !! wikitext
8753 *
8754 **bar
8755 !! html
8756 <ul><li>
8757 <ul><li>bar</li></ul></li></ul>
8758
8759 !! end
8760
8761 !! test
8762 Nested lists 4 (first element empty)
8763 !! wikitext
8764 **
8765 *bar
8766 !! html
8767 <ul><li><ul><li></li></ul></li>
8768 <li>bar</li></ul>
8769
8770 !! end
8771
8772 !! test
8773 Nested lists 5 (both elements empty)
8774 !! wikitext
8775 **
8776 *
8777 !! html
8778 <ul><li><ul><li></li></ul></li>
8779 <li></li></ul>
8780
8781 !! end
8782
8783 !! test
8784 Nested lists 6 (both elements empty)
8785 !! wikitext
8786 *
8787 **
8788 !! html
8789 <ul><li>
8790 <ul><li></li></ul></li></ul>
8791
8792 !! end
8793
8794 !! test
8795 Nested lists 7 (skip initial nesting levels)
8796 !! wikitext
8797 *** foo
8798 !! html
8799 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8800
8801 !! end
8802
8803 !! test
8804 Nested lists 8 (multiple nesting transitions)
8805 !! wikitext
8806 * foo
8807 *** bar
8808 ** baz
8809 * boo
8810 !! html
8811 <ul><li> foo
8812 <ul><li><ul><li> bar</li></ul></li>
8813 <li> baz</li></ul></li>
8814 <li> boo</li></ul>
8815
8816 !! end
8817
8818 !! test
8819 Nested lists 9 (extension interaction)
8820 !! options
8821 parsoid
8822 !! wikitext
8823 *<references />
8824 !! html/parsoid
8825 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8826 !! end
8827
8828 !! test
8829 1. Lists with start-of-line-transparent tokens before bullets: Comments
8830 !! wikitext
8831 *foo
8832 *<!--cmt-->bar
8833 <!--cmt-->*baz
8834 !! html
8835 <ul><li>foo</li>
8836 <li>bar</li>
8837 <li>baz</li></ul>
8838
8839 !! end
8840
8841 !! test
8842 2. Lists with start-of-line-transparent tokens before bullets: Template close
8843 !! wikitext
8844 *foo {{echo|bar
8845 }}*baz
8846 !! html
8847 <ul><li>foo bar</li>
8848 <li>baz</li></ul>
8849
8850 !! end
8851
8852 !! test
8853 List items are not parsed correctly following a <pre> block (bug 785)
8854 !! wikitext
8855 * <pre>foo</pre>
8856 * <pre>bar</pre>
8857 * zar
8858 !! html/php
8859 <ul><li> <pre>foo</pre></li>
8860 <li> <pre>bar</pre></li>
8861 <li> zar</li></ul>
8862
8863 !! html/parsoid
8864 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8865 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8866 <li> zar</li></ul>
8867 !! end
8868
8869 !! test
8870 List items from template
8871 !! wikitext
8872
8873 {{inner list}}
8874 * item 2
8875
8876 * item 0
8877 {{inner list}}
8878 * item 2
8879
8880 * item 0
8881 * notSOL{{inner list}}
8882 * item 2
8883 !! html
8884 <ul><li> item 1</li>
8885 <li> item 2</li></ul>
8886 <ul><li> item 0</li>
8887 <li> item 1</li>
8888 <li> item 2</li></ul>
8889 <ul><li> item 0</li>
8890 <li> notSOL</li>
8891 <li> item 1</li>
8892 <li> item 2</li></ul>
8893
8894 !! end
8895
8896 !! test
8897 List interrupted by empty line or heading
8898 !! wikitext
8899 * foo
8900
8901 ** bar
8902 == A heading ==
8903 * Another list item
8904 !! html
8905 <ul><li> foo</li></ul>
8906 <ul><li><ul><li> bar</li></ul></li></ul>
8907 <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>
8908 <ul><li> Another list item</li></ul>
8909
8910 !!end
8911
8912 !!test
8913 Multiple list tags generated by templates
8914 !! wikitext
8915 {{echo|<li>}}a
8916 {{echo|<li>}}b
8917 {{echo|<li>}}c
8918 !! html
8919 <li>a
8920 <li>b
8921 <li>c</li>
8922 </li>
8923 </li>
8924
8925 !! html+tidy
8926 <ul>
8927 <li>a</li>
8928 <li>b</li>
8929 <li>c</li>
8930 </ul>
8931 !!end
8932
8933 !!test
8934 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8935 !! wikitext
8936 *a
8937 <!--This line will NOT split the list-->
8938 *b
8939 <!--This line will NOT split the list either-->
8940 *c
8941 <!--foo--> <!----> <!--This line NOT split the list either-->
8942 *d
8943 !! html
8944 <ul><li>a</li>
8945 <li>b</li>
8946 <li>c</li>
8947 <li>d</li></ul>
8948
8949 !!end
8950
8951 !!test
8952 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8953 !! wikitext
8954 *a
8955 <!--This line will NOT split the list-->
8956 *b
8957 <!--This line will NOT split the list either-->
8958 *c
8959 <!--foo--> <!----> <!--This line NOT split the list
8960 either-->
8961 *d
8962 !! html
8963 <ul><li>a</li>
8964 <li>b</li>
8965 <li>c</li>
8966 <li>d</li></ul>
8967
8968 !!end
8969
8970 !!test
8971 Test the li-hack
8972 (The PHP parser relies on Tidy for the hack)
8973 !!options
8974 parsoid=wt2html,wt2wt
8975 !! wikitext
8976 * foo
8977 * <li>li-hack
8978 * {{echo|<li>templated li-hack}}
8979 * <!--foo--> <li> unsupported li-hack with preceding comments
8980
8981 <ul>
8982 <li><li>not a li-hack
8983 </li>
8984 </ul>
8985 !! html+tidy
8986 <ul>
8987 <li>foo</li>
8988 <li>li-hack</li>
8989 <li>templated li-hack</li>
8990 <li>unsupported li-hack with preceding comments</li>
8991 </ul>
8992 <ul>
8993 <li>not a li-hack</li>
8994 </ul>
8995 !!end
8996
8997 !! test
8998 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8999 !! options
9000 parsoid
9001 !! wikitext
9002 # foo
9003 ## bar
9004 * foo
9005 ** bar
9006 : foo
9007 :: bar
9008 !! html
9009 <ol>
9010 <li> foo<ol>
9011 <li> bar</li>
9012 </ol></li>
9013 </ol><ul>
9014 <li> foo<ul>
9015 <li> bar</li>
9016 </ul></li>
9017 </ul><dl>
9018 <dd> foo<dl>
9019 <dd> bar</dd>
9020 </dl></dd>
9021 </dl>
9022 !! end
9023
9024 !! test
9025 Parsoid: Test of whitespace serialization with Templated bullets
9026 !! options
9027 parsoid
9028 !! wikitext
9029 * {{bullet}}
9030 !! html
9031 <ul>
9032 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9033 </ul>
9034 !! end
9035
9036 # ------------------------------------------------------------------------
9037 # The next set of tests are about Parsoid's ability to handle badly nested
9038 # tags (parse, minimize scope of fixup, and roundtrip back)
9039 # ------------------------------------------------------------------------
9040
9041 !! test
9042 Unbalanced closing block tags break a list
9043 (php parser relies on Tidy to fix up)
9044 !! wikitext
9045 <div>
9046 *a</div><div>
9047 *b</div>
9048 !! html+tidy
9049 <div>
9050 <ul>
9051 <li>a</li>
9052 </ul>
9053 </div>
9054 <div>
9055 <ul>
9056 <li>b</li>
9057 </ul>
9058 </div>
9059 !! end
9060
9061 # Parsoid fails this test, but it might be tricky to support properly.
9062 # See bug 68395.
9063 !! test
9064 Unbalanced closing non-block tags don't break a list
9065 (php parser relies on Tidy to fix up)
9066 !! wikitext
9067 <span>
9068 *a</span><span>
9069 *b</span>
9070 !! html/php+tidy
9071 <ul>
9072 <li><span>a</span></li>
9073 <li><span>b</span></li>
9074 </ul>
9075 !! html/parsoid
9076 <span>
9077 <ul>
9078 <li>a<span></span>
9079 </li>
9080 <li>b
9081 </li>
9082 </ul>
9083 </span>
9084 !! end
9085
9086 !! test
9087 Unclosed formatting tags that straddle lists are closed and reopened
9088 (php parser relies on Tidy to fix up)
9089 !! options
9090 parsoid=wt2html,wt2wt,html2html
9091 !! wikitext
9092 # <s> a
9093 # b </s>
9094 !! html/php+tidy
9095 <ol>
9096 <li><s>a</s></li>
9097 <li><s>b</s></li>
9098 </ol>
9099 !! html/parsoid
9100 <ol><li> <s> a</s></li>
9101 <li><s> b </s></li></ol>
9102 !! end
9103
9104 # See bug 68395.
9105 !!test
9106 1. List embedded in a formatting tag
9107 !! wikitext
9108 <small>
9109 * foo
9110 </small>
9111 !! html/php+tidy
9112 <ul>
9113 <li><small>foo</small></li>
9114 </ul>
9115 !! html/parsoid
9116 <small>
9117 <ul>
9118 <li> foo</li>
9119 </ul>
9120 </small>
9121 !!end
9122
9123 ## Ugly Parsoid output here
9124 ## Not sure what the right output is.
9125 !!test
9126 2. List embedded in a formatting tag
9127 !! wikitext
9128 <small>
9129 *a
9130 *b</small>
9131 !! html/php+tidy
9132 <ul>
9133 <li><small>a</small></li>
9134 <li><small>b</small></li>
9135 </ul>
9136 !! html/parsoid
9137 <small></small>
9138 <ul><small>
9139 <li>a</li>
9140 </small>
9141 <li><small>b</small></li>
9142 </ul>
9143 !!end
9144
9145 # Ugly Parsoid and PHP parser output here
9146 # Not sure if we want to make this a test!
9147 #
9148 ## !!test
9149 ## 3. Unclosed formatting tags in list elements
9150 ## !! wikitext
9151 ## *<small>a
9152 ## *<small>b
9153 ## !! html/php+tidy
9154 ## <ul>
9155 ## <li><small>a</small></li>
9156 ## <li><small><small>b</small></small></li>
9157 ## </ul>
9158 ## !! html/parsoid
9159 ## <ul>
9160 ## <li><small>a</small></li>
9161 ## <small>
9162 ## <li><small>b</small></li>
9163 ## </small></ul>
9164 ## !!end
9165
9166 # This is a bug in the PHP parser + tidy combination.
9167 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9168 # and then fostered out of the table by tidy.)
9169 # We believe the Parsoid output to be correct.
9170 !! test
9171 Table with missing opening <tr> tag
9172 !! options
9173 parsoid=wt2html,wt2wt
9174 !! wikitext
9175 <table>
9176 <td>foo</td>
9177 </tr>
9178 </table>
9179 !! html+tidy
9180 <table>
9181 <tr>
9182 <td>foo</td>
9183 </tr>
9184 </table>
9185 !! end
9186
9187 ###
9188 ### Magic Words
9189 ###
9190
9191 # Note that the current date is hard-coded as
9192 # 1970-01-01T00:02:03Z (a Thursday)
9193 # when running parser tests. The timezone is also fixed to GMT, so
9194 # local date will be identical to current date.
9195
9196 !! test
9197 Magic Word: {{CURRENTDAY}}
9198 !! wikitext
9199 {{CURRENTDAY}}
9200 !! html
9201 <p>1
9202 </p>
9203 !! end
9204
9205 !! test
9206 Magic Word: {{CURRENTDAY2}}
9207 !! wikitext
9208 {{CURRENTDAY2}}
9209 !! html
9210 <p>01
9211 </p>
9212 !! end
9213
9214 !! test
9215 Magic Word: {{CURRENTDAYNAME}}
9216 !! wikitext
9217 {{CURRENTDAYNAME}}
9218 !! html
9219 <p>Thursday
9220 </p>
9221 !! end
9222
9223 !! test
9224 Magic Word: {{CURRENTDOW}}
9225 !! wikitext
9226 {{CURRENTDOW}}
9227 !! html
9228 <p>4
9229 </p>
9230 !! end
9231
9232 !! test
9233 Magic Word: {{CURRENTMONTH}}
9234 !! wikitext
9235 {{CURRENTMONTH}}
9236 !! html
9237 <p>01
9238 </p>
9239 !! end
9240
9241 !! test
9242 Magic Word: {{CURRENTMONTH1}}
9243 !! wikitext
9244 {{CURRENTMONTH1}}
9245 !! html
9246 <p>1
9247 </p>
9248 !! end
9249
9250 !! test
9251 Magic Word: {{CURRENTMONTHABBREV}}
9252 !! wikitext
9253 {{CURRENTMONTHABBREV}}
9254 !! html
9255 <p>Jan
9256 </p>
9257 !! end
9258
9259 !! test
9260 Magic Word: {{CURRENTMONTHNAME}}
9261 !! wikitext
9262 {{CURRENTMONTHNAME}}
9263 !! html
9264 <p>January
9265 </p>
9266 !! end
9267
9268 !! test
9269 Magic Word: {{CURRENTMONTHNAMEGEN}}
9270 !! wikitext
9271 {{CURRENTMONTHNAMEGEN}}
9272 !! html
9273 <p>January
9274 </p>
9275 !! end
9276
9277 !! test
9278 Magic Word: {{CURRENTTIME}}
9279 !! wikitext
9280 {{CURRENTTIME}}
9281 !! html
9282 <p>00:02
9283 </p>
9284 !! end
9285
9286 !! test
9287 Magic Word: {{CURRENTHOUR}}
9288 !! wikitext
9289 {{CURRENTHOUR}}
9290 !! html
9291 <p>00
9292 </p>
9293 !! end
9294
9295 !! test
9296 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9297 !! wikitext
9298 {{CURRENTWEEK}}
9299 !! html
9300 <p>1
9301 </p>
9302 !! end
9303
9304 !! test
9305 Magic Word: {{CURRENTYEAR}}
9306 !! wikitext
9307 {{CURRENTYEAR}}
9308 !! html
9309 <p>1970
9310 </p>
9311 !! end
9312
9313 !! test
9314 Magic Word: {{CURRENTTIMESTAMP}}
9315 !! wikitext
9316 {{CURRENTTIMESTAMP}}
9317 !! html
9318 <p>19700101000203
9319 </p>
9320 !! end
9321
9322 !! test
9323 Magic Words LOCAL (UTC)
9324 !! wikitext
9325 * {{LOCALMONTH}}
9326 * {{LOCALMONTH1}}
9327 * {{LOCALMONTHNAME}}
9328 * {{LOCALMONTHNAMEGEN}}
9329 * {{LOCALMONTHABBREV}}
9330 * {{LOCALDAY}}
9331 * {{LOCALDAY2}}
9332 * {{LOCALDAYNAME}}
9333 * {{LOCALYEAR}}
9334 * {{LOCALTIME}}
9335 * {{LOCALHOUR}}
9336 * {{LOCALWEEK}}
9337 * {{LOCALDOW}}
9338 * {{LOCALTIMESTAMP}}
9339 !! html
9340 <ul><li> 01</li>
9341 <li> 1</li>
9342 <li> January</li>
9343 <li> January</li>
9344 <li> Jan</li>
9345 <li> 1</li>
9346 <li> 01</li>
9347 <li> Thursday</li>
9348 <li> 1970</li>
9349 <li> 00:02</li>
9350 <li> 00</li>
9351 <li> 1</li>
9352 <li> 4</li>
9353 <li> 19700101000203</li></ul>
9354
9355 !! end
9356
9357 !! test
9358 Magic Word: {{FULLPAGENAME}}
9359 !! options
9360 title=[[User:Ævar Arnfjörð Bjarmason]]
9361 !! wikitext
9362 {{FULLPAGENAME}}
9363 !! html
9364 <p>User:Ævar Arnfjörð Bjarmason
9365 </p>
9366 !! end
9367
9368 !! test
9369 Magic Word: {{FULLPAGENAMEE}}
9370 !! options
9371 title=[[User:Ævar Arnfjörð Bjarmason]]
9372 !! wikitext
9373 {{FULLPAGENAMEE}}
9374 !! html
9375 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9376 </p>
9377 !! end
9378
9379 !! test
9380 Magic Word: {{TALKSPACE}}
9381 !! options
9382 title=[[User:Ævar Arnfjörð Bjarmason]]
9383 !! wikitext
9384 {{TALKSPACE}}
9385 !! html
9386 <p>User talk
9387 </p>
9388 !! end
9389
9390 !! test
9391 Magic Word: {{TALKSPACE}}, same namespace
9392 !! options
9393 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9394 !! wikitext
9395 {{TALKSPACE}}
9396 !! html
9397 <p>User talk
9398 </p>
9399 !! end
9400
9401 !! test
9402 Magic Word: {{TALKSPACE}}, main namespace
9403 !! options
9404 title=[[Parser Test]]
9405 !! wikitext
9406 {{TALKSPACE}}
9407 !! html
9408 <p>Talk
9409 </p>
9410 !! end
9411
9412 !! test
9413 Magic Word: {{TALKSPACEE}}
9414 !! options
9415 title=[[User:Ævar Arnfjörð Bjarmason]]
9416 !! wikitext
9417 {{TALKSPACEE}}
9418 !! html
9419 <p>User_talk
9420 </p>
9421 !! end
9422
9423 !! test
9424 Magic Word: {{SUBJECTSPACE}}
9425 !! options
9426 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9427 !! wikitext
9428 {{SUBJECTSPACE}}
9429 !! html
9430 <p>User
9431 </p>
9432 !! end
9433
9434 !! test
9435 Magic Word: {{SUBJECTSPACE}}, same namespace
9436 !! options
9437 title=[[User:Ævar Arnfjörð Bjarmason]]
9438 !! wikitext
9439 {{SUBJECTSPACE}}
9440 !! html
9441 <p>User
9442 </p>
9443 !! end
9444
9445 !! test
9446 Magic Word: {{SUBJECTSPACE}}, main namespace
9447 !! options
9448 title=[[Parser Test]]
9449 !! wikitext
9450 {{SUBJECTSPACE}}
9451 !! html
9452
9453 !! end
9454
9455 !! test
9456 Magic Word: {{SUBJECTSPACEE}}
9457 !! options
9458 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9459 !! wikitext
9460 {{SUBJECTSPACEE}}
9461 !! html
9462 <p>User
9463 </p>
9464 !! end
9465
9466 !! test
9467 Magic Word: {{NAMESPACE}}
9468 !! options
9469 title=[[User:Ævar Arnfjörð Bjarmason]]
9470 !! wikitext
9471 {{NAMESPACE}}
9472 !! html
9473 <p>User
9474 </p>
9475 !! end
9476
9477 !! test
9478 Magic Word: {{NAMESPACEE}}
9479 !! options
9480 title=[[User:Ævar Arnfjörð Bjarmason]]
9481 !! wikitext
9482 {{NAMESPACEE}}
9483 !! html
9484 <p>User
9485 </p>
9486 !! end
9487
9488 !! test
9489 Magic Word: {{NAMESPACENUMBER}}
9490 !! options
9491 title=[[User:Ævar Arnfjörð Bjarmason]]
9492 !! wikitext
9493 {{NAMESPACENUMBER}}
9494 !! html
9495 <p>2
9496 </p>
9497 !! end
9498
9499 !! test
9500 Magic Word: {{SUBPAGENAME}}
9501 !! options
9502 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9503 !! wikitext
9504 {{SUBPAGENAME}}
9505 !! html
9506 <p>sub ö
9507 </p>
9508 !! end
9509
9510 !! test
9511 Magic Word: {{SUBPAGENAMEE}}
9512 !! options
9513 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9514 !! wikitext
9515 {{SUBPAGENAMEE}}
9516 !! html
9517 <p>sub_%C3%B6
9518 </p>
9519 !! end
9520
9521 !! test
9522 Magic Word: {{ROOTPAGENAME}}
9523 !! options
9524 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9525 !! wikitext
9526 {{ROOTPAGENAME}}
9527 !! html
9528 <p>Ævar Arnfjörð Bjarmason
9529 </p>
9530 !! end
9531
9532 !! test
9533 Magic Word: {{ROOTPAGENAMEE}}
9534 !! options
9535 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9536 !! wikitext
9537 {{ROOTPAGENAMEE}}
9538 !! html
9539 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9540 </p>
9541 !! end
9542
9543 !! test
9544 Magic Word: {{BASEPAGENAME}}
9545 !! options
9546 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9547 !! wikitext
9548 {{BASEPAGENAME}}
9549 !! html
9550 <p>Ævar Arnfjörð Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{BASEPAGENAMEE}}
9556 !! options
9557 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9558 !! wikitext
9559 {{BASEPAGENAMEE}}
9560 !! html
9561 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9562 </p>
9563 !! end
9564
9565 !! test
9566 Magic Word: {{TALKPAGENAME}}
9567 !! options
9568 title=[[User:Ævar Arnfjörð Bjarmason]]
9569 !! wikitext
9570 {{TALKPAGENAME}}
9571 !! html
9572 <p>User talk:Ævar Arnfjörð Bjarmason
9573 </p>
9574 !! end
9575
9576 !! test
9577 Magic Word: {{TALKPAGENAMEE}}
9578 !! options
9579 title=[[User:Ævar Arnfjörð Bjarmason]]
9580 !! wikitext
9581 {{TALKPAGENAMEE}}
9582 !! html
9583 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9584 </p>
9585 !! end
9586
9587 !! test
9588 Magic Word: {{SUBJECTPAGENAME}}
9589 !! options
9590 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9591 !! wikitext
9592 {{SUBJECTPAGENAME}}
9593 !! html
9594 <p>User:Ævar Arnfjörð Bjarmason
9595 </p>
9596 !! end
9597
9598 !! test
9599 Magic Word: {{SUBJECTPAGENAMEE}}
9600 !! options
9601 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9602 !! wikitext
9603 {{SUBJECTPAGENAMEE}}
9604 !! html
9605 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9606 </p>
9607 !! end
9608
9609 !! test
9610 Magic Word: {{NUMBEROFFILES}}
9611 !! wikitext
9612 {{NUMBEROFFILES}}
9613 !! html
9614 <p>5
9615 </p>
9616 !! end
9617
9618 !! test
9619 Magic Word: {{PAGENAME}}
9620 !! options
9621 title=[[User:Ævar Arnfjörð Bjarmason]]
9622 !! wikitext
9623 {{PAGENAME}}
9624 !! html
9625 <p>Ævar Arnfjörð Bjarmason
9626 </p>
9627 !! end
9628
9629 !! test
9630 Magic Word: {{PAGENAME}} with metacharacters
9631 !! options
9632 title=[['foo & bar = baz']]
9633 !! wikitext
9634 ''{{PAGENAME}}''
9635 !! html/php
9636 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9637 </p>
9638 !! html+tidy
9639 <p><i>'foo &amp; bar = baz'</i></p>
9640 !! end
9641
9642 !! test
9643 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9644 !! options
9645 title=[[*RFC 1234 http://example.com/]]
9646 !! wikitext
9647 {{PAGENAME}}
9648 !! html/php
9649 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9650 </p>
9651 !! html+tidy
9652 <p>*RFC 1234 http://example.com/</p>
9653 !! end
9654
9655 !! test
9656 Magic Word: {{PAGENAMEE}}
9657 !! options
9658 title=[[User:Ævar Arnfjörð Bjarmason]]
9659 !! wikitext
9660 {{PAGENAMEE}}
9661 !! html
9662 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9663 </p>
9664 !! end
9665
9666 !! test
9667 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9668 !! options
9669 title=[[*RFC 1234 http://example.com/]]
9670 !! wikitext
9671 {{PAGENAMEE}}
9672 !! html/php
9673 <p>&#42;RFC_1234_http&#58;//example.com/
9674 </p>
9675 !! html+tidy
9676 <p>*RFC_1234_http://example.com/</p>
9677 !! end
9678
9679 !! test
9680 Magic Word: {{REVISIONID}}
9681 !! wikitext
9682 {{REVISIONID}}
9683 !! html
9684 <p>1337
9685 </p>
9686 !! end
9687
9688 !! test
9689 Magic Word: {{SCRIPTPATH}}
9690 !! wikitext
9691 {{SCRIPTPATH}}
9692 !! html
9693 <p>/
9694 </p>
9695 !! end
9696
9697 !! test
9698 Magic Word: {{STYLEPATH}}
9699 !! wikitext
9700 {{STYLEPATH}}
9701 !! html
9702 <p>/skins
9703 </p>
9704 !! end
9705
9706 !! test
9707 Magic Word: {{SERVER}}
9708 !! wikitext
9709 {{SERVER}}
9710 !! html
9711 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9712 </p>
9713 !! end
9714
9715 !! test
9716 Magic Word: {{SERVERNAME}}
9717 !! wikitext
9718 {{SERVERNAME}}
9719 !! html
9720 <p>example.org
9721 </p>
9722 !! end
9723
9724 !! test
9725 Magic Word: {{SITENAME}}
9726 !! wikitext
9727 {{SITENAME}}
9728 !! html
9729 <p>MediaWiki
9730 </p>
9731 !! end
9732
9733 !! test
9734 Case-sensitive magic words, when cased differently, should just be template transclusions
9735 !! wikitext
9736 {{CurrentMonth}}
9737 {{currentday}}
9738 {{cURreNTweEK}}
9739 {{currentHour}}
9740 !! html
9741 <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>
9742 <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>
9743 <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>
9744 <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>
9745 </p>
9746 !! end
9747
9748 !! test
9749 Case-insensitive magic words should still work with weird casing.
9750 !! wikitext
9751 {{sErVeRNaMe}}
9752 {{LCFirst:AOEU}}
9753 {{ucFIRST:aoeu}}
9754 {{SERver}}
9755 !! html
9756 <p>example.org
9757 aOEU
9758 Aoeu
9759 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9760 </p>
9761 !! end
9762
9763 # From plwiki:PLOS_ONE
9764 !! test
9765 Parsoid: Page property magic word with magic word contents
9766 !! wikitext
9767 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9768 !! html/parsoid
9769 <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>"}]]}'/>
9770 !! end
9771
9772 !! test
9773 Parsoid: Template-generated DISPLAYTITLE
9774 !! wikitext
9775 {{{{echo|DISPLAYTITLE}}:Foo}}
9776 !! html/parsoid
9777 <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}}]}'/>
9778 !! end
9779
9780 !! test
9781 Namespace 1 {{ns:1}}
9782 !! wikitext
9783 {{ns:1}}
9784 !! html
9785 <p>Talk
9786 </p>
9787 !! end
9788
9789 !! test
9790 Namespace 1 {{ns:01}}
9791 !! wikitext
9792 {{ns:01}}
9793 !! html
9794 <p>Talk
9795 </p>
9796 !! end
9797
9798 !! test
9799 Namespace 0 {{ns:0}} (bug 4783)
9800 !! wikitext
9801 {{ns:0}}
9802 !! html
9803
9804 !! end
9805
9806 !! test
9807 Namespace 0 {{ns:00}} (bug 4783)
9808 !! wikitext
9809 {{ns:00}}
9810 !! html
9811
9812 !! end
9813
9814 !! test
9815 Namespace -1 {{ns:-1}}
9816 !! wikitext
9817 {{ns:-1}}
9818 !! html
9819 <p>Special
9820 </p>
9821 !! end
9822
9823 !! test
9824 Namespace User {{ns:User}}
9825 !! wikitext
9826 {{ns:User}}
9827 !! html
9828 <p>User
9829 </p>
9830 !! end
9831
9832 !! test
9833 Namespace User talk {{ns:User_talk}}
9834 !! wikitext
9835 {{ns:User_talk}}
9836 !! html
9837 <p>User talk
9838 </p>
9839 !! end
9840
9841 !! test
9842 Namespace User talk {{ns:uSeR tAlK}}
9843 !! wikitext
9844 {{ns:uSeR tAlK}}
9845 !! html
9846 <p>User talk
9847 </p>
9848 !! end
9849
9850 !! test
9851 Namespace File {{ns:File}}
9852 !! wikitext
9853 {{ns:File}}
9854 !! html
9855 <p>File
9856 </p>
9857 !! end
9858
9859 !! test
9860 Namespace File {{ns:Image}}
9861 !! wikitext
9862 {{ns:Image}}
9863 !! html
9864 <p>File
9865 </p>
9866 !! end
9867
9868 !! test
9869 Namespace (lang=de) Benutzer {{ns:User}}
9870 !! options
9871 language=de
9872 !! wikitext
9873 {{ns:User}}
9874 !! html
9875 <p>Benutzer
9876 </p>
9877 !! end
9878
9879 !! test
9880 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9881 !! options
9882 language=de
9883 !! wikitext
9884 {{ns:3}}
9885 !! html
9886 <p>Benutzer Diskussion
9887 </p>
9888 !! end
9889
9890
9891 !! test
9892 Urlencode
9893 !! wikitext
9894 {{urlencode:hi world?!}}
9895 {{urlencode:hi world?!|WIKI}}
9896 {{urlencode:hi world?!|PATH}}
9897 {{urlencode:hi world?!|QUERY}}
9898 !! html
9899 <p>hi+world%3F%21
9900 hi_world%3F!
9901 hi%20world%3F%21
9902 hi+world%3F%21
9903 </p>
9904 !! end
9905
9906 !! test
9907 Magic Word: prioritize type info over data-parsoid
9908 !! options
9909 parsoid=html2wt
9910 !! html/parsoid
9911 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9912 !! wikitext
9913 __FORCETOC__
9914 !! end
9915
9916 !! test
9917 Magic Word: serialize on separate line (parsoid)
9918 !! options
9919 parsoid=wt2wt,html2wt
9920 !! wikitext
9921 foo
9922 __NOTOC__
9923 bar
9924 !! html/parsoid
9925 foo<meta property="mw:PageProp/notoc"/>bar
9926 !! end
9927
9928 !! test
9929 Magic Word: rt non-english wikis
9930 !! options
9931 parsoid=wt2wt
9932 language=de
9933 !! wikitext
9934 __NOEDITSECTION__
9935 !! html/parsoid
9936 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9937 !! end
9938
9939 !!test
9940 __proto__ is treated as normal wikitext (T105997)
9941 !!wikitext
9942 __proto__
9943 !!html
9944 <p>__proto__
9945 </p>
9946 !!end
9947
9948 ###
9949 ### Magic links
9950 ###
9951 !! test
9952 Magic links: internal link to RFC (bug 479)
9953 !! wikitext
9954 [[RFC 123]]
9955 !! html/php
9956 <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>
9957 </p>
9958 !! html/parsoid
9959 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
9960 !! end
9961
9962 !! test
9963 Magic links: RFC (bug 479)
9964 !! wikitext
9965 RFC 822
9966 !! html/php
9967 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9968 </p>
9969 !! html/parsoid
9970 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
9971 !! end
9972
9973 !! test
9974 Magic links: RFC (bug 65278)
9975 !! wikitext
9976 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9977 !! html/php
9978 <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.
9979 </p>
9980 !! html/parsoid
9981 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
9982 !! end
9983
9984 !! test
9985 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9986 !! wikitext
9987 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9988 RFC
9989 822
9990 !! html/php
9991 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9992 RFC
9993 822
9994 </p>
9995 !! html/parsoid
9996 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
9997 RFC
9998 822</p>
9999 !! end
10000
10001 !! test
10002 Magic links: ISBN (bug 1937)
10003 !! wikitext
10004 ISBN 0-306-40615-2
10005 !! html/php
10006 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10007 </p>
10008 !! html/parsoid
10009 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10010 !! end
10011
10012 !! test
10013 Magic links: ISBN (bug 65278)
10014 !! wikitext
10015 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10016 !! html/php
10017 <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.
10018 </p>
10019 !! html/parsoid
10020 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10021 !! end
10022
10023 !! test
10024 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10025 !! wikitext
10026 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10027 ISBN
10028 9780316098113
10029 ISBN 978
10030 0316098113
10031 !! html/php
10032 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10033 ISBN
10034 9780316098113
10035 ISBN 978
10036 0316098113
10037 </p>
10038 !! html/parsoid
10039 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10040 ISBN
10041 9780316098113
10042 ISBN 978
10043 0316098113</p>
10044 !! end
10045
10046 !! test
10047 Magic links: PMID incorrectly converts space to underscore
10048 !! wikitext
10049 PMID 1234
10050 !! html/php
10051 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10052 </p>
10053 !! html/parsoid
10054 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10055 !! end
10056
10057 !! test
10058 Magic links: PMID (bug 65278)
10059 !! wikitext
10060 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10061 !! html/php
10062 <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.
10063 </p>
10064 !! html/parsoid
10065 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10066 !! end
10067
10068 !! test
10069 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10070 !! wikitext
10071 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10072 PMID
10073 1234
10074 !! html/php
10075 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10076 PMID
10077 1234
10078 </p>
10079 !! html/parsoid
10080 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10081 PMID
10082 1234</p>
10083 !! end
10084
10085 ###
10086 ### Templates
10087 ####
10088
10089 !! test
10090 Nonexistent template
10091 !! wikitext
10092 {{thistemplatedoesnotexist}}
10093 !! html
10094 <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>
10095 </p>
10096 !! end
10097
10098 !! test
10099 Template with invalid target containing tags
10100 !! wikitext
10101 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10102 !! html
10103 <p>{{a<b>b</b>|foo|a=b|a = b}}
10104 </p>
10105 !! end
10106
10107 !! test
10108 Template with invalid target containing unclosed tag
10109 !! wikitext
10110 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10111 !! html
10112 <p>{{a<b>|foo|a=b|a = b}}</b>
10113 </p>
10114 !! end
10115
10116 !! test
10117 Template with invalid target containing wikilink
10118 !! wikitext
10119 {{[[Main Page]]}}
10120 !! html/php
10121 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10122 </p>
10123 !! html/parsoid
10124 <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>
10125 !! end
10126
10127 !! test
10128 Template with just whitespace in it, bug #68421
10129 !! wikitext
10130 {{echo|{{ }}}}
10131 !! html/parsoid
10132 <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>
10133 !! end
10134
10135 !! article
10136 Template:test
10137 !! text
10138 This is a test template
10139 !! endarticle
10140
10141 !! test
10142 Simple template
10143 !! wikitext
10144 {{test}}
10145 !! html
10146 <p>This is a test template
10147 </p>
10148 !! end
10149
10150 !! test
10151 Template with explicit namespace
10152 !! wikitext
10153 {{Template:test}}
10154 !! html
10155 <p>This is a test template
10156 </p>
10157 !! end
10158
10159
10160 !! article
10161 Template:paramtest
10162 !! text
10163 This is a test template with parameter {{{param}}}
10164 !! endarticle
10165
10166 !! test
10167 Template parameter
10168 !! wikitext
10169 {{paramtest|param=foo}}
10170 !! html
10171 <p>This is a test template with parameter foo
10172 </p>
10173 !! end
10174
10175 !! article
10176 Template:paramtestnum
10177 !! text
10178 [[{{{1}}}|{{{2}}}]]
10179 !! endarticle
10180
10181 !! test
10182 Template unnamed parameter
10183 !! wikitext
10184 {{paramtestnum|Main Page|the main page}}
10185 !! html
10186 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10187 </p>
10188 !! end
10189
10190 !! article
10191 Template:templatesimple
10192 !! text
10193 (test)
10194 !! endarticle
10195
10196 !! article
10197 Template:templateredirect
10198 !! text
10199 #redirect [[Template:templatesimple]]
10200 !! endarticle
10201
10202 !! article
10203 Template:templateasargtestnum
10204 !! text
10205 {{{{{1}}}}}
10206 !! endarticle
10207
10208 !! article
10209 Template:templateasargtest
10210 !! text
10211 {{template{{{templ}}}}}
10212 !! endarticle
10213
10214 !! article
10215 Template:templateasargtest2
10216 !! text
10217 {{{{{templ}}}}}
10218 !! endarticle
10219
10220 !! test
10221 Template with template name as unnamed argument
10222 !! wikitext
10223 {{templateasargtestnum|templatesimple}}
10224 !! html
10225 <p>(test)
10226 </p>
10227 !! end
10228
10229 !! test
10230 Template with template name as argument
10231 !! wikitext
10232 {{templateasargtest|templ=simple}}
10233 !! html
10234 <p>(test)
10235 </p>
10236 !! end
10237
10238 !! test
10239 Template with template name as argument (2)
10240 !! wikitext
10241 {{templateasargtest2|templ=templatesimple}}
10242 !! html
10243 <p>(test)
10244 </p>
10245 !! end
10246
10247 !! article
10248 Template:templateasargtestdefault
10249 !! text
10250 {{{{{templ|templatesimple}}}}}
10251 !! endarticle
10252
10253 !! article
10254 Template:templa
10255 !! text
10256 '''templ'''
10257 !! endarticle
10258
10259 !! test
10260 Template with default value
10261 !! wikitext
10262 {{templateasargtestdefault}}
10263 !! html
10264 <p>(test)
10265 </p>
10266 !! end
10267
10268 !! test
10269 Template with default value (value set)
10270 !! wikitext
10271 {{templateasargtestdefault|templ=templa}}
10272 !! html
10273 <p><b>templ</b>
10274 </p>
10275 !! end
10276
10277 !! test
10278 Template redirect
10279 !! wikitext
10280 {{templateredirect}}
10281 !! html/php
10282 <p>(test)
10283 </p>
10284 !! html/parsoid
10285 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10286 !! end
10287
10288 !! test
10289 Template with argument in separate line
10290 !! wikitext
10291 {{ templateasargtest |
10292 templ = simple }}
10293 !! html
10294 <p>(test)
10295 </p>
10296 !! end
10297
10298 !! test
10299 Template with complex template as argument
10300 !! wikitext
10301 {{paramtest|
10302 param ={{ templateasargtest |
10303 templ = simple }}}}
10304 !! html
10305 <p>This is a test template with parameter (test)
10306 </p>
10307 !! end
10308
10309 !! test
10310 Template with thumb image (with link in description)
10311 !! wikitext
10312 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10313 !! html/php
10314 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>
10315
10316 !! html+tidy
10317 <p>This is a test template with parameter</p>
10318 <div class="thumb tright">
10319 <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>
10320 <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>
10321 </div>
10322 </div>
10323 !! html/parsoid
10324 <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>
10325 !! end
10326
10327 !! article
10328 Template:complextemplate
10329 !! text
10330 {{{1}}} {{paramtest|
10331 param ={{{param}}}}}
10332 !! endarticle
10333
10334 !! test
10335 Template with complex arguments
10336 !! wikitext
10337 {{complextemplate|
10338 param ={{ templateasargtest |
10339 templ = simple }}|[[Template:complextemplate|link]]}}
10340 !! html
10341 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10342 </p>
10343 !! end
10344
10345 !! test
10346 BUG 553: link with two variables in a piped link
10347 !! wikitext
10348 {|
10349 |[[{{{1}}}|{{{2}}}]]
10350 |}
10351 !! html
10352 <table>
10353 <tr>
10354 <td>[[{{{1}}}|{{{2}}}]]
10355 </td></tr></table>
10356
10357 !! end
10358
10359 !! test
10360 Magic variable as template parameter
10361 !! wikitext
10362 {{paramtest|param={{SITENAME}}}}
10363 !! html
10364 <p>This is a test template with parameter MediaWiki
10365 </p>
10366 !! end
10367
10368 !! article
10369 Template:linktest
10370 !! text
10371 [[{{{param}}}|link]]
10372 !! endarticle
10373
10374 !! test
10375 Template parameter as link source
10376 !! wikitext
10377 {{linktest|param=Main Page}}
10378 !! html
10379 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10380 </p>
10381 !! end
10382
10383 !!article
10384 Template:paramtest2
10385 !! text
10386 including another template, {{paramtest|param={{{arg}}}}}
10387 !! endarticle
10388
10389 !! test
10390 Template passing argument to another template
10391 !! wikitext
10392 {{paramtest2|arg='hmm'}}
10393 !! html
10394 <p>including another template, This is a test template with parameter 'hmm'
10395 </p>
10396 !! end
10397
10398 !! article
10399 Template:Linktest2
10400 !! text
10401 Main Page
10402 !! endarticle
10403
10404 !! test
10405 Template as link source
10406 !! wikitext
10407 [[{{linktest2}}]]
10408
10409 [[{{linktest2}}|Main Page]]
10410
10411 [[{{linktest2}}]]Page
10412 !! html
10413 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10414 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10415 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10416 </p>
10417 !! end
10418
10419
10420 !! article
10421 Template:loop1
10422 !! text
10423 {{loop2}}
10424 !! endarticle
10425
10426 !! article
10427 Template:loop2
10428 !! text
10429 {{loop1}}
10430 !! endarticle
10431
10432 !! test
10433 Template infinite loop
10434 !! wikitext
10435 {{loop1}}
10436 !! html
10437 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10438 </p>
10439 !! end
10440
10441 !! test
10442 Template from main namespace
10443 !! wikitext
10444 {{:Main Page}}
10445 !! html
10446 <p>blah blah
10447 </p>
10448 !! end
10449
10450 !! article
10451 Template:table
10452 !! text
10453 {|
10454 | 1 || 2
10455 |-
10456 | 3 || 4
10457 |}
10458 !! endarticle
10459
10460 !! test
10461 BUG 529: Template with table, not included at beginning of line
10462 !! wikitext
10463 foo {{table}}
10464 !! html
10465 <p>foo
10466 </p>
10467 <table>
10468 <tr>
10469 <td> 1 </td>
10470 <td> 2
10471 </td></tr>
10472 <tr>
10473 <td> 3 </td>
10474 <td> 4
10475 </td></tr></table>
10476
10477 !! end
10478
10479 !! test
10480 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10481 !! wikitext
10482 foo
10483 {{table}}
10484 !! html
10485 <p>foo
10486 </p>
10487 <table>
10488 <tr>
10489 <td> 1 </td>
10490 <td> 2
10491 </td></tr>
10492 <tr>
10493 <td> 3 </td>
10494 <td> 4
10495 </td></tr></table>
10496
10497 !! end
10498
10499 !! test
10500 BUG 41: Template parameters shown as broken links
10501 !! wikitext
10502 {{{parameter}}}
10503 !! html
10504 <p>{{{parameter}}}
10505 </p>
10506 !! end
10507
10508 !! test
10509 Template with targets containing wikilinks
10510 !! wikitext
10511 {{[[foo]]}}
10512
10513 {{[[{{echo|foo}}]]}}
10514
10515 {{{{echo|[[foo}}]]}}
10516 !! html
10517 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10518 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10519 </p><p>{{[[foo}}]]
10520 </p>
10521 !! end
10522
10523 !! article
10524 Template:''
10525 !! text
10526 bar
10527 !! endarticle
10528
10529 !! test
10530 Templates: Double quotes as template target
10531 !! wikitext
10532 foo {{''}} baz
10533 !! html/php
10534 <p>foo bar baz
10535 </p>
10536 !! html/parsoid
10537 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10538 </p>
10539 !! end
10540
10541 !! article
10542 Template:MSGNW test
10543 !! text
10544 ''None'' of '''this''' should be
10545 * interpreted
10546 but rather passed unmodified
10547 {{test}}
10548 <gallery>
10549 File:Foobar.jpg
10550 </gallery>
10551 <!-- comment -->
10552 !! endarticle
10553
10554 # hmm, fix this or just deprecate msgnw and document its behavior?
10555 !! test
10556 msgnw keyword
10557 !! wikitext
10558 {{msgnw:MSGNW test}}
10559 !! html/php
10560 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10561 &#42; interpreted
10562 &#32;but rather passed unmodified
10563 &#123;&#123;test&#125;&#125;
10564 &#60;gallery&#62;
10565 File:Foobar.jpg
10566 &#60;/gallery&#62;
10567 &#60;!-- comment --&#62;
10568 </p>
10569 !! end
10570
10571 !! test
10572 int keyword
10573 !! wikitext
10574 {{int:youhavenewmessages|lots of money|not!}}
10575 !! html
10576 <p>You have lots of money (not!).
10577 </p>
10578 !! end
10579
10580 !! test
10581 int keyword - non-existing message
10582 !! wikitext
10583 {{int:var}}
10584 !! html
10585 <p>&lt;var&gt;
10586 </p>
10587 !! end
10588
10589 !! article
10590 Template:Includes
10591 !! text
10592 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10593 !! endarticle
10594
10595 !! test
10596 <includeonly> and <noinclude> being included
10597 !! wikitext
10598 {{Includes}}
10599 !! html
10600 <p>Foobar
10601 </p>
10602 !! end
10603
10604 !! article
10605 Template:Includes2
10606 !! text
10607 <onlyinclude>Foo</onlyinclude>bar
10608 !! endarticle
10609
10610 !! test
10611 <onlyinclude> being included
10612 !! wikitext
10613 {{Includes2}}
10614 !! html
10615 <p>Foo
10616 </p>
10617 !! end
10618
10619
10620 !! article
10621 Template:Includes3
10622 !! text
10623 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10624 !! endarticle
10625
10626 !! test
10627 <onlyinclude> and <includeonly> being included
10628 !! wikitext
10629 {{Includes3}}
10630 !! html
10631 <p>Foo
10632 </p>
10633 !! end
10634
10635 !! test
10636 <includeonly> and <noinclude> on a page
10637 !! wikitext
10638 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10639 !! html
10640 <p>Foozar
10641 </p>
10642 !! end
10643
10644 !! test
10645 Un-closed <noinclude>
10646 !! wikitext
10647 <noinclude>
10648 !! html
10649 !! end
10650
10651 !! test
10652 <onlyinclude> on a page
10653 !! wikitext
10654 <onlyinclude>Foo</onlyinclude>bar
10655 !! html
10656 <p>Foobar
10657 </p>
10658 !! end
10659
10660 !! test
10661 Un-closed <onlyinclude>
10662 !! wikitext
10663 <onlyinclude>
10664 !! html
10665 !! end
10666
10667 !!test
10668 Self-closed noinclude, includeonly, onlyinclude tags
10669 !! wikitext
10670 <noinclude />
10671 <includeonly />
10672 <onlyinclude />
10673 !! html
10674 <p><br />
10675 </p>
10676 !!end
10677
10678 !!test
10679 Unbalanced includeonly and noinclude tags
10680 !! wikitext
10681 {|
10682 |a</noinclude>
10683 |b</noinclude></noinclude>
10684 |c</noinclude></includeonly>
10685 |d</includeonly></includeonly>
10686 |}
10687 !! html
10688 <table>
10689 <tr>
10690 <td>a
10691 </td>
10692 <td>b
10693 </td>
10694 <td>c&lt;/includeonly&gt;
10695 </td>
10696 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10697 </td></tr></table>
10698
10699 !!end
10700
10701 !! article
10702 Template:Includeonly section
10703 !! text
10704 <includeonly>
10705 ==Includeonly section==
10706 </includeonly>
10707 ==Section T-1==
10708 !!endarticle
10709
10710 !! test
10711 Bug 6563: Edit link generation for section shown by <includeonly>
10712 !! wikitext
10713 {{includeonly section}}
10714 !! html
10715 <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>
10716 <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>
10717
10718 !! end
10719
10720 # Uses same input as the contents of [[Template:Includeonly section]]
10721 !! test
10722 Bug 6563: Section extraction for section shown by <includeonly>
10723 !! options
10724 section=T-2
10725 !! wikitext
10726 <includeonly>
10727 ==Includeonly section==
10728 </includeonly>
10729 ==Section T-2==
10730 !! html
10731 ==Section T-2==
10732 !! end
10733
10734 !! test
10735 Bug 6563: Edit link generation for section suppressed by <includeonly>
10736 !! wikitext
10737 <includeonly>
10738 ==Includeonly section==
10739 </includeonly>
10740 ==Section 1==
10741 !! html
10742 <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>
10743
10744 !! end
10745
10746 !! test
10747 Bug 6563: Section extraction for section suppressed by <includeonly>
10748 !! options
10749 section=1
10750 !! wikitext
10751 <includeonly>
10752 ==Includeonly section==
10753 </includeonly>
10754 ==Section 1==
10755 !! html
10756 ==Section 1==
10757 !! end
10758
10759 !! test
10760 Un-closed <includeonly>
10761 !! wikitext
10762 <includeonly>
10763 !! html
10764 !! end
10765
10766 !! test
10767 Includes and comments at SOL
10768 !! wikitext
10769 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10770
10771 <noinclude>
10772 some
10773 </noinclude>* stuff
10774 * here
10775
10776 <includeonly>can have stuff</includeonly>=== here ===
10777
10778 !! html/php
10779 <h2><span class="mw-headline" id="hu">hu</span></h2>
10780 <p>some
10781 </p>
10782 <ul><li> stuff</li>
10783 <li> here</li></ul>
10784 <h3><span class="mw-headline" id="here">here</span></h3>
10785
10786 !! html/parsoid
10787 <!-- 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>
10788
10789 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10790 <p>some</p>
10791 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10792 <li> here</li></ul>
10793
10794 <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>
10795
10796 !! end
10797
10798 # TODO: test with DOM fragment reuse!
10799 !! test
10800 Parsoid: DOM fragment reuse
10801 !! options
10802 parsoid=wt2wt,wt2html
10803 !! wikitext
10804 a{{echo|b<table></table>c}}d
10805
10806 a{{echo|b
10807 <table></table>
10808 c}}d
10809
10810 {{echo|a
10811
10812 <table></table>
10813
10814 b}}
10815 !! html
10816 <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>
10817
10818 <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">
10819 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10820 </span><p about="#mwt2">cd</p>
10821
10822 <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">
10823
10824 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10825
10826 </span><p about="#mwt3">b</p>
10827 !! end
10828
10829 !! test
10830 Parsoid: Merge double tds (T52603)
10831 !! options
10832 parsoid
10833 !! wikitext
10834 {|
10835 |{{echo|{{!}} foo}}
10836 |}
10837 !! html
10838 <table><tbody>
10839 <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>
10840 </tbody></table>
10841 !! end
10842
10843 !! test
10844 Parsoid: Merge double tds in nested transclusion content (T52603)
10845 !! options
10846 parsoid
10847 !! wikitext
10848 {{echo|<div>}}
10849 {|
10850 |{{echo|{{!}} foo}}
10851 |}
10852 {{echo|</div>}}
10853 !! html
10854 <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}}]}'>
10855 <table><tbody>
10856 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10857 </tbody></table>
10858 </div>
10859 !! end
10860
10861 ###
10862 ### <includeonly> and <noinclude> in attributes
10863 ###
10864 !!test
10865 0. includeonly around the entire attribute
10866 !! wikitext
10867 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10868 !! html
10869 <p><span id="v2">bar</span>
10870 </p>
10871 !!end
10872
10873 !!test
10874 1. includeonly in html attr key
10875 !! wikitext
10876 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10877 !! html
10878 <p><span id="foo">bar</span>
10879 </p>
10880 !!end
10881
10882 !!test
10883 2. includeonly in html attr value
10884 !! wikitext
10885 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10886 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10887 !! html
10888 <p><span id="v1">bar</span>
10889 <span id="v1">bar</span>
10890 </p>
10891 !!end
10892
10893 !!test
10894 3. includeonly in part of an attr value
10895 !! wikitext
10896 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10897 !! html
10898 <p><span style="color:red;">bar</span>
10899 </p>
10900 !!end
10901
10902 !!test
10903 4. includeonly in table attributes
10904 !! wikitext
10905 {|
10906 |- <noinclude>
10907 |-
10908 |a
10909 </noinclude>
10910 |- <includeonly>
10911 |-
10912 |b
10913 </includeonly>
10914 |}
10915 !! html
10916 <table>
10917
10918
10919 <tr>
10920 <td>a
10921 </td></tr>
10922 </table>
10923
10924 !!end
10925
10926 ###
10927 ### Token Stream Patcher tests
10928 ###
10929 ### These tests won't always pass wt2wt and other modes because
10930 ### on serialization, the table will be output on a new line.
10931 ### For now, we are blacklisting them, and using this to test selser.
10932 ###
10933
10934 !!test
10935 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10936 !!options
10937 parsoid=wt2html,wt2wt
10938 !!wikitext
10939 {{echo|}}{| width = '100%'
10940 |foo
10941 |}
10942 !!html/parsoid
10943 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10944 <tbody><tr><td>foo</td></tr>
10945 </tbody></table>
10946 !!end
10947
10948 !!test
10949 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10950 !!options
10951 parsoid=wt2html,wt2wt
10952 !!wikitext
10953 <includeonly>a</includeonly>{| {{{b}}}
10954 |c
10955 |}
10956 !!html/parsoid
10957 <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}}}":""}}'>
10958 <tbody><tr><td>c</td></tr>
10959 </tbody></table>
10960
10961 !!end
10962
10963 ###
10964 ### Testing parsing of templates where a template arg
10965 ### has the same name as the template itself.
10966 ###
10967
10968 !! article
10969 Template:quote
10970 !! text
10971 {{{quote|{{{1}}}}}}
10972 !! endarticle
10973
10974 !!test
10975 Templates: Template Name/Arg clash: 1. Use of positional param
10976 !! wikitext
10977 {{quote|foo}}
10978 !! html
10979 <p>foo
10980 </p>
10981 !!end
10982
10983 !!test
10984 Templates: Template Name/Arg clash: 2. Use of named param
10985 !! wikitext
10986 {{quote|quote=foo}}
10987 !! html
10988 <p>foo
10989 </p>
10990 !!end
10991
10992 !!test
10993 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10994 !! wikitext
10995 {{quote|quote}}
10996 !! html
10997 <p>quote
10998 </p>
10999 !!end
11000
11001 ###
11002 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11003 ###
11004
11005 !!test
11006 Templates: 1. Simple use
11007 !! wikitext
11008 {{echo|Foo}}
11009 !! html
11010 <p>Foo
11011 </p>
11012 !!end
11013
11014 !!test
11015 Templates: 2. Inside a block tag
11016 !! wikitext
11017 <div>{{echo|Foo}}</div>
11018 <blockquote>{{echo|Foo}}</blockquote>
11019 !! html
11020 <div>Foo</div>
11021 <blockquote>Foo</blockquote>
11022
11023 !! html+tidy
11024 <div>Foo</div>
11025 <blockquote>
11026 <p>Foo</p>
11027 </blockquote>
11028 !!end
11029
11030 !!test
11031 Templates: P-wrapping: 1a. Templates on consecutive lines
11032 !! wikitext
11033 {{echo|Foo}}
11034 {{echo|bar}}
11035 !! html
11036 <p>Foo
11037 bar
11038 </p>
11039 !!end
11040
11041 !!test
11042 Templates: P-wrapping: 1b. Templates on consecutive lines
11043 !! wikitext
11044 Foo
11045
11046 {{echo|bar}}
11047 {{echo|baz}}
11048 !! html
11049 <p>Foo
11050 </p><p>bar
11051 baz
11052 </p>
11053 !!end
11054
11055 !!test
11056 Templates: P-wrapping: 1c. Templates on consecutive lines
11057 !! wikitext
11058 {{echo|Foo}}
11059 {{echo|bar}} <div>baz</div>
11060 !! html
11061 <p>Foo
11062 </p>
11063 bar <div>baz</div>
11064
11065 !! html+tidy
11066 <p>Foo</p>
11067 <p>bar</p>
11068 <div>baz</div>
11069 !! end
11070
11071 !!test
11072 Templates: P-wrapping: 1d. Template preceded by comment-only line
11073 !!options
11074 parsoid
11075 !! wikitext
11076 <!-- foo -->
11077 {{echo|Bar}}
11078 !! html
11079 <!-- foo -->
11080
11081 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11082 !!end
11083
11084 !!test
11085 Templates: Inline Text: 1. Multiple template uses
11086 !! wikitext
11087 {{echo|Foo}}bar{{echo|baz}}
11088 !! html
11089 <p>Foobarbaz
11090 </p>
11091 !!end
11092
11093 !!test
11094 Templates: Inline Text: 2. Back-to-back template uses
11095 !! wikitext
11096 {{echo|Foo}}{{echo|bar}}
11097 !! html
11098 <p>Foobar
11099 </p>
11100 !!end
11101
11102 !!test
11103 Templates: Block Tags: 1. Multiple template uses
11104 !! wikitext
11105 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11106 !! html
11107 <div>Foo</div><div>bar</div><div>baz</div>
11108
11109 !!end
11110
11111 !!test
11112 Templates: Block Tags: 2. Back-to-back template uses
11113 !! wikitext
11114 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11115 !! html
11116 <div>Foo</div><div>bar</div>
11117
11118 !!end
11119
11120 # This is an edge case relating to paragraph wrapping.
11121 !!test
11122 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11123 !! wikitext
11124 {{echo|a
11125 b</p>}}
11126 !! html/parsoid
11127 <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
11128 b</p>
11129 !!end
11130
11131 !!test
11132 Templates: Links: 1. Simple example
11133 !! wikitext
11134 {{echo|[[Foo|bar]]}}
11135 !! html
11136 <p><a href="/wiki/Foo" title="Foo">bar</a>
11137 </p>
11138 !!end
11139
11140 !!test
11141 Templates: Links: 2. Generation of link href
11142 !! wikitext
11143 [[{{echo|Foo}}|bar]]
11144 !! html
11145 <p><a href="/wiki/Foo" title="Foo">bar</a>
11146 </p>
11147 !!end
11148
11149 !!test
11150 Templates: Links: 3. Generation of part of a link href
11151 !! wikitext
11152 [[Fo{{echo|o}}|bar]]
11153
11154 [[Foo{{echo|bar}}]]
11155
11156 [[Foo{{echo|bar}}baz]]
11157
11158 [[Foo{{echo|bar}}|bar]]
11159
11160 [[:Foo{{echo|bar}}]]
11161
11162 [[:Foo{{echo|bar}}|bar]]
11163 !! html
11164 <p><a href="/wiki/Foo" title="Foo">bar</a>
11165 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11166 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11167 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11168 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11169 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11170 </p>
11171 !!end
11172
11173 !!test
11174 Templates: Links: 4. Multiple templates generating link href
11175 !! wikitext
11176 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11177 !! html
11178 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11179 </p>
11180 !!end
11181
11182 !!test
11183 Templates: Links: 5. Generation of link text
11184 !! wikitext
11185 [[Foo|{{echo|bar}}]]
11186 !! html
11187 <p><a href="/wiki/Foo" title="Foo">bar</a>
11188 </p>
11189 !!end
11190
11191 !!test
11192 Templates: Links: 5. Nested templates (only outermost template should be marked)
11193 !! wikitext
11194 {{echo|[[{{echo|Foo}}|bar]]}}
11195 !! html
11196 <p><a href="/wiki/Foo" title="Foo">bar</a>
11197 </p>
11198 !!end
11199
11200 !!test
11201 Templates: HTML Tag: 1. Generation of HTML attr. key
11202 !! wikitext
11203 <div {{echo|style}}="color:red;">foo</div>
11204 !! html
11205 <div style="color:red;">foo</div>
11206
11207 !!end
11208
11209 !!test
11210 Templates: HTML Tag: 2. Generation of HTML attr. value
11211 !! wikitext
11212 <div style={{echo|'color:red;'}}>foo</div>
11213 !! html
11214 <div style="color:red;">foo</div>
11215
11216 !!end
11217
11218 !!test
11219 Templates: HTML Tag: 3. Generation of HTML attr key and value
11220 !! wikitext
11221 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11222 !! html
11223 <div style="color:red;">foo</div>
11224
11225 !!end
11226
11227 !!test
11228 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11229 !! wikitext
11230 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11231 !! html
11232 <div title="This is a long title with just one piece templated">foo</div>
11233
11234 !!end
11235
11236 !!test
11237 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11238 !! wikitext
11239 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11240 !! html
11241 <div title="This is a long title with just one piece templated">foo</div>
11242
11243 !!end
11244
11245 !!test
11246 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11247 !! wikitext
11248 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11249 !! html
11250 <div title="This is a long title with just one piece templated">foo</div>
11251
11252 !!end
11253
11254 # SSS FIXME: While it is great we added support for all this,
11255 # do we want to make this part of the spec? Maybe we want to
11256 # deprecate this kind of usage in the future?
11257 !!test
11258 Templates: HTML Tag: 7. Generation of partial attribute key string
11259 !! wikitext
11260 <div st{{echo|yle}}="color:red;">foo</div>
11261 !! html
11262 <div style="color:red;">foo</div>
11263
11264 !!end
11265
11266 !! test
11267 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11268 !! wikitext
11269 <div {{echo|1=id="v1"}}>bar</div>
11270 !! html
11271 <div id="v1">bar</div>
11272
11273 !!end
11274
11275 !! test
11276 Templates: HTML Tag: 9. Multiple template-generated attributes
11277 !! wikitext
11278 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11279 !! html
11280 <div id="v1" title="foo">bar</div>
11281
11282 !!end
11283
11284 !! test
11285 Templates: Support for templates generating attributes and content
11286 !! wikitext
11287 {| {{mixed_attr_content_template}}
11288 |-
11289 |bar
11290 |}
11291 !! html/php
11292 <table style="color:red;" title="T48811">
11293
11294 <tr>
11295 <td>foo
11296 </td></tr>
11297 <tr>
11298 <td>bar
11299 </td></tr></table>
11300
11301 !! html/parsoid
11302 <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|}"]}'>
11303 <tbody><tr>
11304 <td>foo</td></tr>
11305 <tr>
11306 <td>bar</td></tr>
11307 </tbody></table>
11308 !!end
11309
11310 !! test
11311 1. Entities and nowikis inside templated attributes should be handled correctly
11312 !! wikitext
11313 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11314 !! html/php
11315 <div style="background:#f9f9f9;">foo</div>
11316
11317 !! html/parsoid
11318 <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>
11319 !! end
11320
11321 !! test
11322 2. Entities and nowikis inside templated attributes should be handled correctly
11323 !! wikitext
11324 {|
11325 |{{table_attribs_3}}
11326 |}
11327 !! html/php
11328 <table>
11329 <tr>
11330 <td style="background:#f9f9f9;">Foo
11331 </td></tr></table>
11332
11333 !! html/parsoid
11334 <table>
11335 <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>
11336 </tbody></table>
11337 !! end
11338
11339 !! test
11340 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11341 !! wikitext
11342 {{tbl-start}}
11343 |{{table_attribs_3}}
11344 {{tbl-end}}
11345 !! html/php
11346 <table>
11347 <tr>
11348 <td style="background:#f9f9f9;">Foo
11349 </td></tr></table>
11350
11351 !! html/parsoid
11352 <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}}]}'>
11353 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11354 </tbody></table>
11355 !! end
11356
11357 # T107622
11358 !! test
11359 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11360 !! wikitext
11361 {|
11362 | {{table_attribs_6}} hi
11363 |}
11364 !! html/php
11365 <table>
11366 <tr>
11367 <td style="background: red;"> hi
11368 </td></tr></table>
11369
11370 !! html/parsoid
11371 <table>
11372 <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>
11373 </tbody></table>
11374 !! end
11375
11376 !!test
11377 Templates: HTML Tables: 1. Generating start of a HTML table
11378 !! wikitext
11379 {{echo|<table><tr><td>foo</td>}}</tr></table>
11380 !! html
11381 <table><tr><td>foo</td></tr></table>
11382
11383 !!end
11384
11385 !!test
11386 Templates: HTML Tables: 2a. Generating middle of a HTML table
11387 !! wikitext
11388 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11389 !! html
11390 <table><tr><td>foo</td></tr></table>
11391
11392 !!end
11393
11394 !!test
11395 Templates: HTML Tables: 2b. Generating middle of a HTML table
11396 !! wikitext
11397 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11398 !! html
11399 <table><tr><td>foo</td></tr></table>
11400
11401 !!end
11402
11403 !!test
11404 Templates: HTML Tables: 3. Generating end of a HTML table
11405 !! wikitext
11406 <table><tr>{{echo|<td>foo</td></tr></table>}}
11407 !! html
11408 <table><tr><td>foo</td></tr></table>
11409
11410 !!end
11411
11412 !!test
11413 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11414 !! wikitext
11415 {{echo|<table>}}<tr><td>foo</td></tr></table>
11416 !! html
11417 <table><tr><td>foo</td></tr></table>
11418
11419 !!end
11420
11421 !!test
11422 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11423 !! wikitext
11424 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11425 !! html
11426 <table><tr><td>foo</td></tr></table>
11427
11428 !!end
11429
11430 !!test
11431 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11432 !! wikitext
11433 <table><tr>{{echo|<td>}}foo</td></tr></table>
11434 !! html
11435 <table><tr><td>foo</td></tr></table>
11436
11437 !!end
11438
11439 !!test
11440 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11441 !! wikitext
11442 <table><tr><td>foo{{echo|</td>}}</tr></table>
11443 !! html
11444 <table><tr><td>foo</td></tr></table>
11445
11446 !!end
11447
11448 !!test
11449 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11450 !! wikitext
11451 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11452 !! html
11453 <table><tr><td>foo</td></tr></table>
11454
11455 !!end
11456
11457 !!test
11458 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11459 !! wikitext
11460 <table><tr><td>foo</td></tr>{{echo|</table>}}
11461 !! html
11462 <table><tr><td>foo</td></tr></table>
11463
11464 !!end
11465
11466 !!test
11467 Templates: HTML Tables: 5. Proper fostering of categories from inside
11468 !!options
11469 parsoid=wt2html,wt2wt
11470 !! wikitext
11471 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11472 <!--Two categories (Bug 50330)-->
11473 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11474 !! html
11475 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11476 <!--Two categories (Bug 50330)-->
11477 <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>
11478 !!end
11479
11480 !!test
11481 Templates: Wiki Tables: 1a. Fostering of entire template content
11482 !! wikitext
11483 {|
11484 {{echo|a}}
11485 |}
11486 !! html
11487 <table>
11488 a
11489 <tr><td></td></tr></table>
11490
11491 !! html+tidy
11492 <p>a</p>
11493 <table>
11494 <tr>
11495 <td></td>
11496 </tr>
11497 </table>
11498 !! end
11499
11500 !!test
11501 Templates: Wiki Tables: 1b. Fostering of entire template content
11502 !! wikitext
11503 {|
11504 {{echo|<div>}}
11505 foo
11506 {{echo|</div>}}
11507 |}
11508 !! html
11509 <table>
11510 <div>
11511 <p>foo
11512 </p>
11513 </div>
11514 <tr><td></td></tr></table>
11515
11516 !! html+tidy
11517 <div>
11518 <p>foo</p>
11519 </div>
11520 <table>
11521 <tr>
11522 <td></td>
11523 </tr>
11524 </table>
11525 !! end
11526
11527 !!test
11528 Templates: Wiki Tables: 2. Fostering of partial template content
11529 !! wikitext
11530 {|
11531 {{echo|a
11532 <div>b</div>}}
11533 |}
11534 !! html
11535 <table>
11536 a
11537 <div>b</div>
11538 <tr><td></td></tr></table>
11539
11540 !! html+tidy
11541 <p>a</p>
11542 <div>b</div>
11543 <table>
11544 <tr>
11545 <td></td>
11546 </tr>
11547 </table>
11548 !! end
11549
11550 !!test
11551 Templates: Wiki Tables: 3. td-content via multiple templates
11552 !! wikitext
11553 {|
11554 {{echo|{{pipe}}a}}{{echo|b}}
11555 |}
11556 !! html
11557 <table>
11558 <tr>
11559 <td>ab
11560 </td></tr></table>
11561
11562 !!end
11563
11564 !!test
11565 Templates: Wiki Tables: 4. Templated tags, no content
11566 !! wikitext
11567 {{tbl-start}}
11568 {{tbl-end}}
11569 !! html
11570 <table>
11571 <tr><td></td></tr></table>
11572
11573 !!end
11574
11575 !!test
11576 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11577 !! wikitext
11578 {{tbl-start}}
11579 |foo
11580 {{tbl-end}}
11581 !! html
11582 <table>
11583 <tr>
11584 <td>foo
11585 </td></tr></table>
11586
11587 !!end
11588
11589 !!test
11590 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11591 !! wikitext
11592 {{tbl-start}}
11593 {{!}}foo
11594 {{tbl-end}}
11595 !! html
11596 <table>
11597 <tr>
11598 <td>foo
11599 </td></tr></table>
11600
11601 !!end
11602
11603 ## This test case is very specific to Parsoid's internals
11604 ## and is hence only tested for Parsoid's code. Parsoid uses
11605 ## a <meta> marker tag for <ref> tags and they are expanded
11606 ## much later. We are verifying that this <meta> tag usage
11607 ## doesn't prevent foster parenting.
11608 !!test
11609 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11610 !!wikitext
11611 {{PartialTable}}<ref>foo</ref>
11612 |}
11613
11614 <references />
11615 !!html/parsoid
11616 <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">
11617 <tbody>
11618 </tbody></table>
11619
11620 <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>
11621 !!end
11622
11623 !! test
11624 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11625 !! wikitext
11626 {{echo|
11627 {{{!}}
11628 {{!}}-}}
11629 <onlyinclude>
11630 |foo
11631 </onlyinclude>
11632 {{!}}}
11633 !! html/parsoid
11634 <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{{!}}}"]}'>
11635 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11636 <tbody><tr>
11637
11638 <td>foo
11639 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11640 </tbody></table>
11641 !! end
11642
11643 !!test
11644 Templates: Lists: Multi-line list-items via templates
11645 !! wikitext
11646 *{{echo|a {{nonexistent|
11647 unused}}}}
11648 *{{echo|b {{nonexistent|
11649 unused}}}}
11650 !! html
11651 <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>
11652 <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>
11653
11654 !!end
11655
11656 !!test
11657 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11658 !! wikitext
11659 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11660 !! html
11661 <p><i>ab</i>c<i>d</i>e
11662 </p>
11663 !!end
11664
11665 !!test
11666 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11667 (PHP parser generates misnested html)
11668 !! wikitext
11669 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11670 !! html/parsoid
11671 <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>
11672 !!end
11673
11674 !!test
11675 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11676 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11677 !! options
11678 parsoid=wt2html,wt2wt
11679 !! wikitext
11680 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11681 !! html
11682 <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>
11683 <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>
11684 <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>
11685 !!end
11686
11687 !!test
11688 Templates: Ugly nesting: 4. Divs opened/closed across templates
11689 !! wikitext
11690 a<div>b{{echo|c</div>d}}e
11691 !! html
11692 a<div>bc</div>de
11693
11694 !! html+tidy
11695 <p>a</p>
11696 <div>bc</div>
11697 <p>de</p>
11698 !! end
11699
11700 !!test
11701 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11702 (Parsoid-centric)
11703 !! options
11704 parsoid
11705 !! wikitext
11706 {|
11707 |{{echo|foo</table>}}
11708 |bar
11709 |}
11710 !! html
11711 <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|}"]}'>
11712
11713 <tbody>
11714 <tr>
11715 <td>foo</td></tr></tbody></table><span about="#mwt1">
11716 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11717 |}</span>
11718 !!end
11719
11720 !!test
11721 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11722 (Parsoid-centric)
11723 !! options
11724 parsoid
11725 !! wikitext
11726 <table>
11727 <tr>
11728 <td>
11729 <table>
11730 <tr>
11731 <td>1. {{echo|foo </table>}}</td>
11732 <td> bar </td>
11733 <td>2. {{echo|baz </table>}}</td>
11734 </tr>
11735 <tr>
11736 <td>abc</td>
11737 </tr>
11738 </table>
11739 </td>
11740 </tr>
11741 <tr>
11742 <td>xyz</td>
11743 </tr>
11744 </table>
11745 !! html
11746 <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>"]}'>
11747 <tbody><tr>
11748 <td>
11749 <table>
11750 <tbody><tr>
11751 <td>1. foo </td></tr></tbody></table></td>
11752 <td> bar </td>
11753 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11754 </span><span about="#mwt2">
11755 </span><span about="#mwt2">
11756 </span><span about="#mwt2">abc</span><span about="#mwt2">
11757 </span><span about="#mwt2">
11758 </span><span about="#mwt2">
11759 </span><span about="#mwt2">
11760 </span><span about="#mwt2">
11761 </span><span about="#mwt2">
11762 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11763 </span><span about="#mwt2">
11764 </span>
11765 !!end
11766
11767 !! test
11768 Templates: Ugly templates: 3. newline-only template parameter
11769 !! wikitext
11770 foo {{echo|
11771 }}
11772 !! html
11773 <p>foo
11774 </p>
11775 !! end
11776
11777 # This looks like a bug: a single newline triggers p/br for some reason.
11778 !! test
11779 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11780 !! wikitext
11781 {{echo|
11782 }}
11783 !! html
11784 <p><br />
11785 </p>
11786 !! end
11787
11788 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11789 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11790 !! test
11791 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11792 !! wikitext
11793 {{echo|<table>}}
11794 {{echo|<div>foo}}
11795 {{echo|</table>}}
11796 !! html/parsoid
11797 <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
11798 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11799 </table>
11800 !! end
11801
11802 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11803 # that are "identical" and generate nesting cycles in the algorithm
11804 !! test
11805 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11806 !! wikitext
11807 {{echo|<table><tr><td><table>}}
11808 {{echo|<div>}}
11809 {{echo|</div>}}
11810 !! html/parsoid
11811 <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"}'>
11812 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11813 </table></td></tr></tbody></table>
11814 !! end
11815
11816 !!test
11817 Parser Functions: 1. Simple example
11818 !! wikitext
11819 {{uc:foo}}
11820 !! html
11821 <p>FOO
11822 </p>
11823 !!end
11824
11825 !!test
11826 Parser Functions: 2. Nested use (only outermost should be marked up)
11827 !! wikitext
11828 {{uc:{{lc:FOO}}}}
11829 !! html
11830 <p>FOO
11831 </p>
11832 !!end
11833
11834 ###
11835 ### Pre-save transform tests
11836 ###
11837 !! test
11838 pre-save transform: subst:
11839 !! options
11840 pst
11841 !! wikitext
11842 {{subst:test}}
11843 !! html/php
11844 This is a test template
11845 !! end
11846
11847 !! test
11848 pre-save transform: normal template
11849 !! options
11850 pst
11851 !! wikitext
11852 {{test}}
11853 !! html/php
11854 {{test}}
11855 !! end
11856
11857 !! test
11858 pre-save transform: nonexistent template
11859 !! options
11860 pst
11861 !! wikitext
11862 {{thistemplatedoesnotexist}}
11863 !! html/php
11864 {{thistemplatedoesnotexist}}
11865 !! end
11866
11867 !! test
11868 pre-save transform: subst magic variables
11869 !! options
11870 pst
11871 !! wikitext
11872 {{subst:SITENAME}}
11873 !! html/php
11874 MediaWiki
11875 !! end
11876
11877 # This is bug 89, which I fixed. -- wtm
11878 !! test
11879 pre-save transform: subst: templates with parameters
11880 !! options
11881 pst
11882 !! wikitext
11883 {{subst:paramtest|param="something else"}}
11884 !! html/php
11885 This is a test template with parameter "something else"
11886 !! end
11887
11888 !! article
11889 Template:nowikitest
11890 !! text
11891 <nowiki>'''not wiki'''</nowiki>
11892 !! endarticle
11893
11894 !! test
11895 pre-save transform: nowiki in subst (bug 1188)
11896 !! options
11897 pst
11898 !! wikitext
11899 {{subst:nowikitest}}
11900 !! html/php
11901 <nowiki>'''not wiki'''</nowiki>
11902 !! end
11903
11904 !! article
11905 Template:commenttest
11906 !! text
11907 This template has <!-- a comment --> in it.
11908 !! endarticle
11909
11910 !! test
11911 pre-save transform: comment in subst (bug 1936)
11912 !! options
11913 pst
11914 !! wikitext
11915 {{subst:commenttest}}
11916 !! html/php
11917 This template has <!-- a comment --> in it.
11918 !! end
11919
11920 !! test
11921 pre-save transform: unclosed tag
11922 !! options
11923 pst noxml
11924 !! wikitext
11925 <nowiki>'''not wiki'''
11926 !! html/php
11927 <nowiki>'''not wiki'''
11928 !! end
11929
11930 !! test
11931 pre-save transform: mixed tag case
11932 !! options
11933 pst noxml
11934 !! wikitext
11935 <NOwiki>'''not wiki'''</noWIKI>
11936 !! html/php
11937 <NOwiki>'''not wiki'''</noWIKI>
11938 !! end
11939
11940 !! test
11941 pre-save transform: unclosed comment in <nowiki>
11942 !! options
11943 pst noxml
11944 !! wikitext
11945 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11946 !! html/php
11947 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11948 !!end
11949
11950 # Leading @ in this template definition works around a limitation
11951 # in parsoid's parserTests which otherwise strips the <span> from the
11952 # result (confusing it for a template wrapper)
11953 !! article
11954 Template:dangerous
11955 !!text
11956 @<span onmouseover="alert('crap')">Oh no</span>
11957 !!endarticle
11958
11959 !!test
11960 (confirming safety of fix for subst bug 1936)
11961 !! wikitext
11962 {{Template:dangerous}}
11963 !! html
11964 <p>@<span>Oh no</span>
11965 </p>
11966 !! end
11967
11968 !! test
11969 pre-save transform: comment containing gallery (bug 5024)
11970 !! options
11971 pst
11972 !! wikitext
11973 <!-- <gallery>data</gallery> -->
11974 !! html/php
11975 <!-- <gallery>data</gallery> -->
11976 !!end
11977
11978 !! test
11979 pre-save transform: comment containing extension
11980 !! options
11981 pst
11982 !! wikitext
11983 <!-- <tag>data</tag> -->
11984 !! html/php
11985 <!-- <tag>data</tag> -->
11986 !!end
11987
11988 !! test
11989 pre-save transform: comment containing nowiki
11990 !! options
11991 pst
11992 !! wikitext
11993 <!-- <nowiki>data</nowiki> -->
11994 !! html/php
11995 <!-- <nowiki>data</nowiki> -->
11996 !!end
11997
11998 !! test
11999 pre-save transform: <noinclude> in subst (bug 3298)
12000 !! options
12001 pst
12002 !! wikitext
12003 {{subst:Includes}}
12004 !! html/php
12005 Foobar
12006 !! end
12007
12008 !! test
12009 pre-save transform: <onlyinclude> in subst (bug 3298)
12010 !! options
12011 pst
12012 !! wikitext
12013 {{subst:Includes2}}
12014 !! html/php
12015 Foo
12016 !! end
12017
12018 !! article
12019 Template:SubstTest
12020 !!text
12021 {{<includeonly>subst:</includeonly>Includes}}
12022 !! endarticle
12023
12024 !! article
12025 Template:SafeSubstTest
12026 !! text
12027 {{<includeonly>safesubst:</includeonly>Includes}}
12028 !! endarticle
12029
12030 !! test
12031 bug 22297: safesubst: works during PST
12032 !! options
12033 pst
12034 !! wikitext
12035 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12036 !! html/php
12037 FoobarFoobar
12038 !! end
12039
12040 !! test
12041 bug 22297: safesubst: works during normal parse
12042 !! wikitext
12043 {{SafeSubstTest}}
12044 !! html
12045 <p>Foobar
12046 </p>
12047 !! end
12048
12049 !! test
12050 subst: does not work during normal parse
12051 !! wikitext
12052 {{SubstTest}}
12053 !! html
12054 <p>{{subst:Includes}}
12055 </p>
12056 !! end
12057
12058 !! test
12059 pre-save transform: context links ("pipe trick")
12060 !! options
12061 pst
12062 !! wikitext
12063 [[Article (context)|]]
12064 [[Bar:Article|]]
12065 [[:Bar:Article|]]
12066 [[Bar:Article (context)|]]
12067 [[:Bar:Article (context)|]]
12068 [[|Article]]
12069 [[|Article (context)]]
12070 [[Bar:X (Y) Z|]]
12071 [[:Bar:X (Y) Z|]]
12072 !! html/php
12073 [[Article (context)|Article]]
12074 [[Bar:Article|Article]]
12075 [[:Bar:Article|Article]]
12076 [[Bar:Article (context)|Article]]
12077 [[:Bar:Article (context)|Article]]
12078 [[Article]]
12079 [[Article (context)]]
12080 [[Bar:X (Y) Z|X (Y) Z]]
12081 [[:Bar:X (Y) Z|X (Y) Z]]
12082 !! end
12083
12084 !! test
12085 pre-save transform: context links ("pipe trick") with interwiki prefix
12086 !! options
12087 pst
12088 !! wikitext
12089 [[interwiki:Article|]]
12090 [[:interwiki:Article|]]
12091 [[interwiki:Bar:Article|]]
12092 [[:interwiki:Bar:Article|]]
12093 !! html/php
12094 [[interwiki:Article|Article]]
12095 [[:interwiki:Article|Article]]
12096 [[interwiki:Bar:Article|Bar:Article]]
12097 [[:interwiki:Bar:Article|Bar:Article]]
12098 !! end
12099
12100 !! test
12101 pre-save transform: context links ("pipe trick") with parens in title
12102 !! options
12103 pst title=[[Somearticle (context)]]
12104 !! wikitext
12105 [[|Article]]
12106 !! html/php
12107 [[Article (context)|Article]]
12108 !! end
12109
12110 !! test
12111 pre-save transform: context links ("pipe trick") with comma in title
12112 !! options
12113 pst title=[[Someplace, Somewhere]]
12114 !! wikitext
12115 [[|Otherplace]]
12116 [[Otherplace, Elsewhere|]]
12117 [[Otherplace, Elsewhere, Anywhere|]]
12118 !! html/php
12119 [[Otherplace, Somewhere|Otherplace]]
12120 [[Otherplace, Elsewhere|Otherplace]]
12121 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12122 !! end
12123
12124 !! test
12125 pre-save transform: context links ("pipe trick") with parens and comma
12126 !! options
12127 pst title=[[Someplace (IGNORED), Somewhere]]
12128 !! wikitext
12129 [[|Otherplace]]
12130 [[Otherplace (place), Elsewhere|]]
12131 !! html/php
12132 [[Otherplace, Somewhere|Otherplace]]
12133 [[Otherplace (place), Elsewhere|Otherplace]]
12134 !! end
12135
12136 !! test
12137 pre-save transform: context links ("pipe trick") with comma and parens
12138 !! options
12139 pst title=[[Who, me? (context)]]
12140 !! wikitext
12141 [[|Yes, you.]]
12142 [[Me, Myself, and I (1937 song)|]]
12143 !! html/php
12144 [[Yes, you. (context)|Yes, you.]]
12145 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12146 !! end
12147
12148 !! test
12149 pre-save transform: context links ("pipe trick") with namespace
12150 !! options
12151 pst title=[[Ns:Somearticle]]
12152 !! wikitext
12153 [[|Article]]
12154 !! html/php
12155 [[Ns:Article|Article]]
12156 !! end
12157
12158 !! test
12159 pre-save transform: context links ("pipe trick") with namespace and parens
12160 !! options
12161 pst title=[[Ns:Somearticle (context)]]
12162 !! wikitext
12163 [[|Article]]
12164 !! html/php
12165 [[Ns:Article (context)|Article]]
12166 !! end
12167
12168 !! test
12169 pre-save transform: context links ("pipe trick") with namespace and comma
12170 !! options
12171 pst title=[[Ns:Somearticle, Context, Whatever]]
12172 !! wikitext
12173 [[|Article]]
12174 !! html/php
12175 [[Ns:Article, Context, Whatever|Article]]
12176 !! end
12177
12178 !! test
12179 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12180 !! options
12181 pst title=[[Ns:Somearticle, Context (context)]]
12182 !! wikitext
12183 [[|Article]]
12184 !! html/php
12185 [[Ns:Article (context)|Article]]
12186 !! end
12187
12188 !! test
12189 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12190 !! options
12191 pst title=[[Ns:Somearticle (IGNORED), Context]]
12192 !! wikitext
12193 [[|Article]]
12194 !! html/php
12195 [[Ns:Article, Context|Article]]
12196 !! end
12197
12198 !! test
12199 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12200 !! options
12201 pst
12202 !! wikitext
12203 [[Article(context)|]]
12204 [[Bar:Article(context)|]]
12205 [[:Bar:Article(context)|]]
12206 [[|Article(context)]]
12207 [[Bar:X(Y)Z|]]
12208 [[:Bar:X(Y)Z|]]
12209 !! html/php
12210 [[Article(context)|Article]]
12211 [[Bar:Article(context)|Article]]
12212 [[:Bar:Article(context)|Article]]
12213 [[Article(context)]]
12214 [[Bar:X(Y)Z|X(Y)Z]]
12215 [[:Bar:X(Y)Z|X(Y)Z]]
12216 !! end
12217
12218 !! test
12219 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12220 !! options
12221 pst
12222 !! wikitext
12223 [[Article (context)|]]
12224 [[Bar:Article (context)|]]
12225 [[:Bar:Article (context)|]]
12226 [[|Article (context)]]
12227 [[Bar:X (Y) Z|]]
12228 [[:Bar:X (Y) Z|]]
12229 !! html/php
12230 [[Article (context)|Article]]
12231 [[Bar:Article (context)|Article]]
12232 [[:Bar:Article (context)|Article]]
12233 [[Article (context)]]
12234 [[Bar:X (Y) Z|X (Y) Z]]
12235 [[:Bar:X (Y) Z|X (Y) Z]]
12236 !! end
12237
12238 !! test
12239 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12240 !! options
12241 pst
12242 !! wikitext
12243 [[Article(context)|]]
12244 [[Bar:Article(context)|]]
12245 [[:Bar:Article(context)|]]
12246 [[|Article(context)]]
12247 [[Bar:X(Y)Z|]]
12248 [[:Bar:X(Y)Z|]]
12249 !! html/php
12250 [[Article(context)|Article]]
12251 [[Bar:Article(context)|Article]]
12252 [[:Bar:Article(context)|Article]]
12253 [[Article(context)]]
12254 [[Bar:X(Y)Z|X(Y)Z]]
12255 [[:Bar:X(Y)Z|X(Y)Z]]
12256 !! end
12257
12258 !! test
12259 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12260 !! options
12261 pst
12262 !! wikitext
12263 [[Article (context), context|]]
12264 [[Article (context),context|]]
12265 [[Bar:Article (context), context|]]
12266 [[Bar:Article (context),context|]]
12267 [[:Bar:Article (context), context|]]
12268 [[:Bar:Article (context),context|]]
12269 !! html/php
12270 [[Article (context), context|Article]]
12271 [[Article (context),context|Article]]
12272 [[Bar:Article (context), context|Article]]
12273 [[Bar:Article (context),context|Article]]
12274 [[:Bar:Article (context), context|Article]]
12275 [[:Bar:Article (context),context|Article]]
12276 !! end
12277
12278 !! test
12279 pre-save transform: trim trailing empty lines
12280 !! options
12281 pst
12282 !! wikitext
12283 Empty lines are trimmed
12284
12285
12286
12287
12288 !! html/php
12289 Empty lines are trimmed
12290 !! end
12291
12292 !! test
12293 pre-save transform: Signature expansion
12294 !! options
12295 pst
12296 !! wikitext
12297 * ~~~
12298 * <noinclude>~~~</noinclude>
12299 * <includeonly>~~~</includeonly>
12300 * <onlyinclude>~~~</onlyinclude>
12301 !! html/php
12302 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12303 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12304 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12305 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12306 !! end
12307
12308
12309 !! test
12310 pre-save transform: Signature expansion in nowiki tags (bug 93)
12311 !! options
12312 pst disabled
12313 !! wikitext
12314 Shall not expand:
12315
12316 <nowiki>~~~~</nowiki>
12317
12318 <includeonly><nowiki>~~~~</nowiki></includeonly>
12319
12320 <noinclude><nowiki>~~~~</nowiki></noinclude>
12321
12322 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12323
12324 {{subst:Foo}} shall be converted to FOO
12325
12326 As well as inside noinclude/onlyinclude
12327 <noinclude>{{subst:Foo}}</noinclude>
12328 <onlyinclude>{{subst:Foo}}</onlyinclude>
12329
12330 But not inside includeonly
12331 <includeonly>{{subst:Foo}}</includeonly>
12332 !! html/php
12333 Shall not expand:
12334
12335 <nowiki>~~~~</nowiki>
12336
12337 <includeonly><nowiki>~~~~</nowiki></includeonly>
12338
12339 <noinclude><nowiki>~~~~</nowiki></noinclude>
12340
12341 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12342
12343 FOO shall be converted to FOO
12344
12345 As well as inside noinclude/onlyinclude
12346 <noinclude>FOO</noinclude>
12347 <onlyinclude>FOO</onlyinclude>
12348
12349 But not inside includeonly
12350 <includeonly>{{subst:Foo}}</includeonly>
12351 !! end
12352
12353 !! test
12354 Parsoid: Recognize nowiki with trailing space in tags
12355 !! options
12356 parsoid=wt2html
12357 !! wikitext
12358 <nowiki ><div>[[foo]]</nowiki >
12359
12360 a<nowiki / >b
12361
12362 c<nowiki />d
12363
12364 e<nowiki/ >f
12365 !! html
12366 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12367 <p>ab</p>
12368 <p>cd</p>
12369 <p>ef</p>
12370 !! end
12371
12372 !! test
12373 Parsoid: Recognize nowiki with odd capitalization
12374 !! options
12375 parsoid=wt2html
12376 !! wikitext
12377 <noWikI ><div>[[foo]]</Nowiki >
12378 !! html
12379 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12380 !! end
12381
12382
12383 !! test
12384 Parsoid: Escape nowiki with trailing space in tags
12385 !! options
12386 parsoid=html2wt
12387 !! html/parsoid
12388 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12389 <p>a&lt;nowiki /&gt;b</p>
12390 <p>c&lt;nowiki/ &gt;d</p>
12391 !! wikitext
12392 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12393
12394 a&lt;nowiki /&gt;b
12395
12396 c&lt;nowiki/ &gt;d
12397 !! end
12398
12399 !! test
12400 Parsoid: Escape weird noWikI capitalizations
12401 !! options
12402 parsoid=html2wt
12403 !! html/parsoid
12404 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12405 !! wikitext
12406 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12407 !! end
12408
12409 ###
12410 ### Message transform tests
12411 ###
12412 !! test
12413 message transform: magic variables
12414 !! options
12415 msg
12416 !! wikitext
12417 {{SITENAME}}
12418 !! html
12419 MediaWiki
12420 !! end
12421
12422 !! test
12423 message transform: should not transform wiki markup
12424 !! options
12425 msg
12426 !! wikitext
12427 ''test''
12428 !! html
12429 ''test''
12430 !! end
12431
12432 !! test
12433 message transform: <noinclude> in transcluded template (bug 4926)
12434 !! options
12435 msg
12436 !! wikitext
12437 {{Includes}}
12438 !! html
12439 Foobar
12440 !! end
12441
12442 !! test
12443 message transform: <onlyinclude> in transcluded template (bug 4926)
12444 !! options
12445 msg
12446 !! wikitext
12447 {{Includes2}}
12448 !! html
12449 Foo
12450 !! end
12451
12452 !! test
12453 {{#special:}} page name, known
12454 !! options
12455 msg
12456 !! wikitext
12457 {{#special:Recentchanges}}
12458 !! html
12459 Special:RecentChanges
12460 !! end
12461
12462 !! test
12463 {{#special:}} page name with subpage, known
12464 !! options
12465 msg
12466 !! wikitext
12467 {{#special:Recentchanges/param}}
12468 !! html
12469 Special:RecentChanges/param
12470 !! end
12471
12472 !! test
12473 {{#special:}} page name, unknown
12474 !! options
12475 msg
12476 !! wikitext
12477 {{#special:foobar nonexistent}}
12478 !! html
12479 Special:Foobar nonexistent
12480 !! end
12481
12482 !! test
12483 {{#speciale:}} page name, known
12484 !! options
12485 msg
12486 !! wikitext
12487 {{#speciale:Recentchanges}}
12488 !! html
12489 Special:RecentChanges
12490 !! end
12491
12492 !! test
12493 {{#speciale:}} page name with subpage, known
12494 !! options
12495 msg
12496 !! wikitext
12497 {{#speciale:Recentchanges/param}}
12498 !! html
12499 Special:RecentChanges/param
12500 !! end
12501
12502 !! test
12503 {{#speciale:}} page name, unknown
12504 !! options
12505 msg
12506 !! wikitext
12507 {{#speciale:foobar nonexistent}}
12508 !! html
12509 Special:Foobar_nonexistent
12510 !! end
12511
12512 ###
12513 ### Images
12514 ###
12515 ### For Parsoid-specific tests, see
12516 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12517
12518 !! test
12519 Simple image
12520 !! options
12521 parsoid=wt2html,wt2wt,html2html
12522 !! wikitext
12523 [[Image:foobar.jpg]]
12524 !! html/php
12525 <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>
12526 </p>
12527 !! html/parsoid
12528 <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>
12529 !! end
12530
12531 !! test
12532 Simple image (using File: namespace, now canonical)
12533 !! wikitext
12534 [[File:Foobar.jpg]]
12535 !! html/php
12536 <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>
12537 </p>
12538 !! html/parsoid
12539 <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>
12540 !! end
12541
12542 !! test
12543 Right-aligned image
12544 !! wikitext
12545 [[File:Foobar.jpg|right]]
12546 !! html/php
12547 <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>
12548
12549 !! html/parsoid
12550 <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>
12551 !! end
12552
12553 !! test
12554 Image with caption
12555 !! wikitext
12556 [[File:Foobar.jpg|right|Caption text]]
12557 !! html/php
12558 <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>
12559
12560 !! html/parsoid
12561 <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>
12562 !! end
12563
12564 !! test
12565 Image with caption, bug 53312 #1
12566 !! wikitext
12567 [[File:Foobar.jpg|right|Caption page stuff]]
12568 !! html/php
12569 <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>
12570
12571 !! html/parsoid
12572 <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>
12573 !! end
12574
12575 !! test
12576 Image with caption, bug 53312 #2
12577 !! wikitext
12578 [[File:Foobar.jpg|right|Caption page=]]
12579 !! html/php
12580 <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>
12581
12582 !! html/parsoid
12583 <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>
12584 !! end
12585
12586 !! test
12587 Image with caption, bug 53312 #3
12588 !! wikitext
12589 [[File:Foobar.jpg|right|Caption page=stuff]]
12590 !! html/php
12591 <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>
12592
12593 !! html/parsoid
12594 <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>
12595 !! end
12596
12597 !! test
12598 Allow empty links in image captions (Bug 60753)
12599 !! options
12600 thumbsize=220
12601 !! wikitext
12602 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12603 [[]]
12604 [[Link2]]
12605 ]]
12606 !! html/php
12607 <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>
12608
12609 !! html/parsoid
12610 <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>
12611 [[]]
12612 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12613 </figcaption></figure>
12614 !! end
12615
12616 !! test
12617 Titles in unlinked images (T23454)
12618 !! wikitext
12619 [[File:Foobar.jpg|link=|stuff]]
12620 !! html/php
12621 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12622 </p>
12623 !! end
12624
12625 !! test
12626 Link with empty target
12627 !! wikitext
12628 [[]]
12629 !! html
12630 <p>[[]]
12631 </p>
12632 !! end
12633
12634 !! test
12635 Image with link trail
12636 !! wikitext
12637 Linktrails should not work for images: [[File:Foobar.jpg]]s
12638 !! html/php
12639 <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
12640 </p>
12641 !! html/parsoid
12642 <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>
12643 !! end
12644
12645 !! test
12646 Image with empty attribute
12647 !! options
12648 parsoid=wt2html,wt2wt,html2html
12649 !! wikitext
12650 [[File:Foobar.jpg|right||Caption text]]
12651 !! html/php
12652 <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>
12653
12654 !! html/parsoid
12655 <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>
12656 !! end
12657
12658 !! test
12659 1. Block image with individual attributes from templates
12660 !! wikitext
12661 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12662 !! html/php
12663 <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>
12664
12665 !! html/parsoid
12666 <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>
12667 !! end
12668
12669 !! test
12670 2. Block Image with individual attributes from templates
12671 !! wikitext
12672 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12673 !! html/php
12674 <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>
12675
12676 !! html/parsoid
12677 <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>
12678 !! end
12679
12680 !! test
12681 3. Inline image with individual attributes from templates
12682 !! wikitext
12683 [[File:Foobar.jpg|{{echo|50px}}]]
12684 !! html/php
12685 <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>
12686 </p>
12687 !! html/parsoid
12688 <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>
12689 !! end
12690
12691 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12692 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12693 !! test
12694 Image with multiple attributes from the same template
12695 !! wikitext
12696 [[File:Foobar.jpg|{{image_attribs}}]]
12697 !! html/php
12698 <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>
12699
12700 !! html/parsoid
12701 <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>
12702 !! end
12703
12704 !! test
12705 Image with link tails
12706 !! options
12707 thumbsize=220
12708 !! wikitext
12709 123[[File:Foobar.jpg]]456
12710 123[[File:Foobar.jpg|right]]456
12711 123[[File:Foobar.jpg|thumb]]456
12712 !! html/php
12713 <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
12714 </p>
12715 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
12716 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
12717
12718 !! html/php+tidy
12719 <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>
12720 <p>123</p>
12721 <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>
12722 <p>456 123</p>
12723 <div class="thumb tright">
12724 <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>
12725 <div class="thumbcaption">
12726 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12727 </div>
12728 </div>
12729 </div>
12730 <p>456</p>
12731 !! html/parsoid
12732 <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>
12733 <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>
12734 <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>
12735 !! end
12736
12737 !! test
12738 Image with multiple captions -- only last one is accepted
12739 !! wikitext
12740 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12741 !! html/php
12742 <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>
12743
12744 !! html/parsoid
12745 <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>
12746 !! end
12747
12748 !! test
12749 Image with multiple widths -- use last
12750 !! wikitext
12751 [[File:Foobar.jpg|200px|300px|caption]]
12752 !! html/php
12753 <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>
12754 </p>
12755 !! html/parsoid
12756 <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>
12757 !! end
12758
12759 !! test
12760 Image with multiple alignments -- use first (bug 48664)
12761 !! options
12762 thumbsize=220
12763 !! wikitext
12764 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12765
12766 [[File:Foobar.jpg|middle|text-top|caption]]
12767 !! html/php
12768 <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>
12769 <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>
12770 </p>
12771 !! html/parsoid
12772 <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>
12773 <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>
12774 !! end
12775
12776 !! test
12777 Image with width attribute at different positions
12778 !! wikitext
12779 [[File:Foobar.jpg|200px|right|Caption]]
12780 [[File:Foobar.jpg|right|200px|Caption]]
12781 [[File:Foobar.jpg|right|Caption|200px]]
12782 !! html/php
12783 <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>
12784 <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>
12785 <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>
12786
12787 !! html/parsoid
12788 <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>
12789 <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>
12790 <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>
12791 !! end
12792
12793 # a sad bit of backward-compatibility
12794 !! test
12795 Image with size specified with pxpx (bug 13500, 51628)
12796 !! options
12797 parsoid=wt2html,wt2wt,html2html
12798 !! wikitext
12799 [[File:Foobar.jpg|20pxpx]]
12800 [[File:Foobar.jpg|200x20pxpx]]
12801 !! html/php
12802 <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>
12803 <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>
12804 </p>
12805 !! html/parsoid
12806 <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>
12807 !! end
12808
12809 !! test
12810 Image with link parameter, wiki target
12811 !! wikitext
12812 [[File:Foobar.jpg|link=Main Page]]
12813 !! html/php
12814 <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>
12815 </p>
12816 !! html/parsoid
12817 <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>
12818 !! end
12819
12820 # parsoid bug 49293 (part 1)
12821 !! test
12822 Image with link parameter, URL target
12823 !! wikitext
12824 [[File:Foobar.jpg|link=http://example.com/]]
12825 !! html/php
12826 <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>
12827 </p>
12828 !! html/parsoid
12829 <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>
12830 !! end
12831
12832 # parsoid bug 49293 (part 2)
12833 !! test
12834 Image with link parameter, protocol-less URL target
12835 !! wikitext
12836 [[File:Foobar.jpg|link=//example.com/]]
12837 !! html/php
12838 <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>
12839 </p>
12840 !! html/parsoid
12841 <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>
12842 !! end
12843
12844 !! test
12845 Escaping non-block captions (T107435)
12846 !! options
12847 parsoid={
12848 "modes": ["wt2wt"],
12849 "changes": [
12850 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12851 ]
12852 }
12853 !! wikitext
12854 [[Image:Foobar.jpg|caption]]
12855 !! wikitext/edited
12856 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12857 !! end
12858
12859 !! test
12860 Image with link parameter, wgExternalLinkTarget
12861 !! wikitext
12862 [[Image:foobar.jpg|link=http://example.com/]]
12863 !! config
12864 wgExternalLinkTarget='foobar'
12865 !! html
12866 <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>
12867 </p>
12868 !! end
12869
12870 !! test
12871 Image with link parameter, wgNoFollowLinks set to false
12872 !! wikitext
12873 [[Image:foobar.jpg|link=http://example.com/]]
12874 !! config
12875 wgNoFollowLinks=false
12876 !! html
12877 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12878 </p>
12879 !! end
12880
12881 !! test
12882 Image with link parameter, wgNoFollowDomainExceptions
12883 !! wikitext
12884 [[Image:foobar.jpg|link=http://example.com/]]
12885 !! config
12886 wgNoFollowDomainExceptions='example.com'
12887 !! html
12888 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12889 </p>
12890 !! end
12891
12892 !! test
12893 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12894 !! wikitext
12895 [[Image:foobar.jpg|link=http://example.com/|Title]]
12896 !! config
12897 wgExternalLinkTarget='foobar'
12898 !! html
12899 <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>
12900 </p>
12901 !! end
12902
12903 !! test
12904 Image with empty link parameter
12905 !! wikitext
12906 [[File:Foobar.jpg|link=]]
12907 !! html/php
12908 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12909 </p>
12910 !! html/parsoid
12911 <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>
12912 !! end
12913
12914 !! test
12915 Image with link parameter (wiki target) and unnamed parameter
12916 !! wikitext
12917 [[File:Foobar.jpg|link=Main_Page|Title]]
12918 !! html/php
12919 <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>
12920 </p>
12921 !! html/parsoid
12922 <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>
12923 !! end
12924
12925 !! test
12926 Image with link parameter (URL target) and unnamed parameter
12927 !! wikitext
12928 [[File:Foobar.jpg|link=http://example.com/|Title]]
12929 !! html/php
12930 <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>
12931 </p>
12932 !! html/parsoid
12933 <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>
12934 !! end
12935
12936 !! test
12937 Thumbnail image with link parameter
12938 !! options
12939 thumbsize=220
12940 parsoid=wt2html,wt2wt,html2html
12941 !! wikitext
12942 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12943 !! html/php
12944 <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>
12945
12946 !! html/parsoid
12947 <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>
12948 !! end
12949
12950 !! test
12951 Manually-specified thumbnail image
12952 !! options
12953 thumbsize=220
12954 !! wikitext
12955 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12956 !! html/php
12957 <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>
12958
12959 !! html/parsoid
12960 <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>
12961 !! end
12962
12963 !! test
12964 Manually-specified thumbnail image with explicit link to wiki page
12965 !! options
12966 thumbsize=220
12967 parsoid=wt2html,wt2wt,html2html
12968 !! wikitext
12969 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12970 !! html/php
12971 <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>
12972
12973 !! html/parsoid
12974 <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>
12975 !! end
12976
12977 !! test
12978 Manually-specified thumbnail image with explicit link to url
12979 !! options
12980 thumbsize=220
12981 parsoid=wt2html,wt2wt,html2html
12982 !! wikitext
12983 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12984 !! html/php
12985 <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>
12986
12987 !! html/parsoid
12988 <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>
12989 !! end
12990
12991 !! test
12992 Manually-specified thumbnail image with explicit no link
12993 !! options
12994 thumbsize=220
12995 parsoid=wt2html,wt2wt,html2html
12996 !! wikitext
12997 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12998 !! html/php
12999 <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>
13000
13001 !! html/parsoid
13002 <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>
13003 !! end
13004
13005 !! test
13006 Manually-specified thumbnail image with explicit link and alt text
13007 !! options
13008 thumbsize=220
13009 parsoid=wt2html,wt2wt,html2html
13010 !! wikitext
13011 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13012 !! html/php
13013 <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>
13014
13015 !! html/parsoid
13016 <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>
13017 !! end
13018
13019 !! test
13020 Image with frame and link
13021 !! options
13022 parsoid=wt2html,wt2wt,html2html
13023 !! wikitext
13024 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13025 !! html/php
13026 <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>
13027
13028 !! html/parsoid
13029 <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>
13030 !! end
13031
13032 !! test
13033 Image with frame and link and explicit alt
13034 !! options
13035 parsoid=wt2html,wt2wt,html2html
13036 !! wikitext
13037 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13038 !! html/php
13039 <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>
13040
13041 !! html/parsoid
13042 <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>
13043 !! end
13044
13045 !! test
13046 Image with wiki markup in implicit alt
13047 !! wikitext
13048 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13049
13050 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13051 !! html/php
13052 <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>
13053 </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>
13054 </p>
13055 !! html/parsoid
13056 <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>
13057 <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>
13058 !! end
13059
13060 !! test
13061 Alt image option should handle most kinds of wikitext without barfing
13062 !! wikitext
13063 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13064 !! html/php
13065 <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>
13066
13067 !! html/parsoid
13068 <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>
13069 !! end
13070
13071 ###################
13072 # Conflicting image format options.
13073 # First option specified should 'win'.
13074 # All three cases in each test should be identical.
13075
13076 !! test
13077 Image with 'frameless' first.
13078 !! options
13079 parsoid=wt2html,wt2wt,html2html
13080 !! wikitext
13081 [[File:Foobar.jpg|frameless|caption]]
13082
13083 [[File:Foobar.jpg|frameless|frame|caption]]
13084
13085 [[File:Foobar.jpg|frameless|thumb|caption]]
13086 !! html/php
13087 <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>
13088 </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>
13089 </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>
13090 </p>
13091 !! html/parsoid
13092 <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>
13093 <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>
13094 <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>
13095 !! end
13096
13097 !! test
13098 Image with 'frame' first.
13099 !! options
13100 parsoid=wt2html,wt2wt,html2html
13101 !! wikitext
13102 [[File:Foobar.jpg|frame|caption]]
13103 [[File:Foobar.jpg|frame|frameless|caption]]
13104 [[File:Foobar.jpg|frame|thumb|caption]]
13105 !! html/php
13106 <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>
13107 <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>
13108 <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>
13109
13110 !! html/parsoid
13111 <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>
13112 <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>
13113 <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>
13114 !! end
13115
13116 !! test
13117 Image with 'thumb' first.
13118 !! options
13119 parsoid=wt2html,wt2wt,html2html
13120 !! wikitext
13121 [[File:Foobar.jpg|thumb|caption]]
13122 [[File:Foobar.jpg|thumb|frameless|caption]]
13123 [[File:Foobar.jpg|thumb|frame|caption]]
13124 !! html/php
13125 <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>
13126 <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>
13127 <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>
13128
13129 !! html/parsoid
13130 <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>
13131 <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>
13132 <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>
13133 !! end
13134
13135 ###################
13136 # Image sizing.
13137 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13138 # and https://phabricator.wikimedia.org/T64258
13139 # Foobar has actual size of 1941x220
13140 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13141 # a scalable format.
13142 # 2. Framed images always ignore size options; always render at default size.
13143 # 3. "Unspecified format" and border are the only types which can be
13144 # enlarged.
13145
13146 !! test
13147 Image: "unspecified format" and border enlarge
13148 !! options
13149 parsoid=wt2html,wt2wt,html2html
13150 !! wikitext
13151 [[File:Foobar.jpg|2000px]]
13152
13153 [[File:Foobar.jpg|border|2000px]]
13154 !! html/php
13155 <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>
13156 </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>
13157 </p>
13158 !! html/parsoid
13159 <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>
13160 <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>
13161 !! end
13162
13163 !! test
13164 Image: "unspecified format" and border reduce
13165 !! options
13166 parsoid=wt2html,wt2wt,html2html
13167 !! wikitext
13168 [[File:Foobar.jpg|1000px]]
13169
13170 [[File:Foobar.jpg|border|1000px]]
13171 !! html/php
13172 <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>
13173 </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>
13174 </p>
13175 !! html/parsoid
13176 <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>
13177 <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>
13178 !! end
13179
13180 !! test
13181 Image: thumbs reduce
13182 !! options
13183 parsoid=wt2html,wt2wt,html2html
13184 !! wikitext
13185 [[File:Foobar.jpg|thumb|50px]]
13186 !! html/php
13187 <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>
13188
13189 !! html/parsoid
13190 <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>
13191 !! end
13192
13193 !! test
13194 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13195 !! options
13196 parsoid=wt2html,wt2wt,html2html
13197 !! wikitext
13198 [[File:Foobar.jpg|thumb|2000px]]
13199
13200 [[File:Foobar.svg|thumb|2000px]]
13201 !! html/php
13202 <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>
13203 <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>
13204
13205 !! html/parsoid
13206 <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>
13207 <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>
13208 !! end
13209
13210 !! test
13211 Image: frameless can reduce in size
13212 !! options
13213 parsoid=wt2html,wt2wt,html2html
13214 !! wikitext
13215 [[File:Foobar.jpg|frameless|50px]]
13216 !! html/php
13217 <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>
13218 </p>
13219 !! html/parsoid
13220 <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>
13221 !! end
13222
13223 !! test
13224 Image: bitmap frameless can't be enlarged past original size, but vector can
13225 !! options
13226 parsoid=wt2html,wt2wt,html2html
13227 !! wikitext
13228 [[File:Foobar.jpg|frameless|2000px]]
13229
13230 [[File:Foobar.svg|frameless|2000px]]
13231 !! html/php
13232 <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>
13233 </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>
13234 </p>
13235 !! html/parsoid
13236 <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>
13237 <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>
13238 !! end
13239
13240 !! test
13241 Image: framed images are always unscaled.
13242 !! options
13243 parsoid=wt2html,wt2wt,html2html
13244 !! wikitext
13245 [[File:Foobar.jpg|frame]]
13246
13247 [[File:Foobar.jpg|frame|50px]]
13248
13249 [[File:Foobar.jpg|frame|50x50px]]
13250
13251 [[File:Foobar.jpg|frame|2000px]]
13252 !! html/php
13253 <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>
13254 <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>
13255 <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>
13256 <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>
13257
13258 !! html/parsoid
13259 <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>
13260 <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>
13261 <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>
13262 <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>
13263 !! end
13264
13265 ###################
13266
13267 !! test
13268 Link to image page- image page normally doesn't exists, hence edit link
13269 Add test with existing image page
13270 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13271 !! wikitext
13272 [[:Image:test]]
13273 !! html
13274 <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>
13275 </p>
13276 !! end
13277
13278 !! test
13279 bug 18784 Link to non-existent image page with caption should use caption as link text
13280 !! wikitext
13281 [[:Image:test|caption]]
13282 !! html
13283 <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>
13284 </p>
13285 !! end
13286
13287 !! test
13288 Frameless image caption with a free URL
13289 !! wikitext
13290 [[File:Foobar.jpg|http://example.com]]
13291 !! html/php
13292 <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>
13293 </p>
13294 !! html/parsoid
13295 <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>
13296 !! end
13297
13298 !! test
13299 Thumbnail image caption with a free URL
13300 !! options
13301 thumbsize=220
13302 !! wikitext
13303 [[File:Foobar.jpg|thumb|http://example.com]]
13304 !! html/php
13305 <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>
13306
13307 !! html/parsoid
13308 <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>
13309 !! end
13310
13311 !! test
13312 Thumbnail image caption with a free URL and explicit alt
13313 !! options
13314 thumbsize=220
13315 parsoid=wt2html,wt2wt,html2html
13316 !! wikitext
13317 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13318 !! html/php
13319 <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>
13320
13321 !! html/parsoid
13322 <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>
13323 !! end
13324
13325 !! test
13326 SVG thumbnails with no language set
13327 !! options
13328 !! wikitext
13329 [[File:Foobar.svg|thumb|caption]]
13330 !! html/php
13331 <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>
13332
13333 !! html/parsoid
13334 <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>
13335 !! end
13336
13337 !! test
13338 SVG thumbnails with language de
13339 !! options
13340 parsoid=wt2html,wt2wt,html2html
13341 !! wikitext
13342 [[File:Foobar.svg|thumb|caption|lang=de]]
13343 !! html/php
13344 <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>
13345
13346 !! html/parsoid
13347 <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>
13348 !! end
13349
13350 !! test
13351 SVG thumbnails with invalid language code
13352 !! options
13353 parsoid=wt2html,wt2wt,html2html
13354 !! wikitext
13355 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13356 !! html/php
13357 <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>
13358
13359 !! html/parsoid
13360 <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>
13361 !! end
13362
13363 !! test
13364 BUG 1887: A ISBN with a thumbnail
13365 !! wikitext
13366 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13367 !! html/php
13368 <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>
13369
13370 !! html/parsoid
13371 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13372 !! end
13373
13374 !! test
13375 BUG 1887: A RFC with a thumbnail
13376 !! wikitext
13377 [[File:Foobar.jpg|thumb|This is RFC 12354]]
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 class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></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 href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13383 !! end
13384
13385 !! test
13386 BUG 1887: A mailto link with a thumbnail
13387 !! wikitext
13388 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13389 !! html/php
13390 <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>
13391
13392 !! html/parsoid
13393 <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>
13394 !! end
13395
13396 # Pending resolution to bug 368
13397 !! test
13398 BUG 648: Frameless image caption with a link
13399 !! wikitext
13400 [[File:Foobar.jpg|text with a [[link]] in it]]
13401 !! html/php
13402 <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>
13403 </p>
13404 !! html/parsoid
13405 <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>
13406 !! end
13407
13408 !! test
13409 BUG 648: Frameless image caption with a link (suffix)
13410 !! wikitext
13411 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13412 !! html/php
13413 <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>
13414 </p>
13415 !! html/parsoid
13416 <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>
13417 !! end
13418
13419 !! test
13420 BUG 648: Frameless image caption with an interwiki link
13421 !! wikitext
13422 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13423 !! html/php
13424 <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>
13425 </p>
13426 !! html/parsoid
13427 <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>
13428 !! end
13429
13430 !! test
13431 BUG 648: Frameless image caption with a piped interwiki link
13432 !! wikitext
13433 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13434 !! html/php
13435 <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>
13436 </p>
13437 !! html/parsoid
13438 <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>
13439 !! end
13440
13441 !! test
13442 T107474: Frameless image caption with <nowiki>
13443 !! wikitext
13444 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13445 !! html/parsoid
13446 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13447 !! end
13448
13449 !! test
13450 Escape HTML special chars in image alt text
13451 !! wikitext
13452 [[File:Foobar.jpg|& < > "]]
13453 !! html/php
13454 <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>
13455 </p>
13456 !! html/parsoid
13457 <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>
13458 !! end
13459
13460 !! test
13461 BUG 499: Alt text should have &#1234;, not &amp;1234;
13462 !! wikitext
13463 [[File:Foobar.jpg|&#9792;]]
13464 !! html/php
13465 <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>
13466 </p>
13467 !! html/parsoid
13468 <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>
13469 !! end
13470
13471 !! test
13472 Broken image caption with link
13473 !! options
13474 parsoid=wt2html,wt2wt,html2html
13475 !! wikitext
13476 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13477 !! html/php
13478 <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.
13479 </p>
13480 !! html/parsoid
13481 <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>
13482 !! end
13483
13484 !! test
13485 Image caption containing another image
13486 !! wikitext
13487 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13488 !! html/php
13489 <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>
13490
13491 !! html/parsoid
13492 <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>
13493 !! end
13494
13495 !! test
13496 Image: caption containing a newline
13497 !! wikitext
13498 [[File:Foobar.jpg|This
13499 *is some text]]
13500 !! html/php
13501 <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>
13502 </p>
13503 !! html/parsoid
13504 <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>
13505 !!end
13506
13507 !!test
13508 Image: caption containing leading space
13509 (The leading space should not trigger nowiki escaping in wt2wt mode)
13510 !! wikitext
13511 [[File:Foobar.jpg|thumb| bar]]
13512 !! html/php
13513 <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>
13514
13515 !! html/parsoid
13516 <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>
13517 !!end
13518
13519 !! test
13520 Image: caption containing a table
13521 !! options
13522 parsoid=wt2html,wt2wt,html2html
13523 !! wikitext
13524 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13525 {|
13526 ! Foo !! Bar
13527 |-
13528 | Foo1 || Bar1
13529 |}
13530 and some more text.]]
13531 !! html/php
13532 <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>
13533
13534 !! html/parsoid
13535 <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
13536 <table>
13537 <tbody>
13538 <tr><th>Foo </th><th>Bar</th></tr>
13539 <tr>
13540 <td>Foo1 </td>
13541 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13542 !! end
13543
13544 !! test
13545 Bug 3090: External links other than http: in image captions
13546 !! wikitext
13547 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13548 !! html/php
13549 <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>
13550
13551 !! html/parsoid
13552 <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>
13553 !! end
13554
13555 !! test
13556 Custom class
13557 !! options
13558 parsoid=wt2html,wt2wt,html2html
13559 !! wikitext
13560 [[Image:foobar.jpg|a|class=b]]
13561 !! html/php
13562 <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>
13563 </p>
13564 !! html/parsoid
13565 <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>
13566 !! end
13567
13568 !! test
13569 Localized image handling (1).
13570 !! options
13571 parsoid=wt2html,wt2wt,html2html
13572 language=es
13573 !! wikitext
13574 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13575 !! html/php
13576 <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>
13577
13578 !! html/parsoid
13579 <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>
13580 !! end
13581
13582 !! test
13583 Localized image handling (2).
13584 !! options
13585 thumbsize=220
13586 parsoid=wt2html,wt2wt,html2html
13587 language=es
13588 !! wikitext
13589 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13590 !! html/php
13591 <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>
13592
13593 !! html/parsoid
13594 <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>
13595 !! end
13596
13597 !! test
13598 "border", "frameless" and "class" attributes on an image.
13599 !! options
13600 thumbsize=220
13601 parsoid=wt2html,wt2wt,html2html
13602 !! wikitext
13603 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13604 !! html/php
13605 <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>
13606 </p>
13607 !! html/parsoid
13608 <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>
13609 !! end
13610
13611 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13612 !! test
13613 Invalid image attributes (bug 62500)
13614 !! options
13615 thumbsize=220
13616 parsoid=wt2html,wt2wt,html2html
13617 !! wikitext
13618 [[File:Foobar.jpg|thumb|float|left|caption]]
13619
13620 [[File:Foobar.jpg|thumb|righ|caption]]
13621
13622 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13623 !! html/php
13624 <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>
13625 <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>
13626 <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>
13627
13628 !! html/parsoid
13629 <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>
13630 <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>
13631 <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>
13632 !! end
13633
13634 !! article
13635 File:Barfoo.jpg
13636 !! text
13637 #REDIRECT [[File:Barfoo.jpg]]
13638 !! endarticle
13639
13640 # FIXME: Parsoid should run this test -- but we'd need to teach the
13641 # mockAPI about the redirected Barfoo.jpg image.
13642 !! test
13643 Redirected image
13644 !! wikitext
13645 [[Image:Barfoo.jpg]]
13646 !! html/php
13647 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13648 </p>
13649 !! end
13650
13651 !! test
13652 Missing image with uploads disabled
13653 !! options
13654 wgEnableUploads=0
13655 !! wikitext
13656 [[File:Foobaz.jpg]]
13657 !! html/php
13658 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13659 </p>
13660 !! html/parsoid
13661 <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>
13662 !! end
13663
13664 # Parsoid-specific testing for images
13665 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13666 # Currently imperfect due to a flaw in the Parsoid testrunner
13667 # Work in progress
13668 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13669 # image tests.
13670
13671 !! test
13672 Parsoid-specific image handling - simple image with size and middle alignment
13673 !! wikitext
13674 [[File:Foobar.jpg|middle|50px]]
13675 !! html/parsoid
13676 <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>
13677 !! end
13678
13679 !! test
13680 Parsoid-specific image handling - simple image with size, middle alignment,
13681 non-standard namespace alias
13682 !! options
13683 parsoid=wt2wt,wt2html,html2html
13684 !! wikitext
13685 [[Image:Foobar.jpg|middle|50px]]
13686 !! html/parsoid
13687 <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>
13688 !! end
13689
13690 !! test
13691 Parsoid-specific image handling - simple image with size and middle alignment
13692 (existing content)
13693 !! wikitext
13694 [[File:Foobar.jpg|50px|middle]]
13695 !! html/parsoid
13696 <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>
13697 !! end
13698
13699 !! test
13700 Parsoid-specific image handling - simple image with size and middle alignment
13701 and non-standard namespace name
13702 !! options
13703 parsoid=wt2html,wt2wt,html2html
13704 !! wikitext
13705 [[Image:Foobar.jpg|50px|middle]]
13706 !! html/parsoid
13707 <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>
13708 !! end
13709
13710 !! test
13711 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13712 !! wikitext
13713 [[File:Foobar.jpg|500x10px|baseline|caption]]
13714 !! html/parsoid
13715 <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>
13716 !! end
13717
13718 !! test
13719 Parsoid-specific image handling - simple image with border and size spec
13720 !! wikitext
13721 [[File:Foobar.jpg|50px|border|caption]]
13722 !! html/parsoid
13723 <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>
13724 !! end
13725
13726 !! test
13727 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13728 !! wikitext
13729 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13730 !! html/parsoid
13731 <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>
13732 !! end
13733
13734 !! test
13735 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13736 (existing content)
13737 !! wikitext
13738 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13739 !! html/parsoid
13740 <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>
13741 !! end
13742
13743 !! test
13744 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13745 !! wikitext
13746 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13747 !! html/parsoid
13748 <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>
13749 !! end
13750
13751 !! test
13752 Parsoid-specific image handling - thumbnail with specific size, halign,
13753 valign, and caption (existing content)
13754 !! wikitext
13755 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13756 !! html/parsoid
13757 <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>
13758 !! end
13759
13760 !! test
13761 Parsoid-specific image handling - framed image with specific size and caption
13762 (size is ignored)
13763 !! options
13764 parsoid=wt2html,wt2wt,html2html
13765 !! wikitext
13766 [[File:Foobar.jpg|frame|500x50px|caption]]
13767 !! html/parsoid
13768 <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>
13769 !! end
13770
13771 !! test
13772 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13773 (size is ignored)
13774 !! options
13775 parsoid=wt2html,wt2wt,html2html
13776 !! wikitext
13777 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13778 !! html/parsoid
13779 <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>
13780 !! end
13781
13782 !! test
13783 Parsoid-specific image handling - frameless image with specific size, border, and caption
13784 !! wikitext
13785 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13786 !! html/parsoid
13787 <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>
13788 !! end
13789
13790 !! test
13791 Parsoid-specific image handling - simple image with a formatted caption
13792 !! wikitext
13793 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13794 !! html/parsoid
13795 <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>
13796 !! end
13797
13798 !! test
13799 Parsoid-specific image handling - caption with a template in it
13800 !! wikitext
13801 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13802 !! html/parsoid
13803 <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>
13804 !! end
13805
13806 !! test
13807 Parsoid-specific image handling - caption with unbalanced tags in it
13808 !! options
13809 parsoid=wt2html,wt2wt,html2html
13810 !! wikitext
13811 foo
13812 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13813 bar
13814 !! html/parsoid
13815 <p>foo</p>
13816 <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>
13817 <p>bar</p>
13818 !! end
13819
13820 !! test
13821 Parsoid-specific image handling - empty caption (1)
13822 !! options
13823 parsoid=wt2html,wt2wt
13824 !! wikitext
13825 [[File:Foobar.jpg|thumb|]]
13826 !! html/parsoid
13827 <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>
13828 !! end
13829
13830 # empty captions don't get serialized unless we're in the "round trip" case
13831 !! test
13832 Parsoid-specific image handling - empty caption (2)
13833 !! options
13834 parsoid=html2wt
13835 !! html/parsoid
13836 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13837 <a href="./File:Foobar.jpg">
13838 <img resource="./File:Foobar.jpg"
13839 src="//example.com/images/3/3a/Foobar.jpg"
13840 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13841 height="25" width="220"/>
13842 </a>
13843 <figcaption></figcaption>
13844 </figure>
13845 !! wikitext
13846 [[File:Foobar.jpg|thumb]]
13847 !! end
13848
13849 !! test
13850 Parsoid-specific image handling - whitespace caption
13851 !! wikitext
13852 [[File:Foobar.jpg|thumb| ]]
13853 !! html/parsoid
13854 <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>
13855 !! end
13856
13857 !! test
13858 Parsoid-specific image handling - lang option
13859 !! wikitext
13860 foo
13861 [[File:Foobar.svg|lang=de|caption]]
13862 bar
13863 !! html/parsoid
13864 <p>foo
13865 <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>
13866 bar</p>
13867 !! end
13868
13869 ## Edge case bugs in Parsoid from T93580
13870 !! test
13871 T93580: 1. Templated <ref> inside block images
13872 !! wikitext
13873 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13874
13875 <references />
13876 !! html/parsoid
13877 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
13878
13879 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
13880 !! end
13881
13882 !! test
13883 T93580: 2. <ref> inside inline images
13884 !! wikitext
13885 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
13886
13887 <references />
13888 !! html/parsoid
13889 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13890
13891 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
13892 !! end
13893
13894 !! test
13895 T93580: 3. Templated <ref> inside inline images
13896 !! wikitext
13897 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
13898
13899 <references />
13900 !! html/parsoid
13901 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13902
13903 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
13904 !! end
13905
13906 ###
13907 ### Subpages
13908 ###
13909 !! article
13910 Subpage test/subpage
13911 !! text
13912 foo
13913 !! endarticle
13914
13915 !! test
13916 Subpage link
13917 !! options
13918 subpage title=[[Subpage test]]
13919 !! wikitext
13920 [[/subpage]]
13921 !! html
13922 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13923 </p>
13924 !! end
13925
13926 !! test
13927 Subpage noslash link
13928 !! options
13929 subpage title=[[Subpage test]]
13930 !! wikitext
13931 [[/subpage/]]
13932 !! html
13933 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13934 </p>
13935 !! end
13936
13937 !! article
13938 Subpage test/1/2/subpage
13939 !! text
13940 blah
13941 !! endarticle
13942
13943 !! test
13944 Relative subpage noslash link
13945 !! options
13946 parsoid=wt2wt,wt2html,html2html
13947 subpage title=[[Subpage test/1/2/3/4]]
13948 !! wikitext
13949 [[../../subpage/]]
13950
13951 [[../../subpage]]
13952 !! html/php
13953 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13954 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13955 </p>
13956 !! html/parsoid
13957 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13958 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13959 !! end
13960
13961 !! test
13962 Parsoid: dot-slash prefixed wikilinks
13963 !! wikitext
13964 [[./foo]]
13965
13966 [[././bar]]
13967
13968 [[././baz/]]
13969 !! html/php
13970 <p>[[./foo]]
13971 </p><p>[[././bar]]
13972 </p><p>[[././baz/]]
13973 </p>
13974 !! html/parsoid
13975 <p>[[./foo]]
13976 </p><p>[[././bar]]
13977 </p><p>[[././baz/]]
13978 </p>
13979 !! end
13980
13981 !! test
13982 Render invalid page names as plain text (bug 51090)
13983 !! wikitext
13984 [[./../foo|bar]]
13985 [[foo�|bar]]
13986 [[foo/.|bar]]
13987 [[foo/..|bar]]
13988 [[foo~~~bar]]
13989 [[foo>bar]]
13990 [[foo[bar]]
13991 [[.]]
13992 [[..]]
13993 [[foo././bar]]
13994
13995 [[{{echo|./../foo}}|bar]]
13996 [[{{echo|foo/.}}|bar]]
13997 [[{{echo|foo/..}}|bar]]
13998 [[{{echo|foo~~~~bar}}]]
13999 [[{{echo|foo>bar}}]]
14000 [[{{echo|foo././bar}}]]
14001 [[{{echo|foo{bar}}]]
14002 [[{{echo|foo}bar}}]]
14003 [[{{echo|foo[bar}}]]
14004 [[{{echo|foo]bar}}]]
14005 [[{{echo|foo<bar}}]]
14006 !!html/php
14007 <p>[[./../foo|bar]]
14008 [[foo�|bar]]
14009 [[foo/.|bar]]
14010 [[foo/..|bar]]
14011 [[foo~~~bar]]
14012 [[foo&gt;bar]]
14013 [[foo[bar]]
14014 [[.]]
14015 [[..]]
14016 [[foo././bar]]
14017 </p><p>[[./../foo|bar]]
14018 [[foo/.|bar]]
14019 [[foo/..|bar]]
14020 [[foo~~~~bar]]
14021 [[foo&gt;bar]]
14022 [[foo././bar]]
14023 [[foo{bar]]
14024 [[foo}bar]]
14025 [[foo[bar]]
14026 [[foo]bar]]
14027 [[foo&lt;bar]]
14028 </p>
14029 !!html/parsoid
14030 <p>[[./../foo|bar]]
14031 [[foo�|bar]]
14032 [[foo/.|bar]]
14033 [[foo/..|bar]]
14034 [[foo~~~bar]]
14035 [[foo>bar]]
14036 [[foo[bar]]
14037 [[.]]
14038 [[..]]
14039 [[foo././bar]]</p>
14040
14041 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14042 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14043 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14044 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14045 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14046 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14047 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14048 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14049 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14050 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14051 [[<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>
14052 !!end
14053
14054 !! test
14055 Disabled subpages
14056 !! wikitext
14057 [[/subpage]]
14058 !! html
14059 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14060 </p>
14061 !! end
14062
14063 !! test
14064 BUG 561: {{/Subpage}}
14065 !! options
14066 subpage title=[[Page]]
14067 !! wikitext
14068 {{/Subpage}}
14069 !! html
14070 <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>
14071 </p>
14072 !! end
14073
14074 ###
14075 ### Categories
14076 ###
14077 !! article
14078 Category:MediaWiki User's Guide
14079 !! text
14080 blah
14081 !! endarticle
14082
14083 !! test
14084 Link to category
14085 !! wikitext
14086 [[:Category:MediaWiki User's Guide]]
14087 !! html
14088 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14089 </p>
14090 !! end
14091
14092 !! test
14093 Simple category
14094 !! options
14095 cat
14096 !! wikitext
14097 [[Category:MediaWiki User's Guide]]
14098 !! html
14099 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14100 !! end
14101
14102 !! test
14103 PAGESINCATEGORY invalid title fatal (r33546 fix)
14104 !! wikitext
14105 {{PAGESINCATEGORY:<bogus>}}
14106 !! html
14107 <p>0
14108 </p>
14109 !! end
14110
14111 !! test
14112 Category with different sort key
14113 !! options
14114 cat
14115 !! wikitext
14116 [[Category:MediaWiki User's Guide|Foo]]
14117 !! html
14118 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14119 !! end
14120
14121 !! test
14122 Category with identical sort key
14123 !! options
14124 cat
14125 !! wikitext
14126 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14127 !! html
14128 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14129 !! end
14130
14131 !! test
14132 Category with empty sort key
14133 !! options
14134 cat
14135 pst
14136 !! wikitext
14137 [[Category:MediaWiki User's Guide|]]
14138 !! html
14139 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14140 !! end
14141
14142 !! test
14143 Category with empty sort key and parentheses
14144 !! options
14145 cat
14146 pst
14147 !! wikitext
14148 [[Category:Foo (bar)|]]
14149 !! html
14150 [[Category:Foo (bar)|Foo]]
14151 !! end
14152
14153 !! test
14154 Category with link tail
14155 !! options
14156 cat
14157 pst
14158 !! wikitext
14159 123[[Category:Foo]]456
14160 !! html
14161 123[[Category:Foo]]456
14162 !! end
14163
14164 !! test
14165 Category with template
14166 !! options
14167 cat
14168 pst
14169 !! wikitext
14170 [[Category:{{echo|Foo}}]]
14171 !! html
14172 [[Category:{{echo|Foo}}]]
14173 !! end
14174
14175 !! test
14176 Category with template in sort key
14177 !! options
14178 cat
14179 pst
14180 !! wikitext
14181 [[Category:Foo|{{echo|Bar}}]]
14182 !! html
14183 [[Category:Foo|{{echo|Bar}}]]
14184 !! end
14185
14186 !! test
14187 Category with template in sort key and title
14188 !! options
14189 cat
14190 pst
14191 !! wikitext
14192 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14193 !! html
14194 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14195 !! end
14196
14197 !! test
14198 Category / paragraph interactions
14199 !! wikitext
14200 Foo [[Category:Baz]] Bar
14201
14202 Foo [[Category:Baz]]
14203 Bar
14204
14205 Foo
14206 [[Category:Baz]]
14207 Bar
14208
14209 Foo
14210 [[Category:Baz]] Bar
14211
14212 Foo
14213 [[Category:Baz]]
14214 [[Category:Baz]]
14215 [[Category:Baz]]
14216 Bar
14217
14218 [[Category:Baz]]
14219 [[Category:Baz]]
14220 [[Category:Baz]]
14221
14222 [[Category:Baz]]
14223 {{echo|[[Category:Baz]]}}
14224 [[Category:Baz]]
14225 !! html
14226 <p>Foo Bar
14227 </p><p>Foo
14228 Bar
14229 </p><p>Foo
14230 Bar
14231 </p><p>Foo Bar
14232 </p><p>Foo
14233 Bar
14234 </p>
14235 !! end
14236
14237 ## The whitespace on the empty line is part of the test. Please do not delete
14238 !! test
14239 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14240 !! options
14241 parsoid=wt2html,wt2wt
14242 !! wikitext
14243 This
14244
14245 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14246
14247 {{echo|[[Category:Foo]] and so should this!}}
14248 !! html
14249 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14250 </p>
14251 !! html/parsoid
14252 <p>This
14253
14254 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14255
14256 <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>
14257 !! end
14258
14259 ## Parsoid will not try to wt2wt this while preserving newlines because
14260 ## it suppresses excess newlines within list items -- and we don't want to
14261 ## introduce a special case just for categories, which is, in reality somewhat
14262 ## odd behavior -- categories are unlikely to be used in list items like this
14263 ## in top-level pages and are only likely to show up in template-generated
14264 ## list items where this RT-ing is a non-issue.
14265 ##
14266 ## The whitespace on the empty line is part of the test. Please do not delete
14267 !! test
14268 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14269 !! options
14270 parsoid=wt2html
14271 !! wikitext
14272 * This
14273
14274 [[Category:Foo]] and this should be part of the same list item
14275 * So should this
14276
14277 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14278 !! html
14279 <ul><li>This and this should be part of the same list item</li>
14280 <li>So should this and this should be part of the same list item</li></ul>
14281 !! html/parsoid
14282 <ul>
14283 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14284 <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>
14285 </ul>
14286 !! end
14287
14288 ## Newlines and categories that follow the last item of a list
14289 ## are treated differently because this (list followed by categories)
14290 ## is an extremely common pattern on wikis.
14291 !! test
14292 3. Categories and newlines: newline suppression for last list item should RT properly
14293 !! wikitext
14294 * a
14295 * b
14296
14297 [[Category:Foo]]
14298
14299 [[Category:Bar]]
14300 [[Category:Baz]]
14301 !! html/parsoid
14302 <ul><li> a</li>
14303 <li> b</li></ul>
14304
14305 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14306
14307 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14308 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14309 !! end
14310
14311 !! test
14312 4. Categories and newlines: newline suppression for last list item should RT properly
14313 !! wikitext
14314 * a
14315 **** b
14316
14317 [[Category:Foo]]
14318 !! html/parsoid
14319 <ul><li> a
14320 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14321
14322 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14323 !! end
14324
14325 ## only wt2html for this to make sure the algo only applies to the rightmost path
14326 !! test
14327 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14328 !! options
14329 parsoid=wt2html
14330 !! wikitext
14331 * a
14332 ** b
14333 [[Category:Foo]]
14334 * c
14335 ** d
14336 [[Category:Foo]]
14337 !! html/parsoid
14338 <ul><li> a
14339 <ul><li> b
14340 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14341 <li> c
14342 <ul><li> d</li></ul></li></ul>
14343 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14344 !! end
14345
14346 !! test
14347 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14348 !! wikitext
14349 * a [[Category:Foo]]
14350 !! html/parsoid
14351 <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>
14352 !! end
14353
14354 # This test also demonstrates because of newline+category tunneling
14355 # through the list hander, template wrapping doesn't expand to the
14356 # containing list when the list item swallows the category.
14357 !! test
14358 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14359 !! wikitext
14360 * {{echo|a
14361 [[Category:Foo]]}}
14362 !! html/parsoid
14363 <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">
14364 </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>
14365 !! end
14366
14367 !! test
14368 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14369 !! wikitext
14370 * a
14371
14372 {{echo|[[Category:Foo]]
14373 [[Category:Bar]]}}
14374 [[Category:Baz]]
14375 !! html/parsoid
14376 <ul><li> a</li></ul>
14377
14378 <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">
14379 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14380 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14381 !! end
14382
14383 !! test
14384 Parsoid: Serialize link to category page with colon escape
14385 !! options
14386 parsoid
14387 !! wikitext
14388
14389 [[:Category:Foo]]
14390 [[:Category:Foo|Bar]]
14391 !! html
14392 <p>
14393 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14394 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14395 </p>
14396 !! end
14397
14398 # html2wt localizes the "Category" namespace.
14399 # XXX the <link> element needs an empty data-parsoid attribute, or
14400 # else the html2html test fails because spaces are inserted.
14401 !! test
14402 Link prefix/suffixes aren't applied to category links
14403 !! options
14404 parsoid=wt2html,wt2wt,html2html
14405 language=is
14406 !! wikitext
14407 x[[Category:Foo]]y
14408 !! html/php
14409 <p>xy
14410 </p>
14411 !! html/parsoid
14412 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14413 !! end
14414
14415 !! test
14416 Parsoid: Serialize link to file page with colon escape
14417 !! options
14418 parsoid
14419 !! wikitext
14420
14421 [[:File:Foo.png]]
14422 [[:File:Foo.png|Bar]]
14423 !! html
14424 <p>
14425 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14426 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14427 </p>
14428 !! end
14429
14430 !! test
14431 Parsoid: Serialize a genuine category link without colon escape
14432 !! options
14433 parsoid
14434 !! wikitext
14435 [[Category:Foo]]
14436 [[Category:Foo|Bar]]
14437 !! html
14438 <link rel="mw:PageProp/Category" href="./Category:Foo">
14439 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14440 !! end
14441
14442 !! test
14443 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14444 !! options
14445 parsoid=html2wt
14446 !! html/parsoid
14447 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14448 !! wikitext
14449 [[Category:Toxine bactérienne]]
14450 !! end
14451
14452 !! test
14453 Parsoid: Defaultsort
14454 !! wikitext
14455 {{DEFAULTSORT:Foo}}
14456 !! html/parsoid
14457 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14458 !! end
14459
14460 !! test
14461 Parsoid: Defaultsort (template-generated)
14462 !! wikitext
14463 {{{{echo|DEFAULTSORT}}:Foo}}
14464 !! html/parsoid
14465 <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}}]}'/>
14466 !! end
14467
14468 ###
14469 ### Inter-language links
14470 ###
14471 !! test
14472 Interlanguage links
14473 !! options
14474 ill
14475 !! wikitext
14476 [[es:Alimento]]
14477 [[fr:Nourriture]]
14478 [[zh:食品]]
14479 !! html/php
14480 es:Alimento fr:Nourriture zh:食品
14481 !! html/parsoid
14482 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14483 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14484 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14485 !! end
14486
14487 !! test
14488 Duplicate interlanguage links (bug 24502)
14489 !! options
14490 ill
14491 !! wikitext
14492 [[es:1]]
14493 [[es:2]]
14494 [[fr:1]]
14495 [[fr:2]]
14496 !! html/php
14497 es:1 fr:1
14498 !! html/parsoid
14499 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14500 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14501 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14502 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14503 !! end
14504
14505 ###
14506 ### Sections
14507 ###
14508 !! test
14509 Basic section headings
14510 !! wikitext
14511 == Headline 1 ==
14512 Some text
14513
14514 ==Headline 2==
14515 More
14516 ===Smaller headline===
14517 Blah blah
14518 !! html
14519 <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>
14520 <p>Some text
14521 </p>
14522 <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>
14523 <p>More
14524 </p>
14525 <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>
14526 <p>Blah blah
14527 </p>
14528 !! end
14529
14530 !! test
14531 Section headings with TOC
14532 !! wikitext
14533 == Headline 1 ==
14534 === Subheadline 1 ===
14535 ===== Skipping a level =====
14536 ====== Skipping a level ======
14537
14538 == Headline 2 ==
14539 Some text
14540 ===Another headline===
14541 !! html
14542 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14543 <ul>
14544 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14545 <ul>
14546 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14547 <ul>
14548 <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>
14549 <ul>
14550 <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>
14551 </ul>
14552 </li>
14553 </ul>
14554 </li>
14555 </ul>
14556 </li>
14557 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14558 <ul>
14559 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14560 </ul>
14561 </li>
14562 </ul>
14563 </div>
14564
14565 <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>
14566 <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>
14567 <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>
14568 <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>
14569 <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>
14570 <p>Some text
14571 </p>
14572 <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>
14573
14574 !! end
14575
14576 !! test
14577 TOC anchors don't collide
14578 !! wikitext
14579 __FORCETOC__
14580 == Headline 2 ==
14581 == Headline ==
14582 == Headline 2 ==
14583 == Headline ==
14584 !! html/php
14585 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14586 <ul>
14587 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14588 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14589 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14590 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14591 </ul>
14592 </div>
14593
14594 <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>
14595 <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>
14596 <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>
14597 <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>
14598
14599 !! end
14600
14601 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14602 !! test
14603 Handling of sections up to level 6 and beyond
14604 !! wikitext
14605 = Level 1 Heading=
14606 == Level 2 Heading==
14607 === Level 3 Heading===
14608 ==== Level 4 Heading====
14609 ===== Level 5 Heading=====
14610 ====== Level 6 Heading======
14611 ======= Level 7 Heading=======
14612 ======== Level 8 Heading========
14613 ========= Level 9 Heading=========
14614 ========== Level 10 Heading==========
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="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14619 <ul>
14620 <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>
14621 <ul>
14622 <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>
14623 <ul>
14624 <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>
14625 <ul>
14626 <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>
14627 <ul>
14628 <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>
14629 <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>
14630 <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>
14631 <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>
14632 <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>
14633 </ul>
14634 </li>
14635 </ul>
14636 </li>
14637 </ul>
14638 </li>
14639 </ul>
14640 </li>
14641 </ul>
14642 </li>
14643 </ul>
14644 </div>
14645
14646 <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>
14647 <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>
14648 <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>
14649 <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>
14650 <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>
14651 <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>
14652 <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>
14653 <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>
14654 <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>
14655 <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>
14656
14657 !! end
14658
14659 !! test
14660 TOC regression (T11764)
14661 !! wikitext
14662 == title 1 ==
14663 === title 1.1 ===
14664 ==== title 1.1.1 ====
14665 === title 1.2 ===
14666 == title 2 ==
14667 === title 2.1 ===
14668 !! html
14669 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14670 <ul>
14671 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14672 <ul>
14673 <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>
14674 <ul>
14675 <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>
14676 </ul>
14677 </li>
14678 <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>
14679 </ul>
14680 </li>
14681 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14682 <ul>
14683 <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>
14684 </ul>
14685 </li>
14686 </ul>
14687 </div>
14688
14689 <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>
14690 <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>
14691 <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>
14692 <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>
14693 <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>
14694 <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>
14695
14696 !! end
14697
14698 !! test
14699 TOC for heading containing <span id="..."></span> (T96153)
14700 !! wikitext
14701 __FORCETOC__
14702 ==<span id="old-anchor"></span>New title==
14703 !! html/php
14704 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14705 <ul>
14706 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14707 </ul>
14708 </div>
14709
14710 <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>
14711
14712 !! end
14713
14714 !! test
14715 TOC with wgMaxTocLevel=3 (bug 6204)
14716 !! options
14717 wgMaxTocLevel=3
14718 !! wikitext
14719 == title 1 ==
14720 === title 1.1 ===
14721 ==== title 1.1.1 ====
14722 === title 1.2 ===
14723 == title 2 ==
14724 === title 2.1 ===
14725 !! html
14726 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14727 <ul>
14728 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14729 <ul>
14730 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
14731 <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>
14732 </ul>
14733 </li>
14734 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14735 <ul>
14736 <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>
14737 </ul>
14738 </li>
14739 </ul>
14740 </div>
14741
14742 <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>
14743 <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>
14744 <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>
14745 <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>
14746 <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>
14747 <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>
14748
14749 !! end
14750
14751 !! test
14752 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14753 !! options
14754 wgMaxTocLevel=3
14755 !! wikitext
14756 ==Section 1==
14757 ===Section 1.1===
14758 ====Section 1.1.1====
14759 ====Section 1.1.1.1====
14760 ==Section 2==
14761 !! html
14762 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14763 <ul>
14764 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14765 <ul>
14766 <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>
14767 </ul>
14768 </li>
14769 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14770 </ul>
14771 </div>
14772
14773 <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>
14774 <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>
14775 <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>
14776 <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>
14777 <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>
14778
14779 !! end
14780
14781
14782 !! test
14783 Resolving duplicate section names
14784 !! wikitext
14785 == Foo bar ==
14786 == Foo bar ==
14787 !! html
14788 <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>
14789 <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>
14790
14791 !! end
14792
14793 !! test
14794 Resolving duplicate section names with differing case (bug 10721)
14795 !! wikitext
14796 == Foo bar ==
14797 == Foo Bar ==
14798 !! html
14799 <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>
14800 <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>
14801
14802 !! end
14803
14804 !! article
14805 Template:sections
14806 !! text
14807 ===Section 1===
14808 ==Section 2==
14809 !! endarticle
14810
14811 !! test
14812 Template with sections, __NOTOC__
14813 !! wikitext
14814 __NOTOC__
14815 ==Section 0==
14816 {{sections}}
14817 ==Section 4==
14818 !! html
14819 <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>
14820 <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>
14821 <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>
14822 <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>
14823
14824 !! end
14825
14826 !! test
14827 __NOEDITSECTION__ keyword
14828 !! wikitext
14829 __NOEDITSECTION__
14830 ==Section 1==
14831 ==Section 2==
14832 !! html
14833 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14834 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14835
14836 !! end
14837
14838 !! test
14839 Link inside a section heading
14840 !! wikitext
14841 ==Section with a [[Main Page|link]] in it==
14842 !! html
14843 <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>
14844
14845 !! end
14846
14847 !! test
14848 TOC regression (T14077)
14849 !! wikitext
14850 __TOC__
14851 == title 1 ==
14852 === title 1.1 ===
14853 == title 2 ==
14854 !! html
14855 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14856 <ul>
14857 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14858 <ul>
14859 <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>
14860 </ul>
14861 </li>
14862 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14863 </ul>
14864 </div>
14865
14866 <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>
14867 <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>
14868 <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>
14869
14870 !! end
14871
14872 !! test
14873 BUG 1219 URL next to image (good)
14874 !! wikitext
14875 http://example.com [[File:Foobar.jpg]]
14876 !! html/php
14877 <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>
14878 </p>
14879 !! html/parsoid
14880 <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>
14881 !!end
14882
14883 !! test
14884 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14885 !! wikitext
14886 ===
14887 The line above must have a trailing space!
14888 === <!--
14889 --> <!-- -->
14890 But just in case it doesn't...
14891 !! html
14892 <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>
14893 <p>The line above must have a trailing space!
14894 </p>
14895 <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>
14896 <p>But just in case it doesn't...
14897 </p>
14898 !! end
14899
14900 !! test
14901 Header with special characters (bug 25462)
14902 !! wikitext
14903 The tooltips shall not show entities to the user (ie. be double escaped)
14904
14905 == text > text ==
14906 section 1
14907
14908 == text < text ==
14909 section 2
14910
14911 == text & text ==
14912 section 3
14913
14914 == text ' text ==
14915 section 4
14916
14917 == text " text ==
14918 section 5
14919 !! html
14920 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14921 </p>
14922 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14923 <ul>
14924 <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>
14925 <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>
14926 <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>
14927 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14928 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14929 </ul>
14930 </div>
14931
14932 <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>
14933 <p>section 1
14934 </p>
14935 <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>
14936 <p>section 2
14937 </p>
14938 <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>
14939 <p>section 3
14940 </p>
14941 <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>
14942 <p>section 4
14943 </p>
14944 <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>
14945 <p>section 5
14946 </p>
14947 !! end
14948
14949 !! test
14950 Header with space, plus and underscore as entity
14951 !! wikitext
14952 Id should not contain + for spaces
14953
14954 == Space between Text ==
14955 section 1
14956
14957 == Space-Entity&#32;between&#32;Text ==
14958 section 2
14959
14960 == Plus+between+Text ==
14961 section 3
14962
14963 == Plus-Entity&#43;between&#43;Text ==
14964 section 4
14965
14966 == Underscore_between_Text ==
14967 section 5
14968
14969 == Underscore-Entity&#95;between&#95;Text ==
14970 section 6
14971
14972 [[#Space between Text]]
14973 [[#Space-Entity&#32;between&#32;Text]]
14974 [[#Plus+between+Text]]
14975 [[#Plus-Entity&#43;between&#43;Text]]
14976 [[#Underscore_between_Text]]
14977 [[#Underscore-Entity&#95;between&#95;Text]]
14978 !! html
14979 <p>Id should not contain + for spaces
14980 </p>
14981 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14982 <ul>
14983 <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>
14984 <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>
14985 <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>
14986 <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>
14987 <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>
14988 <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>
14989 </ul>
14990 </div>
14991
14992 <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>
14993 <p>section 1
14994 </p>
14995 <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>
14996 <p>section 2
14997 </p>
14998 <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>
14999 <p>section 3
15000 </p>
15001 <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>
15002 <p>section 4
15003 </p>
15004 <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>
15005 <p>section 5
15006 </p>
15007 <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>
15008 <p>section 6
15009 </p><p><a href="#Space_between_Text">#Space between Text</a>
15010 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15011 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15012 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15013 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15014 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15015 </p>
15016 !! end
15017
15018 !! test
15019 Headers with excess '=' characters
15020 (Are similar tests necessary beyond the 1st level?)
15021 !! wikitext
15022 =foo==
15023 ==foo=
15024 =''italic'' heading==
15025 ==''italic'' heading=
15026 !! html
15027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15028 <ul>
15029 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15030 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15031 <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>
15032 <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>
15033 </ul>
15034 </div>
15035
15036 <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>
15037 <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>
15038 <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>
15039 <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>
15040
15041 !! end
15042
15043 !! test
15044 HTML headers vs TOC (bug 23393)
15045 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15046 !! wikitext
15047 <h1>Header 1</h1>
15048 == Header 1.1 ==
15049 == Header 1.2 ==
15050
15051 <h1>Header 2
15052 </h1>
15053 == Header 2.1 ==
15054 == Header 2.2 ==
15055 __NOEDITSECTION__
15056 !! html
15057 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15058 <ul>
15059 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15060 <ul>
15061 <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>
15062 <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>
15063 </ul>
15064 </li>
15065 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15066 <ul>
15067 <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>
15068 <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>
15069 </ul>
15070 </li>
15071 </ul>
15072 </div>
15073
15074 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15075 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15076 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15077 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15078 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15079 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15080
15081 !! end
15082
15083 !! test
15084 Single-line or multiline-comments can follow headings
15085 !! options
15086 parsoid=wt2html,wt2wt
15087 !! wikitext
15088 ==foo==<!---->
15089 ==bar==<!--c1-->
15090 ==baz==<!--
15091 c2
15092 c3-->
15093 !! html
15094 <h2><span class="mw-headline" id="foo">foo</span></h2>
15095 <h2><span class="mw-headline" id="bar">bar</span></h2>
15096 <h2><span class="mw-headline" id="baz">baz</span></h2>
15097
15098 !! end
15099
15100 !! test
15101 BUG 1219 URL next to image (broken)
15102 !! wikitext
15103 http://example.com[[File:Foobar.jpg]]
15104 !! html/php
15105 <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>
15106 </p>
15107 !! html/parsoid
15108 <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>
15109 !!end
15110
15111 !! test
15112 Bug 1186 news: in the middle of text
15113 !! wikitext
15114 http://en.wikinews.org/wiki/Wikinews:Workplace
15115 !! html
15116 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15117 </p>
15118 !!end
15119
15120
15121 !! test
15122 Namespaced link must have a title
15123 !! wikitext
15124 [[Project:]]
15125 !! html
15126 <p>[[Project:]]
15127 </p>
15128 !!end
15129
15130 !! test
15131 Namespaced link must have a title (bad fragment version)
15132 !! wikitext
15133 [[Project:#fragment]]
15134 !! html
15135 <p>[[Project:#fragment]]
15136 </p>
15137 !!end
15138
15139
15140 ###
15141 ### HTML tags and HTML attributes
15142 ###
15143
15144 !! test
15145 div with no attributes
15146 !! wikitext
15147 <div>HTML rocks</div>
15148 !! html
15149 <div>HTML rocks</div>
15150
15151 !! end
15152
15153 !! test
15154 div with double-quoted attribute
15155 !! wikitext
15156 <div id="rock">HTML rocks</div>
15157 !! html
15158 <div id="rock">HTML rocks</div>
15159
15160 !! end
15161
15162 !! test
15163 div with single-quoted attribute
15164 !! wikitext
15165 <div id='rock'>HTML rocks</div>
15166 !! html
15167 <div id="rock">HTML rocks</div>
15168
15169 !! end
15170
15171 !! test
15172 div with unquoted attribute
15173 !! wikitext
15174 <div id=rock>HTML rocks</div>
15175 !! html
15176 <div id="rock">HTML rocks</div>
15177
15178 !! end
15179
15180 !! test
15181 div with illegal double attributes
15182 !! wikitext
15183 <div id="a" id="b">HTML rocks</div>
15184 !! html
15185 <div id="b">HTML rocks</div>
15186
15187 !!end
15188
15189 # FIXME: produce empty string instead of "class" in the PHP parser, following
15190 # the HTML5 spec.
15191 !! test
15192 div with empty attribute value, space before equals
15193 !! options
15194 parsoid
15195 !! wikitext
15196 <div class =>HTML rocks</div>
15197 !! html
15198 <div class="">HTML rocks</div>
15199
15200 !! end
15201
15202 !! test
15203 div with multiple empty attribute values
15204 !! options
15205 parsoid
15206 !! wikitext
15207 <div id= title=>HTML rocks</div>
15208 !! html
15209 <div id="" title="">HTML rocks</div>
15210
15211 !! end
15212
15213 !! test
15214 table with multiple empty attribute values
15215 !! options
15216 parsoid
15217 !! wikitext
15218 {| title= id=
15219 | hi
15220 |}
15221 !! html
15222 <table title="" id="">
15223 <tbody><tr><td> hi</td></tr>
15224 </tbody></table>
15225 !! end
15226
15227 !! test
15228 div with braces in attribute value
15229 !! wikitext
15230 <div title="{}">Foo</div>
15231 !! html/php
15232 <div title="&#123;}">Foo</div>
15233
15234 !! html/parsoid
15235 <div title="{}">Foo</div>
15236 !! end
15237
15238 # This it very inconsistent in the PHP parser: it returns
15239 # class="class" if there is a space between the name and the equal sign (see
15240 # 'div with empty attribute value, space before equals'), but strips the
15241 # attribute completely if the space is missing. We hope that not much content
15242 # depends on this, so are implementing the behavior below in Parsoid for
15243 # consistencies' sake.
15244 # FIXME: fix this behavior in the PHP parser?
15245 !! test
15246 div with empty attribute value, no space before equals
15247 !! options
15248 parsoid=wt2html,html2html
15249 !! wikitext
15250 <div class=>HTML rocks</div>
15251 !! html/php
15252 <div>HTML rocks</div>
15253
15254 !! html/parsoid
15255 <div class="">HTML rocks</div>
15256 !! end
15257
15258 !! test
15259 HTML multiple attributes correction
15260 !! wikitext
15261 <p class="error" class="awesome">Awesome!</p>
15262 !! html
15263 <p class="awesome">Awesome!</p>
15264
15265 !!end
15266
15267 !! test
15268 Table multiple attributes correction
15269 !! wikitext
15270 {|
15271 !+ class="error" class="awesome"| status
15272 |}
15273 !! html
15274 <table>
15275 <tr>
15276 <th class="awesome"> status
15277 </th></tr></table>
15278
15279 !!end
15280
15281 !! test
15282 DIV IN UPPERCASE
15283 !! wikitext
15284 <DIV ID="x">HTML ROCKS</DIV>
15285 !! html
15286 <div id="x">HTML ROCKS</div>
15287
15288 !!end
15289
15290 !! test
15291 Non-ASCII pseudo-tags are rendered as text
15292 !! wikitext
15293 <khyô>
15294 !! html
15295 <p>&lt;khyô&gt;
15296 </p>
15297 !! end
15298
15299 !! test
15300 Pseudo-tag with URL 'name' renders as url link
15301 !! wikitext
15302 <http://example.com/>
15303 !! html
15304 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15305 </p>
15306 !! end
15307
15308 !! test
15309 text with amp in the middle of nowhere
15310 !! wikitext
15311 Remember AT&T?
15312 !! html
15313 <p>Remember AT&amp;T?
15314 </p>
15315 !! end
15316
15317 !! test
15318 text with character entity: eacute
15319 !! wikitext
15320 I always thought &eacute; was a cute letter.
15321 !! html
15322 <p>I always thought &#233; was a cute letter.
15323 </p>
15324 !! html+tidy
15325 <p>I always thought é was a cute letter.</p>
15326 !! end
15327
15328 !! test
15329 text with entity-escaped character entity-like string: eacute
15330 !! wikitext
15331 I always thought &amp;eacute; was a cute letter.
15332 !! html
15333 <p>I always thought &amp;eacute; was a cute letter.
15334 </p>
15335 !! end
15336
15337 !! test
15338 text with undefined character entity: xacute
15339 !! wikitext
15340 I always thought &xacute; was a cute letter.
15341 !! html
15342 <p>I always thought &amp;xacute; was a cute letter.
15343 </p>
15344 !! end
15345
15346 !! test
15347 HTML5 tags
15348 !! wikitext
15349 <data value="5">five</data>
15350 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15351 <mark>This highlighted text</mark>
15352 !! html
15353 <p><data value="5">five</data>
15354 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15355 <mark>This highlighted text</mark>
15356 </p>
15357 !! end
15358
15359 !! test
15360 HTML tag with leading space is parsed as text
15361 !! wikitext
15362 < div>foo< /div>
15363 !! html
15364 <p>&lt; div&gt;foo&lt; /div&gt;
15365 </p>
15366 !! end
15367
15368 ###
15369 ### Nesting tests (see bug 41545, 50604, 51081)
15370 ###
15371
15372 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15373 # Note that html2wt is considerably more difficult if we use <b> in
15374 # the test case, instead of <big>
15375 !! test
15376 Ensure that HTML adoption agency algorithm is properly implemented.
15377 !! wikitext
15378 <big>X<big>Y</big>Z</big>
15379 !! html
15380 <p><big>X<big>Y</big>Z</big>
15381 </p>
15382 !! end
15383
15384 # This was bug 41545 in the PHP parser.
15385 # Note that tidy doesn't handle this correctly.
15386 !! test
15387 Nesting of <kbd>
15388 !! wikitext
15389 <kbd>X<kbd>Y</kbd>Z</kbd>
15390 !! html
15391 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15392 </p>
15393 !! end
15394
15395 # The following cases were bug 51081 in the PHP parser.
15396 # Note that there are some other nestable tags (b, i, etc) which are
15397 # not covered; see bug 51081 for discussion.
15398
15399 # Note that tidy doesn't handle this correctly.
15400 !! test
15401 Nesting of <em>
15402 !! wikitext
15403 <em>X<em>Y</em>Z</em>
15404 !! html
15405 <p><em>X<em>Y</em>Z</em>
15406 </p>
15407 !! end
15408
15409 # Note that tidy doesn't handle this correctly.
15410 !! test
15411 Nesting of <strong>
15412 !! wikitext
15413 <strong>X<strong>Y</strong>Z</strong>
15414 !! html
15415 <p><strong>X<strong>Y</strong>Z</strong>
15416 </p>
15417 !! end
15418
15419 !! test
15420 Nesting of <q>
15421 !! wikitext
15422 <q>X<q>Y</q>Z</q>
15423 !! html+tidy
15424 <p><q>X<q>Y</q>Z</q></p>
15425 !! end
15426
15427 # Note that tidy doesn't handle this correctly.
15428 !! test
15429 Nesting of <ruby>
15430 !! wikitext
15431 <ruby>X<ruby>Y</ruby>Z</ruby>
15432 !! html
15433 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15434 </p>
15435 !! end
15436
15437 # Note that tidy doesn't handle this correctly.
15438 !! test
15439 Nesting of <bdo>
15440 !! wikitext
15441 <bdo>X<bdo>Y</bdo>Z</bdo>
15442 !! html
15443 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15444 </p>
15445 !! end
15446
15447
15448 ###
15449 ### Media links
15450 ###
15451
15452 !! test
15453 Media link
15454 !! wikitext
15455 [[Media:Foobar.jpg]]
15456 !! html
15457 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15458 </p>
15459 !! end
15460
15461 !! test
15462 Media link with text
15463 !! wikitext
15464 [[Media:Foobar.jpg|A neat file to look at]]
15465 !! html
15466 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15467 </p>
15468 !! end
15469
15470 # FIXME: this is still bad HTML tag nesting
15471 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15472 !! test
15473 Media link with nasty text
15474 !! wikitext
15475 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15476 !! html
15477 <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>
15478
15479 !! html+tidy
15480 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15481 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15482 !! end
15483
15484 !! test
15485 Media link to nonexistent file (bug 1702)
15486 !! wikitext
15487 [[Media:No such.jpg]]
15488 !! html
15489 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15490 </p>
15491 !! end
15492
15493 !! test
15494 Image link to nonexistent file (bug 1850 - good)
15495 !! wikitext
15496 [[File:No_such.jpg]]
15497 !! html/php
15498 <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>
15499 </p>
15500 !! html/parsoid
15501 <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>
15502 !! end
15503
15504 !! test
15505 :Image link to nonexistent file (bug 1850 - bad)
15506 !! wikitext
15507 [[:Image:No such.jpg]]
15508 !! html/php
15509 <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>
15510 </p>
15511 !! html/parsoid
15512 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15513 !! end
15514
15515
15516
15517 !! test
15518 Character reference normalization in link text (bug 1938)
15519 !! wikitext
15520 [[Main Page|this&that]]
15521 !! html
15522 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15523 </p>
15524 !!end
15525
15526 !! article
15527 אַ
15528 !! text
15529 Test for unicode normalization
15530
15531 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15532 !! endarticle
15533
15534 !! test
15535 (bug 19451) Links should refer to the normalized form.
15536 !! wikitext
15537 [[&#xFB2E;]]
15538 [[&#x5d0;&#x5b7;]]
15539 [[&#x5d0;ַ]]
15540 [[א&#x5b7;]]
15541 [[אַ]]
15542 !! html
15543 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15544 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15545 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15546 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15547 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15548 </p>
15549 !! end
15550
15551 !! test
15552 Empty attribute crash test (bug 2067)
15553 !! wikitext
15554 <font color="">foo</font>
15555 !! html
15556 <p><font color="">foo</font>
15557 </p>
15558 !! end
15559
15560 !! test
15561 Empty attribute crash test single-quotes (bug 2067)
15562 !! wikitext
15563 <font color=''>foo</font>
15564 !! html
15565 <p><font color="">foo</font>
15566 </p>
15567 !! end
15568
15569 !! test
15570 Attribute test: equals, then nothing
15571 !! wikitext
15572 <font color=>foo</font>
15573 !! html
15574 <p><font>foo</font>
15575 </p>
15576 !! end
15577
15578 !! test
15579 Attribute test: unquoted value
15580 !! wikitext
15581 <font color=x>foo</font>
15582 !! html
15583 <p><font color="x">foo</font>
15584 </p>
15585 !! end
15586
15587 !! test
15588 Attribute test: unquoted but illegal value (hash)
15589 !! wikitext
15590 <font color=#x>foo</font>
15591 !! html
15592 <p><font color="#x">foo</font>
15593 </p>
15594 !! end
15595
15596 # Parsoid does not serialize to empty attribute syntax,
15597 # so wt2wt and html2wt cases are skipped
15598 !! test
15599 Attribute test: no value (T54330)
15600 !! options
15601 parsoid=wt2html,html2html
15602 !! wikitext
15603 <font color>foo</font>
15604 !! html/php
15605 <p><font color="">foo</font>
15606 </p>
15607 !! html/parsoid
15608 <p><font color="">foo</font></p>
15609 !! end
15610
15611 !! test
15612 Bug 2095: link with three closing brackets
15613 !! wikitext
15614 [[Main Page]]]
15615 !! html/php
15616 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15617 </p>
15618 !! html/parsoid
15619 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15620 !! end
15621
15622 !! test
15623 Bug 2095: link with pipe and three closing brackets
15624 !! wikitext
15625 [[Main Page|link]]]
15626 !! html/php
15627 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15628 </p>
15629 !! html/parsoid
15630 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15631 !! end
15632
15633 !! test
15634 Bug 2095: link with pipe and three closing brackets, version 2
15635 !! wikitext
15636 [[Main Page|[http://example.com/]]]
15637 !! html/php
15638 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15639 </p>
15640 !! html/parsoid
15641 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15642 !! end
15643
15644
15645 ###
15646 ### Safety
15647 ###
15648
15649 !! article
15650 Template:Dangerous attribute
15651 !! text
15652 " onmouseover="alert(document.cookie)
15653 !! endarticle
15654
15655 !! article
15656 Template:Dangerous style attribute
15657 !! text
15658 border-size: expression(alert(document.cookie))
15659 !! endarticle
15660
15661 !! article
15662 Template:Div style
15663 !! text
15664 <div style="float: right; {{{1}}}">Magic div</div>
15665 !! endarticle
15666
15667 !! test
15668 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15669 !! wikitext
15670 <div title="{{test}}"></div>
15671 !! html
15672 <div title="This is a test template"></div>
15673
15674 !! end
15675
15676 # Parsoid has enough context to handle this case
15677 !! test
15678 Bug 2304: HTML attribute safety (dangerous template; 2309)
15679 !! wikitext
15680 <div title="{{dangerous attribute}}"></div>
15681 !! html/php
15682 <div title=""></div>
15683
15684 !! html/parsoid
15685 <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>
15686 !! end
15687
15688 !! test
15689 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15690 !! wikitext
15691 <div style="{{dangerous style attribute}}"></div>
15692 !! html
15693 <div style="/* insecure input */"></div>
15694
15695 !! end
15696
15697 !! test
15698 Bug 2304: HTML attribute safety (safe parameter; 2309)
15699 !! wikitext
15700 {{div style|width: 200px}}
15701 !! html
15702 <div style="float: right; width: 200px">Magic div</div>
15703
15704 !! end
15705
15706 !! test
15707 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15708 !! wikitext
15709 {{div style|width: expression(alert(document.cookie))}}
15710 !! html
15711 <div style="/* insecure input */">Magic div</div>
15712
15713 !! end
15714
15715 !! test
15716 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15717 !! wikitext
15718 {{div style|"><script>alert(document.cookie)</script>}}
15719 !! html
15720 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15721
15722 !! end
15723
15724 !! test
15725 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15726 !! wikitext
15727 {{div style|" ><script>alert(document.cookie)</script>}}
15728 !! html
15729 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15730
15731 !! end
15732
15733 !! test
15734 Bug 2304: HTML attribute safety (link)
15735 !! wikitext
15736 <div title="[[Main Page]]"></div>
15737 !! html
15738 <div title="&#91;&#91;Main Page]]"></div>
15739
15740 !! end
15741
15742 !! test
15743 Bug 2304: HTML attribute safety (italics)
15744 !! wikitext
15745 <div title="''foobar''"></div>
15746 !! html
15747 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15748
15749 !! end
15750
15751 !! test
15752 Bug 2304: HTML attribute safety (bold)
15753 !! wikitext
15754 <div title="'''foobar'''"></div>
15755 !! html
15756 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15757
15758 !! end
15759
15760
15761 !! test
15762 Bug 2304: HTML attribute safety (ISBN)
15763 !! wikitext
15764 <div title="ISBN 1234567890"></div>
15765 !! html
15766 <div title="&#73;SBN 1234567890"></div>
15767
15768 !! end
15769
15770 !! test
15771 Bug 2304: HTML attribute safety (RFC)
15772 !! wikitext
15773 <div title="RFC 1234"></div>
15774 !! html
15775 <div title="&#82;FC 1234"></div>
15776
15777 !! end
15778
15779 !! test
15780 Bug 2304: HTML attribute safety (PMID)
15781 !! wikitext
15782 <div title="PMID 1234567890"></div>
15783 !! html
15784 <div title="&#80;MID 1234567890"></div>
15785
15786 !! end
15787
15788 !! test
15789 Bug 2304: HTML attribute safety (web link)
15790 !! wikitext
15791 <div title="http://example.com/"></div>
15792 !! html
15793 <div title="http&#58;//example.com/"></div>
15794
15795 !! end
15796
15797 !! test
15798 Bug 2304: HTML attribute safety (named web link)
15799 !! wikitext
15800 <div title="[http://example.com/ link]"></div>
15801 !! html
15802 <div title="&#91;http&#58;//example.com/ link]"></div>
15803
15804 !! end
15805
15806 !! test
15807 Bug 3244: HTML attribute safety (extension; safe)
15808 !! wikitext
15809 <div style="<nowiki>background:blue</nowiki>"></div>
15810 !! html
15811 <div style="background:blue"></div>
15812
15813 !! end
15814
15815 !! test
15816 Bug 3244: HTML attribute safety (extension; unsafe)
15817 !! wikitext
15818 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15819 !! html
15820 <div style="/* insecure input */"></div>
15821
15822 !! end
15823
15824 # More MSIE fun discovered by Tom Gilder
15825
15826 !! test
15827 MSIE CSS safety test: spurious slash
15828 !! wikitext
15829 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15830 !! html
15831 <div style="/* insecure input */">evil</div>
15832
15833 !! end
15834
15835 !! test
15836 MSIE CSS safety test: hex code
15837 !! wikitext
15838 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15839 !! html
15840 <div style="/* insecure input */">evil</div>
15841
15842 !! end
15843
15844 !! test
15845 MSIE CSS safety test: comment in url
15846 !! wikitext
15847 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15848 !! html
15849 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15850
15851 !! end
15852
15853 !! test
15854 MSIE CSS safety test: comment in expression
15855 !! wikitext
15856 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15857 !! html
15858 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15859
15860 !! end
15861
15862 !! test
15863 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15864 !! wikitext
15865 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15866 !! html
15867 <p style="/* invalid control char */">A</p>
15868
15869 !! end
15870
15871 !! test
15872 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15873 !! wikitext
15874 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15875 <div style="top:EXPRESSION(alert())">B</div>
15876 !! html
15877 <p style="/* insecure input */">A</p>
15878 <div style="/* insecure input */">B</div>
15879
15880 !! end
15881
15882 !! test
15883 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15884 !! wikitext
15885 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15886 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15887 !! html
15888 <div style="/* insecure input */">A</div>
15889 <p style="/* insecure input */">B</p>
15890
15891 !! end
15892
15893 !! test
15894 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15895 !! wikitext
15896 <div style="background-image:url⁽javascript:alert())">A</div>
15897 <div style="background-image:url₍javascript:alert())">B</div>
15898 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15899 !! html
15900 <div style="/* insecure input */">A</div>
15901 <div style="/* insecure input */">B</div>
15902 <p style="/* insecure input */">C</p>
15903
15904 !! end
15905
15906 # FIXME: Parsoid fails to sanitize this! See T58846.
15907 !! test
15908 Opera -o-link CSS
15909 !! wikitext
15910 <div
15911 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;"
15912 style="-o-link:attr(title);-o-link-source:current">X</div>
15913 !! html
15914 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15915
15916 !! end
15917
15918 !! test
15919 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15920 !! wikitext
15921 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15922 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15923 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15924 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15925 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15926 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15927 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15928 !! html
15929 <p style="/* insecure input */">A</p>
15930 <p style="/* insecure input */">B</p>
15931 <p style="/* insecure input */">C</p>
15932 <p style="/* insecure input */">D</p>
15933 <p style="/* insecure input */">E</p>
15934 <p style="/* insecure input */">F</p>
15935 <p style="/* insecure input */">G</p>
15936
15937 !! end
15938
15939 !! test
15940 Table attribute legitimate extension
15941 !! wikitext
15942 {|
15943 !+ style="<nowiki>color:blue</nowiki>"| status
15944 |}
15945 !! html
15946 <table>
15947 <tr>
15948 <th style="color:blue"> status
15949 </th></tr></table>
15950
15951 !!end
15952
15953 !! test
15954 Table attribute safety
15955 !! wikitext
15956 {|
15957 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15958 |}
15959 !! html
15960 <table>
15961 <tr>
15962 <th style="/* insecure input */"> status
15963 </th></tr></table>
15964
15965 !! end
15966
15967 !! test
15968 CSS line continuation 1
15969 !! wikitext
15970 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15971 !! html
15972 <div style="/* insecure input */"></div>
15973
15974 !! end
15975
15976 !! test
15977 CSS line continuation 2
15978 !! wikitext
15979 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15980 !! html
15981 <div style="/* invalid control char */"></div>
15982
15983 !! end
15984
15985 !! article
15986 Template:Identity
15987 !! text
15988 {{{1}}}
15989 !! endarticle
15990
15991 !! test
15992 Expansion of multi-line templates in attribute values (bug 6255)
15993 !! wikitext
15994 <div style="background: {{identity|#00FF00}}">-</div>
15995 !! html
15996 <div style="background: #00FF00">-</div>
15997
15998 !! end
15999
16000
16001 !! test
16002 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16003 !! wikitext
16004 <div style="background:
16005 #00FF00">-</div>
16006 !! html/php
16007 <div style="background: #00FF00">-</div>
16008
16009 !! html/parsoid
16010 <div style="background:
16011 #00FF00">-</div>
16012 !! end
16013
16014 !! test
16015 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16016 !! wikitext
16017 <div style="background: &#10;#00FF00">-</div>
16018 !! html
16019 <div style="background: &#10;#00FF00">-</div>
16020
16021 !! end
16022
16023 !! test
16024 evil <math>-wiki-tags without Extension:Math enabled
16025 !! wikitext
16026 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16027 !! html+tidy
16028 <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>
16029 !! end
16030
16031 ###
16032 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16033 ###
16034 !! test
16035 Parser hook: empty input
16036 !! wikitext
16037 <tag></tag>
16038 !! html/php
16039 <pre>
16040 ''
16041 array (
16042 )
16043 </pre>
16044
16045 !! end
16046
16047 !! test
16048 Parser hook: empty input using terminated empty elements
16049 !! wikitext
16050 <tag/>
16051 !! html/php
16052 <pre>
16053 NULL
16054 array (
16055 )
16056 </pre>
16057
16058 !! end
16059
16060 !! test
16061 Parser hook: empty input using terminated empty elements (space before)
16062 !! wikitext
16063 <tag />
16064 !! html/php
16065 <pre>
16066 NULL
16067 array (
16068 )
16069 </pre>
16070
16071 !! end
16072
16073 !! test
16074 Parser hook: basic input
16075 !! wikitext
16076 <tag>input</tag>
16077 !! html/php
16078 <pre>
16079 'input'
16080 array (
16081 )
16082 </pre>
16083
16084 !! end
16085
16086
16087 !! test
16088 Parser hook: case insensitive
16089 !! wikitext
16090 <TAG>input</TAG>
16091 !! html/php
16092 <pre>
16093 'input'
16094 array (
16095 )
16096 </pre>
16097
16098 !! end
16099
16100
16101 !! test
16102 Parser hook: case insensitive, redux
16103 !! wikitext
16104 <TaG>input</TAg>
16105 !! html/php
16106 <pre>
16107 'input'
16108 array (
16109 )
16110 </pre>
16111
16112 !! end
16113
16114 !! test
16115 Parser hook: nested tags
16116 !! options
16117 noxml
16118 !! wikitext
16119 <tag><tag></tag></tag>
16120 !! html/php
16121 <pre>
16122 '<tag>'
16123 array (
16124 )
16125 </pre>&lt;/tag&gt;
16126
16127 !! end
16128
16129 !! test
16130 Parser hook: basic arguments
16131 !! wikitext
16132 <tag width=200 height = "100" depth = '50' square></tag>
16133 !! html/php
16134 <pre>
16135 ''
16136 array (
16137 'width' => '200',
16138 'height' => '100',
16139 'depth' => '50',
16140 'square' => '',
16141 )
16142 </pre>
16143
16144 !! end
16145
16146 !! test
16147 Parser hook: argument containing a forward slash (bug 5344)
16148 !! wikitext
16149 <tag filename='/tmp/bla'></tag>
16150 !! html/php
16151 <pre>
16152 ''
16153 array (
16154 'filename' => '/tmp/bla',
16155 )
16156 </pre>
16157
16158 !! end
16159
16160 !! test
16161 Parser hook: empty input using terminated empty elements (bug 2374)
16162 !! wikitext
16163 <tag foo=bar/>text
16164 !! html/php
16165 <pre>
16166 NULL
16167 array (
16168 'foo' => 'bar',
16169 )
16170 </pre>text
16171
16172 !! end
16173
16174 # </tag> should be output literally since there is no matching tag that begins it
16175 !! test
16176 Parser hook: basic arguments using terminated empty elements (bug 2374)
16177 !! wikitext
16178 <tag width=200 height = "100" depth = '50' square/>
16179 other stuff
16180 </tag>
16181 !! html/php
16182 <pre>
16183 NULL
16184 array (
16185 'width' => '200',
16186 'height' => '100',
16187 'depth' => '50',
16188 'square' => '',
16189 )
16190 </pre>
16191 <p>other stuff
16192 &lt;/tag&gt;
16193 </p>
16194 !! end
16195
16196 ###
16197 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16198 ###
16199
16200 !! test
16201 Parser hook: static parser hook not inside a comment
16202 !! wikitext
16203 <statictag>hello, world</statictag>
16204 <statictag action=flush/>
16205 !! html/php
16206 <p>hello, world
16207 </p>
16208 !! end
16209
16210
16211 !! test
16212 Parser hook: static parser hook inside a comment
16213 !! wikitext
16214 <!-- <statictag>hello, world</statictag> -->
16215 <statictag action=flush/>
16216 !! html/php
16217 <p><br />
16218 </p>
16219 !! end
16220
16221 # Nested template calls; this case was broken by Parser.php rev 1.506,
16222 # since reverted.
16223
16224 !! article
16225 Template:One-parameter
16226 !! text
16227 (My parameter is: {{{1}}})
16228 !! endarticle
16229
16230 !! article
16231 Template:Map-one-parameter
16232 !! text
16233 {{{{{1}}}|{{{2}}}}}
16234 !! endarticle
16235
16236 !! test
16237 Nested template calls
16238 !! wikitext
16239 {{Map-one-parameter|One-parameter|param}}
16240 !! html
16241 <p>(My parameter is: param)
16242 </p>
16243 !! end
16244
16245
16246 ###
16247 ### Sanitizer
16248 ###
16249
16250 # HTML+Tidy effectively strips out the empty tags completely
16251 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16252 # which Tidy would have done for the PHP parser had there been content inside it.
16253 !! test
16254 Sanitizer: Closing of open tags
16255 !! wikitext
16256 <s></s><table></table>
16257 !! html
16258 <s></s><table></table>
16259
16260 !! html/parsoid
16261 <p><s></s></p><table></table>
16262 !! end
16263
16264 !! test
16265 Sanitizer: Closing of open but not closed tags
16266 !! wikitext
16267 <s>foo
16268 !! html
16269 <p><s>foo</s>
16270 </p>
16271 !! end
16272
16273 !! test
16274 Sanitizer: Closing of closed but not open tags
16275 !! options
16276 parsoid=wt2html
16277 !! wikitext
16278 </s>
16279 !! html/php+tidy
16280 !! html/parsoid
16281 !! end
16282
16283 !! test
16284 Sanitizer: Closing of closed but not open table tags
16285 !! options
16286 parsoid=wt2html
16287 !! wikitext
16288 Table not started</td></tr></table>
16289 !! html/php+tidy
16290 <p>Table not started</p>
16291 !! html/parsoid
16292 <p>Table not started</p>
16293 !! end
16294
16295 !! test
16296 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16297 !! wikitext
16298 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16299 !! html
16300 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16301 </p>
16302 !! end
16303
16304 # In HTML5, the restrictions are that id must contain at least one character,
16305 # and must not contain any space characters.
16306 !! test
16307 Sanitizer: Validating the contents of the id attribute (bug 4515)
16308 !! options
16309 disabled
16310 !! wikitext
16311 <br id="" /><br id="a space" />
16312 !! html
16313 Something ...
16314 !! end
16315
16316 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16317 !! test
16318 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16319 !! options
16320 disabled
16321 !! wikitext
16322 <br id="foo" /><br id="foo" />
16323 !! html
16324 Something need to be done. foo-2 ?
16325 !! end
16326
16327 !! test
16328 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16329 !! wikitext
16330 <div itemscope>
16331 <meta itemprop="hello" content="world">
16332 <meta http-equiv="refresh" content="5">
16333 <meta itemprop="hello" http-equiv="refresh" content="5">
16334 <link itemprop="hello" href="{{SERVER}}">
16335 <link rel="stylesheet" href="{{SERVER}}">
16336 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16337 </div>
16338 !! html
16339 <div itemscope="">
16340 <p> <meta itemprop="hello" content="world" />
16341 &lt;meta http-equiv="refresh" content="5"&gt;
16342 <meta itemprop="hello" content="5" />
16343 </p>
16344 <link itemprop="hello" href="http&#58;//example.org" />
16345 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16346 <link itemprop="hello" href="http&#58;//example.org" />
16347 </div>
16348
16349 !! end
16350
16351 !! test
16352 Language converter: output gets cut off unexpectedly (bug 5757)
16353 !! options
16354 language=zh
16355 !! wikitext
16356 this bit is safe: }-
16357
16358 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16359
16360 then we get cut off here: }-
16361
16362 all additional text is vanished
16363 !! html
16364 <p>this bit is safe: }-
16365 </p><p>but if we add a conversion instance: xxx
16366 </p><p>then we get cut off here: }-
16367 </p><p>all additional text is vanished
16368 </p>
16369 !! end
16370
16371 !! test
16372 Self closed html pairs (bug 5487)
16373 !! options
16374 !! wikitext
16375 <center><font id="bug" />Centered text</center>
16376 <div><font id="bug2" />In div text</div>
16377 !! html
16378 <center>&lt;font id="bug" /&gt;Centered text</center>
16379 <div>&lt;font id="bug2" /&gt;In div text</div>
16380
16381 !! end
16382
16383 #
16384 #
16385 #
16386
16387 !! test
16388 Punctuation: nbsp before exclamation
16389 !! wikitext
16390 C'est grave !
16391 !! html
16392 <p>C'est grave&#160;!
16393 </p>
16394 !! end
16395
16396 !! test
16397 Punctuation: CSS !important (bug 11874)
16398 !! wikitext
16399 <div style="width:50% !important">important</div>
16400 !! html
16401 <div style="width:50% !important">important</div>
16402
16403 !!end
16404
16405 !! test
16406 Punctuation: CSS ! important (bug 11874; with space after)
16407 !! wikitext
16408 <div style="width:50% ! important">important</div>
16409 !! html
16410 <div style="width:50% ! important">important</div>
16411
16412 !!end
16413
16414 !! test
16415 HTML bullet list, closed tags (bug 5497)
16416 !! wikitext
16417 <ul>
16418 <li>One</li>
16419 <li>Two</li>
16420 </ul>
16421 !! html/php
16422 <ul>
16423 <li>One</li>
16424 <li>Two</li>
16425 </ul>
16426
16427 !! html/parsoid
16428 <ul data-parsoid='{"stx":"html"}'>
16429 <li data-parsoid='{"stx":"html"}'>One</li>
16430 <li data-parsoid='{"stx":"html"}'>Two</li>
16431 </ul>
16432
16433 !! end
16434
16435 !! test
16436 HTML bullet list, unclosed tags (bug 5497)
16437 !! wikitext
16438 <ul>
16439 <li>One
16440 <li>Two
16441 </ul>
16442 !! html/php+tidy
16443 <ul>
16444 <li>One</li>
16445 <li>Two</li>
16446 </ul>
16447 !! html/parsoid
16448 <ul data-parsoid='{"stx":"html"}'>
16449 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16450 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16451 </ul>
16452
16453 !! end
16454
16455 !! test
16456 HTML ordered list, closed tags (bug 5497)
16457 !! wikitext
16458 <ol>
16459 <li>One</li>
16460 <li>Two</li>
16461 </ol>
16462 !! html/php
16463 <ol>
16464 <li>One</li>
16465 <li>Two</li>
16466 </ol>
16467
16468 !! html/parsoid
16469 <ol data-parsoid='{"stx":"html"}'>
16470 <li data-parsoid='{"stx":"html"}'>One</li>
16471 <li data-parsoid='{"stx":"html"}'>Two</li>
16472 </ol>
16473
16474 !! end
16475
16476 !! test
16477 HTML ordered list, unclosed tags (bug 5497)
16478 !! options
16479 !! wikitext
16480 <ol>
16481 <li>One
16482 <li>Two
16483 </ol>
16484 !! html/php+tidy
16485 <ol>
16486 <li>One</li>
16487 <li>Two</li>
16488 </ol>
16489 !! html/parsoid
16490 <ol data-parsoid='{"stx":"html"}'>
16491 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16492 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16493 </ol>
16494
16495 !! end
16496
16497 !! test
16498 HTML nested bullet list, closed tags (bug 5497)
16499 !! wikitext
16500 <ul>
16501 <li>One</li>
16502 <li>Two:
16503 <ul>
16504 <li>Sub-one</li>
16505 <li>Sub-two</li>
16506 </ul>
16507 </li>
16508 </ul>
16509 !! html
16510 <ul>
16511 <li>One</li>
16512 <li>Two:
16513 <ul>
16514 <li>Sub-one</li>
16515 <li>Sub-two</li>
16516 </ul>
16517 </li>
16518 </ul>
16519
16520 !! end
16521
16522 !! test
16523 HTML nested bullet list, open tags (bug 5497)
16524 !! wikitext
16525 <ul>
16526 <li>One
16527 <li>Two:
16528 <ul>
16529 <li>Sub-one
16530 <li>Sub-two
16531 </ul>
16532 </ul>
16533 !! html/php+tidy
16534 <ul>
16535 <li>One</li>
16536 <li>Two:
16537 <ul>
16538 <li>Sub-one</li>
16539 <li>Sub-two</li>
16540 </ul>
16541 </li>
16542 </ul>
16543 !! html/parsoid
16544 <ul>
16545 <li>One
16546 </li>
16547 <li>Two:
16548 <ul>
16549 <li>Sub-one
16550 </li>
16551 <li>Sub-two
16552 </li>
16553 </ul>
16554 </li>
16555 </ul>
16556
16557 !! end
16558
16559 !! test
16560 HTML nested ordered list, closed tags (bug 5497)
16561 !! wikitext
16562 <ol>
16563 <li>One</li>
16564 <li>Two:
16565 <ol>
16566 <li>Sub-one</li>
16567 <li>Sub-two</li>
16568 </ol>
16569 </li>
16570 </ol>
16571 !! html
16572 <ol>
16573 <li>One</li>
16574 <li>Two:
16575 <ol>
16576 <li>Sub-one</li>
16577 <li>Sub-two</li>
16578 </ol>
16579 </li>
16580 </ol>
16581
16582 !! end
16583
16584 !! test
16585 HTML nested ordered list, open tags (bug 5497)
16586 !! wikitext
16587 <ol>
16588 <li>One
16589 <li>Two:
16590 <ol>
16591 <li>Sub-one
16592 <li>Sub-two
16593 </ol>
16594 </ol>
16595 !! html/php
16596 <ol>
16597 <li>One
16598 <li>Two:
16599 <ol>
16600 <li>Sub-one
16601 <li>Sub-two
16602 </ol>
16603 </ol>
16604
16605 !! html/parsoid
16606 <ol>
16607 <li>One
16608 </li>
16609 <li>Two:
16610 <ol>
16611 <li>Sub-one
16612 </li>
16613 <li>Sub-two
16614 </li>
16615 </ol>
16616 </li>
16617 </ol>
16618
16619 !! end
16620
16621 !! test
16622 HTML ordered list item with parameters oddity
16623 !! wikitext
16624 <ol><li id="fragment">One</li>
16625 </ol>
16626 !! html
16627 <ol><li id="fragment">One</li>
16628 </ol>
16629
16630 !! end
16631
16632 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16633 !!test
16634 bug 5918: autonumbering
16635 !! wikitext
16636 [http://first/] [http://second] [ftp://ftp]
16637
16638 ftp://inlineftp
16639
16640 [mailto:enclosed@mail.tld With target]
16641
16642 [mailto:enclosed@mail.tld]
16643
16644 mailto:inline@mail.tld
16645 !! html/php
16646 <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>
16647 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16648 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16649 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16650 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16651 </p>
16652 !! html/parsoid
16653 <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>
16654 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16655 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16656 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16657 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16658 !! end
16659
16660
16661 #
16662 # Security and HTML correctness
16663 # From Nick Jenkins' fuzz testing
16664 #
16665
16666 !! test
16667 Fuzz testing: Parser13
16668 !! wikitext
16669 {|
16670 | http://a|
16671 !! html
16672 <table>
16673 <tr>
16674 <td>
16675 </td>
16676 </tr>
16677 </table>
16678
16679 !! end
16680
16681 !! test
16682 Fuzz testing: Parser14
16683 !! wikitext
16684 == onmouseover= ==
16685 http://__TOC__
16686 !! html
16687 <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>
16688 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16689 <ul>
16690 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16691 </ul>
16692 </div>
16693
16694
16695 !! html+tidy
16696 <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>
16697 <p>http://</p>
16698 <div id="toc" class="toc">
16699 <div id="toctitle">
16700 <h2>Contents</h2>
16701 </div>
16702 <ul>
16703 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16704 </ul>
16705 </div>
16706 <p></p>
16707 !! end
16708
16709 !! test
16710 Fuzz testing: Parser14-table
16711 !! wikitext
16712 ==a==
16713 {| STYLE=__TOC__
16714 !! html
16715 <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>
16716 <table style="&#95;_TOC&#95;_">
16717 <tr><td></td></tr>
16718 </table>
16719
16720 !! html+tidy
16721 <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>
16722 <table style="__TOC__">
16723 <tr>
16724 <td></td>
16725 </tr>
16726 </table>
16727 !! end
16728
16729 # Known to produce bogus xml (extra </td>)
16730 !! test
16731 Fuzz testing: Parser16
16732 !! options
16733 noxml
16734 !! wikitext
16735 {|
16736 !https://||||||
16737 !! html
16738 <table>
16739 <tr>
16740 <th>https://</th>
16741 <th></th>
16742 <th></th>
16743 <th>
16744 </td>
16745 </tr>
16746 </table>
16747
16748 !! html+tidy
16749 <table>
16750 <tr>
16751 <th>https://</th>
16752 <th></th>
16753 <th></th>
16754 <th></th>
16755 </tr>
16756 </table>
16757 !! end
16758
16759 !! test
16760 Fuzz testing: Parser21
16761 !! wikitext
16762 {|
16763 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16764 |
16765 !! html
16766 <table>
16767 <tr>
16768 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16769 </th>
16770 <td>
16771 </td>
16772 </tr>
16773 </table>
16774
16775 !! end
16776
16777 !! test
16778 Fuzz testing: Parser22
16779 !! wikitext
16780 http://===r:::https://b
16781
16782 {|
16783 !! html
16784 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16785 </p>
16786 <table>
16787 <tr><td></td></tr>
16788 </table>
16789
16790 !! end
16791
16792 # Known to produce bad XML for now
16793 !! test
16794 Fuzz testing: Parser24
16795 !! options
16796 noxml
16797 !! wikitext
16798 {|
16799 {{{|
16800 <u CLASS=
16801 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16802 <br style="onmouseover='alert(document.cookie);' " />
16803
16804 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16805 |
16806 !! html
16807 <table>
16808 {{{|
16809 <u class="&#124;">}}}} &gt;
16810 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16811
16812 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16813 <tr>
16814 <td></u>
16815 </td>
16816 </tr>
16817 </table>
16818
16819 !! end
16820
16821 # Note: the current result listed for this is not what the original one was,
16822 # but the original bug was JavaScript injection, which is fixed in any case.
16823 # It's not clear that the original result listed was any more correct than the
16824 # current one. Original result:
16825 # <p>{{{|
16826 # </p>
16827 # <li class="&#124;&#124;">
16828 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16829 !!test
16830 Fuzz testing: Parser25 (bug 6055)
16831 !! wikitext
16832 {{{
16833 |
16834 <LI CLASS=||
16835 >
16836 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16837 !! html
16838 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16839 </p>
16840 !! end
16841
16842 !!test
16843 Fuzz testing: URL adjacent extension (with space, clean)
16844 !! wikitext
16845 http://example.com <nowiki>junk</nowiki>
16846 !! html/php
16847 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16848 </p>
16849 !! html/parsoid
16850 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16851 !! end
16852
16853 !!test
16854 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16855 !! wikitext
16856 http://example.com<nowiki>junk</nowiki>
16857 !! html/php
16858 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16859 </p>
16860 !! html/parsoid
16861 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16862 !! end
16863
16864 !!test
16865 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16866 !! wikitext
16867 http://example.com<pre>junk</pre>
16868 !! html/php
16869 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16870
16871 !! html/php+tidy
16872 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16873 <pre>
16874 junk
16875 </pre>
16876 !! html/parsoid
16877 <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>
16878 !!end
16879
16880 !!test
16881 Fuzz testing: image with bogus manual thumbnail
16882 !! wikitext
16883 [[Image:foobar.jpg|thumbnail= ]]
16884 !! html/php
16885 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16886
16887 !! html/parsoid
16888 <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>
16889 !!end
16890
16891 !! test
16892 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16893 !! wikitext
16894 <pre dir="&#10;"></pre>
16895 !! html
16896 <pre dir="&#10;"></pre>
16897
16898 !! end
16899
16900 !! test
16901 Parsing optional HTML elements (Bug 6171)
16902 !! options
16903 !! wikitext
16904 <table>
16905 <tr>
16906 <td> Some tabular data</td>
16907 <td> More tabular data ...
16908 <td> And yet som tabular data</td>
16909 </tr>
16910 </table>
16911 !! html
16912 <table>
16913 <tr>
16914 <td> Some tabular data</td>
16915 <td> More tabular data ...
16916 </td><td> And yet som tabular data</td>
16917 </tr>
16918 </table>
16919
16920 !! end
16921
16922 !! test
16923 Correct handling of <td>, <tr> (Bug 6171)
16924 !! options
16925 !! wikitext
16926 <table>
16927 <tr>
16928 <td> Some tabular data</td>
16929 <td> More tabular data ...</td>
16930 <td> And yet som tabular data</td>
16931 </tr>
16932 </table>
16933 !! html
16934 <table>
16935 <tr>
16936 <td> Some tabular data</td>
16937 <td> More tabular data ...</td>
16938 <td> And yet som tabular data</td>
16939 </tr>
16940 </table>
16941
16942 !! end
16943
16944
16945 !! test
16946 Parsing crashing regression (fr:JavaScript)
16947 !! wikitext
16948 </body></x>
16949 !! html
16950 <p>&lt;/body&gt;&lt;/x&gt;
16951 </p>
16952 !! end
16953
16954 !! test
16955 Inline wiki vs wiki block nesting
16956 !! wikitext
16957 '''Bold paragraph
16958
16959 New wiki paragraph
16960 !! html
16961 <p><b>Bold paragraph</b>
16962 </p><p>New wiki paragraph
16963 </p>
16964 !! end
16965
16966 # FIXME: The current php output is documented
16967 # and desired output is the parsoid target.
16968 !! test
16969 Inline HTML vs wiki block nesting
16970 !! wikitext
16971 <b>Bold paragraph
16972
16973 New wiki paragraph
16974 !! html/php
16975 <p><b>Bold paragraph
16976 </p><p>New wiki paragraph</b>
16977 </p>
16978 !! html/parsoid
16979 <p><b>Bold paragraph</b>
16980 </p><p>New wiki paragraph
16981 </p>
16982 !! end
16983
16984 # Original result was this:
16985 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16986 # </p>
16987 # While that might be marginally more intuitive, maybe, the six-apostrophe
16988 # construct is clearly pathological and the result stated here (which is what
16989 # the parser actually does) is about as reasonable as anything.
16990 !!test
16991 Mixing markup for italics and bold
16992 !! options
16993 !! wikitext
16994 '''bold''''''bold''bolditalics'''''
16995 !! html
16996 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16997 </p>
16998 !! end
16999
17000
17001 !! article
17002 Xyzzyx
17003 !! text
17004 Article for special page transclusion test
17005 !! endarticle
17006
17007 !! test
17008 Special page transclusion
17009 !! options
17010 !! wikitext
17011 {{Special:Prefixindex/Xyzzyx}}
17012 !! html
17013 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17014
17015 !! end
17016
17017 !! test
17018 Special page transclusion twice (bug 5021)
17019 !! options
17020 !! wikitext
17021 {{Special:Prefixindex/Xyzzyx}}
17022 {{Special:Prefixindex/Xyzzyx}}
17023 !! html
17024 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17025 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17026
17027 !! end
17028
17029 !! test
17030 Transclusion of default MediaWiki message
17031 !! wikitext
17032 {{MediaWiki:Mainpage}}
17033 !! html
17034 <p>Main Page
17035 </p>
17036 !! end
17037
17038 !! test
17039 Transclusion of nonexistent MediaWiki message
17040 !! wikitext
17041 {{MediaWiki:Mainpagexxx}}
17042 !! html
17043 <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>
17044 </p>
17045 !! end
17046
17047 !! test
17048 Transclusion of MediaWiki message with underscore
17049 !! wikitext
17050 {{MediaWiki:history_short}}
17051 !! html
17052 <p>History
17053 </p>
17054 !! end
17055
17056 !! test
17057 Transclusion of MediaWiki message with space
17058 !! wikitext
17059 {{MediaWiki:history short}}
17060 !! html
17061 <p>History
17062 </p>
17063 !! end
17064
17065 !! test
17066 Invalid header with following text
17067 !! wikitext
17068 = x = y
17069 !! html
17070 <p>= x = y
17071 </p>
17072 !! end
17073
17074
17075 !! test
17076 Section extraction test (section 0)
17077 !! options
17078 section=0
17079 !! wikitext
17080 start
17081 ==a==
17082 ===aa===
17083 ====aaa====
17084 ==b==
17085 ===ba===
17086 ===bb===
17087 ====bba====
17088 ===bc===
17089 ==c==
17090 ===ca===
17091 !! html/php
17092 start
17093 !! end
17094
17095 !! test
17096 Section extraction test (section 1)
17097 !! options
17098 section=1
17099 !! wikitext
17100 start
17101 ==a==
17102 ===aa===
17103 ====aaa====
17104 ==b==
17105 ===ba===
17106 ===bb===
17107 ====bba====
17108 ===bc===
17109 ==c==
17110 ===ca===
17111 !! html/php
17112 ==a==
17113 ===aa===
17114 ====aaa====
17115 !! end
17116
17117 !! test
17118 Section extraction test (section 2)
17119 !! options
17120 section=2
17121 !! wikitext
17122 start
17123 ==a==
17124 ===aa===
17125 ====aaa====
17126 ==b==
17127 ===ba===
17128 ===bb===
17129 ====bba====
17130 ===bc===
17131 ==c==
17132 ===ca===
17133 !! html/php
17134 ===aa===
17135 ====aaa====
17136 !! end
17137
17138 !! test
17139 Section extraction test (section 3)
17140 !! options
17141 section=3
17142 !! wikitext
17143 start
17144 ==a==
17145 ===aa===
17146 ====aaa====
17147 ==b==
17148 ===ba===
17149 ===bb===
17150 ====bba====
17151 ===bc===
17152 ==c==
17153 ===ca===
17154 !! html/php
17155 ====aaa====
17156 !! end
17157
17158 !! test
17159 Section extraction test (section 4)
17160 !! options
17161 section=4
17162 !! wikitext
17163 start
17164 ==a==
17165 ===aa===
17166 ====aaa====
17167 ==b==
17168 ===ba===
17169 ===bb===
17170 ====bba====
17171 ===bc===
17172 ==c==
17173 ===ca===
17174 !! html/php
17175 ==b==
17176 ===ba===
17177 ===bb===
17178 ====bba====
17179 ===bc===
17180 !! end
17181
17182 !! test
17183 Section extraction test (section 5)
17184 !! options
17185 section=5
17186 !! wikitext
17187 start
17188 ==a==
17189 ===aa===
17190 ====aaa====
17191 ==b==
17192 ===ba===
17193 ===bb===
17194 ====bba====
17195 ===bc===
17196 ==c==
17197 ===ca===
17198 !! html/php
17199 ===ba===
17200 !! end
17201
17202 !! test
17203 Section extraction test (section 6)
17204 !! options
17205 section=6
17206 !! wikitext
17207 start
17208 ==a==
17209 ===aa===
17210 ====aaa====
17211 ==b==
17212 ===ba===
17213 ===bb===
17214 ====bba====
17215 ===bc===
17216 ==c==
17217 ===ca===
17218 !! html/php
17219 ===bb===
17220 ====bba====
17221 !! end
17222
17223 !! test
17224 Section extraction test (section 7)
17225 !! options
17226 section=7
17227 !! wikitext
17228 start
17229 ==a==
17230 ===aa===
17231 ====aaa====
17232 ==b==
17233 ===ba===
17234 ===bb===
17235 ====bba====
17236 ===bc===
17237 ==c==
17238 ===ca===
17239 !! html/php
17240 ====bba====
17241 !! end
17242
17243 !! test
17244 Section extraction test (section 8)
17245 !! options
17246 section=8
17247 !! wikitext
17248 start
17249 ==a==
17250 ===aa===
17251 ====aaa====
17252 ==b==
17253 ===ba===
17254 ===bb===
17255 ====bba====
17256 ===bc===
17257 ==c==
17258 ===ca===
17259 !! html/php
17260 ===bc===
17261 !! end
17262
17263 !! test
17264 Section extraction test (section 9)
17265 !! options
17266 section=9
17267 !! wikitext
17268 start
17269 ==a==
17270 ===aa===
17271 ====aaa====
17272 ==b==
17273 ===ba===
17274 ===bb===
17275 ====bba====
17276 ===bc===
17277 ==c==
17278 ===ca===
17279 !! html/php
17280 ==c==
17281 ===ca===
17282 !! end
17283
17284 !! test
17285 Section extraction test (section 10)
17286 !! options
17287 section=10
17288 !! wikitext
17289 start
17290 ==a==
17291 ===aa===
17292 ====aaa====
17293 ==b==
17294 ===ba===
17295 ===bb===
17296 ====bba====
17297 ===bc===
17298 ==c==
17299 ===ca===
17300 !! html/php
17301 ===ca===
17302 !! end
17303
17304 !! test
17305 Section extraction test (nonexistent section 11)
17306 !! options
17307 section=11
17308 !! wikitext
17309 start
17310 ==a==
17311 ===aa===
17312 ====aaa====
17313 ==b==
17314 ===ba===
17315 ===bb===
17316 ====bba====
17317 ===bc===
17318 ==c==
17319 ===ca===
17320 !! html/php
17321 !! end
17322
17323 !! test
17324 Section extraction test with bogus heading (section 1)
17325 !! options
17326 section=1
17327 !! wikitext
17328 ==a==
17329 ==bogus== not a legal section
17330 ==b==
17331 !! html/php
17332 ==a==
17333 ==bogus== not a legal section
17334 !! end
17335
17336 !! test
17337 Section extraction test with bogus heading (section 2)
17338 !! options
17339 section=2
17340 !! wikitext
17341 ==a==
17342 ==bogus== not a legal section
17343 ==b==
17344 !! html/php
17345 ==b==
17346 !! end
17347
17348 !! test
17349 Section extraction test with comment after heading (section 1)
17350 !! options
17351 section=1
17352 !! wikitext
17353 ==a==
17354 ==b== <!-- -->
17355 ==c==
17356 !! html/php
17357 ==a==
17358 !! end
17359
17360 !! test
17361 Section extraction test with comment after heading (section 2)
17362 !! options
17363 section=2
17364 !! wikitext
17365 ==a==
17366 ==b== <!-- -->
17367 ==c==
17368 !! html/php
17369 ==b== <!-- -->
17370 !! end
17371
17372 !! test
17373 Section extraction test with bogus <nowiki> heading (section 1)
17374 !! options
17375 section=1
17376 !! wikitext
17377 ==a==
17378 ==bogus== <nowiki>not a legal section</nowiki>
17379 ==b==
17380 !! html/php
17381 ==a==
17382 ==bogus== <nowiki>not a legal section</nowiki>
17383 !! end
17384
17385 !! test
17386 Section extraction test with bogus <nowiki> heading (section 2)
17387 !! options
17388 section=2
17389 !! wikitext
17390 ==a==
17391 ==bogus== <nowiki>not a legal section</nowiki>
17392 ==b==
17393 !! html/php
17394 ==b==
17395 !! end
17396
17397 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17398 # instead of respecting commented sections
17399 !! test
17400 Section extraction prefixed by comment (section 1)
17401 !! options
17402 section=1
17403 !! wikitext
17404 <!-- -->==sec1==
17405 ==sec2==
17406 !! html/php
17407 ==sec2==
17408 !!end
17409
17410 !! test
17411 Section extraction prefixed by comment (section 2)
17412 !! options
17413 section=2
17414 !! wikitext
17415 <!-- -->==sec1==
17416 ==sec2==
17417 !! html/php
17418
17419 !!end
17420
17421 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17422 # instead of respecting HTML-style headings
17423 !! test
17424 Section extraction, mixed wiki and html (section 1)
17425 !! options
17426 section=1
17427 !! wikitext
17428 <h2>unmarked</h2>
17429 unmarked
17430 ==1==
17431 one
17432 ==2==
17433 two
17434 !! html/php
17435 ==1==
17436 one
17437 !! end
17438
17439 !! test
17440 Section extraction, mixed wiki and html (section 2)
17441 !! options
17442 section=2
17443 !! wikitext
17444 <h2>unmarked</h2>
17445 unmarked
17446 ==1==
17447 one
17448 ==2==
17449 two
17450 !! html/php
17451 ==2==
17452 two
17453 !! end
17454
17455
17456 # Formerly testing for bug 3342
17457 !! test
17458 Section extraction, heading surrounded by <noinclude>
17459 !! options
17460 section=1
17461 !! wikitext
17462 <noinclude>==unmarked==</noinclude>
17463 ==marked==
17464 !! html/php
17465 ==marked==
17466 !!end
17467
17468 # Test behavior of bug 19910
17469 !! test
17470 Sectiion with all-equals
17471 !! options
17472 section=2
17473 !! wikitext
17474 ===
17475 The line above must have a trailing space
17476 === <!--
17477 --> <!-- -->
17478 But just in case it doesn't...
17479 !! html/php
17480 === <!--
17481 --> <!-- -->
17482 But just in case it doesn't...
17483 !! end
17484
17485 !! test
17486 Section replacement test (section 0)
17487 !! options
17488 replace=0,"xxx"
17489 !! wikitext
17490 start
17491 ==a==
17492 ===aa===
17493 ====aaa====
17494 ==b==
17495 ===ba===
17496 ===bb===
17497 ====bba====
17498 ===bc===
17499 ==c==
17500 ===ca===
17501 !! html/php
17502 xxx
17503
17504 ==a==
17505 ===aa===
17506 ====aaa====
17507 ==b==
17508 ===ba===
17509 ===bb===
17510 ====bba====
17511 ===bc===
17512 ==c==
17513 ===ca===
17514 !! end
17515
17516 !! test
17517 Section replacement test (section 1)
17518 !! options
17519 replace=1,"xxx"
17520 !! wikitext
17521 start
17522 ==a==
17523 ===aa===
17524 ====aaa====
17525 ==b==
17526 ===ba===
17527 ===bb===
17528 ====bba====
17529 ===bc===
17530 ==c==
17531 ===ca===
17532 !! html/php
17533 start
17534 xxx
17535
17536 ==b==
17537 ===ba===
17538 ===bb===
17539 ====bba====
17540 ===bc===
17541 ==c==
17542 ===ca===
17543 !! end
17544
17545 !! test
17546 Section replacement test (section 2)
17547 !! options
17548 replace=2,"xxx"
17549 !! wikitext
17550 start
17551 ==a==
17552 ===aa===
17553 ====aaa====
17554 ==b==
17555 ===ba===
17556 ===bb===
17557 ====bba====
17558 ===bc===
17559 ==c==
17560 ===ca===
17561 !! html/php
17562 start
17563 ==a==
17564 xxx
17565
17566 ==b==
17567 ===ba===
17568 ===bb===
17569 ====bba====
17570 ===bc===
17571 ==c==
17572 ===ca===
17573 !! end
17574
17575 !! test
17576 Section replacement test (section 3)
17577 !! options
17578 replace=3,"xxx"
17579 !! wikitext
17580 start
17581 ==a==
17582 ===aa===
17583 ====aaa====
17584 ==b==
17585 ===ba===
17586 ===bb===
17587 ====bba====
17588 ===bc===
17589 ==c==
17590 ===ca===
17591 !! html/php
17592 start
17593 ==a==
17594 ===aa===
17595 xxx
17596
17597 ==b==
17598 ===ba===
17599 ===bb===
17600 ====bba====
17601 ===bc===
17602 ==c==
17603 ===ca===
17604 !! end
17605
17606 !! test
17607 Section replacement test (section 4)
17608 !! options
17609 replace=4,"xxx"
17610 !! wikitext
17611 start
17612 ==a==
17613 ===aa===
17614 ====aaa====
17615 ==b==
17616 ===ba===
17617 ===bb===
17618 ====bba====
17619 ===bc===
17620 ==c==
17621 ===ca===
17622 !! html/php
17623 start
17624 ==a==
17625 ===aa===
17626 ====aaa====
17627 xxx
17628
17629 ==c==
17630 ===ca===
17631 !! end
17632
17633 !! test
17634 Section replacement test (section 5)
17635 !! options
17636 replace=5,"xxx"
17637 !! wikitext
17638 start
17639 ==a==
17640 ===aa===
17641 ====aaa====
17642 ==b==
17643 ===ba===
17644 ===bb===
17645 ====bba====
17646 ===bc===
17647 ==c==
17648 ===ca===
17649 !! html/php
17650 start
17651 ==a==
17652 ===aa===
17653 ====aaa====
17654 ==b==
17655 xxx
17656
17657 ===bb===
17658 ====bba====
17659 ===bc===
17660 ==c==
17661 ===ca===
17662 !! end
17663
17664 !! test
17665 Section replacement test (section 6)
17666 !! options
17667 replace=6,"xxx"
17668 !! wikitext
17669 start
17670 ==a==
17671 ===aa===
17672 ====aaa====
17673 ==b==
17674 ===ba===
17675 ===bb===
17676 ====bba====
17677 ===bc===
17678 ==c==
17679 ===ca===
17680 !! html/php
17681 start
17682 ==a==
17683 ===aa===
17684 ====aaa====
17685 ==b==
17686 ===ba===
17687 xxx
17688
17689 ===bc===
17690 ==c==
17691 ===ca===
17692 !! end
17693
17694 !! test
17695 Section replacement test (section 7)
17696 !! options
17697 replace=7,"xxx"
17698 !! wikitext
17699 start
17700 ==a==
17701 ===aa===
17702 ====aaa====
17703 ==b==
17704 ===ba===
17705 ===bb===
17706 ====bba====
17707 ===bc===
17708 ==c==
17709 ===ca===
17710 !! html/php
17711 start
17712 ==a==
17713 ===aa===
17714 ====aaa====
17715 ==b==
17716 ===ba===
17717 ===bb===
17718 xxx
17719
17720 ===bc===
17721 ==c==
17722 ===ca===
17723 !! end
17724
17725 !! test
17726 Section replacement test (section 8)
17727 !! options
17728 replace=8,"xxx"
17729 !! wikitext
17730 start
17731 ==a==
17732 ===aa===
17733 ====aaa====
17734 ==b==
17735 ===ba===
17736 ===bb===
17737 ====bba====
17738 ===bc===
17739 ==c==
17740 ===ca===
17741 !! html/php
17742 start
17743 ==a==
17744 ===aa===
17745 ====aaa====
17746 ==b==
17747 ===ba===
17748 ===bb===
17749 ====bba====
17750 xxx
17751
17752 ==c==
17753 ===ca===
17754 !!end
17755
17756 !! test
17757 Section replacement test (section 9)
17758 !! options
17759 replace=9,"xxx"
17760 !! wikitext
17761 start
17762 ==a==
17763 ===aa===
17764 ====aaa====
17765 ==b==
17766 ===ba===
17767 ===bb===
17768 ====bba====
17769 ===bc===
17770 ==c==
17771 ===ca===
17772 !! html/php
17773 start
17774 ==a==
17775 ===aa===
17776 ====aaa====
17777 ==b==
17778 ===ba===
17779 ===bb===
17780 ====bba====
17781 ===bc===
17782 xxx
17783 !! end
17784
17785 !! test
17786 Section replacement test (section 10)
17787 !! options
17788 replace=10,"xxx"
17789 !! wikitext
17790 start
17791 ==a==
17792 ===aa===
17793 ====aaa====
17794 ==b==
17795 ===ba===
17796 ===bb===
17797 ====bba====
17798 ===bc===
17799 ==c==
17800 ===ca===
17801 !! html/php
17802 start
17803 ==a==
17804 ===aa===
17805 ====aaa====
17806 ==b==
17807 ===ba===
17808 ===bb===
17809 ====bba====
17810 ===bc===
17811 ==c==
17812 xxx
17813 !! end
17814
17815 !! test
17816 Section replacement test with initial whitespace (bug 13728)
17817 !! options
17818 replace=2,"xxx"
17819 !! wikitext
17820 Preformatted initial line
17821 ==a==
17822 ===a===
17823 !! html/php
17824 Preformatted initial line
17825 ==a==
17826 xxx
17827 !! end
17828
17829
17830 !! test
17831 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17832 !! options
17833 section=1
17834 !! wikitext
17835 ==a==
17836 a
17837 !! html/php
17838 ==a==
17839 a
17840 !! end
17841
17842 !! test
17843 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17844 !! options
17845 section=1
17846 !! wikitext
17847 ==a==
17848 a
17849 !! html/php
17850 ==a==
17851 a
17852 !! end
17853
17854
17855 !! test
17856 Section extraction, <pre> around bogus header (bug 10309)
17857 !! options
17858 noxml section=2
17859 !! wikitext
17860 == Section One ==
17861 <pre>
17862 =======
17863 </pre>
17864
17865 == Section Two ==
17866 stuff
17867 !! html/php
17868 == Section Two ==
17869 stuff
17870 !! end
17871
17872 !! test
17873 Section replacement, <pre> around bogus header (bug 10309)
17874 !! options
17875 noxml replace=2,"xxx"
17876 !! wikitext
17877 == Section One ==
17878 <pre>
17879 =======
17880 </pre>
17881
17882 == Section Two ==
17883 stuff
17884 !! html/php
17885 == Section One ==
17886 <pre>
17887 =======
17888 </pre>
17889
17890 xxx
17891 !! end
17892
17893
17894 !! test
17895 Handling of &#x0A; in URLs
17896 !! wikitext
17897 ** irc://&#x0A;a
17898 !! html/php
17899 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17900
17901 !! html/parsoid
17902 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17903 a">irc://
17904 a</a></li></ul></li></ul>
17905 !! end
17906
17907 !! test
17908 Handling of %0A in URLs
17909 !! wikitext
17910 ** irc://%0Aa
17911 !! html/php
17912 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17913
17914 !! html/parsoid
17915 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17916 !! end
17917
17918
17919 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17920 !! test
17921 5 quotes, code coverage +1 line
17922 !! options
17923 parsoid=wt2html
17924 !! wikitext
17925 '''''
17926 !! html/php
17927 !! html/parsoid
17928 <p><b><i></i></b></p>
17929 !! end
17930
17931 # same html as previous, but wikitext adjusted to match parsoid html2wt
17932 # note that wt2html and html2html will put the <i> before the <b>
17933 !! test
17934 5 quotes, code coverage +1 line w/ nowiki (1)
17935 !! options
17936 parsoid=wt2wt,html2wt
17937 !! wikitext
17938 '''''<nowiki/>'''''
17939 !! html/php
17940 <p><i></i>
17941 </p>
17942 !! html/parsoid
17943 <p><b><i></i></b></p>
17944 !! end
17945
17946 # same as previous, just swapping the <i> and <b>
17947 !! test
17948 5 quotes, code coverage +1 line w/ nowiki (2)
17949 !! wikitext
17950 '''''<nowiki/>'''''
17951 !! html/php
17952 <p><i></i>
17953 </p>
17954 !! html/parsoid
17955 <p><i><b></b></i></p>
17956 !! end
17957
17958 !! test
17959 Special:Search page linking.
17960 !! wikitext
17961 {{Special:search}}
17962 !! html
17963 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17964 </p>
17965 !! end
17966
17967 !! test
17968 {{!}} is a magic word
17969 !! wikitext
17970 {{!}} is a magic word there and {{!}} is still a magic word here
17971 !! html/php
17972 <p>| is a magic word there and | is still a magic word here
17973 </p>
17974 !! html/parsoid
17975 <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>
17976 !! end
17977
17978 !! test
17979 Say the magic word
17980 !! options
17981 title=[[Parser test]]
17982 !! wikitext
17983 * {{PAGENAME}}
17984 * {{PAGENAMEE}}
17985 * {{FULLPAGENAME}}
17986 * {{FULLPAGENAMEE}}
17987 * {{BASEPAGENAME}}
17988 * {{BASEPAGENAMEE}}
17989 * {{SUBPAGENAME}}
17990 * {{SUBPAGENAMEE}}
17991 * {{ROOTPAGENAME}}
17992 * {{ROOTPAGENAMEE}}
17993 * {{TALKPAGENAME}}
17994 * {{TALKPAGENAMEE}}
17995 * {{SUBJECTPAGENAME}}
17996 * {{SUBJECTPAGENAMEE}}
17997 * {{NAMESPACEE}}
17998 * {{NAMESPACE}}
17999 * {{NAMESPACENUMBER}}
18000 * {{TALKSPACE}}
18001 * {{TALKSPACEE}}
18002 * {{SUBJECTSPACE}}
18003 * {{SUBJECTSPACEE}}
18004 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18005 !! html
18006 <ul><li> Parser test</li>
18007 <li> Parser_test</li>
18008 <li> Parser test</li>
18009 <li> Parser_test</li>
18010 <li> Parser test</li>
18011 <li> Parser_test</li>
18012 <li> Parser test</li>
18013 <li> Parser_test</li>
18014 <li> Parser test</li>
18015 <li> Parser_test</li>
18016 <li> Talk:Parser test</li>
18017 <li> Talk:Parser_test</li>
18018 <li> Parser test</li>
18019 <li> Parser_test</li>
18020 <li> </li>
18021 <li> </li>
18022 <li> 0</li>
18023 <li> Talk</li>
18024 <li> Talk</li>
18025 <li> </li>
18026 <li> </li>
18027 <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>
18028
18029 !! end
18030 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18031
18032 !! test
18033 Gallery
18034 !! wikitext
18035 <gallery>
18036 image1.png |
18037 image2.gif|||||
18038
18039 image3|
18040 image4 |300px| centre
18041 image5.svg| http://///////
18042 [[x|xx]]]]
18043 * image6
18044 </gallery>
18045 !! html
18046 <ul class="gallery mw-gallery-traditional">
18047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18048 <div class="thumb" style="height: 150px;">Image1.png</div>
18049 <div class="gallerytext">
18050 </div>
18051 </div></li>
18052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18053 <div class="thumb" style="height: 150px;">Image2.gif</div>
18054 <div class="gallerytext">
18055 <p>||||
18056 </p>
18057 </div>
18058 </div></li>
18059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18060 <div class="thumb" style="height: 150px;">Image3</div>
18061 <div class="gallerytext">
18062 </div>
18063 </div></li>
18064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18065 <div class="thumb" style="height: 150px;">Image4</div>
18066 <div class="gallerytext">
18067 <p>300px| centre
18068 </p>
18069 </div>
18070 </div></li>
18071 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18072 <div class="thumb" style="height: 150px;">Image5.svg</div>
18073 <div class="gallerytext">
18074 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18075 </p>
18076 </div>
18077 </div></li>
18078 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18079 <div class="thumb" style="height: 150px;">* image6</div>
18080 <div class="gallerytext">
18081 </div>
18082 </div></li>
18083 </ul>
18084
18085 !! end
18086
18087 !! test
18088 Gallery (with options)
18089 !! wikitext
18090 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18091 File:Nonexistent.jpg|caption
18092 File:Nonexistent.jpg
18093 image:foobar.jpg|some '''caption''' [[Main Page]]
18094 image:foobar.jpg
18095 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18096 </gallery>
18097 !! html
18098 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18099 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18100 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18101 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18102 <div class="gallerytext">
18103 <p>caption
18104 </p>
18105 </div>
18106 </div></li>
18107 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18108 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18109 <div class="gallerytext">
18110 </div>
18111 </div></li>
18112 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18113 <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>
18114 <div class="gallerytext">
18115 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18116 </p>
18117 </div>
18118 </div></li>
18119 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18120 <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>
18121 <div class="gallerytext">
18122 </div>
18123 </div></li>
18124 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18125 <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>
18126 <div class="gallerytext">
18127 <p>Blabla|blabla.
18128 </p>
18129 </div>
18130 </div></li>
18131 </ul>
18132
18133 !! end
18134
18135 !! test
18136 Gallery with link that has fragment
18137 !! wikitext
18138 <gallery>
18139 image:foobar.jpg|link=Main_Page
18140 image:foobar.jpg|link=Main_Page#section
18141 image:foobar.jpg|link=Main Page#section|caption
18142 </gallery>
18143 !! html
18144 <ul class="gallery mw-gallery-traditional">
18145 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18146 <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>
18147 <div class="gallerytext">
18148 </div>
18149 </div></li>
18150 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18151 <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>
18152 <div class="gallerytext">
18153 </div>
18154 </div></li>
18155 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18156 <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>
18157 <div class="gallerytext">
18158 <p>caption
18159 </p>
18160 </div>
18161 </div></li>
18162 </ul>
18163
18164 !! end
18165
18166 !! test
18167 Gallery with wikitext inside caption
18168 !! wikitext
18169 <gallery>
18170 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18171 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18172 </gallery>
18173 !! html
18174 <ul class="gallery mw-gallery-traditional">
18175 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18176 <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>
18177 <div class="gallerytext">
18178 <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>
18179 </p>
18180 </div>
18181 </div></li>
18182 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18183 <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>
18184 <div class="gallerytext">
18185 <p>This is a test template
18186 </p>
18187 </div>
18188 </div></li>
18189 </ul>
18190
18191 !! end
18192
18193 !! test
18194 gallery (with showfilename option)
18195 !! wikitext
18196 <gallery showfilename>
18197 File:Nonexistent.jpg|caption
18198 File:Nonexistent.jpg
18199 image:foobar.jpg|some '''caption''' [[Main Page]]
18200 File:Foobar.jpg
18201 </gallery>
18202 !! html
18203 <ul class="gallery mw-gallery-traditional">
18204 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18205 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18206 <div class="gallerytext">
18207 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18208 caption
18209 </p>
18210 </div>
18211 </div></li>
18212 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18213 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18214 <div class="gallerytext">
18215 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18216 </p>
18217 </div>
18218 </div></li>
18219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18220 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18221 <div class="gallerytext">
18222 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18223 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18224 </p>
18225 </div>
18226 </div></li>
18227 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18228 <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>
18229 <div class="gallerytext">
18230 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18231 </p>
18232 </div>
18233 </div></li>
18234 </ul>
18235
18236 !! end
18237
18238 !! test
18239 Gallery (with namespace-less filenames)
18240 !! wikitext
18241 <gallery>
18242 File:Nonexistent.jpg
18243 Nonexistent.jpg
18244 image:foobar.jpg
18245 foobar.jpg
18246 </gallery>
18247 !! html
18248 <ul class="gallery mw-gallery-traditional">
18249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18250 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18251 <div class="gallerytext">
18252 </div>
18253 </div></li>
18254 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18255 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18256 <div class="gallerytext">
18257 </div>
18258 </div></li>
18259 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18260 <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>
18261 <div class="gallerytext">
18262 </div>
18263 </div></li>
18264 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18265 <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>
18266 <div class="gallerytext">
18267 </div>
18268 </div></li>
18269 </ul>
18270
18271 !! end
18272
18273 !! test
18274 HTML Hex character encoding (spells the word "JavaScript")
18275 !! options
18276 parsoid=wt2html,wt2wt,html2html
18277 !! wikitext
18278 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18279 !! html/php
18280 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18281 </p>
18282 !! html/php+tidy
18283 <p>JavaScript</p>
18284 !! html/parsoid
18285 <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>
18286 !! end
18287
18288 !! test
18289 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18290 !! wikitext
18291 &#xsee;&#XSEE;
18292 !! html/php
18293 <p>&amp;#xsee;&amp;#XSEE;
18294 </p>
18295 !! html/parsoid
18296 <p>&amp;#xsee;&amp;#XSEE;</p>
18297 !! end
18298
18299 !! test
18300 HTML Hex character encoding mixed case
18301 !! options
18302 parsoid=wt2html,wt2wt,html2html
18303 !! wikitext
18304 &#xEE;&#Xee;
18305 !! html/php
18306 <p>&#xee;&#xee;
18307 </p>
18308 !! html/php+tidy
18309 <p>îî</p>
18310 !! html/parsoid
18311 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18312 !! end
18313
18314 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18315 # Note that U+000C (form feed) is not a valid XML character, so
18316 # it is banned even though allowed in HTML5.
18317 !! test
18318 Illegal character references (T106578)
18319 !! wikitext
18320 ; Null: &#00;
18321 ; FF: &#xC;
18322 ; CR: &#xD;
18323 ; Control (low): &#8;
18324 ; Control (high): &#x7F; &#x9F;
18325 ; Surrogate: &#xD83D;&#xDCA9;
18326 ; This is an okay astral character: &#x1F4A9;
18327 !! html+tidy
18328 <dl>
18329 <dt>Null</dt>
18330 <dd>&amp;#00;</dd>
18331 <dt>FF</dt>
18332 <dd>&amp;#xC;</dd>
18333 <dt>CR</dt>
18334 <dd>&amp;#xD;</dd>
18335 <dt>Control (low)</dt>
18336 <dd>&amp;#8;</dd>
18337 <dt>Control (high)</dt>
18338 <dd>&amp;#x7F; &amp;#x9F;</dd>
18339 <dt>Surrogate</dt>
18340 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18341 <dt>This is an okay astral character</dt>
18342 <dd>💩</dd>
18343 </dl>
18344 !! end
18345
18346 !! test
18347 __FORCETOC__ override
18348 !! wikitext
18349 __NEWSECTIONLINK__
18350 __FORCETOC__
18351 !! html/php
18352 <p><br />
18353 </p>
18354 !! end
18355
18356 !! test
18357 ISBN code coverage
18358 !! wikitext
18359 ISBN 978-0-1234-56&#x20;789
18360 !! html
18361 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18362 </p>
18363 !! html+tidy
18364 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18365 !! html/parsoid
18366 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18367 !! end
18368
18369 !! test
18370 ISBN followed by 5 spaces
18371 !! wikitext
18372 ISBN
18373 !! html
18374 <p>ISBN
18375 </p>
18376 !! end
18377
18378 !! test
18379 Double ISBN
18380 !! wikitext
18381 ISBN ISBN 1234567890
18382 !! html/php
18383 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18384 </p>
18385 !! html/parsoid
18386 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18387 !! end
18388
18389 # Uppercase X and lowercase x as well
18390 !! test
18391 ISBN with an X
18392 !! wikitext
18393 ISBN 3-462-04561-X
18394 ISBN 3-462-04561-x
18395 ISBN 080442957X
18396 ISBN 080442957x
18397 ISBN 978080442957X
18398 ISBN 978080442957x
18399 !! html/php
18400 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18401 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18402 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18403 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18404 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18405 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18406 </p>
18407 !! html/parsoid
18408 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18409 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18410 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18411 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18412 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18413 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18414 !! end
18415
18416 !! test
18417 ISBN with empty prefix (parsoid test)
18418 !! wikitext
18419 ISBN 1234567890
18420 !! html/php
18421 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18422 </p>
18423 !! html/parsoid
18424 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18425 !! end
18426
18427 !! test
18428 Bug 22905: <abbr> followed by ISBN followed by </a>
18429 !! wikitext
18430 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18431 !! html/php
18432 <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>
18433 </p>
18434 !! html/parsoid
18435 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18436 !! end
18437
18438 !! test
18439 Double RFC
18440 !! wikitext
18441 RFC RFC 1234
18442 !! html
18443 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18444 </p>
18445 !! end
18446
18447 !! test
18448 Double RFC with a wiki link
18449 !! wikitext
18450 RFC [[RFC 1234]]
18451 !! html
18452 <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>
18453 </p>
18454 !! end
18455
18456 !! test
18457 RFC code coverage
18458 !! wikitext
18459 RFC 983&#x20;987
18460 !! html
18461 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18462 </p>
18463 !! html+tidy
18464 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18465 !! end
18466
18467 !! test
18468 Centre-aligned image
18469 !! wikitext
18470 [[Image:foobar.jpg|centre]]
18471 !! html
18472 <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>
18473
18474 !!end
18475
18476 !! test
18477 None-aligned image
18478 !! wikitext
18479 [[Image:foobar.jpg|none]]
18480 !! html
18481 <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>
18482
18483 !!end
18484
18485 !! test
18486 Width + Height sized image (using px) (height is ignored)
18487 !! wikitext
18488 [[Image:foobar.jpg|640x480px]]
18489 !! html
18490 <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>
18491 </p>
18492 !!end
18493
18494 !! test
18495 Width-sized image (using px, no following whitespace)
18496 !! wikitext
18497 [[Image:foobar.jpg|640px]]
18498 !! html
18499 <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>
18500 </p>
18501 !!end
18502
18503 !! test
18504 Width-sized image (using px, with following whitespace - test regression from r39467)
18505 !! wikitext
18506 [[Image:foobar.jpg|640px ]]
18507 !! html
18508 <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>
18509 </p>
18510 !!end
18511
18512 !! test
18513 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18514 !! wikitext
18515 [[Image:foobar.jpg| 640px]]
18516 !! html
18517 <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>
18518 </p>
18519 !!end
18520
18521 !! test
18522 Image with page parameter
18523 !! options
18524 djvu
18525 !! wikitext
18526 [[File:LoremIpsum.djvu|page=2]]
18527 !! html/php
18528 <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>
18529 </p>
18530 !! html/parsoid
18531 <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>
18532 !! end
18533
18534 !! test
18535 Another italics / bold test
18536 !! wikitext
18537 ''' ''x'
18538 !! html
18539 <pre>'<i> </i>x'
18540 </pre>
18541 !!end
18542
18543 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18544 !! test
18545 dt/dd/dl test
18546 !! wikitext
18547 :;;;::
18548 !! html/php
18549 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18550
18551 !! html/parsoid
18552 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18553
18554 !!end
18555
18556
18557 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18558 !! test
18559 Images with the "|" character in the comment
18560 !! wikitext
18561 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18562 !! html/php
18563 <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>
18564
18565 !! html/parsoid
18566 <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>
18567 !! end
18568
18569 !! test
18570 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18571 !! wikitext
18572 <html><script>alert(1);</script></html>
18573 !! html
18574 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18575 </p>
18576 !! end
18577
18578 !! test
18579 HTML with raw HTML ($wgRawHtml==true)
18580 !! options
18581 wgRawHtml=1
18582 !! wikitext
18583 <html><script>alert(1);</script></html>
18584 !! html
18585 <p><script>alert(1);</script>
18586 </p>
18587 !! end
18588
18589 !! test
18590 Parents of subpages, one level up
18591 !! options
18592 subpage title=[[Subpage test/L1/L2/L3]]
18593 !! wikitext
18594 [[../|L2]]
18595 !! html
18596 <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>
18597 </p>
18598 !! end
18599
18600
18601 !! test
18602 Parents of subpages, one level up, not named
18603 !! options
18604 subpage title=[[Subpage test/L1/L2/L3]]
18605 !! wikitext
18606 [[../]]
18607 !! html
18608 <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>
18609 </p>
18610 !! end
18611
18612
18613
18614 !! test
18615 Parents of subpages, two levels up
18616 !! options
18617 subpage title=[[Subpage test/L1/L2/L3]]
18618 !! wikitext
18619 [[../../|L1]]2
18620
18621 [[../../|L1]]l
18622 !! html
18623 <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
18624 </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>
18625 </p>
18626 !! end
18627
18628 !! test
18629 Parents of subpages, two levels up, without trailing slash or name.
18630 !! options
18631 subpage title=[[Subpage test/L1/L2/L3]]
18632 !! wikitext
18633 [[../..]]
18634 !! html
18635 <p>[[../..]]
18636 </p>
18637 !! end
18638
18639 !! test
18640 Parents of subpages, two levels up, with lots of extra trailing slashes.
18641 !! options
18642 subpage title=[[Subpage test/L1/L2/L3]]
18643 !! wikitext
18644 [[../../////]]
18645 !! html
18646 <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>
18647 </p>
18648 !! end
18649
18650 !! article
18651 Subpage test/L1/L2/L3Sibling
18652 !! text
18653 Sibling article
18654 !! endarticle
18655
18656 !! test
18657 Transclusion of a sibling page (one level up)
18658 !! options
18659 subpage title=[[Subpage test/L1/L2/L3]]
18660 !! wikitext
18661 {{../L3Sibling}}
18662 !! html
18663 <p>Sibling article
18664 </p>
18665 !! end
18666
18667 !! test
18668 Transclusion of a child page
18669 !! options
18670 subpage title=[[Subpage test/L1/L2]]
18671 !! wikitext
18672 {{/L3Sibling}}
18673 !! html
18674 <p>Sibling article
18675 </p>
18676 !! end
18677
18678 !! test
18679 Non-transclusion because of too many up levels
18680 !! options
18681 subpage title=[[Subpage test/L1/L2/L3]]
18682 !! wikitext
18683 {{../../../../More than parent}}
18684 !! html
18685 <p>{{../../../../More than parent}}
18686 </p>
18687 !! end
18688
18689 !! test
18690 Definition list code coverage
18691 !! wikitext
18692 ; title : def
18693 ; title : def
18694 ;title: def
18695 !! html/php
18696 <dl><dt> title &#160;</dt>
18697 <dd> def</dd>
18698 <dt> title&#160;</dt>
18699 <dd> def</dd>
18700 <dt>title</dt>
18701 <dd> def</dd></dl>
18702
18703 !! html/parsoid
18704 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18705 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18706 <dt>title</dt><dd> def</dd></dl>
18707 !! end
18708
18709 !! test
18710 Don't fall for the self-closing div
18711 !! wikitext
18712 <div>hello world</div/>
18713 !! html
18714 <div>hello world</div>
18715
18716 !! end
18717
18718 !! test
18719 MSGNW magic word
18720 !! wikitext
18721 {{MSGNW:msg}}
18722 !! html/php
18723 <p>&#91;&#91;:Template:Msg&#93;&#93;
18724 </p>
18725 !! end
18726
18727 !! test
18728 RAW magic word
18729 !! wikitext
18730 {{RAW:QUERTY}}
18731 !! html
18732 <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>
18733 </p>
18734 !! end
18735
18736 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18737 !! test
18738 Always escape literal '>' in output, not just after '<'
18739 !! wikitext
18740 ><>
18741 !! html
18742 <p>&gt;&lt;&gt;
18743 </p>
18744 !! end
18745
18746 !! test
18747 Template caching
18748 !! wikitext
18749 {{Test}}
18750 {{Test}}
18751 !! html
18752 <p>This is a test template
18753 This is a test template
18754 </p>
18755 !! end
18756
18757
18758 !! article
18759 MediaWiki:Fake
18760 !! text
18761 ==header==
18762 !! endarticle
18763
18764 !! test
18765 Inclusion of !userCanEdit() content
18766 !! wikitext
18767 {{MediaWiki:Fake}}
18768 !! html
18769 <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>
18770
18771 !! end
18772
18773
18774 !! test
18775 Out-of-order TOC heading levels
18776 !! wikitext
18777 ==2==
18778 ======6======
18779 ===3===
18780 =1=
18781 =====5=====
18782 ==2==
18783 !! html
18784 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18785 <ul>
18786 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18787 <ul>
18788 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18789 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18790 </ul>
18791 </li>
18792 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18793 <ul>
18794 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18795 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18796 </ul>
18797 </li>
18798 </ul>
18799 </div>
18800
18801 <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>
18802 <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>
18803 <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>
18804 <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>
18805 <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>
18806 <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>
18807
18808 !! end
18809
18810
18811 !! test
18812 ISBN with a dummy number
18813 !! wikitext
18814 ISBN ---
18815 !! html
18816 <p>ISBN ---
18817 </p>
18818 !! end
18819
18820
18821 !! test
18822 ISBN with space-delimited number
18823 !! wikitext
18824 ISBN 92 9017 032 8
18825 !! html
18826 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18827 </p>
18828 !! end
18829
18830
18831 !! test
18832 ISBN with multiple spaces, no number
18833 !! wikitext
18834 ISBN foo
18835 !! html
18836 <p>ISBN foo
18837 </p>
18838 !! end
18839
18840
18841 !! test
18842 ISBN length
18843 !! wikitext
18844 ISBN 123456789
18845
18846 ISBN 1234567890
18847
18848 ISBN 12345678901
18849 !! html
18850 <p>ISBN 123456789
18851 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18852 </p><p>ISBN 12345678901
18853 </p>
18854 !! end
18855
18856
18857 !! test
18858 ISBN with trailing year (bug 8110)
18859 !! wikitext
18860 ISBN 1-234-56789-0 - 2006
18861
18862 ISBN 1 234 56789 0 - 2006
18863 !! html
18864 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18865 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18866 </p>
18867 !! end
18868
18869
18870 !! test
18871 anchorencode
18872 !! wikitext
18873 {{anchorencode:foo bar©#%n}}
18874 !! html
18875 <p>foo_bar.C2.A9.23.25n
18876 </p>
18877 !! end
18878
18879 !! test
18880 anchorencode trims spaces
18881 !! wikitext
18882 {{anchorencode: __pretty__please__}}
18883 !! html
18884 <p>pretty_please
18885 </p>
18886 !! end
18887
18888 !! test
18889 anchorencode deals with links
18890 !! wikitext
18891 {{anchorencode: [[hello|world]] [[hi]]}}
18892 !! html
18893 <p>world_hi
18894 </p>
18895 !! end
18896
18897 !! test
18898 anchorencode deals with templates
18899 !! wikitext
18900 {{anchorencode: {{Foo}} }}
18901 !! html
18902 <p>FOO
18903 </p>
18904 !! end
18905
18906 !! test
18907 anchorencode encodes like the TOC generator: (bug 18431)
18908 !! wikitext
18909 === _ +:.3A%3A&&amp;]] ===
18910 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18911 __NOEDITSECTION__
18912 !! html
18913 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18914 <p>.2B:.3A.253A.26.26.5D.5D
18915 </p>
18916 !! end
18917
18918 !! test
18919 Bug 6200: blockquotes and paragraph formatting
18920 !! wikitext
18921 <blockquote>
18922 foo
18923 </blockquote>
18924
18925 bar
18926
18927 baz
18928 !! html
18929 <blockquote>
18930 <p>foo
18931 </p>
18932 </blockquote>
18933 <p>bar
18934 </p>
18935 <pre>baz
18936 </pre>
18937 !! end
18938
18939 !! test
18940 Bug 8293: Use of center tag ruins paragraph formatting
18941 !! wikitext
18942 <center>
18943 foo
18944 </center>
18945
18946 bar
18947
18948 baz
18949 !! html
18950 <center>
18951 <p>foo
18952 </p>
18953 </center>
18954 <p>bar
18955 </p>
18956 <pre>baz
18957 </pre>
18958 !! end
18959
18960 !!test
18961 Parsing of overlapping (improperly nested) inline html tags
18962 !! wikitext
18963 <span><s>x</span></s>
18964 !! html/php
18965 <p><span><s>x&lt;/span&gt;</s></span>
18966 </p>
18967 !! html/parsoid
18968 <p><span><s>x</s></span>
18969 </p>
18970 !!end
18971
18972 ###
18973 ### Language variants related tests
18974 ###
18975 !! test
18976 Self-link in language variants
18977 !! options
18978 title=[[Dunav]] language=sr
18979 !! wikitext
18980 Both [[Dunav]] and [[Дунав]] are names for this river.
18981 !! html
18982 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18983 </p>
18984 !!end
18985
18986 !! article
18987 Дуна
18988 !! text
18989 content
18990 !! endarticle
18991
18992 !! test
18993 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18994 !! options
18995 title=[[Duna]] language=sr
18996 !! wikitext
18997 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18998 !! html
18999 <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.
19000 </p>
19001 !! end
19002
19003 !! test
19004 Link to a section of a variant of this title shouldn't be parsed as self-link
19005 !! options
19006 title=[[Duna]] language=sr
19007 !! wikitext
19008 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19009 !! html
19010 <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.
19011 </p>
19012 !! end
19013
19014 !! test
19015 Link to pages in language variants
19016 !! options
19017 language=sr
19018 !! wikitext
19019 Main Page can be written as [[Маин Паге]]
19020 !! html
19021 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19022 </p>
19023 !!end
19024
19025
19026 !! test
19027 Multiple links to pages in language variants
19028 !! options
19029 language=sr
19030 !! wikitext
19031 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19032 !! html
19033 <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>.
19034 </p>
19035 !!end
19036
19037
19038 !! test
19039 Simple template in language variants
19040 !! options
19041 language=sr
19042 !! wikitext
19043 {{тест}}
19044 !! html
19045 <p>This is a test template
19046 </p>
19047 !! end
19048
19049
19050 !! test
19051 Template with explicit namespace in language variants
19052 !! options
19053 language=sr
19054 !! wikitext
19055 {{Template:тест}}
19056 !! html
19057 <p>This is a test template
19058 </p>
19059 !! end
19060
19061
19062 !! test
19063 Basic test for template parameter in language variants
19064 !! options
19065 language=sr
19066 !! wikitext
19067 {{парамтест|param=foo}}
19068 !! html
19069 <p>This is a test template with parameter foo
19070 </p>
19071 !! end
19072
19073
19074 !! test
19075 Simple category in language variants
19076 !! options
19077 language=sr cat
19078 !! wikitext
19079 [[Category:МедиаWики Усер'с Гуиде]]
19080 !! html
19081 <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>
19082 !! end
19083
19084
19085 !! article
19086 Category:分类
19087 !! text
19088 blah
19089 !! endarticle
19090
19091 !! article
19092 Category:分類
19093 !! text
19094 blah
19095 !! endarticle
19096
19097 !! test
19098 Don't convert blue categorylinks to another variant (bug 33210)
19099 !! options
19100 language=zh cat
19101 !! wikitext
19102 [[A]][[Category:分类]]
19103 !! html
19104 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19105 !! end
19106
19107
19108 !! test
19109 Stripping -{}- tags (language variants)
19110 !! options
19111 language=sr
19112 !! wikitext
19113 Latin proverb: -{Ne nuntium necare}-
19114 !! html
19115 <p>Latin proverb: Ne nuntium necare
19116 </p>
19117 !! end
19118
19119
19120 !! test
19121 Prevent conversion with -{}- tags (language variants)
19122 !! options
19123 language=sr variant=sr-ec
19124 !! wikitext
19125 Latinski: -{Ne nuntium necare}-
19126 !! html
19127 <p>Латински: Ne nuntium necare
19128 </p>
19129 !! end
19130
19131
19132 !! test
19133 Prevent conversion of text with -{}- tags (language variants)
19134 !! options
19135 language=sr variant=sr-ec
19136 !! wikitext
19137 Latinski: -{Ne nuntium necare}-
19138 !! html
19139 <p>Латински: Ne nuntium necare
19140 </p>
19141 !! end
19142
19143
19144 !! test
19145 Prevent conversion of links with -{}- tags (language variants)
19146 !! options
19147 language=sr variant=sr-ec
19148 !! wikitext
19149 -{[[Main Page]]}-
19150 !! html
19151 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19152 </p>
19153 !! end
19154
19155
19156 !! test
19157 -{}- tags within headlines (within html for parserConvert())
19158 !! options
19159 language=sr variant=sr-ec
19160 !! wikitext
19161 == -{Naslov}- ==
19162 !! html
19163 <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>
19164
19165 !! end
19166
19167
19168 !! test
19169 Explicit definition of language variant alternatives
19170 !! options
19171 language=zh variant=zh-tw
19172 !! wikitext
19173 -{zh:China;zh-tw:Taiwan}-, not China
19174 !! html
19175 <p>Taiwan, not China
19176 </p>
19177 !! end
19178
19179
19180 !! test
19181 Conversion around HTML tags
19182 !! options
19183 language=sr variant=sr-ec
19184 !! wikitext
19185 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19186 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19187 !! html
19188 <p>
19189 <span title="ЛаCтин">ски</span>
19190 </p>
19191 !! end
19192
19193
19194 !! test
19195 Explicit session-wise language variant mapping (A flag and - flag)
19196 !! options
19197 language=zh variant=zh-tw
19198 !! wikitext
19199 Taiwan is not China.
19200 But -{A|zh:China;zh-tw:Taiwan}- is China,
19201 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19202 and -{China}- is China.
19203 !! html
19204 <p>Taiwan is not China.
19205 But Taiwan is Taiwan,
19206 (This should be stripped!)
19207 and China is China.
19208 </p>
19209 !! end
19210
19211 !! test
19212 Explicit session-wise language variant mapping (H flag for hide)
19213 !! options
19214 language=zh variant=zh-tw
19215 !! wikitext
19216 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19217 Taiwan is China.
19218 !! html
19219 <p>(This should be stripped!)
19220 Taiwan is Taiwan.
19221 </p>
19222 !! end
19223
19224 !! test
19225 Adding explicit conversion rule for title (T flag)
19226 !! options
19227 language=zh variant=zh-tw showtitle
19228 !! wikitext
19229 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19230 !! html
19231 Taiwan
19232 <p>Should be stripped!
19233 </p>
19234 !! end
19235
19236 !! test
19237 Testing that changing the language variant here in the tests actually works
19238 !! options
19239 language=zh variant=zh showtitle
19240 !! wikitext
19241 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19242 !! html
19243 China
19244 <p>Should be stripped!
19245 </p>
19246 !! end
19247
19248 !! test
19249 Recursive conversion of alt and title attrs shouldn't clear converter state
19250 !! options
19251 language=zh variant=zh-cn showtitle
19252 !! wikitext
19253 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19254 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19255 !! html
19256 China
19257 <p>
19258 Should be stripped<span title="Exclamation">!</span>
19259 </p>
19260 !! end
19261
19262 !! test
19263 Bug 24072: more test on conversion rule for title
19264 !! options
19265 language=zh variant=zh-tw showtitle
19266 !! wikitext
19267 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19268 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19269 !! html
19270 Taiwan
19271 <p>This should be stripped!
19272 This won't take interferes with the title rule.
19273 </p>
19274 !! end
19275
19276 !! test
19277 Partly disable title conversion if variant == main language code
19278 !! options
19279 language=zh variant=zh title=[[ZH]] showtitle
19280 !! wikitext
19281 -{T|zh-cn:CN;zh-tw:TW}-
19282 !! html
19283 ZH
19284 <p>
19285 </p>
19286 !! end
19287
19288 !! test
19289 Partly disable title conversion if variant == main language code, more
19290 !! options
19291 language=zh variant=zh title=[[ZH]] showtitle
19292 !! wikitext
19293 -{T|TW}-
19294 !! html
19295 ZH
19296 <p>
19297 </p>
19298 !! end
19299
19300 !! test
19301 Raw output of variant escape tags (R flag)
19302 !! options
19303 language=zh variant=zh-tw
19304 !! wikitext
19305 Raw: -{R|zh:China;zh-tw:Taiwan}-
19306 !! html
19307 <p>Raw: zh:China;zh-tw:Taiwan
19308 </p>
19309 !! end
19310
19311 !! test
19312 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19313 !! options
19314 language=zh variant=zh-cn
19315 !! input
19316 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19317 !! result
19318 <p>0
19319 </p>
19320 !! end
19321
19322 !! test
19323 Conversion rules from [numeric-only string] to [something else] (T48634)
19324 !! options
19325 language=zh variant=zh-cn
19326 !! input
19327 -{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
19328 !! result
19329 <p>D12345EE12345
19330 </p>
19331 !! end
19332
19333 !! test
19334 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19335 !! options
19336 language=zh variant=zh-cn
19337 !! input
19338 -{H|zh-cn:foo;zh-tw:;}-foobar
19339 !! result
19340 <p>foobar
19341 </p>
19342 !! end
19343
19344 !! test
19345 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19346 !! options
19347 language=zh variant=zh-cn
19348 !! input
19349 -{H|=>zh-cn:foo;}-foobar
19350 !! result
19351 <p>foobar
19352 </p>
19353 !! end
19354
19355 !! test
19356 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19357 !! options
19358 language=zh variant=zh-cn
19359 !! input
19360 -{H|}-foobar
19361 !! result
19362 <p>foobar
19363 </p>
19364 !! end
19365
19366 !! test
19367 Nested using of manual convert syntax
19368 !! options
19369 language=zh variant=zh-hk
19370 !! wikitext
19371 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19372 !! html
19373 <p>Nested: Hello Hong Kong!
19374 </p>
19375 !! end
19376
19377 !! test
19378 Proper conversion of text in external links
19379 !! options
19380 language=sr variant=sr-ec
19381 !! wikitext
19382 http://www.google.com
19383 gopher://www.google.com
19384 [http://www.google.com http://www.google.com]
19385 [gopher://www.google.com gopher://www.google.com]
19386 [https://www.google.com irc://www.google.com]
19387 [ftp://www.google.com www.google.com/ftp://dir]
19388 [//www.google.com www.google.com]
19389 !! html
19390 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19391 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19392 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19393 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19394 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19395 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19396 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19397 </p>
19398 !! end
19399
19400 !! test
19401 Do not convert roman numbers to language variants
19402 !! options
19403 language=sr variant=sr-ec
19404 !! wikitext
19405 Fridrih IV je car.
19406 !! html
19407 <p>Фридрих IV је цар.
19408 </p>
19409 !! end
19410
19411 !! test
19412 Unclosed language converter markup "-{"
19413 !! options
19414 language=sr
19415 !! wikitext
19416 -{T|hello
19417 !! html
19418 <p>-{T|hello
19419 </p>
19420 !! end
19421
19422 !! test
19423 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19424 !! options
19425 language=sr
19426 !! wikitext
19427 -{R|=&gt;}-
19428 !! html
19429 <p>=&gt;
19430 </p>
19431 !!end
19432
19433 !! test
19434 Don't break link parsing if language converter markup is in the caption.
19435 !! options
19436 language=sr variant=sr-ec
19437 !! wikitext
19438 [[Main Page|-{R|main page}-]]
19439 !! html
19440 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19441 </p>
19442 !! end
19443
19444 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19445 !! test
19446 Don't break image parsing if language converter markup is in the caption.
19447 !! options
19448 language=sr
19449 !! wikitext
19450 [[File:Foobar.jpg|-{R|caption}-]]
19451 !! html/parsoid
19452 <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>
19453 </p>
19454 !! end
19455
19456 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19457 !! test
19458 Don't break list handling if language converter markup is in the item.
19459 !! options
19460 language=zh variant=zh-cn
19461 !! wikitext
19462 ;-{zh-cn:AAA;zh-tw:BBB}-
19463 !! html/php
19464 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19465
19466 !! html/parsoid
19467 <dl><dt>AAA
19468 </dt></dl>
19469 !! end
19470
19471 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19472 !! test
19473 Don't break table handling if language converter markup is in the cell.
19474 !! options
19475 language=sr variant=sr-ec
19476 !! wikitext
19477 {|
19478 |-
19479 | -{R|B}-
19480 |}
19481 !! html/php
19482 <table>
19483
19484 <tr>
19485 <td>Б}-
19486 </td></tr></table>
19487
19488 !! html/parsoid
19489 <table>
19490
19491 <tr>
19492 <td> B
19493 </td></tr></table>
19494
19495 !! end
19496
19497 !! test
19498 Bug 529: Uncovered bullet
19499 !! wikitext
19500 * Foo {{bullet}}
19501 !! html
19502 <ul><li> Foo </li>
19503 <li> Bar</li></ul>
19504
19505 !! end
19506
19507 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19508 # Templates in Wikipedia rely on this behavior, as tidy has always been
19509 # enabled there. These tests are normally run *without* tidy, so specify the
19510 # full output here.
19511 # To test realistic parsing behavior, apply a tidy-like transformation to both
19512 # the expected output and your parser's output.
19513 !! test
19514 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19515 !! wikitext
19516 ******* Foo {{bullet}}
19517 !! html
19518 <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>
19519 <li> Bar</li></ul>
19520
19521 !! end
19522
19523 !! test
19524 Bug 529: Uncovered table already at line-start
19525 !! wikitext
19526 x
19527
19528 {{table}}
19529 y
19530 !! html
19531 <p>x
19532 </p>
19533 <table>
19534 <tr>
19535 <td> 1 </td>
19536 <td> 2
19537 </td></tr>
19538 <tr>
19539 <td> 3 </td>
19540 <td> 4
19541 </td></tr></table>
19542 <p>y
19543 </p>
19544 !! end
19545
19546 !! test
19547 Bug 529: Uncovered bullet in parser function result
19548 !! wikitext
19549 * Foo {{lc:{{bullet}} }}
19550 !! html
19551 <ul><li> Foo </li>
19552 <li> bar</li></ul>
19553
19554 !! end
19555
19556 !! test
19557 Bug 5678: Double-parsed template argument
19558 !! wikitext
19559 {{lc:{{{1}}}|hello}}
19560 !! html
19561 <p>{{{1}}}
19562 </p>
19563 !! end
19564
19565 !! test
19566 Bug 5678: Double-parsed template invocation
19567 !! wikitext
19568 {{lc:{{paramtest {{!}} param = hello }} }}
19569 !! html
19570 <p>{{paramtest | param = hello }}
19571 </p>
19572 !! end
19573
19574 !! test
19575 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19576 !! options
19577 language=cs
19578 title=[[Main Page]]
19579 !! wikitext
19580 {{PRVNÍVELKÉ:ěščř}}
19581 {{prvnívelké:ěščř}}
19582 {{PRVNÍMALÉ:ěščř}}
19583 {{prvnímalé:ěščř}}
19584 {{MALÁ:ěščř}}
19585 {{malá:ěščř}}
19586 {{VELKÁ:ěščř}}
19587 {{velká:ěščř}}
19588 !! html
19589 <p>Ěščř
19590 Ěščř
19591 ěščř
19592 ěščř
19593 ěščř
19594 ěščř
19595 ĚŠČŘ
19596 ĚŠČŘ
19597 </p>
19598 !! end
19599
19600 !! test
19601 Morwen/13: Unclosed link followed by heading
19602 !! wikitext
19603 [[link
19604 ==heading==
19605 !! html
19606 <p>[[link
19607 </p>
19608 <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>
19609
19610 !! end
19611
19612 !! test
19613 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19614 !! wikitext
19615 {{foo|
19616 =heading=
19617 !! html
19618 <p>{{foo|
19619 </p>
19620 <h1><span class="mw-headline" id="heading">heading</span></h1>
19621
19622 !! end
19623
19624 !! test
19625 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19626 !! wikitext
19627 {{foo|
19628 ==heading==
19629 !! html
19630 <p>{{foo|
19631 </p>
19632 <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>
19633
19634 !! end
19635
19636 !! test
19637 Tildes in comments
19638 !! options
19639 pst
19640 !! wikitext
19641 <!-- ~~~~ -->
19642 !! html
19643 <!-- ~~~~ -->
19644 !! end
19645
19646 !! test
19647 Paragraphs inside divs (no extra line breaks)
19648 !! wikitext
19649 <div>Line one
19650
19651 Line two</div>
19652 !! html
19653 <div>Line one
19654 Line two</div>
19655
19656 !! end
19657
19658 !! test
19659 Paragraphs inside divs (extra line break on open)
19660 !! wikitext
19661 <div>
19662 Line one
19663
19664 Line two</div>
19665 !! html
19666 <div>
19667 <p>Line one
19668 </p>
19669 Line two</div>
19670
19671 !! end
19672
19673 !! test
19674 Paragraphs inside divs (extra line break on close)
19675 !! wikitext
19676 <div>Line one
19677
19678 Line two
19679 </div>
19680 !! html
19681 <div>Line one
19682 <p>Line two
19683 </p>
19684 </div>
19685
19686 !! end
19687
19688 !! test
19689 Paragraphs inside divs (extra line break on open and close)
19690 !! wikitext
19691 <div>
19692 Line one
19693
19694 Line two
19695 </div>
19696 !! html
19697 <div>
19698 <p>Line one
19699 </p><p>Line two
19700 </p>
19701 </div>
19702
19703 !! end
19704
19705 !! test
19706 Nesting tags, paragraphs on lines which begin with <div>
19707 !! wikitext
19708 <div></div><strong>A
19709 B</strong>
19710 !! html/php+tidy
19711 <p><strong>A</strong></p>
19712 <p><strong>B</strong></p>
19713 !! html/parsoid
19714 <div></div>
19715 <p><strong>A
19716 B</strong>
19717 </p>
19718 !! end
19719
19720 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19721 !! test
19722 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19723 !! wikitext
19724 <blockquote>Line one
19725
19726 Line two</blockquote>
19727 !! html
19728 <blockquote>Line one
19729 Line two</blockquote>
19730
19731 !! html+tidy
19732 <blockquote>
19733 <p>Line one Line two</p>
19734 </blockquote>
19735 !! end
19736
19737 !! test
19738 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19739 !! wikitext
19740 <blockquote>
19741 Line one
19742
19743 Line two</blockquote>
19744 !! html
19745 <blockquote>
19746 <p>Line one
19747 </p>
19748 Line two</blockquote>
19749
19750 !! html+tidy
19751 <blockquote>
19752 <p>Line one</p>
19753 Line two</blockquote>
19754 !! end
19755
19756 !! test
19757 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19758 !! wikitext
19759 <blockquote>Line one
19760
19761 Line two
19762 </blockquote>
19763 !! html
19764 <blockquote>Line one
19765 <p>Line two
19766 </p>
19767 </blockquote>
19768
19769 !! html+tidy
19770 <blockquote>
19771 <p>Line one</p>
19772 <p>Line two</p>
19773 </blockquote>
19774 !! end
19775
19776 !! test
19777 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19778 !! wikitext
19779 <blockquote>
19780 Line one
19781
19782 Line two
19783 </blockquote>
19784 !! html
19785 <blockquote>
19786 <p>Line one
19787 </p><p>Line two
19788 </p>
19789 </blockquote>
19790
19791 !! html+tidy
19792 <blockquote>
19793 <p>Line one</p>
19794 <p>Line two</p>
19795 </blockquote>
19796 !! end
19797
19798 !! test
19799 Paragraphs inside blockquotes/divs (no extra line breaks)
19800 !! wikitext
19801 <blockquote><div>Line one
19802
19803 Line two</div></blockquote>
19804 !! html
19805 <blockquote><div>Line one
19806 Line two</div></blockquote>
19807
19808 !! end
19809
19810 !! test
19811 Paragraphs inside blockquotes/divs (extra line break on open)
19812 !! wikitext
19813 <blockquote><div>
19814 Line one
19815
19816 Line two</div></blockquote>
19817 !! html
19818 <blockquote><div>
19819 <p>Line one
19820 </p>
19821 Line two</div></blockquote>
19822
19823 !! end
19824
19825 !! test
19826 Paragraphs inside blockquotes/divs (extra line break on close)
19827 !! wikitext
19828 <blockquote><div>Line one
19829
19830 Line two
19831 </div></blockquote>
19832 !! html
19833 <blockquote><div>Line one
19834 <p>Line two
19835 </p>
19836 </div></blockquote>
19837
19838 !! end
19839
19840 !! test
19841 Paragraphs inside blockquotes/divs (extra line break on open and close)
19842 !! wikitext
19843 <blockquote><div>
19844 Line one
19845
19846 Line two
19847 </div></blockquote>
19848 !! html
19849 <blockquote><div>
19850 <p>Line one
19851 </p><p>Line two
19852 </p>
19853 </div></blockquote>
19854
19855 !! end
19856
19857 !! test
19858 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19859 !! options
19860 wgLinkHolderBatchSize=0
19861 !! wikitext
19862 [[meatball:1]]
19863 [[meatball:2]]
19864 [[meatball:3]]
19865 !! html
19866 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19867 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19868 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19869 </p>
19870 !! end
19871
19872 !! test
19873 Free external link invading image caption
19874 !! wikitext
19875 [[Image:Foobar.jpg|thumb|http://x|hello]]
19876 !! html
19877 <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>
19878
19879 !! end
19880
19881 !! test
19882 Bug 15196: localised external link numbers
19883 !! options
19884 language=fa
19885 !! wikitext
19886 [http://en.wikipedia.org/]
19887 !! html/php
19888 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19889 </p>
19890 !! html/parsoid
19891 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19892 !! end
19893
19894 !! test
19895 Multibyte character in padleft
19896 !! wikitext
19897 {{padleft:-Hello|7|Æ}}
19898 !! html
19899 <p>Æ-Hello
19900 </p>
19901 !! end
19902
19903 !! test
19904 Multibyte character in padright
19905 !! wikitext
19906 {{padright:Hello-|7|Æ}}
19907 !! html
19908 <p>Hello-Æ
19909 </p>
19910 !! end
19911
19912 !!test
19913 formatdate parser function
19914 !! wikitext
19915 {{#formatdate:2009-03-24}}
19916 !! html
19917 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19918 </p>
19919 !! end
19920
19921 !!test
19922 formatdate parser function, with default format
19923 !! wikitext
19924 {{#formatdate:2009-03-24|mdy}}
19925 !! html
19926 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19927 </p>
19928 !! end
19929
19930 !! test
19931 Spacing of numbers in formatted dates
19932 !! wikitext
19933 {{#formatdate:January 15}}
19934 !! html
19935 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19936 </p>
19937 !! end
19938
19939 !! test
19940 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
19941 !! options
19942 language=nl title=[[MediaWiki:Common.css]]
19943 !! wikitext
19944 {{#formatdate:2009-03-24|dmy}}
19945 !! html
19946 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19947 </p>
19948 !! end
19949
19950 #
19951 #
19952 #
19953
19954 #
19955 # Edit comments
19956 #
19957
19958 !! test
19959 Edit comment with link
19960 !! options
19961 comment
19962 !! wikitext
19963 I like the [[Main Page]] a lot
19964 !! html
19965 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19966 !!end
19967
19968 !! test
19969 Edit comment with link and link text
19970 !! options
19971 comment
19972 !! wikitext
19973 I like the [[Main Page|best pages]] a lot
19974 !! html
19975 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19976 !!end
19977
19978 !! test
19979 Edit comment with link and link text with suffix
19980 !! options
19981 comment
19982 !! wikitext
19983 I like the [[Main Page|best page]]s a lot
19984 !! html
19985 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19986 !!end
19987
19988 !! test
19989 Edit comment with section link (non-local, eg in history list)
19990 !! options
19991 comment title=[[Main Page]]
19992 !! wikitext
19993 /* External links */ removed bogus entries
19994 !! html
19995 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19996 !!end
19997
19998 !! test
19999 Edit comment with section link and text before it (non-local, eg in history list)
20000 !! options
20001 comment title=[[Main Page]]
20002 !! wikitext
20003 pre-comment text /* External links */ removed bogus entries
20004 !! html
20005 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>
20006 !!end
20007
20008 !! test
20009 Edit comment with section link (local, eg in diff view)
20010 !! options
20011 comment local title=[[Main Page]]
20012 !! wikitext
20013 /* External links */ removed bogus entries
20014 !! html
20015 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20016 !!end
20017
20018 !! test
20019 Edit comment with subpage link (bug 14080)
20020 !! options
20021 comment
20022 subpage
20023 title=[[Subpage test]]
20024 !! wikitext
20025 Poked at a [[/subpage]] here...
20026 !! html
20027 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20028 !!end
20029
20030 !! test
20031 Edit comment with subpage link and link text (bug 14080)
20032 !! options
20033 comment
20034 subpage
20035 title=[[Subpage test]]
20036 !! wikitext
20037 Poked at a [[/subpage|neat little page]] here...
20038 !! html
20039 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20040 !!end
20041
20042 !! test
20043 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20044 !! options
20045 comment
20046 title=[[Subpage test]]
20047 !! wikitext
20048 Poked at a [[/subpage]] here...
20049 !! html
20050 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...
20051 !!end
20052
20053 !! test
20054 Edit comment with bare anchor link (local, as on diff)
20055 !! options
20056 comment
20057 local
20058 title=[[Main Page]]
20059 !! wikitext
20060 [[#section]]
20061 !! html
20062 <a href="#section">#section</a>
20063 !! end
20064
20065 !! test
20066 Edit comment with bare anchor link (non-local, as on history)
20067 !! options
20068 comment
20069 title=[[Main Page]]
20070 !! wikitext
20071 [[#section]]
20072 !! html
20073 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20074 !! end
20075
20076 !! test
20077 Anchor starting with underscore
20078 !! wikitext
20079 [[#_ref|One]]
20080 !! html
20081 <p><a href="#_ref">One</a>
20082 </p>
20083 !! end
20084
20085 !! test
20086 Id starting with underscore
20087 !! wikitext
20088 <div id="_ref"></div>
20089 !! html
20090 <div id="_ref"></div>
20091
20092 !! end
20093
20094 !! test
20095 Space normalisation on autocomment (bug 22784)
20096 !! options
20097 comment
20098 title=[[Main Page]]
20099 !! wikitext
20100 /* __hello__world__ */
20101 !! html
20102 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20103 !! end
20104
20105 !! test
20106 percent-encoding and + signs in comments (Bug 26410)
20107 !! options
20108 comment
20109 !! wikitext
20110 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20111 !! html/php
20112 <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>
20113 !! end
20114
20115 # Parsoid doesn't support this yet: see bug 73581
20116 # but it *should* omit the 'src' attribute if the image is bad.
20117 # PHP side of tests was disabled in
20118 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20119 # because of issues in the PHP parserTests infrastructure
20120 # (but the output below is indeed what the PHP side emits)
20121 !! test
20122 Bad images - basic functionality
20123 !! wikitext
20124 [[File:Bad.jpg]]
20125 !! DISABLED/html/php
20126 !! html/parsoid
20127 <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>
20128 !! end
20129
20130 !! test
20131 Bad images - bug 16039: text after bad image disappears
20132 !! wikitext
20133 Foo bar
20134 [[File:Bad.jpg]]
20135 Bar foo
20136 !! DISABLED/html/php
20137 <p>Foo bar
20138 </p><p>Bar foo
20139 </p>
20140 !! html/parsoid
20141 <p>Foo bar
20142 <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>
20143 Bar foo</p>
20144 !! end
20145
20146 !! test
20147 Verify that displaytitle works (bug #22501) no displaytitle
20148 !! options
20149 showtitle
20150 !! config
20151 wgAllowDisplayTitle=true
20152 wgRestrictDisplayTitle=false
20153 !! wikitext
20154 this is not the the title
20155 !! html/php
20156 Parser test
20157 <p>this is not the the title
20158 </p>
20159 !! end
20160
20161 !! test
20162 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20163 !! options
20164 showtitle
20165 title=[[Screen]]
20166 !! config
20167 wgAllowDisplayTitle=true
20168 wgRestrictDisplayTitle=false
20169 !! wikitext
20170 this is not the the title
20171 {{DISPLAYTITLE:whatever}}
20172 !! html/php
20173 whatever
20174 <p>this is not the the title
20175 </p>
20176 !! end
20177
20178 !! test
20179 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20180 !! options
20181 showtitle
20182 title=[[Screen]]
20183 !! config
20184 wgAllowDisplayTitle=true
20185 wgRestrictDisplayTitle=true
20186 !! wikitext
20187 this is not the the title
20188 {{DISPLAYTITLE:whatever}}
20189 !! html/php
20190 Screen
20191 <p>this is not the the title
20192 </p>
20193 !! end
20194
20195 !! test
20196 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20197 !! options
20198 showtitle
20199 title=[[Screen]]
20200 !! config
20201 wgAllowDisplayTitle=true
20202 wgRestrictDisplayTitle=true
20203 !! wikitext
20204 this is not the the title
20205 {{DISPLAYTITLE:screen}}
20206 !! html/php
20207 screen
20208 <p>this is not the the title
20209 </p>
20210 !! end
20211
20212 !! test
20213 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20214 !! options
20215 showtitle
20216 title=[[Screen]]
20217 !! config
20218 wgAllowDisplayTitle=false
20219 !! wikitext
20220 this is not the the title
20221 {{DISPLAYTITLE:screen}}
20222 !! html/php
20223 Screen
20224 <p>this is not the the title
20225 <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>
20226 </p>
20227 !! end
20228
20229 !! test
20230 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20231 !! options
20232 showtitle
20233 title=[[Screen]]
20234 !! config
20235 wgAllowDisplayTitle=false
20236 !! wikitext
20237 this is not the the title
20238 !! html/php
20239 Screen
20240 <p>this is not the the title
20241 </p>
20242 !! end
20243
20244 !! test
20245 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20246 !! options
20247 showtitle
20248 title=[[Screen]]
20249 !! config
20250 wgAllowDisplayTitle=true
20251 wgRestrictDisplayTitle=true
20252 !! wikitext
20253 this is not the the title
20254 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20255 !! html/php
20256 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20257 <p>this is not the the title
20258 </p>
20259 !! end
20260
20261 !! test
20262 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20263 !! options
20264 showtitle
20265 title=[[Screen]]
20266 !! config
20267 wgAllowDisplayTitle=true
20268 wgRestrictDisplayTitle=true
20269 !! wikitext
20270 this is not the the title
20271 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20272 !! html/php
20273 <span style="color: red;">s</span>creen
20274 <p>this is not the the title
20275 </p>
20276 !! end
20277
20278 !! test
20279 Page status indicators: Empty name is invalid
20280 !! options
20281 showindicators
20282 !! wikitext
20283 <indicator name=" "></indicator>
20284 <indicator></indicator>
20285 !! html
20286 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20287 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20288 </p>
20289 !! end
20290
20291 !! test
20292 Page status indicators: Weird syntaxes that are okay
20293 !! options
20294 showindicators
20295 !! wikitext
20296 <indicator name="empty" />
20297 <indicator name="name"></indicator>
20298 !! html
20299 empty=
20300 name=
20301 <p><br />
20302 </p>
20303 !! end
20304
20305 !! test
20306 Page status indicators: Torture test
20307 !! options
20308 showindicators
20309 !! wikitext
20310 <indicator name="01">hello world</indicator>
20311 <indicator name="02">[[Main Page]]</indicator>
20312 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20313 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20314 <indicator name="05">* foo
20315 * bar</indicator>
20316 <indicator name="06"><nowiki>foo</nowiki></indicator>
20317 <indicator name="07"> Preformatted</indicator>
20318 <indicator name="08"><div>Broken tag</indicator>
20319 <indicator name="09">{| class=wikitable
20320 | cell
20321 |}</indicator>
20322 <indicator name="10">Two
20323
20324 paragraphs</indicator>
20325 !! html
20326 01=hello world
20327 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20328 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" />
20329 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>
20330 05=<ul><li> foo</li>
20331 <li> bar</li></ul>
20332
20333 06=foo
20334 07=<pre>Preformatted
20335 </pre>
20336 08=<div>Broken tag</div>
20337
20338 09=<table class="wikitable">
20339 <tr>
20340 <td> cell
20341 </td></tr></table>
20342
20343 10=<p>Two
20344 </p><p>paragraphs
20345 </p>
20346 <p><br />
20347 </p><p><br />
20348 </p><p><br />
20349 </p><p><br />
20350 </p><p><br />
20351 </p>
20352 !! end
20353
20354 !! test
20355 preload: check <noinclude> and <includeonly>
20356 !! options
20357 preload
20358 !! wikitext
20359 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20360 !! html/php
20361 Hello kind world.
20362 !! end
20363
20364 !! test
20365 preload: check <onlyinclude>
20366 !! options
20367 preload
20368 !! wikitext
20369 Goodbye <onlyinclude>Hello world</onlyinclude>
20370 !! html/php
20371 Hello world
20372 !! end
20373
20374 !! test
20375 preload: can pass tags through if we want to
20376 !! options
20377 preload
20378 !! wikitext
20379 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20380 !! html/php
20381 <includeonly>Hello world</includeonly>
20382 !! end
20383
20384 !! test
20385 preload: check that it doesn't try to do tricks
20386 !! options
20387 preload
20388 !! wikitext
20389 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20390 !! html/php
20391 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20392 !! end
20393
20394 !! test
20395 Play a bit with r67090 and bug 3158
20396 !! wikitext
20397 <div style="width:50% !important">&nbsp;</div>
20398 <div style="width:50%&nbsp;!important">&nbsp;</div>
20399 <div style="width:50%&#160;!important">&nbsp;</div>
20400 <div style="border : solid;">&nbsp;</div>
20401 !! html/php
20402 <div style="width:50% !important">&#160;</div>
20403 <div style="width:50% !important">&#160;</div>
20404 <div style="width:50% !important">&#160;</div>
20405 <div style="border&#160;: solid;">&#160;</div>
20406
20407 !! html/parsoid
20408 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20409 <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>
20410 <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>
20411 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20412
20413 !! end
20414
20415 !! test
20416 HTML5 data attributes
20417 !! wikitext
20418 <span data-foo="bar">Baz</span>
20419 <p data-abc-def_hij="">Quuz</p>
20420 !! html
20421 <p><span data-foo="bar">Baz</span>
20422 </p>
20423 <p data-abc-def_hij="">Quuz</p>
20424
20425 !! end
20426
20427 !! test
20428 percent-encoding and + signs in internal links (Bug 26410)
20429 !! wikitext
20430 [[User:+%]] [[Page+title%]]
20431 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20432 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20433 [[%33%45]] [[%33%45+]]
20434 !! html/php
20435 <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>
20436 <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>
20437 <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>
20438 <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>
20439 </p>
20440 !! html/parsoid
20441 <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>
20442 <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>
20443 <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>
20444 <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>
20445 !! end
20446
20447 !! test
20448 Special characters in embedded file links (bug 27679)
20449 !! wikitext
20450 [[File:Contains & ampersand.jpg]]
20451 [[File:Does not exist.jpg|Title with & ampersand]]
20452 !! html/php
20453 <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>
20454 <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>
20455 </p>
20456 !! html/parsoid
20457 <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>
20458 <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>
20459 !! end
20460
20461 !! test
20462 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20463 !! wikitext
20464 Text&apos;s been normalized?
20465 !! html
20466 <p>Text&#39;s been normalized?
20467 </p>
20468 !! end
20469
20470 !! test
20471 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20472 !! wikitext
20473 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20474 !! html
20475 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20476 </p>
20477 !! end
20478
20479 !! test
20480 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20481 !! wikitext
20482 [http://www.example.org/ ideograms]
20483 !! html
20484 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20485 </p>
20486 !! end
20487
20488 !! test
20489 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20490 !! wikitext
20491 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20492 !! html
20493 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20494 </p>
20495 !! end
20496
20497 !! article
20498 Mediawiki:loop1
20499 !! text
20500 {{Identical|A}}
20501 !! endarticle
20502
20503 !! article
20504 Mediawiki:loop2
20505 !! text
20506 {{Identical|B}}
20507 !! endarticle
20508
20509 !! article
20510 Template:Identical
20511 !! text
20512 {{int:loop1}}
20513 {{int:loop2}}
20514 !! endarticle
20515
20516 !! test
20517 Bug 31098 Template which includes system messages which includes the template
20518 !! wikitext
20519 {{Identical}}
20520 !! html
20521 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20522 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20523 </p>
20524 !! end
20525
20526 !! test
20527 Bug31490 Turkish: ucfirst 'blah'
20528 !! options
20529 language=tr
20530 !! wikitext
20531 {{ucfirst:blah}}
20532 !! html
20533 <p>Blah
20534 </p>
20535 !! end
20536
20537 !! test
20538 Bug31490 Turkish: ucfirst 'ix'
20539 !! options
20540 language=tr
20541 !! wikitext
20542 {{ucfirst:ix}}
20543 !! html
20544 <p>İx
20545 </p>
20546 !! end
20547
20548 !! test
20549 Bug31490 Turkish: lcfirst 'BLAH'
20550 !! options
20551 language=tr
20552 !! wikitext
20553 {{lcfirst:BLAH}}
20554 !! html
20555 <p>bLAH
20556 </p>
20557 !! end
20558
20559 !! test
20560 Bug31490 Turkish: ucfırst (with a dotless i)
20561 !! options
20562 language=tr
20563 !! wikitext
20564 {{ucfırst:blah}}
20565 !! html
20566 <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>
20567 </p>
20568 !! end
20569
20570 !! test
20571 Bug31490 ucfırst (with a dotless i) with English language
20572 !! options
20573 language=en
20574 !! wikitext
20575 {{ucfırst:blah}}
20576 !! html
20577 <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>
20578 </p>
20579 !! end
20580
20581 !! test
20582 Bug 26375: TOC with italics
20583 !! options
20584 title=[[Main Page]]
20585 !! wikitext
20586 __TOC__
20587 == ''Lost'' episodes ==
20588 !! html
20589 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20590 <ul>
20591 <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>
20592 </ul>
20593 </div>
20594
20595 <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>
20596
20597 !! end
20598
20599 !! test
20600 Bug 26375: TOC with bold
20601 !! options
20602 title=[[Main Page]]
20603 !! wikitext
20604 __TOC__
20605 == '''should be bold''' then normal text ==
20606 !! html
20607 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20608 <ul>
20609 <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>
20610 </ul>
20611 </div>
20612
20613 <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>
20614
20615 !! end
20616
20617 !! test
20618 Bug 33845: Headings become cursive in TOC when they contain an image
20619 !! options
20620 title=[[Main Page]]
20621 !! wikitext
20622 __TOC__
20623 == Image [[Image:foobar.jpg]] ==
20624 !! html
20625 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20626 <ul>
20627 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20628 </ul>
20629 </div>
20630
20631 <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>
20632
20633 !! end
20634
20635 !! test
20636 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20637 !! options
20638 title=[[Main Page]]
20639 !! wikitext
20640 __TOC__
20641 == <blockquote>Quote</blockquote> ==
20642 !! html
20643 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20644 <ul>
20645 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20646 </ul>
20647 </div>
20648
20649 <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>
20650
20651 !! html+tidy
20652 <p></p>
20653 <div id="toc" class="toc">
20654 <div id="toctitle">
20655 <h2>Contents</h2>
20656 </div>
20657 <ul>
20658 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20659 </ul>
20660 </div>
20661 <p></p>
20662 <h2><span class="mw-headline" id="Quote"></span></h2>
20663 <blockquote>
20664 <p><span class="mw-headline" id="Quote">Quote</span></p>
20665 </blockquote>
20666 <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>
20667 !! end
20668
20669 !! test
20670 Unclosed tags in TOC
20671 !! options
20672 title=[[Main Page]]
20673 !! wikitext
20674 __TOC__
20675 == Proof: 2 < 3 ==
20676 <small>Hanc marginis exiguitas non caperet.</small>
20677 QED
20678 !! html
20679 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20680 <ul>
20681 <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>
20682 </ul>
20683 </div>
20684
20685 <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>
20686 <p><small>Hanc marginis exiguitas non caperet.</small>
20687 QED
20688 </p>
20689 !! end
20690
20691 !! test
20692 Multiple tags in TOC
20693 !! wikitext
20694 __TOC__
20695 == <i>Foo</i> <b>Bar</b> ==
20696
20697 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20698 !! html
20699 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20700 <ul>
20701 <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>
20702 <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>
20703 </ul>
20704 </div>
20705
20706 <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>
20707 <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>
20708
20709 !! html+tidy
20710 <p></p>
20711 <div id="toc" class="toc">
20712 <div id="toctitle">
20713 <h2>Contents</h2>
20714 </div>
20715 <ul>
20716 <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>
20717 <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>
20718 </ul>
20719 </div>
20720 <p></p>
20721 <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>
20722 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20723 <blockquote>
20724 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20725 </blockquote>
20726 <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>
20727 !! end
20728
20729 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20730 # html5 tag parsing.
20731 !! test
20732 Tags with parameters in TOC
20733 !! options
20734 parsoid=wt2html
20735 !! wikitext
20736 __TOC__
20737 == <sup class="in-h2">Hello</sup> ==
20738
20739 == <sup class="a > b">Evilbye</sup> ==
20740 !! html/php
20741 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20742 <ul>
20743 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20744 <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>
20745 </ul>
20746 </div>
20747
20748 <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>
20749 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20750
20751 !! html/parsoid
20752 <meta property="mw:PageProp/toc" />
20753 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
20754
20755 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
20756 !! end
20757
20758 !! test
20759 span tags with directionality in TOC
20760 !! wikitext
20761 __TOC__
20762 == <span dir="ltr">C++</span> ==
20763
20764 == <span dir="rtl">זבנג!</span> ==
20765
20766 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20767
20768 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20769
20770 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20771 !! html
20772 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20773 <ul>
20774 <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>
20775 <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>
20776 <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>
20777 <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>
20778 <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>
20779 </ul>
20780 </div>
20781
20782 <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>
20783 <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>
20784 <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>
20785 <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>
20786 <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>
20787
20788 !! end
20789
20790 !! test
20791 Bug 72884: bdi element in ToC
20792 !! wikitext
20793 __TOC__
20794 == <bdi>test</bdi> ==
20795 !! html
20796 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20797 <ul>
20798 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20799 </ul>
20800 </div>
20801
20802 <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>
20803
20804 !! end
20805
20806 # Note that the html output does not have the <p></p>, but the
20807 # html+tidy output *does*. This is because the empty <p></p> is
20808 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20809 !! test
20810 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20811 !! wikitext
20812 __TOC__
20813 == x ==
20814 !! html
20815 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20816 <ul>
20817 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20818 </ul>
20819 </div>
20820
20821 <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>
20822
20823 !! html+tidy
20824 <p></p>
20825 <div id="toc" class="toc">
20826 <div id="toctitle">
20827 <h2>Contents</h2>
20828 </div>
20829 <ul>
20830 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20831 </ul>
20832 </div>
20833 <p></p>
20834 <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>
20835 !! end
20836
20837 !! article
20838 MediaWiki:Bug32057
20839 !! text
20840 == {{int:headline_sample}} ==
20841 !! endarticle
20842
20843 !! test
20844 Bug 32057: Title needed when expanding <h> nodes.
20845 !! options
20846 title=[[Main Page]]
20847 !! wikitext
20848 {{int:Bug32057}}
20849 !! html
20850 <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>
20851
20852 !! end
20853
20854 !! test
20855 Strip marker in urlencode
20856 !! wikitext
20857 {{urlencode:x<nowiki/>y}}
20858 {{urlencode:x<nowiki/>y|wiki}}
20859 {{urlencode:x<nowiki/>y|path}}
20860 {{urlencode:x<pre id="one">two</pre>y}}
20861 !! html
20862 <p>xy
20863 xy
20864 xy
20865 xy
20866 </p>
20867 !! end
20868
20869 !! test
20870 Strip marker in lc
20871 !! wikitext
20872 {{lc:x<nowiki/>y}}
20873 !! html
20874 <p>xy
20875 </p>
20876 !! end
20877
20878 !! test
20879 Strip marker in uc
20880 !! wikitext
20881 {{uc:x<nowiki/>y}}
20882 !! html
20883 <p>XY
20884 </p>
20885 !! end
20886
20887 !! test
20888 Strip marker in formatNum
20889 !! wikitext
20890 {{formatnum:1<nowiki/>2}}
20891 {{formatnum:1<nowiki/>2|R}}
20892 !! html
20893 <p>12
20894 12
20895 </p>
20896 !! end
20897
20898 !! test
20899 Check noCommafy in formatNum
20900 !! options
20901 language=be-tarask
20902 !! wikitext
20903 {{formatnum:123456.78}}
20904 {{formatnum:123456.78|NOSEP}}
20905 !! html
20906 <p>123 456,78
20907 123456.78
20908 </p>
20909 !! end
20910
20911 !! test
20912 Wrong option for formatNum (bug 56199)
20913 !! wikitext
20914 {{formatnum:1,234.56|Random}}
20915 {{formatnum:1,234.56|EVERYTHING}}
20916 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20917 !! html
20918 <p>1,234.56
20919 1,234.56
20920 1,234.56
20921 </p>
20922 !! end
20923
20924 !! test
20925 Strip marker in grammar
20926 !! options
20927 language=fi
20928 !! wikitext
20929 {{grammar:elative|foo<nowiki/>bar}}
20930 !! html
20931 <p>foobarista
20932 </p>
20933 !! end
20934
20935 !! test
20936 Strip marker in padleft
20937 !! wikitext
20938 {{padleft:|2|x<nowiki/>y}}
20939 !! html
20940 <p>xy
20941 </p>
20942 !! end
20943
20944 !! test
20945 Strip marker in padright
20946 !! wikitext
20947 {{padright:|2|x<nowiki/>y}}
20948 !! html
20949 <p>xy
20950 </p>
20951 !! end
20952
20953 !! test
20954 Strip marker in anchorencode
20955 !! wikitext
20956 {{anchorencode:x<nowiki/>y}}
20957 !! html
20958 <p>xy
20959 </p>
20960 !! end
20961
20962 !! test
20963 nowiki inside link inside heading (bug 18295)
20964 !! wikitext
20965 ==[[foo|x<nowiki>y</nowiki>z]]==
20966 !! html
20967 <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>
20968
20969 !! end
20970
20971 !! test
20972 new support for bdi element (bug 31817)
20973 !! wikitext
20974 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20975 !! html
20976 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20977
20978 !!end
20979
20980 !! test
20981 Ignore pipe between table row attributes
20982 !! wikitext
20983 {|
20984 | quux
20985 |- id=foo | style='color: red'
20986 | bar
20987 |}
20988 !! html
20989 <table>
20990 <tr>
20991 <td> quux
20992 </td></tr>
20993 <tr id="foo" style="color: red">
20994 <td> bar
20995 </td></tr></table>
20996
20997 !! end
20998
20999 !!test
21000 Gallery override link with WikiLink (bug 34852)
21001 !! wikitext
21002 <gallery>
21003 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21004 </gallery>
21005 !! html
21006 <ul class="gallery mw-gallery-traditional">
21007 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21008 <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>
21009 <div class="gallerytext">
21010 <p>caption
21011 </p>
21012 </div>
21013 </div></li>
21014 </ul>
21015
21016 !! end
21017
21018 !!test
21019 Gallery override link with absolute external link (bug 34852)
21020 !! wikitext
21021 <gallery>
21022 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21023 </gallery>
21024 !! html
21025 <ul class="gallery mw-gallery-traditional">
21026 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21027 <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>
21028 <div class="gallerytext">
21029 <p>caption
21030 </p>
21031 </div>
21032 </div></li>
21033 </ul>
21034
21035 !! end
21036
21037 !!test
21038 Gallery override link with malicious javascript (bug 34852)
21039 !! wikitext
21040 <gallery>
21041 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21042 </gallery>
21043 !! html
21044 <ul class="gallery mw-gallery-traditional">
21045 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21046 <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>
21047 <div class="gallerytext">
21048 <p>caption
21049 </p>
21050 </div>
21051 </div></li>
21052 </ul>
21053
21054 !! end
21055
21056 !!test
21057 Gallery with invalid title as link (bug 43964)
21058 !! wikitext
21059 <gallery>
21060 File:foobar.jpg|link=<
21061 </gallery>
21062 !! html
21063 <ul class="gallery mw-gallery-traditional">
21064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21065 <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>
21066 <div class="gallerytext">
21067 </div>
21068 </div></li>
21069 </ul>
21070
21071 !! end
21072
21073 !!test
21074 Language parser function
21075 !! wikitext
21076 {{#language:ar}}
21077 !! html
21078 <p>العربية
21079 </p>
21080 !! end
21081
21082 !!test
21083 Padleft and padright as substr
21084 !! wikitext
21085 {{padleft:|3|abcde}}
21086 {{padright:|3|abcde}}
21087 !! html
21088 <p>abc
21089 abc
21090 </p>
21091 !! end
21092
21093 !!test
21094 Special parser function
21095 !! wikitext
21096 {{#special:RandomPage}}
21097 {{#special:BaDtItLe}}
21098 {{#special:Foobar}}
21099 !! html
21100 <p>Special:Random
21101 Special:Badtitle
21102 Special:Foobar
21103 </p>
21104 !! end
21105
21106 !!test
21107 Bug 34939 - Case insensitive link parsing ([HttP://])
21108 !! wikitext
21109 [HttP://MediaWiki.Org/]
21110 !! html/php
21111 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21112 </p>
21113 !! html/parsoid
21114 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21115 !! end
21116
21117 !!test
21118 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21119 !! wikitext
21120 [HttP://MediaWiki.Org/ MediaWiki]
21121 !! html
21122 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21123 </p>
21124 !! end
21125
21126 !!test
21127 Bug 34939 - Case insensitive link parsing (HttP://)
21128 !! wikitext
21129 HttP://MediaWiki.Org/
21130 !! html/php
21131 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21132 </p>
21133 !! html/parsoid
21134 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21135 !! end
21136
21137 !!test
21138 Disable TOC
21139 !! options
21140 notoc
21141 !! wikitext
21142 Lead
21143 == Section 1 ==
21144 == Section 2 ==
21145 == Section 3 ==
21146 == Section 4 ==
21147 == Section 5 ==
21148 !! html
21149 <p>Lead
21150 </p>
21151
21152 <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>
21153 <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>
21154 <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>
21155 <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>
21156 <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>
21157
21158 !! end
21159
21160
21161 ###
21162 ### Parsoid-specific tests
21163 ### Parsoid-PHP parser incompatibilities
21164 ###
21165 !!test
21166 1. SOL-sensitive wikitext tokens as template-args
21167 !!options
21168 parsoid=wt2html,wt2wt
21169 !! wikitext
21170 {{echo|*a}}
21171 {{echo|#a}}
21172 {{echo|:a}}
21173 !! html
21174 <span about="#mwt1" typeof="mw:Transclusion">
21175 </span><ul about="#mwt1"><li>a</li>
21176 </ul>
21177 <span about="#mwt2" typeof="mw:Transclusion">
21178 </span><ol about="#mwt2"><li>a</li>
21179 </ol>
21180 <span about="#mwt3" typeof="mw:Transclusion">
21181 </span><dl about="#mwt3"><dd>a</dd>
21182 </dl>
21183 !!end
21184
21185 #### -----------------------------------------------------------------
21186 #### Parsoid-specific functionality tests
21187 #### -----------------------------------------------------------------
21188
21189 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21190 # We know wt2wt will fail, but we expect selser to pass.
21191 # Due to the nature of our testing, wt2wt and selser tests will enter the
21192 # blacklist and we'll catch selser regressions based on changes to the
21193 # blacklist entries for selser tests.
21194 !! test
21195 1. Bad treebuilder fixup of formatting elt is cleaned up
21196 !! options
21197 parsoid=wt2html,wt2wt
21198 !! wikitext
21199 {|
21200 |
21201 <small>
21202 [[Image:Foobar.jpg|right|Test]]
21203 </small>
21204 |}
21205 !! html/parsoid
21206 <table>
21207 <tbody><tr><td>
21208 <small>
21209 <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>
21210 </small>
21211 </td></tr>
21212 </tbody></table>
21213 !! end
21214
21215 !! test
21216 2. Bad treebuilder fixup of formatting elt is cleaned up
21217 !! options
21218 parsoid=wt2html,wt2wt
21219 !! wikitext
21220 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21221
21222 <small>[[Image:Foobar.jpg|right|300px]]</small>
21223 !! html/parsoid
21224
21225 <p><b>foo</b></p>
21226 <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>
21227 <p><b>bar</b></p>
21228 <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>
21229 !! end
21230
21231 !! test
21232 3. Bad treebuilder fixup of formatting elt is cleaned up
21233 !! options
21234 parsoid=wt2html,wt2wt
21235 !! wikitext
21236 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21237 !! html/parsoid
21238 <p><small><b>foo</b></small></p>
21239 <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>
21240 <p><small><b>bar</b></small></p>
21241 !! end
21242
21243 !! test
21244 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21245 !! options
21246 parsoid=wt2html,wt2wt
21247 !! wikitext
21248 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21249 !! html/parsoid
21250 <p><b><small></small></b></p>
21251 <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>
21252 <p></p>
21253 !! end
21254
21255 #### ----------------------------------------------------------------
21256 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21257 #### tags. Parsoid's output for these tags differs from that of the
21258 #### PHP parser.
21259 #### ----------------------------------------------------------------
21260
21261 !!test
21262 Ref: 1. ref-location should be replaced with an index span
21263 !!options
21264 parsoid
21265 !! wikitext
21266 A <ref>foo</ref>
21267 B <ref name="x">foo</ref>
21268 C <ref name="y" />
21269 <references />
21270 !! html
21271 <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>
21272 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>
21273 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>
21274 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21275 <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>
21276 <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>
21277 <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>
21278 </ol>
21279 !!end
21280
21281 !!test
21282 Ref: 2. ref-tags with identical names should all get the same index
21283 !!options
21284 parsoid
21285 !! wikitext
21286 A <ref name="x">foo</ref>
21287 B <ref name="x" />
21288 <references />
21289 !! html
21290 <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>
21291 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>
21292 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21293 <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>
21294 </ol>
21295 !!end
21296
21297 !!test
21298 Ref: 3. spaces in ref-names should be ignored
21299 !!options
21300 parsoid
21301 !! wikitext
21302 A <ref name="x">foo</ref>
21303 B <ref name=" x " />
21304 C <ref name= x />
21305 <references />
21306 !! html
21307 <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>
21308 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>
21309 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>
21310 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21311 <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>
21312 </ol>
21313 !!end
21314
21315 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21316 !!test
21317 Ref: 4. 'constructor' should be accepted as a valid ref-name
21318 !!options
21319 parsoid
21320 !! wikitext
21321 A <ref name="constructor">foo</ref>
21322 <references />
21323 !! html
21324 <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>
21325 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21326 <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>
21327 </ol>
21328 !!end
21329
21330 !!test
21331 Ref: 5. body should accept generic wikitext
21332 !!options
21333 parsoid
21334 !! wikitext
21335 A <ref>
21336 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21337 </ref>
21338
21339 <references />
21340 !! html
21341 <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>
21342
21343 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21344 <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>
21345 </span></li>
21346 </ol>
21347 !!end
21348
21349 !!test
21350 Ref: 6. indent-pres should not be output in ref-body
21351 !!options
21352 parsoid
21353 !! wikitext
21354 A <ref>
21355 foo
21356 bar
21357 baz
21358 </ref>
21359
21360 <references />
21361 !! html
21362 <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>
21363
21364 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21365 <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
21366 bar
21367 baz
21368 </span></li>
21369 </ol>
21370 !!end
21371
21372 !!test
21373 Ref: 7. No p-wrapping in ref-body
21374 !!options
21375 parsoid
21376 !! wikitext
21377 A <ref>
21378 foo
21379
21380 bar
21381
21382
21383 baz
21384
21385
21386
21387 booz
21388 </ref>
21389
21390 <references />
21391 !! html
21392 <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>
21393
21394 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21395 <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
21396
21397 bar
21398
21399
21400 baz
21401
21402
21403
21404 booz
21405 </span></li>
21406 </ol>
21407 !!end
21408
21409 !!test
21410 Ref: 8. transclusion wikitext has lower precedence
21411 !!options
21412 parsoid
21413 !! wikitext
21414 A <ref> foo {{echo|</ref> B C}}
21415
21416 <references />
21417 !! html
21418 <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>
21419 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21420 <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>
21421 </ol>
21422 !!end
21423
21424 !!test
21425 Ref: 9. unclosed comments should not leak out of ref-body
21426 !!options
21427 parsoid
21428 !! wikitext
21429 A <ref> foo <!--</ref> B C
21430 <references />
21431 !! html
21432 <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>
21433 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21434 <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>
21435 </ol>
21436 !!end
21437
21438 !!test
21439 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21440 !!options
21441 parsoid
21442 !! wikitext
21443 A <ref> <b> foo </ref> B C
21444
21445 <references />
21446 !! html
21447 <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>
21448
21449
21450 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21451 <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>
21452 </ol>
21453 !!end
21454
21455 !!test
21456 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21457 !!options
21458 parsoid
21459 !! wikitext
21460 A <ref>foo</ref> B
21461 C <ref>bar</ref> D
21462 <references />
21463 !! html
21464 <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
21465 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>
21466 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21467 <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>
21468 <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>
21469 </ol>
21470 !!end
21471
21472 !!test
21473 Ref: 12. ref-tags act as trailing newline migration barrier
21474 !! wikitext
21475 <!--the newline at the end of this line moves out of the p tag-->a
21476
21477 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21478 <ref />
21479
21480 c
21481 <references />
21482 !! html/parsoid
21483 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21484
21485
21486 <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>
21487 <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>
21488
21489 <p>c</p>
21490 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21491 <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>
21492 <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>
21493 !!end
21494
21495 !!test
21496 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21497 !!options
21498 parsoid
21499 !! wikitext
21500 <ref>foo</ref> A
21501 <ref>bar
21502 </ref> B
21503 <references />
21504 !! html
21505 <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
21506 <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>
21507 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21508 <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>
21509 <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
21510 </span></li>
21511 </ol>
21512 !!end
21513
21514 !!test
21515 Ref: 14. A nested ref-tag should be emitted as plain text
21516 !!options
21517 parsoid
21518 !! wikitext
21519 <ref>foo <ref>bar</ref> baz</ref>
21520
21521 <references />
21522 !! html
21523 <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>
21524 </p>
21525 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21526 <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>
21527 </ol>
21528 !!end
21529
21530 !!test
21531 Ref: 15. ref-tags with identical names should get identical indexes
21532 !!options
21533 parsoid
21534 !! wikitext
21535 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21536 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21537
21538 <references />
21539 !! html
21540 <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>
21541 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>
21542
21543 <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>
21544 </ol>
21545 !!end
21546
21547 ## We don't bother wt2wt-ing non-standard whitespace
21548 !!test
21549 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21550 !!options
21551 parsoid=wt2html
21552 !! wikitext
21553 A <ref >foo</ref >
21554
21555 <references />
21556 !! html
21557 <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>
21558 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21559 <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>
21560 !!end
21561
21562 !!test
21563 Ref: 17. Generate valid HTML5 id/about attributes
21564 !!options
21565 parsoid
21566 !!wikitext
21567 <ref name="a b">foo</ref>
21568
21569 <references />
21570 !!html
21571 <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>
21572 </p>
21573
21574 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21575 <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>
21576 </ol>
21577 !!end
21578
21579 !!test
21580 Ref: 18. T58916: Extension attributes should be parsed as plain text
21581 !!options
21582 parsoid
21583 !!wikitext
21584 <ref name="{{echo|a}}">foo</ref>
21585
21586 <references />
21587 !!html
21588 <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>
21589 </p>
21590
21591 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21592 <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>
21593 </ol>
21594 !!end
21595
21596 !!test
21597 Ref: 19. ref-tags with identical name encodings should get identical indexes
21598 !!options
21599 parsoid
21600 !! wikitext
21601 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21602
21603 <references />
21604 !! html
21605 <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>
21606 </p>
21607 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21608 <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>
21609 </ol>
21610 !!end
21611
21612 !!test
21613 Ref: 20. ref-tags with identical names but different content should keep it
21614 !!options
21615 parsoid
21616 !! wikitext
21617 A <ref name="foo">Foo one</ref>
21618 B <ref name="foo">Foo two</ref>
21619 C <ref name="foo" />
21620
21621 <references />
21622 !! html
21623 <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>
21624 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>
21625 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>
21626
21627 <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>
21628 </ol>
21629 !!end
21630
21631 !!test
21632 References: 1. references tag without any refs should be handled properly
21633 !! wikitext
21634 <references />
21635 !! html/parsoid
21636 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21637 !!end
21638
21639 !!test
21640 References: 2. references tag with group only outputs references from that group
21641 !! wikitext
21642 A <ref group="a">foo</ref>
21643 B <ref group="b">bar</ref>
21644 C <ref>baz</ref>
21645
21646 <references group="a" />
21647 <references />
21648 <references group="b" />
21649 !! html/parsoid
21650 <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>
21651 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>
21652 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>
21653
21654 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21655 <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>
21656 </ol>
21657 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21658 <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>
21659 </ol>
21660 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21661 <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>
21662 </ol>
21663 !!end
21664
21665 !!test
21666 References: 3. ref list should be cleared after processing references
21667 !! wikitext
21668 A <ref>foo</ref>
21669
21670 <references />
21671
21672 B <ref>bar</ref>
21673
21674 <references />
21675 !! html/parsoid
21676 <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>
21677
21678 <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>
21679 </ol>
21680
21681 <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>
21682
21683 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21684 <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>
21685 </ol>
21686 !!end
21687
21688 !!test
21689 References: 4. only referenced group should be cleared after processing references
21690 !! wikitext
21691 A <ref group="a">afoo</ref>
21692 B <ref>bfoo</ref>
21693
21694 <references group="a" />
21695
21696 C <ref>cfoo</ref>
21697
21698 <references />
21699 !! html/parsoid
21700 <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>
21701 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>
21702
21703 <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>
21704 </ol>
21705
21706 <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>
21707
21708 <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>
21709 </ol>
21710 !!end
21711
21712 !!test
21713 References: 5. ref tags in references should be processed while ignoring all other content
21714 !! wikitext
21715 A <ref name="a" />
21716 B <ref name="b">bar</ref>
21717
21718 <references>
21719 <ref name="a">foo</ref>
21720 This should just get lost.
21721 </references>
21722 !! html/parsoid
21723 <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>
21724 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>
21725
21726
21727 <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>
21728 </ol>
21729 !!end
21730
21731 !!test
21732 References: 6. <references /> from a transclusion
21733 !! wikitext
21734 <ref>Foo</ref> {{echo|<references />}}
21735 !! html/parsoid
21736 <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>
21737 </ol>
21738 !!end
21739
21740 !! test
21741 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21742 !! wikitext
21743 A <ref>foo bar for a</ref>
21744 B <ref group="X" name="b" />
21745
21746 <references />
21747
21748 <references group="X">
21749 <ref name="b">foo</ref>
21750 </references>
21751 !! html/parsoid
21752 <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>
21753 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>
21754 </p>
21755
21756 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21757 <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>
21758 </ol>
21759
21760 <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"}}'>
21761 <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>
21762 </ol>
21763 !! end
21764
21765 !! test
21766 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21767 !! wikitext
21768 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21769 <references />
21770 !! html/parsoid
21771 <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>
21772 <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>
21773 </ol>
21774 !!end
21775
21776 # This test only works in wt2html now as the <references /> are always generated
21777 # unless selser is active. Once T72722 is fixed, we should add a changes test
21778 # here to ensure that unrelated changes don't add the new <references /> in
21779 # wt2wt.
21780 !! test
21781 References: 9. Generate missing references list at the end
21782 !! wikitext
21783 A <ref>foo</ref>
21784 B <ref group="inexistent">bar</ref>
21785 !! html/parsoid
21786 <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>
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21788 <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>
21789 </ol>
21790 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21791 <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>
21792 </ol>
21793 !! end
21794
21795 !! test
21796 References: 10. New <references/> shouldn't be added for unrelated edits.
21797 !! options
21798 parsoid={
21799 "modes": ["selser"],
21800 "changes": [["#x", "remove"]],
21801 "selser": "noauto"
21802 }
21803 !! wikitext
21804 Unrelated text<span id="x"> that's going to disappear</span>.
21805 A <ref>foo</ref>
21806 !! wikitext/edited
21807 Unrelated text.
21808 A <ref>foo</ref>
21809 !!end
21810
21811 !! test
21812 Entities in ref name
21813 !! wikitext
21814 <ref name="test &amp; me">hi</ref>
21815 <references />
21816 !! html/parsoid
21817 <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>
21818 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21819 <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>
21820 </ol>
21821 !! end
21822
21823 # This test is wt2html only because we're permitting the serializer to produce
21824 # dirty diffs, normalizing the unclosed references to the self-closed version.
21825 !! test
21826 Generate references for unclosed references tag
21827 !! options
21828 parsoid=wt2html
21829 !! wikitext
21830 a<ref>foo</ref>
21831
21832 <references>
21833 !! html/parsoid
21834 <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>
21835 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21836 <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>
21837 !! end
21838
21839 !! test
21840 New reference serializes on its own line
21841 !! options
21842 parsoid=wt2wt,html2wt
21843 !! wikitext
21844 foo
21845 <references />
21846 !! html/parsoid
21847 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21848 !! end
21849
21850 #### ----------------------------------------------------------------
21851 #### Parsoid-only testing of Parsoid's impl of LST
21852 #### Not implemented yet, see
21853 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21854 #### ----------------------------------------------------------------
21855
21856 !!test
21857 LST Sections: 1. Simple section start and end
21858 !! wikitext
21859 <section begin="2011-05-16" />
21860 <section end="2014-04-10 (MW 1.23wmf22)" />
21861 !! html/parsoid
21862 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21863 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21864 !! end
21865
21866 #--------- Test stripping of empty nodes in template content ----------
21867 !!test
21868 Empty LI and TR nodes should be stripped from template content
21869 !!wikitext
21870 {{EmptyLITest}}
21871 {{EmptyTRTest}}
21872 !!html/parsoid
21873 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21874 <li>a</li>
21875 <li>b</li>
21876 </ul>
21877 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21878 <tbody>
21879 <tr>
21880 <td>foo</td>
21881 </tr>
21882 <tr>
21883 <td>bar</td>
21884 </tr>
21885 </tbody>
21886 </table>
21887 !!end
21888
21889 !!test
21890 Empty LI and TR nodes should not be stripped from top-level content
21891 !!wikitext
21892 * a
21893 *
21894 * b
21895 {|
21896 |-
21897 |-
21898 |foo
21899 |}
21900 !!html/parsoid
21901 <ul>
21902 <li> a</li>
21903 <li></li>
21904 <li> b</li>
21905 </ul>
21906 <table>
21907 <tbody>
21908 <tr></tr>
21909 <tr>
21910 <td>foo</td>
21911 </tr>
21912 </tbody>
21913 </table>
21914 !!end
21915
21916 !!test
21917 Empty TR nodes should not be stripped if they have any attributes set
21918 !!wikitext
21919 {{EmptyTRWithHTMLAttrTest}}
21920 !!html/parsoid
21921 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21922 <tr align="center"></tr>
21923 <tr><td>foo</td></tr>
21924 <tr align="center"></tr>
21925 <tr><td>bar</td></tr>
21926 </table>
21927 !!end
21928
21929 #### ----------------------------------------------------------------
21930 #### The following section of tests are primarily to test
21931 #### wikitext escaping capabilities of Parsoid. Given that
21932 #### escaping can be done any number of ways, the wikitext (input)
21933 #### is always adjusted to reflect how Parsoid adds nowiki
21934 #### escape tags.
21935 ####
21936 #### We are marking several tests as parsoid-only since the
21937 #### HTML in the result section is different from what the
21938 #### PHP parser generates for it.
21939 #### ----------------------------------------------------------------
21940
21941
21942 #### --------------- Headings ---------------
21943 #### 0. Unnested
21944 #### 1. Nested inside html <h1>=foo=</h1>
21945 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21946 #### 3. Nested inside html with wikitext split by html tags
21947 #### 4. No escape needed
21948 #### 5. Empty headings <h1></h1>
21949 #### 6. Heading chars in SOL context
21950 #### ----------------------------------------
21951 !! test
21952 Headings: 0. Unnested
21953 !! options
21954 parsoid=html2wt
21955 !! html/parsoid
21956 <p>=foo=</p>
21957
21958 <p> =foo=
21959 <!--cmt-->
21960 =foo=</p>
21961
21962 <p>=foo<i>a</i>=</p>
21963 !! wikitext
21964 <nowiki>=foo=</nowiki>
21965
21966 <nowiki> </nowiki>=foo=
21967 <!--cmt-->
21968 <nowiki>=foo=</nowiki>
21969
21970 =foo''a''<nowiki>=</nowiki>
21971 !!end
21972
21973 # New headings and existing headings are handled differently
21974 !! test
21975 Headings: 1. Nested inside html
21976 !! options
21977 parsoid=html2wt
21978 !! html/parsoid
21979 <h1>=foo=</h1>
21980 <h2>=foo=</h2>
21981 <h3>=foo=</h3>
21982
21983 <h1 data-parsoid=''>=foo=</h1>
21984 <h2 data-parsoid=''>=foo=</h2>
21985 <h3 data-parsoid=''>=foo=</h3>
21986 <h4 data-parsoid=''>=foo=</h4>
21987 <h5 data-parsoid=''>=foo=</h5>
21988 <h6 data-parsoid=''>=foo=</h6>
21989 !! wikitext
21990 = =foo= =
21991
21992 == =foo= ==
21993
21994 === =foo= ===
21995
21996 =<nowiki>=foo=</nowiki>=
21997 ==<nowiki>=foo=</nowiki>==
21998 ===<nowiki>=foo=</nowiki>===
21999 ====<nowiki>=foo=</nowiki>====
22000 =====<nowiki>=foo=</nowiki>=====
22001 ======<nowiki>=foo=</nowiki>======
22002
22003 !!end
22004
22005 !! test
22006 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22007 !! options
22008 parsoid=html2wt
22009 !! html/parsoid
22010 <h1>foo</h1>*bar
22011 <h1>foo</h1>=bar
22012 <h1>foo</h1>=bar=
22013 !! wikitext
22014 = foo =
22015 <nowiki>*</nowiki>bar
22016
22017 = foo =
22018 =bar
22019
22020 = foo =
22021 <nowiki>=bar=</nowiki>
22022 !!end
22023
22024 !! test
22025 Headings: 3. Nested inside html with wikitext split by html tags
22026 !! options
22027 parsoid=html2wt
22028 !! html/parsoid
22029 <h1>=<b>bold</b>foo=</h1>
22030 !! wikitext
22031 = ='''bold'''<nowiki>foo=</nowiki> =
22032 !!end
22033
22034 !! test
22035 Headings: 4a. No escaping needed (testing just h1 and h2)
22036 !! options
22037 parsoid=html2wt
22038 !! html/parsoid
22039 <h1>=foo</h1>
22040 <h1>foo=</h1>
22041 <h1> =foo= </h1>
22042 <h1>=foo= bar</h1>
22043 <h2>=foo</h2>
22044 <h2>foo=</h2>
22045 <h1>=</h1>
22046 <h1><i>=</i>foo=</h1>
22047 !! wikitext
22048 = =foo =
22049
22050 = foo= =
22051
22052 = =foo= =
22053
22054 = =foo= bar =
22055
22056 == =foo ==
22057
22058 == foo= ==
22059
22060 = = =
22061
22062 = ''=''foo= =
22063 !!end
22064
22065 !! test
22066 Headings: 4b. No escaping needed (inside p-tags)
22067 !! options
22068 parsoid=html2wt
22069 !! html/parsoid
22070 <p>===
22071 =foo= x
22072 =foo= <s></s>
22073 </p>
22074 !! wikitext
22075 ===
22076 =foo= x
22077 =foo= <s></s>
22078 !!end
22079
22080 !! test
22081 Headings: 5. Empty headings
22082 !! options
22083 parsoid=html2wt
22084 !! html/parsoid
22085 <h1 data-parsoid='{}'></h1>
22086
22087 <h2 data-parsoid='{}'></h2>
22088
22089 <h3 data-parsoid='{}'></h3>
22090
22091 <h4 data-parsoid='{}'></h4>
22092
22093 <h5 data-parsoid='{}'></h5>
22094
22095 <h6 data-parsoid='{}'></h6>
22096 !! wikitext
22097 =<nowiki/>=
22098
22099 ==<nowiki/>==
22100
22101 ===<nowiki/>===
22102
22103 ====<nowiki/>====
22104
22105 =====<nowiki/>=====
22106
22107 ======<nowiki/>======
22108 !!end
22109
22110 !! test
22111 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22112 !! options
22113 parsoid=html2wt
22114 !! html/parsoid
22115 <p>=a=</p>
22116
22117 <p>=a=</p>
22118
22119 <p>=a=</p>
22120 !! wikitext
22121 <nowiki>=a=</nowiki>
22122
22123 <nowiki>=a=</nowiki>
22124
22125 <nowiki>=a=</nowiki>
22126 !!end
22127
22128 !! test
22129 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22130 !! options
22131 parsoid=html2wt
22132 !! html/parsoid
22133 <p>=a=
22134 b</p>
22135
22136 <p>=a=
22137 b</p>
22138
22139 <p>=a=
22140 b</p>
22141 !! wikitext
22142 <nowiki>=a=</nowiki>
22143 b
22144
22145 <nowiki>=a=</nowiki>
22146 b
22147
22148 <nowiki>=a=</nowiki>
22149 b
22150 !!end
22151
22152 !! test
22153 Headings: 6c. Heading chars in SOL context (leading newline break)
22154 !! options
22155 parsoid=html2wt
22156 !! html/parsoid
22157 <p>a
22158 =b=</p>
22159 !! wikitext
22160 a
22161 <nowiki>=b=</nowiki>
22162 !!end
22163
22164 !! test
22165 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22166 !! options
22167 parsoid=html2wt
22168 !! html/parsoid
22169 <!--c0--><p>=a=</p>
22170
22171 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22172 !! wikitext
22173 <!--c0--><nowiki>=a=</nowiki>
22174
22175 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22176 !!end
22177
22178 !! test
22179 Headings: 6d. Heading chars in SOL context (No escaping needed)
22180 !! options
22181 parsoid=html2wt
22182 !! html/parsoid
22183 =a=<div>b</div>
22184 !! wikitext
22185 =a=<div>b</div>
22186 !!end
22187
22188 !! test
22189 Headings: 7. Insert a newline between new content and headings
22190 !! options
22191 parsoid=html2wt
22192 !! html/parsoid
22193 <h2>NEW</h2>
22194 <p>new</p>
22195 <h2 data-parsoid='{}'>A</h2>
22196 <p data-parsoid='{}'>a</p>
22197 !! wikitext
22198 == NEW ==
22199 new
22200
22201 ==A==
22202 a
22203
22204 !! end
22205
22206 #### --------------- Lists ---------------
22207 #### 0. Outside nests (*foo, etc.)
22208 #### 1. Nested inside html <ul><li>*foo</li></ul>
22209 #### 2. Inside definition lists
22210 #### 3. Only bullets at start should be escaped
22211 #### 4. No escapes needed
22212 #### 5. No unnecessary escapes
22213 #### 6. Escape bullets in SOL position
22214 #### 7. Escape bullets in a multi-line context
22215 #### ----------------------------------------
22216
22217 !! test
22218 Lists: 0. Outside nests
22219 !! options
22220 parsoid=html2wt
22221 !! html/parsoid
22222 <p>*foo</p>
22223
22224 <p>#foo</p>
22225
22226 <p>;Foo:bar</p>
22227 !! wikitext
22228 <nowiki>*</nowiki>foo
22229
22230 <nowiki>#</nowiki>foo
22231
22232 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22233 !!end
22234
22235 !! test
22236 Lists: 1. Nested inside html
22237 !! options
22238 parsoid=html2wt
22239 !! html/parsoid
22240 <ul><li>*foo</li></ul>
22241 <ul><li>#foo</li></ul>
22242 <ul><li>:foo</li></ul>
22243 <ul><li>;foo</li></ul>
22244 <ol><li>*foo</li></ol>
22245 <ol><li>#foo</li></ol>
22246 <ol><li>:foo</li></ol>
22247 <ol><li>;foo</li></ol>
22248
22249 !! wikitext
22250 *<nowiki>*foo</nowiki>
22251
22252 *<nowiki>#foo</nowiki>
22253
22254 *<nowiki>:foo</nowiki>
22255
22256 *<nowiki>;foo</nowiki>
22257
22258 #<nowiki>*foo</nowiki>
22259
22260 #<nowiki>#foo</nowiki>
22261
22262 #<nowiki>:foo</nowiki>
22263
22264 #<nowiki>;foo</nowiki>
22265 !!end
22266
22267 !! test
22268 Lists: 2. Inside definition lists
22269 !! options
22270 parsoid=html2wt
22271 !! html/parsoid
22272 <dl><dt>;foo</dt></dl>
22273 <dl><dt>:foo</dt></dl>
22274 <dl><dt>:foo</dt>
22275 <dd>bar</dd></dl>
22276 <dl><dd>:foo</dd></dl>
22277
22278 !! wikitext
22279 ;<nowiki>;foo</nowiki>
22280
22281 ;<nowiki>:foo</nowiki>
22282
22283 ;<nowiki>:foo</nowiki>
22284 :bar
22285
22286 :<nowiki>:foo</nowiki>
22287 !!end
22288
22289 !! test
22290 Lists: 3. Only bullets at start of text should be escaped
22291 !! options
22292 parsoid=html2wt
22293 !! html/parsoid
22294 <ul><li>*foo*bar</li></ul>
22295 <ul><li>*foo<i>it</i>*bar</li></ul>
22296
22297 !! wikitext
22298 *<nowiki>*foo*bar</nowiki>
22299
22300 *<nowiki>*foo</nowiki>''it''*bar
22301 !!end
22302
22303 !! test
22304 Lists: 4. No escapes needed
22305 !! options
22306 parsoid=html2wt
22307 !! html/parsoid
22308 <ul>
22309 <li>foo*bar
22310 </li>
22311 </ul>
22312 <ul>
22313 <li><i>foo</i>*bar
22314 </li>
22315 </ul>
22316 <ul>
22317 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22318 </li>
22319 </ul>
22320 <ul>
22321 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22322 </li>
22323 </ul>
22324 !! wikitext
22325 *foo*bar
22326
22327 *''foo''*bar
22328
22329 *[[Foo]]: bar
22330
22331 *[[Foo]]*bar
22332 !!end
22333
22334 !! test
22335 Lists: 5. No unnecessary escapes
22336 !! options
22337 parsoid=html2wt
22338 !! html/parsoid
22339 <ul><li> bar <span>[[foo]]</span></li></ul>
22340 <ul><li> =bar <span>[[foo]]</span></li></ul>
22341 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22342 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22343 <ul><li> =bar <span>foo]]</span>=</li></ul>
22344 <ul><li> <s></s>: a</li></ul>
22345 <ul><li> <i>* foo</i></li></ul>
22346
22347 !! wikitext
22348 * bar <span><nowiki>[[foo]]</nowiki></span>
22349
22350 * =bar <span><nowiki>[[foo]]</nowiki></span>
22351
22352 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22353
22354 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22355
22356 * =bar <span>foo]]</span>=
22357
22358 * <s></s>: a
22359
22360 * ''* foo''
22361 !!end
22362
22363 !! test
22364 Lists: 6. Escape bullets in SOL position
22365 !! options
22366 parsoid=html2wt
22367 !! html/parsoid
22368 <p><!--cmt-->*foo</p>
22369 !! wikitext
22370 <!--cmt--><nowiki>*</nowiki>foo
22371 !!end
22372
22373 !! test
22374 Lists: 7. Escape bullets in a multi-line context
22375 !! options
22376 parsoid=html2wt
22377 !! html/parsoid
22378 <p>a
22379 *b
22380 </p>
22381 !! wikitext
22382 a
22383 <nowiki>*</nowiki>b
22384 !!end
22385
22386 !! test
22387 Lists: 8. Escape colons only if not present in tags
22388 !! options
22389 parsoid=html2wt
22390 !! html/parsoid
22391 <dl><dt>a:b<i>c:d</i></dt></dl>
22392 !! wikitext
22393 ; <nowiki>a:b</nowiki>''c:d''
22394 !! end
22395
22396 #### --------------- HRs ---------------
22397 #### 1. Single line
22398 #### -----------------------------------
22399
22400 !! test
22401 HRs: 1. Single line
22402 !! options
22403 parsoid=html2wt
22404 !! html/parsoid
22405 <hr />----
22406 <hr />=foo=
22407 <hr />*foo
22408 !! wikitext
22409 ----<nowiki>----</nowiki>
22410 ----=foo=
22411 ----*foo
22412 !! end
22413
22414 #### --------------- Tables ---------------
22415 #### 1a. Simple example
22416 #### 1b. No escaping needed (!foo)
22417 #### 1c. No escaping needed (|foo)
22418 #### 1d. No escaping needed (|}foo)
22419 ####
22420 #### 2a. Nested in td (<td>foo|bar</td>)
22421 #### 2b. Nested in td (<td>foo||bar</td>)
22422 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22423 ####
22424 #### 3a. Nested in th (<th>foo!bar</th>)
22425 #### 3b. Nested in th (<th>foo!!bar</th>)
22426 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22427 ####
22428 #### 4a. Escape -
22429 #### 4b. Escape +
22430 #### 4c. No escaping needed
22431 #### --------------------------------------
22432
22433 !! test
22434 Tables: 1a. Simple example
22435 !! options
22436 parsoid=html2wt
22437 !! html/parsoid
22438 <p>{|
22439 |}
22440 </p>
22441 !! wikitext
22442 <nowiki>{|</nowiki>
22443 |}
22444 !! end
22445
22446 !! test
22447 Tables: 1b. No escaping needed
22448 !! options
22449 parsoid=html2wt
22450 !! html/parsoid
22451 <p>!foo
22452 </p>
22453 !! wikitext
22454 !foo
22455 !! end
22456
22457 !! test
22458 Tables: 1c. No escaping needed
22459 !! options
22460 parsoid=html2wt
22461 !! html/parsoid
22462 <p>|foo
22463 </p>
22464 !! wikitext
22465 |foo
22466 !! end
22467
22468 !! test
22469 Tables: 1d. No escaping needed
22470 !! options
22471 parsoid=html2wt
22472 !! html/parsoid
22473 <p>|}foo
22474 </p>
22475 !! wikitext
22476 |}foo
22477 !! end
22478
22479 !! test
22480 Tables: 2a. Nested in td
22481 !! options
22482 parsoid=html2wt
22483 !! html/parsoid
22484 <table><tbody><tr>
22485 <td>foo|bar</td></tr>
22486 <tr><td>x<div>a|b</div></td>
22487 </tbody></table>
22488 !! wikitext
22489 {|
22490 |<nowiki>foo|bar</nowiki>
22491 |-
22492 |x<div><nowiki>a|b</nowiki></div>
22493 |}
22494 !! html/php+tidy
22495 <table>
22496 <tr>
22497 <td>foo|bar</td>
22498 </tr>
22499 <tr>
22500 <td>x
22501 <div>a|b</div>
22502 </td>
22503 </tr>
22504 </table>
22505 !! end
22506
22507 !! test
22508 Tables: 2b. Nested in td
22509 !! options
22510 parsoid=html2wt
22511 !! html/parsoid
22512 <table><tbody><tr>
22513 <td>foo||bar</td>
22514 <td>a<i>b||c</i></td>
22515 <td>a<i><div>b||c</div></i></td>
22516 </tr></tbody></table>
22517 !! wikitext
22518 {|
22519 |<nowiki>foo||bar</nowiki>
22520 |a''<nowiki>b||c</nowiki>''
22521 |a''<div><nowiki>b||c</nowiki></div>''
22522 |}
22523 !! html/php
22524 <table>
22525 <tr>
22526 <td>foo||bar
22527 </td>
22528 <td>a<i>b||c</i>
22529 </td>
22530 <td>a<i><div>b||c</div></i>
22531 </td></tr></table>
22532
22533 !! end
22534
22535 !! test
22536 Tables: 2c. Nested in td -- no escaping needed
22537 !! options
22538 parsoid=html2wt
22539 !! html/*
22540 <table>
22541
22542 <tr>
22543 <td>foo!!bar
22544 </td></tr></table>
22545
22546 !! wikitext
22547 {|
22548
22549 |foo!!bar
22550 |}
22551 !! end
22552
22553 !! test
22554 Tables: 3a. Nested in th
22555 !! options
22556 parsoid=html2wt
22557 !! html/*
22558 <table>
22559
22560 <tr>
22561 <th>foo!bar
22562 </th></tr></table>
22563
22564 !! wikitext
22565 {|
22566
22567 !foo!bar
22568 |}
22569 !! end
22570
22571 !! test
22572 Tables: 3b. Nested in th
22573 !! options
22574 parsoid=html2wt
22575 !! html/parsoid
22576 <table><tbody>
22577 <tr><th>foo!!bar</th>
22578 <th><i>foo|bar</i></th>
22579 <th><i>foo!!bar</i></th>
22580 <th><i><span>foo!!bar</span></i></th>
22581 </tr></tbody></table>
22582 !! wikitext
22583 {|
22584 !<nowiki>foo!!bar</nowiki>
22585 !''<nowiki>foo|bar</nowiki>''
22586 !''<nowiki>foo!!bar</nowiki>''
22587 !''<span><nowiki>foo!!bar</nowiki></span>''
22588 |}
22589 !! html/php
22590 <table>
22591 <tr>
22592 <th>foo!!bar
22593 </th>
22594 <th><i>foo|bar</i>
22595 </th>
22596 <th><i>foo!!bar</i>
22597 </th>
22598 <th><i><span>foo!!bar</span></i>
22599 </th></tr></table>
22600
22601 !! end
22602
22603 !! test
22604 Tables: 3c. Nested in th
22605 !! options
22606 parsoid=html2wt
22607 !! html/parsoid
22608 <table><tbody>
22609 <tr><th>foo||bar</th>
22610 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22611 </tr></tbody></table>
22612 !! wikitext
22613 {|
22614 !<nowiki>foo||bar</nowiki>
22615 !<nowiki>foo||bar</nowiki>
22616 |}
22617 !! html/php
22618 <table>
22619 <tr>
22620 <th>foo||bar
22621 </th>
22622 <th>foo||bar
22623 </th></tr></table>
22624
22625 !! end
22626
22627 !! test
22628 Tables: 4a. Escape -
22629 !! options
22630 parsoid=html2wt
22631 !! html/*
22632 <table>
22633
22634 <tr>
22635 <th>-bar
22636 </th></tr>
22637 <tr>
22638 <td>-bar
22639 </td></tr></table>
22640
22641 !! wikitext
22642 {|
22643
22644 !-bar
22645
22646 |-
22647 |<nowiki>-bar</nowiki>
22648 |}
22649 !! end
22650
22651 !! test
22652 Tables: 4b. Escape +
22653 !! options
22654 parsoid=html2wt
22655 !! html/*
22656 <table>
22657
22658 <tr>
22659 <th>+bar
22660 </th></tr>
22661 <tr>
22662 <td>+bar
22663 </td></tr></table>
22664
22665 !! wikitext
22666 {|
22667
22668 !+bar
22669
22670 |-
22671 |<nowiki>+bar</nowiki>
22672 |}
22673 !! end
22674
22675 !! test
22676 Tables: 4c. No escaping needed
22677 !! options
22678 parsoid=html2wt
22679 !! html/parsoid
22680 <table><tbody>
22681 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22682 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22683 <tr><td>foo
22684 <p>bar|baz
22685 +bar
22686 -bar</p></td></tr>
22687 <tr><td>x
22688 <div>a|b</div></td>
22689 </tbody></table>
22690 !! wikitext
22691 {|
22692 |foo-bar
22693 |foo+bar
22694 |-
22695 |''foo''-bar
22696 |''foo''+bar
22697 |-
22698 |foo
22699 bar|baz
22700 +bar
22701 -bar
22702 |-
22703 |x
22704 <div>a|b</div>
22705 |}
22706 !! html/php
22707 <table>
22708 <tr>
22709 <td>foo-bar
22710 </td>
22711 <td>foo+bar
22712 </td></tr>
22713 <tr>
22714 <td><i>foo</i>-bar
22715 </td>
22716 <td><i>foo</i>+bar
22717 </td></tr>
22718 <tr>
22719 <td>foo
22720 <p>bar|baz
22721 +bar
22722 -bar
22723 </p>
22724 </td></tr>
22725 <tr>
22726 <td>x
22727 <div>a|b</div>
22728 </td></tr></table>
22729
22730 !! end
22731
22732 !! test
22733 Tables: 4d. No escaping needed
22734 !! options
22735 parsoid=html2wt
22736 !! html/parsoid
22737 <table>
22738 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22739 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22740 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22741 </tbody></table>
22742 !! wikitext
22743 {|
22744 |[[Foo]]-bar
22745 ||+1
22746 ||-2
22747 |}
22748 !! html/php
22749 <table>
22750 <tr>
22751 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22752 </td>
22753 <td>+1
22754 </td>
22755 <td>-2
22756 </td></tr></table>
22757
22758 !! end
22759
22760 !! test
22761 T97430: Don't emit empty nowiki pairs around marker meta tags
22762 !! options
22763 parsoid=html2wt
22764 !! html/parsoid
22765 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22766 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22767 !! wikitext
22768 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22769 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22770 !! end
22771
22772 !! test
22773 Unclosed xmlish element in table line shouldn't eat end delimiters
22774 !! options
22775 parsoid=html2wt
22776 !! html/parsoid
22777 <table>
22778 <tbody><tr><td> &lt;foo</td>
22779 <td> bar></td></tr>
22780 </tbody></table>
22781 !! wikitext
22782 {|
22783 | <foo
22784 | bar>
22785 |}
22786 !! html/php
22787 <table>
22788 <tr>
22789 <td> &lt;foo
22790 </td>
22791 <td> bar&gt;
22792 </td></tr></table>
22793
22794 !! end
22795
22796 #### --------------- Links ----------------
22797 #### 1. Quote marks in link text
22798 #### 2. Wikilinks: Escapes needed
22799 #### 3. Wikilinks: No escapes needed
22800 #### 4. Extlinks: Escapes needed
22801 #### 5. Extlinks: No escapes needed
22802 #### --------------------------------------
22803 !! test
22804 Links 1. WikiLinks: No escapes needed
22805 !! options
22806 parsoid=html2wt
22807 !! html/parsoid
22808 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22809 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22810 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22811 !! wikitext
22812 [[Foo|Foo''boo'']]
22813 [[Foo|[Foobar]]]
22814 [[Foo|x [Foobar] x]]
22815 !! html/php
22816 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22817 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22818 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22819 </p>
22820 !! end
22821
22822 !! test
22823 Links 2. WikiLinks: Escapes needed
22824 !! options
22825 parsoid=html2wt
22826 !! html/parsoid
22827 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22828 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22829 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22830 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22831 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22832 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22833 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22834 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22835 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22836 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22837 !! wikitext
22838 [[Foo|<nowiki>Foobar]</nowiki>]]
22839 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22840 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22841 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22842 [[Foo|<nowiki>|Bar</nowiki>]]
22843 [[Foo|<nowiki>]]bar</nowiki>]]
22844 [[Foo|<nowiki>[[bar</nowiki>]]
22845 [[Foo|<nowiki>x [[ y</nowiki>]]
22846 [[Foo|<nowiki>x ]] y</nowiki>]]
22847 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22848 !! html/php
22849 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22850 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22851 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22852 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22853 <a href="/wiki/Foo" title="Foo">|Bar</a>
22854 <a href="/wiki/Foo" title="Foo">]]bar</a>
22855 <a href="/wiki/Foo" title="Foo">[[bar</a>
22856 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22857 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22858 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22859 </p>
22860 !! end
22861
22862 !! test
22863 Links 3. WikiLinks: No escapes needed
22864 !! options
22865 parsoid=html2wt
22866 !! html/parsoid
22867 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22868 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22869 !! wikitext
22870 [[Foo|[Foobar]]
22871 [[Foo|foo|bar]]
22872 !! html/php
22873 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22874 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22875 </p>
22876 !! end
22877
22878 !! test
22879 Links 4. ExtLinks: Escapes needed
22880 !! options
22881 parsoid=html2wt
22882 !! html/parsoid
22883 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22884 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22885 <p>[http://google.com]</p>
22886 <p>[http://google.com google]</p>
22887 !! wikitext
22888 [http://google.com <nowiki>[google]</nowiki>]
22889 [http://google.com <nowiki>google]</nowiki>]
22890
22891 <nowiki>[http://google.com]</nowiki>
22892
22893 <nowiki>[http://google.com google]</nowiki>
22894
22895 !! html/php
22896 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22897 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22898 </p><p>[http://google.com]
22899 </p><p>[http://google.com google]
22900 </p>
22901 !! end
22902
22903 !! test
22904 Links 5. ExtLinks: No escapes needed
22905 !! options
22906 parsoid=html2wt
22907 !! html/parsoid
22908 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22909 !! wikitext
22910 [http://google.com [google]
22911 !! html/php
22912 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22913 </p>
22914 !! end
22915
22916 !! test
22917 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22918 !! options
22919 parsoid=html2wt
22920 !! html/parsoid
22921 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22922 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22923 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22924 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22925 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22926 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22927 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22928 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22929 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22930 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22931 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22932 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22933 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22934 </p>
22935 !! wikitext
22936 x<nowiki/>http://example.com<nowiki/>y
22937 http://example.com<nowiki/>?x
22938 http://example.com<nowiki/>&x
22939 http://example.com<nowiki/>'x
22940 http://example.com<nowiki/>,x
22941 http://example.com<nowiki/>.x
22942 http://example.com<nowiki/>;x
22943 http://example.com<nowiki/>:x
22944 http://example.com<nowiki/>;x
22945 http://example.com<nowiki/>!x
22946 http://example.com<nowiki/>=x
22947 http://example.com<nowiki/>(x)
22948 http://example.com(x<nowiki/>)
22949 !! end
22950
22951 !! test
22952 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22953 !! options
22954 parsoid=html2wt
22955 !! html/parsoid
22956 <p>x
22957 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22958 y
22959 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22960 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22961 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22962 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22963 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22964 </p>
22965 !! wikitext
22966 x
22967 http://example.com
22968 y
22969 "http://example.com"
22970 (http://example.com)
22971 (http://example.com) foo
22972 http://example.com,
22973 http://example.com, foo
22974 !! html/php
22975 <p>x
22976 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22977 y
22978 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22979 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22980 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22981 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22982 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22983 </p>
22984 !! end
22985
22986 !! test
22987 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22988 !! options
22989 parsoid=html2wt
22990 !! html/parsoid
22991 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22992 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22993 !! wikitext
22994 http://example.com.,;:!?\
22995 -http://example.com:
22996 !! html/php
22997 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22998 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22999 </p>
23000 !! end
23001
23002 !! test
23003 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23004 !! options
23005 parsoid=html2wt
23006 !! html/parsoid
23007 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23008 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23009 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23010 !! wikitext
23011 RFC 123<nowiki/>4
23012 RFC 123<nowiki/>y
23013 X<nowiki/>RFC 123<nowiki/>y
23014 !! end
23015
23016 !! test
23017 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23018 !! options
23019 parsoid=html2wt
23020 !! html/parsoid
23021 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23022 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23023 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23024 </p>
23025 !! wikitext
23026 RFC 123?foo
23027 RFC 123&foo
23028 -RFC 123-
23029 !! html/php
23030 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23031 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23032 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23033 </p>
23034 !! end
23035
23036 !! test
23037 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23038 !! options
23039 parsoid=html2wt
23040 !! html/parsoid
23041 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23042 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23043 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23044 !! wikitext
23045 PMID 123<nowiki/>4
23046 PMID 123<nowiki/>y
23047 X<nowiki/>PMID 123<nowiki/>y
23048 !! end
23049
23050 !! test
23051 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23052 !! options
23053 parsoid=html2wt
23054 !! html/parsoid
23055 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23056 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23057 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23058 </p>
23059 !! wikitext
23060 PMID 123?foo
23061 PMID 123&foo
23062 -PMID 123-
23063 !! html/php
23064 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23065 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23066 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23067 </p>
23068 !! end
23069
23070 !! test
23071 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23072 !! options
23073 parsoid=html2wt
23074 !! html/parsoid
23075 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23076 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23077 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23078 </p>
23079 !! wikitext
23080 ISBN 1234567890<nowiki/>1
23081 ISBN 1234567890<nowiki/>x
23082 a<nowiki/>ISBN 1234567890<nowiki/>b
23083 !! end
23084
23085 !! test
23086 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23087 !! options
23088 parsoid=html2wt
23089 !! html/parsoid
23090 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23091 !! wikitext
23092 -ISBN 1234567890's
23093 !! html/php
23094 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23095 </p>
23096 !! end
23097
23098 !! test
23099 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23100 !! options
23101 parsoid=html2wt
23102 !! html/*
23103 <p>this is not a link: http://example.com
23104 </p>
23105 !! wikitext
23106 <nowiki>this is not a link: http://example.com</nowiki>
23107 !! end
23108
23109 !! test
23110 Links 15. Link trails can't become link prefixes.
23111 !! options
23112 language=is
23113 parsoid=html2wt
23114 !! html/parsoid
23115 <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>
23116 !! wikitext
23117 [[Söfnuður]]-[[00]]
23118 !! html/php
23119 <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>
23120 </p>
23121 !! end
23122
23123 #### --------------- Quotes ---------------
23124 #### 1. Quotes inside <b> and <i>
23125 #### 2. Link fragments separated by <i> and <b> tags
23126 #### 3. Link fragments inside <i> and <b>
23127 #### 4. No escaping needed
23128 #### --------------------------------------
23129 !! test
23130 1a. Quotes inside <b> and <i>
23131 !! options
23132 parsoid=html2wt
23133 !! html/*
23134 <p><i>'foo'</i>
23135 <i>''foo''</i>
23136 <i>'''foo'''</i>
23137 <i>foo</i>'s
23138 <b>'foo'</b>
23139 <b>''foo''</b>
23140 <b>'''foo'''</b>
23141 <b>foo'<i>bar'</i>baz</b>
23142 <b>foo</b>'s
23143 '<i>foo</i>
23144 <i>foo</i>'
23145 <i>foo'</i>'
23146 '<i>foo</i>'
23147 '<b>foo</b>
23148 <b>foo</b>'
23149 '<b>foo</b>'
23150 <i>fools'<span> errand</span></i>
23151 <i><span>fool</span>'s errand</i>
23152 '<i>foo</i> bar '<i>baz</i>
23153 a|!*#-:;+-~[]{}b'<i>x</i>
23154 </p>
23155 !! wikitext
23156 ''<nowiki/>'foo'''
23157 ''<nowiki>''foo''</nowiki>''
23158 ''<nowiki>'''foo'''</nowiki>''
23159 ''foo''<nowiki/>'s
23160 '''<nowiki/>'foo''''
23161 '''<nowiki>''foo''</nowiki>'''
23162 '''<nowiki>'''foo'''</nowiki>'''
23163 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23164 '''foo'''<nowiki/>'s
23165 '''foo''
23166 ''foo''<nowiki/>'
23167 ''foo'''<nowiki/>'
23168 '''foo''<nowiki/>'
23169 ''''foo'''
23170 '''foo'''<nowiki/>'
23171 ''''foo'''<nowiki/>'
23172 ''fools'<span> errand</span>''
23173 ''<span>fool</span>'s errand''
23174 '<nowiki/>''foo'' bar '''baz''
23175 a|!*#-:;+-~[]{}b'''x''
23176 !! end
23177
23178 !! test
23179 1b. Quotes inside <b> and <i> with other tags on same line
23180 !! options
23181 parsoid=html2wt
23182 !! html/parsoid
23183 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23184 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23185 <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>
23186 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23187 '<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>
23188 '<i>foo</i> <div title="name">test</div>
23189 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23190 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23191 <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>
23192 </ol>
23193 !! wikitext
23194 '''a'' foo ''[[bar]]''
23195 ''a''' foo ''[[bar]]''
23196 ''a''' foo '''{{echo|[[bar]]}}'''
23197 [[foo]] x'''[[bar]]''
23198 '''foo'' <ref>test</ref>
23199 '''foo'' <div title="name">test</div>
23200 '''foo'' and <br> bar
23201 <references />
23202 !! end
23203
23204 !! test
23205 2. Link fragments separated by <i> and <b> tags
23206 !! options
23207 parsoid=html2wt
23208 !! html/parsoid
23209 <p>[[<i>foo</i>hello]]</p>
23210 <p>[[<b>foo</b>hello]]</p>
23211 !! wikitext
23212 [[''foo''<nowiki>hello]]</nowiki>
23213
23214 [['''foo'''<nowiki>hello]]</nowiki>
23215 !! end
23216
23217 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23218 # this is one of the shortcomings of this format
23219 !! test
23220 3. Link fragments inside <i> and <b>
23221 !! options
23222 parsoid=html2wt
23223 !! html/parsoid
23224 <p><i>[[foo</i>]]</p>
23225 <p><b>[[foo</b>]]</p>
23226 !! wikitext
23227 ''[[foo''<nowiki>]]</nowiki>
23228
23229 '''[[foo'''<nowiki>]]</nowiki>
23230 !! end
23231
23232 !! test
23233 4. No escaping needed
23234 !! options
23235 options=html2wt
23236 !! html/parsoid
23237 <p>'<span><i>bar</i></span>'
23238 '<span><b>bar</b></span>'
23239 'a:b'foo
23240 </p>
23241 !! wikitext
23242 '<span>''bar''</span>'
23243 '<span>'''bar'''</span>'
23244 'a:b'foo
23245 !! end
23246
23247 #### ----------- Paragraphs ---------------
23248 #### 1. No unnecessary escapes
23249 #### --------------------------------------
23250
23251 !! test
23252 1. No unnecessary escapes
23253 !! options
23254 parsoid=html2wt
23255 !! html/parsoid
23256 <p>bar <span>[[foo]]</span>
23257 </p><p>=bar <span>[[foo]]</span>
23258 </p><p>[[bar <span>[[foo]]</span>
23259 </p><p>]]bar <span>[[foo]]</span>
23260 </p><p>=bar <span>foo]]</span>=
23261 </p>
23262 !! wikitext
23263 bar <span><nowiki>[[foo]]</nowiki></span>
23264
23265 =bar <span><nowiki>[[foo]]</nowiki></span>
23266
23267 [[bar <span><nowiki>[[foo]]</nowiki></span>
23268
23269 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23270
23271 =bar <span>foo]]</span><nowiki>=</nowiki>
23272 !!end
23273
23274 #### ----------------------- PRE --------------------------
23275 #### 1. Leading whitespace in SOL context should be escaped
23276 #### ------------------------------------------------------
23277 !! test
23278 1. Leading whitespace in SOL context should be escaped
23279 !! options
23280 parsoid=html2wt
23281 !! html/parsoid
23282 <p> a</p>
23283
23284 <p> a</p>
23285
23286 <p> a(tab)</p>
23287
23288 <p> a
23289 <!--cmt-->
23290 a</p>
23291
23292 <p>a
23293 b</p>
23294
23295 <p>a
23296 b</p>
23297
23298 <p>a
23299 b</p>
23300 !! wikitext
23301 <nowiki> </nowiki>a
23302
23303 <nowiki> </nowiki> a
23304
23305 a(tab)
23306
23307 <nowiki> </nowiki> a
23308 <!--cmt-->
23309 <nowiki> </nowiki>a
23310
23311 a
23312 <nowiki> </nowiki>b
23313
23314 a
23315 b
23316
23317 a
23318 b
23319 !! html/php
23320 <p> a
23321 </p><p> a
23322 </p><p> a(tab)
23323 </p><p> a
23324 a
23325 </p><p>a
23326 b
23327 </p><p>a
23328 b
23329 </p><p>a
23330 b
23331 </p>
23332 !! end
23333
23334 !! test
23335 2. Leading whitespace in non-indent-pre contexts should not be escaped
23336 !! options
23337 parsoid=htm2wt
23338 !! html/parsoid
23339 <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>
23340 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23341 <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>
23342 b</span></li>
23343 </ol>
23344 !! wikitext
23345 foo <ref>''a''
23346 b</ref>
23347 <references />
23348 !! end
23349
23350 !! test
23351 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23352 !! options
23353 parsoid=html2wt
23354 !! html/parsoid
23355 <blockquote>
23356 <p>
23357 a
23358 <span>b</span>
23359 c</p>
23360 </blockquote>
23361 !! wikitext
23362 <blockquote>
23363 a
23364 <span>b</span>
23365 c
23366 </blockquote>
23367 !! end
23368
23369 !! test
23370 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23371 !! options
23372 options=html2wt
23373 !! html/parsoid
23374 <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>
23375 !! wikitext
23376 [[File:Foobar.jpg|thumb|caption]]
23377 !! end
23378
23379 !! test
23380 5. Nowiki escaping should account for indent-pres
23381 !! options
23382 parsoid=html2wt
23383 !! html/parsoid
23384 <pre>==foo==</pre>
23385 !! wikitext
23386 ==foo==
23387 !! end
23388
23389 !!test
23390 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23391 !! options
23392 parsoid=html2wt
23393 !! html/parsoid
23394 <pre>
23395 * foo
23396 * bar
23397 </pre>
23398 !! wikitext
23399 * foo
23400 * bar
23401 !! end
23402
23403 #### --------------- Behavior Switches --------------------
23404
23405 !! test
23406 1. Valid behavior switches should be escaped
23407 !! options
23408 parsoid=html2wt
23409 !! html/parsoid
23410 __TOC__
23411 <i>__TOC__</i>
23412 !! wikitext
23413 <nowiki>__TOC__</nowiki>
23414 ''<nowiki>__TOC__</nowiki>''
23415 !! end
23416
23417 !! test
23418 2. Invalid behavior switches should not be escaped
23419 !! options
23420 parsoid=html2wt
23421 !! html/parsoid
23422 __TOO__
23423 __|__
23424 !! wikitext
23425 __TOO__
23426 __|__
23427 !! end
23428
23429 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23430 !! test
23431 Behavior switches should be SOL-transparent
23432 !! options
23433 parsoid=html2wt
23434 !! html/parsoid
23435 <meta property="mw:PageProp/toc" />
23436
23437 <!-- this one's bogus -->
23438 <pre>__TOO__</pre>
23439
23440 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23441
23442 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23443 !! wikitext
23444 __TOC__
23445
23446 <!-- this one's bogus -->
23447 __TOO__
23448
23449 __TOC__ foo
23450
23451 __TOC__ bar
23452 !! end
23453
23454 #### --------------- HTML tags ---------------
23455 #### 1. a tags
23456 #### 2. other tags
23457 #### 3. multi-line html tag
23458 #### 4. extension tags
23459 #### -----------------------------------------
23460 !! test
23461 1. a tags
23462 !! options
23463 parsoid=html2wt
23464 !! html/parsoid
23465 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23466 !! wikitext
23467 <a href="http://google.com">google</a>
23468 !! end
23469
23470 !! test
23471 2. other tags
23472 !! options
23473 parsoid=html2wt
23474 !! html/parsoid
23475 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23476 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23477 <li> &lt;td&gt;</li></ul>
23478
23479 !! wikitext
23480 * <nowiki><div>foo</div></nowiki>
23481 * <nowiki><div style="color:red">foo</div></nowiki>
23482 * <nowiki><td></nowiki>
23483 !! end
23484
23485 !! test
23486 3. multi-line html tag
23487 !! options
23488 parsoid=html2wt
23489 !! html/parsoid
23490 <p>&lt;div
23491 &gt;foo&lt;/div
23492 &gt;
23493 </p>
23494 !! wikitext
23495 <nowiki><div
23496 >foo</div
23497 ></nowiki>
23498 !! end
23499
23500 !! test
23501 4. extension tags
23502 !! options
23503 parsoid=html2wt
23504 !! html/parsoid
23505 <p>&lt;ref&gt;foo&lt;/ref&gt;
23506 </p><p>&lt;ref&gt;bar
23507 </p><p>baz&lt;/ref&gt;
23508 </p>
23509 !! wikitext
23510 <nowiki><ref>foo</ref></nowiki>
23511
23512 <nowiki><ref>bar</nowiki>
23513
23514 baz<nowiki></ref></nowiki>
23515 !! end
23516
23517 #### --------------- Others ---------------
23518 !! test
23519 Escaping nowikis
23520 !! options
23521 parsoid=html2wt
23522 !! html/parsoid
23523 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23524 </p>
23525 !! wikitext
23526 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23527 !! end
23528
23529 ## The quote-char in the input is necessary for triggering the bug
23530 !! test
23531 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23532 !! options
23533 parsoid=html2wt
23534 !! html/parsoid
23535 <p>foo's bar :</p>
23536 !! wikitext
23537 foo's bar :
23538 !! end
23539
23540 #----------- End of wikitext escaping tests --------------
23541
23542 !! test
23543
23544 Tag-like HTML structures are passed through as text
23545 !! wikitext
23546 <x y>
23547
23548 <x.y>
23549
23550 <x-y>
23551
23552 1>2
23553
23554 x<y
23555
23556 a>b
23557
23558 1<d e>f
23559 !! html
23560 <p>&lt;x y&gt;
23561 </p><p>&lt;x.y&gt;
23562 </p><p>&lt;x-y&gt;
23563 </p><p>1&gt;2
23564 </p><p>x&lt;y
23565 </p><p>a&gt;b
23566 </p><p>1&lt;d e&gt;f
23567 </p>
23568 !! end
23569
23570 !! test
23571 HTML tag with necessary entities in attributes
23572 !! wikitext
23573 <span title="&amp;amp;">foo</span>
23574 !! html
23575 <p><span title="&amp;amp;">foo</span>
23576 </p>
23577 !! end
23578
23579 !! test
23580 HTML tag with 'unnecessary' entity encoding in attributes
23581 !! wikitext
23582 <span title="&amp;">foo</span>
23583 !! html
23584 <p><span title="&amp;">foo</span>
23585 </p>
23586 !! end
23587
23588 !! test
23589 HTML tag with broken attribute value quoting
23590 !! wikitext
23591 <span title="Hello world>Foo</span>
23592 !! html/php
23593 <p><span title="Hello world">Foo</span>
23594 </p>
23595 !! html/parsoid
23596 <p><span title="Hello world">Foo</span>
23597 </p>
23598 !! end
23599
23600 !! test
23601 Table with broken attribute value quoting
23602 !! wikitext
23603 {|
23604 | title="Hello world|Foo
23605 |}
23606 !! html/php
23607 <table>
23608 <tr>
23609 <td title="Hello world">Foo
23610 </td></tr></table>
23611
23612 !! html/parsoid
23613 <table>
23614 <tr>
23615 <td title="Hello world">Foo
23616 </td></tr></table>
23617
23618 !! end
23619
23620 !! test
23621 Table with broken attribute value quoting on consecutive lines
23622 !! wikitext
23623 {|
23624 | title="Hello world|Foo
23625 | style="color:red|Bar
23626 |}
23627 !! html/php
23628 <table>
23629 <tr>
23630 <td title="Hello world">Foo
23631 </td>
23632 <td style="color:red">Bar
23633 </td></tr></table>
23634
23635 !! html/parsoid
23636 <table><tbody>
23637 <tr>
23638 <td title="Hello world">Foo
23639 </td><td style="color: red">Bar
23640 </td></tr></tbody></table>
23641
23642 !! end
23643
23644 !! test
23645 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23646 !! options
23647 parsoid
23648 !! wikitext
23649 {{}}
23650 !! html
23651 {{}}
23652 !! end
23653
23654 !! test
23655 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23656 !! options
23657 parsoid
23658 !! wikitext
23659 }}{{
23660 !! html
23661 }}{{
23662 !! end
23663
23664 !!test
23665 Accept empty td cell attribute
23666 !! wikitext
23667 {|
23668 | align="center" | foo || |
23669 |}
23670 !! html
23671 <table>
23672 <tr>
23673 <td align="center"> foo </td>
23674 <td>
23675 </td></tr></table>
23676
23677 !!end
23678
23679 !!test
23680 Non-empty attributes in th-cells
23681 !! wikitext
23682 {|
23683 ! Foo !! style="color: red" | Bar
23684 |}
23685 !! html
23686 <table>
23687 <tr>
23688 <th> Foo </th>
23689 <th style="color: red"> Bar
23690 </th></tr></table>
23691
23692 !!end
23693
23694 !!test
23695 Accept empty attributes in th-cells
23696 !! wikitext
23697 {|
23698 !| foo !!| bar
23699 |}
23700 !! html
23701 <table>
23702 <tr>
23703 <th> foo </th>
23704 <th> bar
23705 </th></tr></table>
23706
23707 !!end
23708
23709 !!test
23710 Empty table rows go away
23711 !! wikitext
23712 {|
23713 | Hello
23714 | there
23715 |- class="foo"
23716 |-
23717 |}
23718 !! html
23719 <table>
23720 <tr>
23721 <td> Hello
23722 </td>
23723 <td> there
23724 </td></tr>
23725
23726 </table>
23727
23728 !! end
23729
23730 ###
23731 ### Parsoid-centric tests for testing RTing of inter-element separators
23732 ### Edge cases not tested by existing parser tests and specific to
23733 ### Parsoid-specific serialization strategies.
23734 ###
23735
23736 !!test
23737 RT-ed inter-element separators should be valid separators
23738 !! wikitext
23739 {|
23740 |- [[foo]]
23741 |}
23742 !! html
23743 <table>
23744
23745 </table>
23746
23747 !!end
23748
23749 # Parsoid-only since PHP parser relies on Tidy for correct output
23750 !!test
23751 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23752 !!options
23753 parsoid
23754 !! wikitext
23755 {|
23756 |<small>foo
23757 bar
23758 |}
23759
23760 {|
23761 |<small>foo<small>
23762 |}
23763 !! html
23764 <table>
23765 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23766 <p>bar</p></small></td></tr>
23767 </tbody></table>
23768
23769 <table>
23770 <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>
23771 </tbody></table>
23772 !!end
23773
23774 # Note that the "style" attribute is really a template parameter here.
23775 # The = would have to be {{=}} if you wanted the literal.
23776 !!test
23777 Empty TD followed by TD with tpl-generated attribute
23778 !! wikitext
23779 {|
23780 |-
23781 |
23782 |{{echo|style='color:red'}}|foo
23783 |}
23784 !! html
23785 <table>
23786
23787 <tr>
23788 <td>
23789 </td>
23790 <td>foo
23791 </td></tr></table>
23792
23793 !!end
23794
23795 !!test
23796 Indented table with an empty td
23797 !! wikitext
23798 {|
23799 |-
23800 |
23801 |foo
23802 |}
23803 !! html
23804 <table>
23805
23806 <tr>
23807 <td>
23808 </td>
23809 <td>foo
23810 </td></tr></table>
23811
23812 !!end
23813
23814 ## We have some newline diffs RT-ing this edge case
23815 ## and it is not important enough -- we seem to be emitting
23816 ## at most 2 newlines after a </tr> and this is unrelated to
23817 ## the issue from T85627 that this is testing.
23818 !!test
23819 Indented table with blank lines in between (T85627)
23820 !! options
23821 parsoid=wt2html
23822 !! wikitext
23823 {|
23824 |foo
23825
23826
23827 |}
23828 !! html
23829 <table>
23830
23831 <tr>
23832 <td>foo
23833 </td></tr></table>
23834
23835 !!end
23836
23837 !!test
23838 Indented block & table
23839 !! wikitext
23840 <div>foo</div>
23841 {|
23842 |foo
23843 |}
23844 !! html/php
23845 <div>foo</div>
23846 <table>
23847 <tr>
23848 <td>foo
23849 </td></tr></table>
23850
23851 !! html/parsoid
23852 <div data-parsoid='{"stx":"html"}'>foo</div>
23853 <table><tbody>
23854 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23855 </tbody></table>
23856 !!end
23857
23858 !! test
23859 Indent and comment before table row
23860 !! wikitext
23861 {|
23862 <!--hi-->|-
23863 | there
23864 |}
23865 !! html/php
23866 <table>
23867
23868 <tr>
23869 <td> there
23870 </td></tr></table>
23871
23872 !! html/parsoid
23873 <table>
23874 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23875 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23876 </tbody></table>
23877 !! end
23878
23879 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23880 !!test
23881 Empty TR followed by a template-generated TR
23882 !!options
23883 parsoid
23884 !! wikitext
23885 {|
23886 |-
23887 {{echo|<tr><td>foo</td></tr>}}
23888 |}
23889 !! html
23890 <table>
23891 <tbody>
23892 <tr></tr>
23893 <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}}]}'>
23894 <td>foo</td></tr>
23895 </tbody></table>
23896 !!end
23897
23898 ## PHP and parsoid output differ for this, and since this is primarily
23899 ## for testing Parsoid's serializer, marking this Parsoid only
23900 !!test
23901 Empty TR followed by mixed-ws-comment line should RT correctly
23902 !!options
23903 parsoid
23904 !! wikitext
23905 {|
23906 |-
23907 <!--c-->
23908 |-
23909 <!--c--> <!--d-->
23910 |}
23911 !! html
23912 <table>
23913 <tbody>
23914 <tr></tr>
23915 <!--c-->
23916 <tr>
23917 <!--c--> </tr><!--d-->
23918 </tbody></table>
23919
23920 !!end
23921
23922 !!test
23923 Multi-line image caption generated by templates with/without trailing newlines
23924 !! wikitext
23925 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23926 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23927 !! html/parsoid
23928 <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>
23929 <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>
23930 !!end
23931
23932 !! test
23933 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23934 !! options
23935 parsoid=html2wt
23936 !! html/parsoid
23937 <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>
23938
23939 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23940 !! wikitext
23941 <includeonly>foo</includeonly>
23942 new para
23943
23944 [[Category:Foo]]
23945
23946 = new heading =
23947 !! end
23948
23949 ## PHP emits broken html for this, and since this is primarily
23950 ## a Parsoid serializer test, marking this Parsoid only
23951 !!test
23952 Improperly nested inline or quotes tags with whitespace in between
23953 !! wikitext
23954 <span> <s>x</span> </s>
23955 ''' ''x''' ''
23956 !! html/parsoid
23957 <p><span> <s>x</s></span><s> </s>
23958 <b> <i>x</i></b><i> </i>
23959 </p>
23960 !!end
23961
23962 !!test
23963 Encapsulate protected attributes from wt
23964 !! wikitext
23965 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23966 !! html/parsoid
23967 <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>
23968 </body>
23969 !!end
23970
23971 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23972 ## Having nested or stray pre tags results in the attempt to add duplicates,
23973 ## causing an assertion fail. This test tries to prevent that situation.
23974 !!test
23975 Ensure ParagraphWrapper can deal with stray closing pre tags
23976 !!options
23977 parsoid=wt2html
23978 !! wikitext
23979 plain text</pre>
23980 !! html/parsoid
23981 plain text
23982 !!end
23983
23984 !!test
23985 1. Ensure fostered text content is wrapped in element nodes
23986 !!options
23987 parsoid=wt2html
23988 !! wikitext
23989 <table>hi</table><table>ho</table>
23990 !! html/parsoid
23991 <p>hi</p>
23992 <table></table>
23993 <p>ho</p>
23994 <table></table>
23995 !!end
23996
23997 !!test
23998 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23999 !!options
24000 parsoid=wt2html,wt2wt
24001 !! wikitext
24002 <table>
24003 <tr> || ||
24004 <td> a
24005 </table>
24006 !! html/parsoid
24007 <p> || ||
24008 </p><table>
24009 <tbody><tr><td> a</td></tr>
24010 </tbody></table>
24011 !!end
24012
24013 !!test
24014 Encapsulation properly handles null DSR information from foster box
24015 !!options
24016 parsoid=wt2html,wt2wt
24017 !! wikitext
24018 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24019 !! html/parsoid
24020 <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>
24021 !!end
24022
24023 !!test
24024 1. Encapsulate foster-parented transclusion content
24025 !!options
24026 parsoid=wt2wt,wt2html
24027 !! wikitext
24028 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24029 !! html/parsoid
24030 <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>
24031 <tbody>
24032 <tr>
24033 <td>bar</td>
24034 </tr>
24035 </tbody>
24036 </table>
24037 !!end
24038
24039 !!test
24040 2. Encapsulate foster-parented transclusion content
24041 !!options
24042 parsoid=wt2wt,wt2html
24043 !! wikitext
24044 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24045 !! html/parsoid
24046 <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>
24047 <table>
24048 <tbody>
24049 <tr>
24050 <td>bar</td>
24051 </tr>
24052 </tbody>
24053 </table>
24054 !!end
24055
24056 !!test
24057 3. Encapsulate foster-parented transclusion content
24058 !!options
24059 parsoid=wt2wt,wt2html
24060 !! wikitext
24061 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24062 !! html/parsoid
24063 <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;]}">
24064 <p>foo</p>
24065 </div>
24066 <table>
24067 <tbody>
24068 <tr>
24069 <td>bar</td>
24070 </tr>
24071 </tbody>
24072 </table>
24073 !!end
24074
24075 !!test
24076 4. Encapsulate foster-parented transclusion content
24077 !!options
24078 parsoid=wt2wt,wt2html
24079 !! wikitext
24080 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24081 !! html/parsoid
24082 <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;]}">
24083 <p>foo</p>
24084 </div>
24085 <table>
24086 <tbody>
24087 <tr>
24088 <td>bar</td>
24089 </tr>
24090 </tbody>
24091 </table>
24092 !!end
24093
24094 !!test
24095 5. Encapsulate foster-parented transclusion content
24096 !!options
24097 parsoid=wt2wt,wt2html
24098 !! wikitext
24099 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24100 !! html/parsoid
24101 <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>
24102 <table>
24103 <tbody>
24104 <tr>
24105 <td>
24106 <div>
24107 <p>foo</p>
24108 </div>
24109 </td>
24110 </tr>
24111 </tbody>
24112 </table>
24113 !!end
24114
24115 !!test
24116 6. Encapsulate foster-parented transclusion content
24117 !!options
24118 parsoid=wt2wt,wt2html
24119 !! wikitext
24120 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24121 !! html/parsoid
24122 <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>
24123 <table>
24124 <tbody>
24125 <tr>
24126 <td>
24127 <div>
24128 <p>foo</p>
24129 </div>
24130 </td>
24131 </tr>
24132 </tbody>
24133 </table>
24134 <p>ok</p>
24135 !!end
24136
24137 !!test
24138 7. Encapsulate foster-parented transclusion content
24139 !!options
24140 parsoid=wt2wt,wt2html
24141 !! wikitext
24142 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24143 !! html/parsoid
24144 <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>
24145 <table>
24146 <tbody>
24147 <tr>
24148 <td>bar</td>
24149 </tr>
24150 </tbody>
24151 </table>
24152 !!end
24153
24154 # Note that the wt is broken on purpose: the = should be {{=}} if you
24155 # don't want it to be a template parameter key.
24156 !!test
24157 8. Encapsulate foster-parented transclusion content
24158 !!options
24159 parsoid=wt2wt,wt2html
24160 !! wikitext
24161 {{echo|a
24162 }}{|{{echo|style='color:red'}}
24163 |-
24164 |b
24165 |}
24166 !! html/parsoid
24167 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24168 <span> </span>
24169 <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>
24170 <table>
24171 <tbody>
24172 <tr>
24173 <td>b</td>
24174 </tr>
24175 </tbody>
24176 </table>
24177 !!end
24178
24179 !!test
24180 9. Encapsulate foster-parented transclusion content
24181 !!options
24182 parsoid=wt2wt,wt2html
24183 !! wikitext
24184 <table>{{echo|hi</table>hello}}
24185 !! html/parsoid
24186 <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>
24187 !!end
24188
24189 !!test
24190 Table in fosterable position
24191 !!options
24192 parsoid=wt2html,wt2wt
24193 !! wikitext
24194 {{OpenTable}}
24195 <div>
24196 {|
24197 |}
24198 </div>
24199 |}
24200 !! html/parsoid
24201 <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">
24202 </span>
24203 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24204
24205 <table>
24206 </table>
24207 !!end
24208
24209 # Parsoid only for bug 64747
24210 !! test
24211 Properly encapsulate empty-content transclusions in fosterable positions
24212 !! wikitext
24213 <table>
24214 {{#if:|
24215 <td>foo</td>
24216 }}
24217 </table>
24218 !! html/parsoid
24219 <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":["","","",""]}]]}'>
24220
24221 </table>
24222 !! end
24223
24224 !!test
24225 Support <object> element with .data attribute
24226 !!options
24227 parsoid=html2wt
24228 !! html/parsoid
24229 <object data="test.swf"></object>
24230 !! wikitext
24231 <object data="test.swf"></object>
24232 !!end
24233
24234 !! test
24235 Don't block XML namespace declaration
24236 !! wikitext
24237 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24238 !! html/php
24239 <p><span>MediaWiki</span>
24240 </p>
24241 !! html/parsoid
24242 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24243 !! end
24244
24245 # -----------------------------------------------------------------
24246 # The following section of tests are primarily to spec requirements
24247 # around serialization of new/edited content.
24248 #
24249 # All these tests are marked Parsoid html2wt and html2html only
24250 # ----------------------------------------------------------------
24251
24252 # 'mi' is a localinterwiki prefix as well as a language
24253 !! test
24254 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24255 !! options
24256 parsoid=html2wt
24257 !! html/parsoid
24258 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24259 !! wikitext
24260 [[Foo]]
24261 !! end
24262
24263 # See T93839
24264 !! test
24265 New wikilinks should be serialized properly
24266 !! options
24267 parsoid=html2wt
24268 !! html/parsoid
24269 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24270 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24271 !! wikitext
24272 [[Foo]]
24273 [[Foo]]
24274 !! end
24275
24276 !! test
24277 New wiki links (href variations)
24278 !! options
24279 parsoid=html2wt
24280 !! html/parsoid
24281 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24282 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24283 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24284 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24285 !! wikitext
24286 [[Foo_bar]]
24287 [[Foo_bar]]
24288 [[Foo_bar]]
24289 [[Toxine bactérienne]]
24290 !! end
24291
24292 !! test
24293 New wiki links (content string variations)
24294 !! options
24295 parsoid=html2wt
24296 !! html/parsoid
24297 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24298 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24299 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24300 !! wikitext
24301 [[Foo_bar]]
24302 [[Foo bar]]
24303 [[Foo_bar|./Foo_bar]]
24304 !! end
24305
24306 !! test
24307 New category links (href variations)
24308 !! options
24309 parsoid=html2wt
24310 !! html/parsoid
24311 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24312 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24313 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24314 !! wikitext
24315 [[Category:Toxine bactérienne]]
24316 [[Category:Toxine bactérienne]]
24317 [[Category:Toxine bactérienne]]
24318 !! end
24319
24320 !! test
24321 New sol transparent links don't need indent-pre nowiki protection
24322 !! options
24323 parsoid=html2wt
24324 language=de
24325 !! html/parsoid
24326 <link rel="mw:PageProp/redirect" href="./Main_Page">
24327 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24328 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24329 !! wikitext
24330 #WEITERLEITUNG [[Main Page]]
24331 <!-- this is good --> [[Category:Good]]
24332 <!-- this is great --> [[Kategorie:Great]]
24333 !! end
24334
24335 !! test
24336 New interlanguage links (href variations)
24337 !! options
24338 parsoid=html2wt
24339 !! html/parsoid
24340 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24341 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24342 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24343 !! wikitext
24344 [[es:Toxine bactérienne]]
24345 [[es:Toxine_bactérienne]]
24346 [[es:Toxine_bactérienne]]
24347 !! end
24348
24349 !! test
24350 Image: Modifying size of an image (1)
24351 !! options
24352 parsoid={
24353 "modes": ["wt2wt"],
24354 "changes": [
24355 ["img[height]", "attr", "height", "22"],
24356 ["img[width]", "attr", "width", "200"]
24357 ]
24358 }
24359 !! wikitext
24360 [[Image:Foobar.jpg|230x230px]]
24361 !! wikitext/edited
24362 [[Image:Foobar.jpg|200x200px]]
24363 !!end
24364
24365 !! test
24366 Image: Modifying size of an image (2)
24367 !! options
24368 parsoid={
24369 "modes": ["wt2wt"],
24370 "changes": [
24371 ["img[height]", "attr", "height", "100"],
24372 ["img[width]", "attr", "width", "500"]
24373 ]
24374 }
24375 !! wikitext
24376 [[Image:Foobar.jpg|230x230px]]
24377 !! wikitext/edited
24378 [[Image:Foobar.jpg|500x500px]]
24379 !!end
24380
24381 # Change in size is ignored so long as class='mw-default-size'
24382 !! test
24383 Image: Modifying size of an image (3)
24384 !! options
24385 parsoid={
24386 "modes": ["wt2wt"],
24387 "changes": [
24388 ["figure[class]", "removeClass", "mw-default-size"],
24389 ["figure img", "attr", "height", "19"],
24390 ["figure img", "attr", "width", "170"]
24391 ]
24392 }
24393 !! wikitext
24394 [[Image:Foobar.jpg|thumb]]
24395 !! wikitext/edited
24396 [[Image:Foobar.jpg|thumb|170x170px]]
24397 !!end
24398
24399 !! test
24400 Image: Modifying alignment of an image (bug 48665)
24401 !! options
24402 parsoid={
24403 "modes": ["wt2wt"],
24404 "changes": [
24405 ["figure[class]", "removeClass", "mw-halign-right"],
24406 ["figure[class]", "addClass", "mw-halign-left"]
24407 ]
24408 }
24409 !! wikitext
24410 [[Image:Foobar.jpg|thumb|caption|right]]
24411 !! wikitext/edited
24412 [[Image:Foobar.jpg|thumb|caption|left]]
24413 !! end
24414
24415 !! test
24416 Image: Modifying mw-default-size of an frameless image (bug 62805)
24417 !! options
24418 parsoid={
24419 "modes": ["wt2wt"],
24420 "changes": [
24421 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24422 ]
24423 }
24424 !! wikitext
24425 [[Image:Foobar.jpg|frameless|right]]
24426 !! wikitext/edited
24427 [[Image:Foobar.jpg|frameless|right|220x220px]]
24428 !! end
24429
24430 !! test
24431 Image: Modifying valign of an image (bug 49221)
24432 !! options
24433 parsoid={
24434 "modes": ["wt2wt"],
24435 "changes": [
24436 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24437 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24438 ]
24439 }
24440 !! wikitext
24441 [[File:Foobar.jpg|20px|middle]]
24442 !! wikitext/edited
24443 [[File:Foobar.jpg|20px|text-top]]
24444 !! end
24445
24446 !! test
24447 Image: Modifying alt attribute of an image (bug 56400)
24448 !! options
24449 parsoid={
24450 "modes": ["wt2wt"],
24451 "changes": [
24452 ["img[alt]", "attr", "alt", "some alternate edited text"]
24453 ]
24454 }
24455 !! wikitext
24456 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24457 !! wikitext/edited
24458 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24459 !!end
24460
24461 !! test
24462 Image: Modifying caption of an image
24463 !! options
24464 parsoid={
24465 "modes": ["wt2wt"],
24466 "changes": [
24467 ["figcaption", "text", "new caption"]
24468 ]
24469 }
24470 !! wikitext
24471 [[Image:Foobar.jpg|thumb|original caption]]
24472 !! wikitext/edited
24473 [[Image:Foobar.jpg|thumb|new caption]]
24474 !!end
24475
24476 !! test
24477 Image: empty alt attribute (bug 48924)
24478 !! options
24479 parsoid
24480 !! wikitext
24481 [[File:Foobar.jpg|thumb|alt=|bar]]
24482 !! html
24483 <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>
24484 !! end
24485
24486 !! test
24487 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24488 !! options
24489 parsoid=html2wt
24490 language=ar
24491 disabled
24492 !! html/parsoid
24493 <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>
24494 !! wikitext
24495 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24496 !! end
24497
24498 !! test
24499 Image: Block level image should have \n before and after
24500 !! wikitext
24501 123
24502 [[File:Foobar.jpg|right|thumb|150x150px]]
24503 456
24504 !! html/parsoid
24505 <p>123</p>
24506 <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>
24507 <p>456</p>
24508 !!end
24509
24510 !! test
24511 Image: New block level image should have \n before and after (existing content)
24512 !! wikitext
24513 123
24514 [[File:Foobar.jpg|right|thumb|150x150px]]
24515 456
24516 !! html/parsoid
24517 <p>123</p>
24518 <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>
24519 <p>456</p>
24520 !!end
24521
24522 !! test
24523 Image: upright option (parsoid)
24524 !! wikitext
24525 [[File:Foobar.jpg|thumb|upright|caption]]
24526 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24527 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24528 !! html/parsoid
24529 <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>
24530 <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>
24531 <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>
24532 !!end
24533
24534 !! test
24535 Image: upright option is ignored on inline and frame images (parsoid)
24536 !! wikitext
24537 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24538 !! html/parsoid
24539 <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>
24540 !!end
24541
24542 !! test
24543 Image: from basic HTML (1)
24544 !! options
24545 parsoid=html2wt
24546 !! html/parsoid
24547 <span typeof="mw:Image">
24548 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24549 </span>
24550 !! wikitext
24551 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24552 !! end
24553
24554 !! test
24555 Image: from basic HTML (2)
24556 !! options
24557 parsoid=html2wt
24558 !! html/parsoid
24559 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24560 !! wikitext
24561 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24562 !! end
24563
24564 !! test
24565 Image: from basic HTML (3)
24566 !! options
24567 parsoid=html2wt
24568 !! html/parsoid
24569 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24570 !! wikitext
24571 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24572 !! end
24573
24574 !! test
24575 Image: from basic HTML (4)
24576 !! options
24577 parsoid=html2wt
24578 !! html/parsoid
24579 <img src="./File:Foobar.jpg">
24580 !! wikitext
24581 [[File:Foobar.jpg|link=]]
24582 !! end
24583
24584 !! test
24585 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24586 !! options
24587 parsoid=html2wt
24588 !! html/parsoid
24589 <ul>
24590 <li><p>foo</p></li>
24591 </ul>
24592 !! wikitext
24593 * foo
24594 !! end
24595
24596 !! test
24597 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24598 !! options
24599 parsoid=html2wt
24600 !! html/parsoid
24601 <ul> <li>foo</li></ul>
24602 !! wikitext
24603 * foo
24604 !! end
24605
24606 !! test
24607 Don't strip leading whitespace when handling indent-pre suppressing tags
24608 !! options
24609 parsoid=html2wt
24610 !! html/parsoid
24611 <table>
24612 <tr><td> indented row</td></tr>
24613 </table>
24614 <blockquote><p>
24615 <b>This is very bold of you!</b>
24616 </p>
24617 <table><tr><td>
24618 indented cell (no pre-wrapping!)
24619 </td></tr></table>
24620 </blockquote>
24621 <p>foo</p>
24622 <div>bar</div>
24623 !! wikitext
24624 {|
24625 | indented row
24626 |}
24627 <blockquote>
24628 '''This is very bold of you!'''
24629
24630 {|
24631 |
24632 indented cell (no pre-wrapping!)
24633 |}
24634 </blockquote>
24635 foo
24636 <div>bar</div>
24637 !! end
24638
24639 !! test
24640 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24641 !! options
24642 parsoid=html2wt
24643 !! html/parsoid
24644 <p>foo</p>
24645 <span>bar</span>
24646
24647 <span>foo2
24648 </span>bar2
24649
24650 <div>foo</div>
24651 <span>bar</span>
24652
24653 <div>
24654 <span>foo</span>
24655 </div>
24656 !! wikitext
24657 foo
24658 <nowiki> </nowiki><span>bar</span>
24659
24660 <span>foo2
24661 <nowiki> </nowiki></span>bar2
24662
24663 <div>foo</div>
24664 <nowiki> </nowiki><span>bar</span>
24665
24666 <div>
24667 <nowiki> </nowiki><span>foo</span>
24668 </div>
24669 !! end
24670
24671 !! test
24672 Lists: Dont insert newlines in a serialized list item.
24673 !! options
24674 parsoid=html2wt
24675 !! html/parsoid
24676 <ul><li>a<br>b</li><li>c</li></ul>
24677 !! wikitext
24678 * a<br>b
24679 * c
24680 !! end
24681
24682 !! test
24683 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24684 !! options
24685 parsoid={
24686 "modes": ["html2wt"],
24687 "scrubWikitext": false
24688 }
24689 !! html/parsoid
24690 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24691 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24692
24693 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24694 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24695
24696 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24697
24698 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24699 !! wikitext
24700 == hello there [[Category:A1]] ==
24701
24702 == [[Category:A2]] hi pal ==
24703
24704 == <!--foo--> [[Category:A3]] how goes it ==
24705
24706 == it goes well [[Category:A4]] <!--bar--> ==
24707
24708 ==howdy [[Category:A5]] ==
24709
24710 == __TOC__ ok ==
24711 !! end
24712
24713 !! test
24714 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24715 !! options
24716 parsoid={
24717 "modes": ["html2wt"],
24718 "scrubWikitext": true
24719 }
24720 !! html/parsoid
24721 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24722 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24723
24724 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24725 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24726
24727 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24728 !! wikitext
24729 == hello there ==
24730 [[Category:A1]]
24731 [[Category:A2]]
24732
24733 == hi pal ==
24734
24735 <!--foo--> [[Category:A3]]
24736
24737 == how goes it ==
24738
24739 == it goes well ==
24740 [[Category:A4]] <!--bar-->
24741
24742 __TOC__
24743
24744 == ok ==
24745 !! end
24746
24747 !! test
24748 Headings: Don't hoist metas that come from templates
24749 !! options
24750 parsoid={
24751 "modes": ["html2wt"],
24752 "scrubWikitext": true
24753 }
24754 !! html/parsoid
24755 <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>
24756 !! wikitext
24757 == {{echo|foo [[Category:Foo]]}} ==
24758 !! end
24759
24760 !! test
24761 Headings: Category in ref isn't hoisted
24762 !! options
24763 parsoid={
24764 "modes": ["html2wt"],
24765 "scrubWikitext": true
24766 }
24767 !! html/parsoid
24768 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
24769
24770 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
24771 !! wikitext
24772 == foo <ref>bar
24773 [[Category:Baz]] </ref> ==
24774
24775 <references />
24776 !! end
24777
24778 !! test
24779 Parsoid: Serialize positional parameters with = in them as named parameter
24780 !! options
24781 parsoid=html2wt
24782 !! html/parsoid
24783 <p about="#mwt1" typeof="mw:Transclusion"
24784 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24785
24786 <p about="#mwt1" typeof="mw:Transclusion"
24787 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24788
24789 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24790 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24791 <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>
24792 !! wikitext
24793 {{echo|1 = f=oo}}
24794
24795 {{echo|1 = f=oo|2 = bar}}
24796
24797 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24798 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24799 {{echo|<nowiki>f=oo</nowiki>|bar}}
24800 !! end
24801
24802 !! test
24803 Parsoid: Serialize positional parameters with = in extlink as named parameter
24804 !! options
24805 parsoid=html2wt
24806 !! html/parsoid
24807 <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>
24808 !! wikitext
24809 {{echo|1 = http://stuff?is=ok}}
24810 !! end
24811
24812 !! test
24813 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24814 !! options
24815 parsoid=html2wt
24816 !! html/parsoid
24817 <div>a<p>b</p></div>
24818 <div>a
24819 <p>b</p></div>
24820 <div>
24821 a
24822 <p>b</p></div>
24823 !! wikitext
24824 <div>a
24825 b
24826 </div>
24827 <div>a
24828 b
24829 </div>
24830 <div>
24831 a
24832
24833 b
24834 </div>
24835 !! end
24836
24837 !! test
24838 Substrings resembling wikitext in hrefs should not get nowiki escapes
24839 !! options
24840 parsoid=html2wt
24841 !! html/parsoid
24842 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24843 !! wikitext
24844 [[Foo''bar''baz]]
24845 !! end
24846
24847 !! test
24848 Enforce single-line context in the serializer
24849 !! options
24850 parsoid=html2wt
24851 !! html/parsoid
24852 <h2>testing
24853 123</h2>
24854
24855 <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">
24856 </span><span about="#mwt1">you</span> </h2>
24857
24858 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
24859
24860 <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
24861 there</span></li></ol>
24862
24863 <ul><li>asd
24864 sdf</li></ul>
24865
24866 <ul><li>foo
24867 bar
24868 baz</li>
24869 <li>foo <b>bar</b>
24870 baz</li></ul>
24871
24872 <dl><dt>hi
24873 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24874 ho</dd></dl>
24875
24876 <dl><dd> <table>
24877 <tbody><tr><td> ha
24878 ha
24879 ha</td></tr>
24880 </tbody></table></dd></dl>
24881 !! wikitext
24882 == testing 123 ==
24883
24884 == hi {{bogus|there
24885 you}} ==
24886
24887 == foo <ref>hello
24888 there</ref> ==
24889
24890 <references />
24891
24892 * asd sdf
24893
24894 * foo bar baz
24895 * foo '''bar''' baz
24896
24897 ; hi ho : hi ho
24898
24899 : {|
24900 | ha
24901 ha
24902 ha
24903 |}
24904 !! end
24905
24906 !! test
24907 Serialize new placeholder space without spans
24908 !! options
24909 parsoid=html2wt
24910 !! html/parsoid
24911 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24912
24913 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24914
24915 <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>
24916 !! wikitext
24917 foo : bar
24918
24919 foo : bar
24920
24921 <ref>foo : bar</ref>ok
24922 !! end
24923
24924
24925 #-----------------------
24926 # Tag minimization tests
24927 #-----------------------
24928
24929 !! test
24930 1. I/B quote minimization: wikitext-only tags should be combined
24931 !! options
24932 parsoid=html2wt
24933 !! html/parsoid
24934 <p><i>A</i><i>B</i></p>
24935 <p><b>A</b><b>B</b></p>
24936 <p><i>A</i><b><i>B</i></b></p>
24937 <p><b>A</b><i><b>B</b></i></p>
24938 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24939 <p><i><b>A</b></i><i><b>B</b></i></p>
24940 <p><i><b>A</b></i><b><i>B</i></b></p>
24941 <p><b><i>A</i></b><i><b>B</b></i></p>
24942 !! wikitext
24943 ''AB''
24944
24945 '''AB'''
24946
24947 ''A'''B'''''
24948
24949 '''A''B'''''
24950
24951 '''A''BC''D'''
24952
24953 '''''AB'''''
24954
24955 '''''AB'''''
24956
24957 '''''AB'''''
24958 !! end
24959
24960 !! test
24961 2. I/B quote minimization: wikitext and html tags should not be combined
24962 !! options
24963 parsoid=html2wt
24964 !! html/parsoid
24965 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24966 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24967 !! wikitext
24968 ''A''<i>B</i>
24969
24970 ''A''<nowiki/>'''<i>B</i>'''
24971 !! end
24972
24973 !! test
24974 3. I/B quote minimization: templated content stops minimization
24975 !! options
24976 parsoid=html2wt
24977 !! html/parsoid
24978 <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>
24979 <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>
24980 !! wikitext
24981 ''A''{{echo|''B''}}
24982
24983 ''A''{{echo|'''''B'''''}}
24984 !! end
24985
24986 !! test
24987 4. I/B quote minimization: new content should be mimimized with adjacent old content
24988 !! options
24989 parsoid=html2wt
24990 !! html/parsoid
24991 <p><i>A</i><i>B</i></p>
24992 <p><b>A</b><b>B</b></p>
24993 <p><i>A</i><b><i>B</i></b></p>
24994 !! wikitext
24995 ''AB''
24996
24997 '''AB'''
24998
24999 ''A'''B'''''
25000 !! end
25001
25002 !! test
25003 5a. Merge adjacent quote nodes if they've been edited
25004 !! options
25005 parsoid={
25006 "modes": ["wt2wt", "selser"],
25007 "changes": [
25008 ["p", "contents", "remove", ":contains('b')"]
25009 ]
25010 }
25011 !! wikitext
25012 ''a''b''c''
25013 !! wikitext/edited
25014 ''ac''
25015 !! end
25016
25017 !! test
25018 5b. Merge adjacent quote nodes if they've been edited
25019 !! options
25020 parsoid={
25021 "modes": ["wt2wt", "selser"],
25022 "changes": [
25023 ["#x", "remove"]
25024 ]
25025 }
25026 !! wikitext
25027 ''a''<span id="x">b</span>''c''
25028 !! wikitext/edited
25029 ''ac''
25030 !! end
25031
25032 !! test
25033 1. Merge adjacent link nodes as long as at least one element is new
25034 !! options
25035 parsoid={
25036 "modes": ["html2wt"],
25037 "scrubWikitext": true
25038 }
25039 !! html/parsoid
25040 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25041 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25042 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25043 !! wikitext
25044 [[Football]]
25045 [[Football]]
25046 [[Football|Foot]][[Football|ball]]
25047 !! end
25048
25049 !! test
25050 2. Merge adjacent link nodes and enable additional normalizations
25051 !! options
25052 parsoid={
25053 "modes": ["html2wt"],
25054 "scrubWikitext": true
25055 }
25056 !! html/parsoid
25057 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25058 !! wikitext
25059 [[Football|''Football'']]
25060 !! end
25061
25062 !! test
25063 3. Don't merge adjacent link nodes if scrubWikitext is false
25064 !! options
25065 parsoid={
25066 "modes": ["html2wt"],
25067 "scrubWikitext": false
25068 }
25069 !! html/parsoid
25070 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25071 !! wikitext
25072 [[Football|Foot]][[Football|ball]]
25073 !! end
25074
25075 #------------------------------
25076 # End of tag minimization tests
25077 #------------------------------
25078
25079 !!test
25080 Bug 54262: New entities
25081 !! options
25082 parsoid=html2wt
25083 !! html/parsoid
25084 <span typeof="mw:Entity">&nbsp;</span>
25085 !! wikitext
25086 &nbsp;
25087 !! end
25088
25089 ## Note that there is no wikitext output for 'unknownproperty' ##
25090 ## Unknown magic words are silently dropped ##
25091
25092 !! test
25093 Magic words
25094 !! options
25095 parsoid=html2wt
25096 !! html/parsoid
25097 <meta property='mw:PageProp/toc' />
25098 <meta property='mw:PageProp/notoc' />
25099 <meta property='mw:PageProp/forcetoc' />
25100 <meta property='mw:PageProp/index' />
25101 <meta property='mw:PageProp/noindex' />
25102 <meta property='mw:PageProp/nogallery' />
25103 <meta property='mw:PageProp/noeditsection' />
25104 <meta property='mw:PageProp/notitleconvert' />
25105 <meta property='mw:PageProp/nocontentconvert' />
25106 <meta property='mw:PageProp/unknownproperty' />
25107 !! wikitext
25108 __TOC__
25109 __NOTOC__
25110 __FORCETOC__
25111 __INDEX__
25112 __NOINDEX__
25113 __NOGALLERY__
25114 __NOEDITSECTION__
25115 __NOTITLECONVERT__
25116 __NOCONTENTCONVERT__
25117 !! end
25118
25119 !! test
25120 Consecutive <pre>s should not get merged
25121 !! options
25122 parsoid=html2wt,html2html
25123 !! html/parsoid
25124 <pre>a</pre><pre>b</pre>
25125
25126 <pre>c
25127 </pre><pre>
25128 d</pre>
25129
25130 <pre>e
25131
25132 </pre><pre>
25133
25134 f</pre>
25135 !! wikitext
25136 a
25137
25138 b
25139
25140 c
25141
25142 d
25143
25144 e
25145
25146
25147
25148 f
25149 !! end
25150
25151 !! test
25152 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25153 !! options
25154 parsoid=html2wt
25155 !! html/parsoid
25156 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25157 !! wikitext
25158 [[Special:BookSources/1234567890|ISBN 1234567895]]
25159 !! end
25160
25161 !! test
25162 Edited RFC links not serializable as RFC links should serialize as extlinks
25163 !! options
25164 parsoid=html2wt
25165 !! html/parsoid
25166 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25167 !! wikitext
25168 [//tools.ietf.org/html/rfc123 New RFC]
25169 !! end
25170
25171 !! test
25172 Edited PMID links not serializable as PMID links should serialize as extlinks
25173 !! options
25174 parsoid=html2wt
25175 !! html/parsoid
25176 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25177 !! wikitext
25178 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25179 !! end
25180
25181 !! test
25182 WTS of autolinks with trailing/surrounding context
25183 !! options
25184 parsoid=html2wt
25185 !! html/parsoid
25186 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25187 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25188 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25189 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25190 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25191 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25192 !! wikitext
25193 http://cscott.net<nowiki/>'''foo'''
25194
25195 http://cscott.net<b>foo</b>
25196
25197 '''http://cscott.net<nowiki/>'''
25198
25199 '''http://cscott.net '''
25200
25201 '''http://cscott.net<nowiki/>x'''
25202
25203 http://cscott.net<nowiki/>x
25204 !! end
25205
25206 !! test
25207 WTS of autolinks with nowikis (round-trip)
25208 !! wikitext
25209 x<nowiki/>http://cscott.net<nowiki/>x
25210 !! html/parsoid
25211 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25212 !! end
25213
25214 # this is the "easy" test because it leaves in place all the
25215 # data-parsoid information indicating this is an autolink
25216 !! test
25217 WTS of autolinks with escapes (editing)
25218 !! options
25219 parsoid={
25220 "modes": ["wt2wt"],
25221 "changes": [
25222 [ "meta", "remove" ]
25223 ]
25224 }
25225 !! wikitext
25226 x<nowiki/>http://cscott.net<nowiki/>x
25227 !! wikitext/edited
25228 x<nowiki/>http://cscott.net<nowiki/>x
25229 !! end
25230
25231 !! test
25232 WTS of edited autolink-like text (T103364)
25233 !! options
25234 parsoid={
25235 "modes": ["wt2wt"],
25236 "changes": [
25237 [ "span[typeof]", "removeAttr", "typeof" ]
25238 ]
25239 }
25240 !! wikitext
25241 Not a link: <nowiki>http://example.com</nowiki>.
25242 !! wikitext/edited
25243 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25244 !! end
25245
25246 !! test
25247 WTS of newly-authored autolink-like text (T103364)
25248 !! options
25249 parsoid=html2wt
25250 !! html/parsoid
25251 <p>http://example.com is not a link.</p>
25252 !! wikitext
25253 <nowiki>http://example.com is not a link.</nowiki>
25254 !! end
25255
25256 !! test
25257 WTS of autolink-like text after an autolink (T108563)
25258 !! options
25259 parsoid=html2wt
25260 !! html/parsoid
25261 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25262 !! wikitext
25263 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25264 !! end
25265
25266 !! test
25267 Magic links inside links (not autolinked)
25268 !! wikitext
25269 [[Foo|http://example.com]]
25270 [[Foo|RFC 1234]]
25271 [[Foo|PMID 1234]]
25272 [[Foo|ISBN 123456789x]]
25273
25274 [http://foo.com http://example.com]
25275 [http://foo.com RFC 1234]
25276 [http://foo.com PMID 1234]
25277 [http://foo.com ISBN 123456789x]
25278 !! html+tidy
25279 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25280 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25281 !! html/parsoid
25282 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25283 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25284 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25285 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25286
25287 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25288 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25289 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25290 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25291 !! end
25292
25293 !! test
25294 Magic links inside image captions (autolinked)
25295 !! wikitext
25296 [[File:Foobar.jpg|thumb|http://example.com]]
25297 [[File:Foobar.jpg|thumb|RFC 1234]]
25298 [[File:Foobar.jpg|thumb|PMID 1234]]
25299 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25300 !! html+tidy
25301 <div class="thumb tright">
25302 <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>
25303 <div class="thumbcaption">
25304 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25305 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25306 </div>
25307 </div>
25308 <div class="thumb tright">
25309 <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>
25310 <div class="thumbcaption">
25311 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25312 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25313 </div>
25314 </div>
25315 <div class="thumb tright">
25316 <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>
25317 <div class="thumbcaption">
25318 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25319 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25320 </div>
25321 </div>
25322 <div class="thumb tright">
25323 <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>
25324 <div class="thumbcaption">
25325 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25326 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25327 </div>
25328 </div>
25329 !! html/parsoid
25330 <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>
25331 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25332 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25333 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25334 !! end
25335
25336 !! test
25337 WTS of magic word text (T109371)
25338 !! options
25339 parsoid=html2wt
25340 !! html/parsoid
25341 <p>RFC 1234</p>
25342 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25343 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25344 !! wikitext
25345 <nowiki>RFC 1234</nowiki>
25346
25347 [http://foo.com RFC 1234]
25348
25349 [[Foo|RFC 1234]]
25350 !! end
25351
25352 !! test
25353 Edited Redirect link should emit a non-piped wikitext link
25354 !! options
25355 parsoid=html2wt
25356 !! html/parsoid
25357 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25358 !! wikitext
25359 #REDIRECT [[Bar]]
25360 !! end
25361
25362 !! test
25363 T75121: Infer extension name from typeOf if data-mw is not present
25364 !! options
25365 parsoid=html2wt
25366 !! html/parsoid
25367 <div typeOf="mw:Extension/foo"></div>
25368 !! wikitext
25369 <foo />
25370 !! end
25371
25372 # Note that the <p> wrapping isn't present in PHP parser output
25373 # The important thing for this test is that P-wrapping doesn't
25374 # interfere with the <nowiki> protection for leading - in <td>
25375 # (which isn't necessary for <th>).
25376 !! test
25377 T88318: p-wrapped dash in table.
25378 !! options
25379 parsoid=html2wt,wt2wt
25380 !! html/parsoid
25381 <table><tbody>
25382 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25383 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25384 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25385 </tbody></table>
25386 !! wikitext
25387 {|
25388 !-
25389 !-
25390 |-
25391 |<nowiki>-</nowiki>
25392 |<nowiki>- </nowiki>
25393 |-
25394 |<small>-</small>
25395 |<br>
25396 -
25397 |<br>
25398 -
25399 |}
25400 !! html/php+tidy
25401 <table>
25402 <tr>
25403 <th>-</th>
25404 <th>-</th>
25405 </tr>
25406 <tr>
25407 <td>-</td>
25408 <td>-</td>
25409 </tr>
25410 <tr>
25411 <td><small>-</small></td>
25412 <td><br />
25413 <p>-</p>
25414 </td>
25415 <td><br />
25416 <p>-</p>
25417 </td>
25418 </tr>
25419 </table>
25420 !! end
25421
25422 !! test
25423 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25424 !! options
25425 parsoid=html2wt
25426 !! html/parsoid
25427 <table id='mwAb'>
25428 <td id='mwAc'>foo</td>
25429 <td id='serialize-this'>bar</td>
25430 </table>
25431 !! wikitext
25432 {|
25433 |foo
25434 | id="serialize-this" |bar
25435 |}
25436 !! end
25437
25438 !! test
25439 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25440 !! options
25441 parsoid=html2wt
25442 !! html/parsoid
25443 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25444 !! wikitext
25445 <div id="hello">ok</div>
25446 !! end
25447
25448 !! test
25449 WTS change modes
25450 !! options
25451 parsoid={
25452 "modes": ["wt2wt"],
25453 "changes": [
25454 [ "#xyz", "before", "<b>before</b> stuff " ],
25455 [ "#xyz", "after", " stuff <i>after</i>" ],
25456 [ "#xyz", "html", "x <b>y</b> z" ]
25457 ]
25458 }
25459 !! wikitext
25460 <span id="xyz">hello</span>
25461 !! wikitext/edited
25462 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25463 !! end
25464
25465 !! test
25466 Never serialize a-tag as html, regardless of what data-parsoid has to say
25467 !! options
25468 parsoid=html2wt
25469 !! html/parsoid
25470 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25471 !! wikitext
25472 [[Foo]]
25473 !! end
25474
25475 ## SSS FIXME: This is broken output nevertheless.
25476 ## What might be a reasonable non-broken output for this?
25477 ## This is an edge case unlikely to be seen in production
25478 ## that I am not wasting more time on this right now.
25479 !! test
25480 Never serialize a-tag as html, no matter what attributes it has
25481 !! options
25482 parsoid=html2wt
25483 !! html/parsoid
25484 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25485 !! wikitext
25486 [http://boo.org http://boohoo.org]
25487 !! end
25488
25489 # Misnested is an indication that selser can reuse the source but these have
25490 # shown to sneak through on occasion. See T101768.
25491 # The original wikitext here is: [http://test.com [[one]] two three]
25492 !! test
25493 Strip span tags added to mark as misnested
25494 !! options
25495 parsoid=html2wt
25496 !! html/parsoid
25497 <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>
25498 !! wikitext
25499 [http://test.com][[one]] two three
25500 !! end
25501
25502 # --------------------------------------------
25503 # Tests spec'ing wikitext serialization norms |
25504 # --------------------------------------------
25505
25506 !! test
25507 Lists: Add space after bullets
25508 !! options
25509 parsoid=html2wt
25510 !! html/parsoid
25511 <ul>
25512 <li>foo</li>
25513 <li> bar</li>
25514 <li><span> baz</span></li>
25515 </ul>
25516 !! wikitext
25517 * foo
25518 * bar
25519 * <span> baz</span>
25520 !! end
25521
25522 !! test
25523 1. Headings: Add space before/after == (T53744)
25524 !! options
25525 parsoid=html2wt
25526 !! html/parsoid
25527 <h2>foo</h2>
25528 <h2> bar</h2>
25529 <h2>baz </h2>
25530 <h2><span> baz</span></h2>
25531 !! wikitext
25532 == foo ==
25533
25534 == bar ==
25535
25536 == baz ==
25537
25538 == <span> baz</span> ==
25539 !! end
25540
25541 !! test
25542 2. Headings: Add space before/after == even after hoisted content
25543 !! options
25544 parsoid={
25545 "modes": ["html2wt"],
25546 "scrubWikitext": true
25547 }
25548 !! html/parsoid
25549 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25550 !! wikitext
25551 [[Category:A2]]
25552
25553 == ok ==
25554 !! end
25555
25556 !! test
25557 1. Headings: suppress newly created empty headings
25558 !! options
25559 parsoid={
25560 "modes": ["html2wt"],
25561 "scrubWikitext": true
25562 }
25563 !! html/parsoid
25564 <h2></h2>
25565 !! wikitext
25566 !! end
25567
25568 !! test
25569 2. Headings: don't suppress empty headings if scrubWikitext is false
25570 !! options
25571 parsoid=html2wt
25572 !! html/parsoid
25573 <h2></h2>
25574 !! wikitext
25575 ==<nowiki/>==
25576 !! end
25577
25578 !! test
25579 3. Headings: suppress empty headings on edits
25580 !! options
25581 parsoid={
25582 "modes": ["selser"],
25583 "scrubWikitext": true,
25584 "changes": [
25585 [ "#x", "remove"]
25586 ]
25587 }
25588 !! wikitext
25589 ==<span id="x">foo</span>==
25590 !! wikitext/edited
25591 !! end
25592
25593 !! test
25594 1. WT Quote Tags: suppress newly created empty style tags
25595 !! options
25596 parsoid={
25597 "modes": ["html2wt"],
25598 "scrubWikitext": true
25599 }
25600 !! html/parsoid
25601 <i></i><b></b>
25602 !! wikitext
25603 !! end
25604
25605 !! test
25606 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <i></i><b></b>
25611 !! wikitext
25612 ''<nowiki/>'''''<nowiki/>'''
25613 !! end
25614
25615 !! test
25616 3. WT Quote Tags: suppress empty style tags on edits
25617 !! options
25618 parsoid={
25619 "modes": ["selser"],
25620 "scrubWikitext": true,
25621 "changes": [
25622 [ "#x", "remove"]
25623 ]
25624 }
25625 !! wikitext
25626 '''<span id="x">foo</span>'''
25627 !! wikitext/edited
25628 !! end
25629
25630 !! test
25631 1. Anchors: suppress newly created empty anchors
25632 !! options
25633 parsoid={
25634 "modes": ["html2wt"],
25635 "scrubWikitext": true
25636 }
25637 !! html/parsoid
25638 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25639 !! wikitext
25640 !! end
25641
25642 !! test
25643 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25644 !! options
25645 parsoid={
25646 "modes": ["html2wt"],
25647 "scrubWikitext": false
25648 }
25649 !! html/parsoid
25650 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25651 !! wikitext
25652 [[Test|<nowiki/>]]
25653 !! end
25654
25655 !! test
25656 3. Anchors: suppress empty anchors on edits
25657 !! options
25658 parsoid={
25659 "modes": ["selser"],
25660 "scrubWikitext": true,
25661 "changes": [
25662 [ "#x", "remove"]
25663 ]
25664 }
25665 !! wikitext
25666 [[Test|<span id="x">foo</span>]]
25667 !! wikitext/edited
25668 !! end
25669
25670 !! test
25671 3a. Anchors: do not suppress numbered extlinks
25672 !! options
25673 parsoid={
25674 "modes": ["wt2wt"],
25675 "scrubWikitext": true
25676 }
25677 !! wikitext
25678 [http://foo.com]
25679 !! html/parsoid
25680 <a rel="mw:ExtLink" href="http://foo.com"></a>
25681 !! end
25682
25683 !! test
25684 3b. Anchors: do not suppress numbered extlinks
25685 !! options
25686 parsoid={
25687 "modes": ["wt2wt"],
25688 "scrubWikitext": true,
25689 "changes": [
25690 [ "#x", "remove"]
25691 ]
25692 }
25693 !! wikitext
25694 [http://foo.com <span id="x">foo</span>]
25695 !! wikitext/edited
25696 [http://foo.com]
25697 !! end
25698
25699 !!test
25700 Normalizations should be restricted to edited content
25701 !!options
25702 parsoid={
25703 "modes": ["selser"],
25704 "scrubWikitext": true,
25705 "changes": [
25706 [ "h1", "before", "<i></i>"]
25707 ]
25708 }
25709 !!wikitext
25710 a
25711 = =
25712 b
25713 !!wikitext/edited
25714 a
25715 = =
25716 b
25717 !!end
25718
25719 !! test
25720 1. Multiple normalizations (html2wt)
25721 !! options
25722 parsoid={
25723 "modes": ["html2wt"],
25724 "scrubWikitext": true
25725 }
25726 !! html
25727 <h2><i></i></h2>
25728 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25729 </a><b><i></i></b>x</p>
25730 !! wikitext
25731
25732 [[foo]]
25733 x
25734
25735 !! end
25736
25737 !! test
25738 2. Multiple normalizations (selser)
25739 !! options
25740 parsoid={
25741 "modes": ["selser"],
25742 "scrubWikitext": true,
25743 "changes": [
25744 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25745 ]
25746 }
25747 !! wikitext
25748 <span id="x">foo</span>
25749 !! wikitext/edited
25750 <span id="x">foo</span>
25751
25752 x
25753 !! end
25754
25755 !! test
25756 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25757 !! options
25758 parsoid={
25759 "modes": ["html2wt"],
25760 "scrubWikitext": true
25761 }
25762 !! html/parsoid
25763 <p> hi</p>
25764 <p> hello</p>
25765 !! wikitext
25766 hi
25767
25768 hello
25769 !! end
25770
25771 !! test
25772 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25773 !! options
25774 parsoid=html2wt
25775 !! html/parsoid
25776 <p> hi</p>
25777 <p> hello</p>
25778 !! wikitext
25779 <nowiki> </nowiki>hi
25780
25781 <nowiki> </nowiki> hello
25782 !! end
25783
25784 !! test
25785 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25786 !! options
25787 parsoid={
25788 "modes": ["html2wt"],
25789 "scrubWikitext": true
25790 }
25791 !! html/parsoid
25792 <p>Foo
25793 bar
25794 baz</p>
25795
25796 <table><tr><td>Foo
25797 bar
25798 baz bang</td></tr></table>
25799
25800 <p><!--boo--> foo
25801 bar</p>
25802
25803 <p> foo
25804 bar<span>boo</span></p>
25805 !! wikitext
25806 Foo
25807 bar
25808 baz
25809
25810 {|
25811 |Foo
25812 bar
25813 baz bang
25814 |}
25815
25816 <!--boo-->foo
25817 bar
25818
25819 foo
25820 bar<span>boo</span>
25821 !! end
25822
25823 !! test
25824 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25825 !! options
25826 parsoid={
25827 "modes": ["selser"],
25828 "scrubWikitext": true,
25829 "changes": [
25830 [ "p", "html", " a\n b" ]
25831 ]
25832 }
25833 !! wikitext
25834 xyz
25835 !! wikitext/edited
25836 a
25837 b
25838 !! end
25839
25840 !! test
25841 1. New links that end in spaces
25842 !! options
25843 parsoid={
25844 "modes": ["html2wt"],
25845 "scrubWikitext": false
25846 }
25847 !! html/parsoid
25848 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25849 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25850 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25851 !! wikitext
25852 [[Berlin ]]<nowiki/>is the capital of Germany.
25853
25854 [[Foo ]]'''bar'''
25855
25856 [[Boston ]] is a city.
25857 !! end
25858
25859 !! test
25860 2. New links that end in spaces
25861 !! options
25862 parsoid={
25863 "modes": ["html2wt"],
25864 "scrubWikitext": true
25865 }
25866 !! html/parsoid
25867 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25868 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25869 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25870 !! wikitext
25871 [[Berlin]] is the capital of Germany.
25872
25873 [[Foo]] '''bar'''
25874
25875 [[Boston]] is a city.
25876 !! end
25877
25878 !! test
25879 1. Table cells with escapable prefixes
25880 !! options
25881 parsoid={
25882 "modes": ["html2wt"],
25883 "scrubWikitext": false
25884 }
25885 !! html
25886 <table>
25887 <tr><td>a</td></tr>
25888 <tr><td>-</td></tr>
25889 <tr><td>+</td></tr>
25890 </table>
25891 !! wikitext
25892 {|
25893 |a
25894 |-
25895 |<nowiki>-</nowiki>
25896 |-
25897 |<nowiki>+</nowiki>
25898 |}
25899 !! end
25900
25901 !! test
25902 2. Table cells with escapable prefixes
25903 !! options
25904 parsoid={
25905 "modes": ["html2wt"],
25906 "scrubWikitext": true
25907 }
25908 !! html
25909 <table>
25910 <tr><td>a</td></tr>
25911 <tr><td>-</td></tr>
25912 <tr><td>+</td></tr>
25913 </table>
25914 !! wikitext
25915 {|
25916 |a
25917 |-
25918 | -
25919 |-
25920 | +
25921 |}
25922 !! end
25923
25924 !! test
25925 3a. Table cells with escapable prefixes after edits
25926 !! options
25927 parsoid={
25928 "modes": ["selser"],
25929 "scrubWikitext": true,
25930 "changes": [
25931 [ "table tbody tr:first-child td:first-child", "remove"]
25932 ]
25933 }
25934 !! wikitext
25935 {|
25936 |a||-
25937 |}
25938 !! wikitext/edited
25939 {|
25940 | -
25941 |}
25942 !! end
25943
25944 !! test
25945 3b. Table cells with escapable prefixes after edits
25946 !! options
25947 parsoid={
25948 "modes": ["selser"],
25949 "scrubWikitext": true,
25950 "changes": [
25951 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25952 [ "#x", "remove" ]
25953 ]
25954 }
25955 !! wikitext
25956 {|
25957 |pqr
25958 |<span id="x">foo</span>+
25959 |}
25960 !! wikitext/edited
25961 {|
25962 | -
25963 | +
25964 |}
25965 !! end
25966
25967 # FIXME: This test will fail because
25968 # normalization doesn't realize that the id attribute
25969 # will eliminate the escapable scenario
25970 !! test
25971 4a. Table cells without escapable prefixes after edits
25972 !! options
25973 parsoid={
25974 "modes": ["selser"],
25975 "scrubWikitext": true,
25976 "changes": [
25977 [ "#x", "html", "-" ]
25978 ]
25979 }
25980 !! wikitext
25981 {|
25982 | id="x" |abcd
25983 |}
25984 !! wikitext/edited
25985 {|
25986 | id="x" |-
25987 |}
25988 !! end
25989
25990 ## This tests normalizer's ability to discriminate between
25991 ## cells having identical content.
25992 !! test
25993 4b. Table cells without escapable prefixes after edits
25994 !! options
25995 parsoid={
25996 "modes": ["selser"],
25997 "scrubWikitext": true,
25998 "changes": [
25999 [ "td", "html", "-" ]
26000 ]
26001 }
26002 !! wikitext
26003 {|
26004 |a||b
26005 |}
26006 !! wikitext/edited
26007 {|
26008 | -||-
26009 |}
26010 !! end
26011
26012 ## This tests normalizer's ability to not be tripped by
26013 ## comments (and whitespace)
26014 !! test
26015 4c. Table cells without escapable prefixes after edits
26016 !! options
26017 parsoid={
26018 "modes": ["selser"],
26019 "scrubWikitext": true,
26020 "changes": [
26021 [ "table tbody tr td:first-child", "remove" ]
26022 ]
26023 }
26024 !! wikitext
26025 {|
26026 |-
26027 <!--foo--> |a||-
26028 |}
26029 !! wikitext/edited
26030 {|
26031 |-
26032 <!--foo--> | -
26033 |}
26034 !! end
26035
26036 ## This tests normalizer's ability to handle HTML cells
26037 !! test
26038 4d. Table cells without escapable prefixes after edits
26039 !! options
26040 parsoid={
26041 "modes": ["selser"],
26042 "scrubWikitext": true,
26043 "changes": [
26044 [ "td", "html", "-" ]
26045 ]
26046 }
26047 !! wikitext
26048 <table>
26049 <tr><td>a</td></tr>
26050 </table>
26051 !! wikitext/edited
26052 <table>
26053 <tr><td>-</td></tr>
26054 </table>
26055 !! end
26056
26057 !! test
26058 Escape nowiki DOM elements
26059 !! options
26060 parsoid=html2wt
26061 !! html/parsoid
26062 <nowiki><i>foo</i></nowiki>
26063 !! wikitext
26064 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26065 !! end
26066
26067 # ---------------------------------------------------
26068 # End of tests spec'ing wikitext serialization norms |
26069 # ---------------------------------------------------
26070
26071 # -----------------------------------------------------------------
26072 # End of section for Parsoid-only html2wt tests for serialization
26073 # of new content
26074 # -----------------------------------------------------------------
26075
26076 # -----------------------------------------------------------------
26077 # The following section of tests are primarily to spec behavior of
26078 # the selective serializer. All these tests have manual selser
26079 # changes. The automated selser changes for all tests handle the
26080 # wide variation of changes, but these tests here capture specs
26081 # deterministically.
26082 # ----------------------------------------------------------------
26083
26084 ## T90517
26085 !! test
26086 Selser: New comments should not be lost
26087 !! options
26088 parsoid={
26089 "modes": ["selser"],
26090 "changes": [
26091 [ "#a", "after", "<!--c1-->" ],
26092 [ "#b", "before", "<!--c2-->" ]
26093 ]
26094 }
26095 !! wikitext
26096 <span id="a">a</span>
26097
26098 <span id="b">b</span>
26099 !! wikitext/edited
26100 <span id="a">a</span><!--c1-->
26101
26102 <!--c2--><span id="b">b</span>
26103 !! end
26104
26105 ## T89383
26106 !! test
26107 Selser: Check for validity of DSR before using it
26108 !! options
26109 parsoid={
26110 "modes": ["selser"],
26111 "changes": [
26112 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26113 ]
26114 }
26115 !! wikitext
26116 <span id="a">a</span>
26117 !! wikitext/edited
26118 {{DISPLAYTITLE:foo}}
26119 <span id="a">a</span>
26120 !! end
26121
26122 !! test
26123 1. DOMDiff: Changes to <ref> content should be looked up using id
26124 !! options
26125 parsoid={
26126 "modes": ["selser"],
26127 "changes": [
26128 ["#X", "after", "bar"],
26129 ["#Y", "after", "baz"]
26130 ]
26131 }
26132 !! wikitext
26133 X <ref><span id="X">foo</span></ref>
26134 Y <ref name="a" />
26135 <references>
26136 <ref name="a"><span id="Y">foo</span></ref>
26137 </references>
26138 !! wikitext/edited
26139 X <ref><span id="X">foo</span>bar</ref>
26140 Y <ref name="a" />
26141 <references>
26142 <ref name="a"><span id="Y">foo</span>baz</ref>
26143 </references>
26144 !! end
26145
26146 !! test
26147 2. DOMDiff: Changes to <ref> content should be looked up using id
26148 !! options
26149 parsoid={
26150 "modes": ["selser"],
26151 "changes": [
26152 ["#Z", "after", "bar"]
26153 ]
26154 }
26155 !! wikitext
26156 A <ref>foo bar for a</ref>
26157 B <ref group="X" name="b" />
26158
26159 <references />
26160
26161 <references group="X">
26162 <ref name="b"><span id="Z">foo</span></ref>
26163 </references>
26164 !! wikitext/edited
26165 A <ref>foo bar for a</ref>
26166 B <ref group="X" name="b" />
26167
26168 <references />
26169
26170 <references group="X">
26171 <ref name="b"><span id="Z">foo</span>bar</ref>
26172 </references>
26173 !! end