Remove 'noclasses' from Linker::linkKnown() defaults
[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 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml
39 #
40 # For testing purposes, temporary articles can created:
41 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
42 # where '/' denotes a newline.
43
44 # This is the standard article assumed to exist.
45 !! article
46 Main Page
47 !! text
48 blah blah
49 !! endarticle
50
51 !!article
52 Foo
53 !!text
54 FOO
55 !!endarticle
56
57 !!article
58 Template:Foo
59 !!text
60 FOO
61 !!endarticle
62
63 !! article
64 Template:Blank
65 !! text
66 !! endarticle
67
68 !! article
69 Template:pipe
70 !! text
71 |
72 !! endarticle
73
74 !! article
75 Template:=
76 !! text
77 <nowiki>=</nowiki>
78 !! endarticle
79
80 !!article
81 MediaWiki:bad image list
82 !!text
83 * [[File:Bad.jpg]] except [[Nasty page]]
84 !!endarticle
85
86 !! article
87 Template:inner list
88 !! text
89 * item 1
90 !! endarticle
91
92 !! article
93 Template:tbl-start
94 !! text
95 {|
96 !! endarticle
97
98 !! article
99 Template:tbl-end
100 !! text
101 |}
102 !! endarticle
103
104 !! article
105 Template:echo
106 !! text
107 {{{1}}}
108 !! endarticle
109
110 !! article
111 Template:echo_with_span
112 !! text
113 <span>{{{1}}}</span>
114 !! endarticle
115
116 !! article
117 Template:echo_with_div
118 !! text
119 <div>{{{1}}}</div>
120 !! endarticle
121
122 !! article
123 Template:blank_param
124 !! text
125 {{{1}}}
126 {{{}}}
127 !! endarticle
128
129 !! article
130 Template:table_attribs
131 !! text
132 <noinclude>
133 |</noinclude>style="color:red;"|Foo
134 !! endarticle
135
136 !! article
137 Template:table_attribs_2
138 !! text
139 <noinclude>
140 |</noinclude>style="color:red;"|Foo
141 |Bar||Baz
142 !! endarticle
143
144 !! article
145 Template:table_attribs_3
146 !! text
147 <noinclude>
148 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
149 !! endarticle
150
151 !! article
152 Template:table_attribs_4
153 !! text
154 | style="background-color:#DC241f;" width="10px" |
155 !! endarticle
156
157 !! article
158 Template:table_attribs_5
159 !! text
160 <noinclude>
161 |</noinclude>style="color:red;"||Bar
162 !! endarticle
163
164 !! article
165 Template:table_attribs_6
166 !! text
167 style="background: <nowiki>
168
169
170 red;</nowiki>" |
171 !! endarticle
172
173 !! article
174 Template:table_attribs_7
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
178 !! endarticle
179
180 !! article
181 Template:table_header_cells
182 !! text
183 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
184 !! endarticle
185
186 !! article
187 Template:table_cells
188 !! text
189 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
190 !! endarticle
191
192 !! article
193 Template:PartialTable
194 !! text
195 {|
196 |-
197 !! endarticle
198
199 !! article
200 Template:image_attribs
201 !! text
202 <noinclude>
203 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
204 !! endarticle
205
206 ## See T48811 for details
207 !! article
208 Template:mixed_attr_content_template
209 !! text
210 style="color:red;" title="T48811"
211 |-
212 |foo
213 !! endarticle
214
215 !! article
216 Template:definition_list
217 !! text
218 one
219 ::two
220 !! endarticle
221
222 !! article
223 A?b
224 !! text
225 Weirdo titles!
226 !! endarticle
227
228 !!article
229 Template:Bullet
230 !!text
231 * Bar
232 !!endarticle
233
234 !!article
235 Template:OpenTable
236 !!text
237 {|
238 !!endarticle
239
240 !!article
241 Template:EmptyLITest
242 !!text
243 *a
244 *
245 *
246 *b
247 !!endarticle
248
249 !!article
250 Template:EmptyTRTest
251 !!text
252 {|
253 |-
254 |-
255 |foo
256 |-
257 |-
258 |bar
259 |}
260 !!endarticle
261
262 !!article
263 Template:EmptyTRWithHTMLAttrTest
264 !!text
265 <table>
266 <tr align="center"></tr>
267 <tr><td>foo</td></tr>
268 <tr align="center"></tr>
269 <tr><td>bar</td></tr>
270 </table>
271 !!endarticle
272
273 ###
274 ### Basic tests
275 ###
276 !! test
277 Blank input
278 !! wikitext
279 !! html
280 !! end
281
282
283 !! test
284 Simple paragraph
285 !! wikitext
286 This is a simple paragraph.
287 !! html
288 <p>This is a simple paragraph.
289 </p>
290 !! end
291
292 !! test
293 Paragraphs with extra newline spacing
294 !! wikitext
295 foo
296
297 bar
298
299
300 baz
301
302
303
304 booz
305 !! html
306 <p>foo
307 </p><p>bar
308 </p><p><br />
309 baz
310 </p><p><br />
311 </p><p>booz
312 </p>
313 !! end
314
315 !! test
316 Paragraphs with newline spacing with comment lines in between
317 !! wikitext
318 ----
319 a
320 <!--foo-->
321 b
322 ----
323 a
324 <!--foo--><!--More than 1 comment, still stripped-->
325 b
326 ----
327 a
328 <!--foo--> <!----> <!-- bar -->
329 b
330 ----
331 a
332 <!--foo-->
333
334 b
335 ----
336 a
337
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo-->
343
344
345 b
346 ----
347 a
348
349
350 <!--foo-->
351 b
352 ----
353 !! html
354 <hr />
355 <p>a
356 b
357 </p>
358 <hr />
359 <p>a
360 b
361 </p>
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 </p><p>b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380 <p>a
381 </p><p><br />
382 b
383 </p>
384 <hr />
385
386 !! end
387
388 !! test
389 Paragraphs with newline spacing with non-empty white-space lines in between
390 !! wikitext
391 ----
392 a
393
394 b
395 ----
396 a
397
398
399 b
400 ----
401 !! html
402 <hr />
403 <p>a
404 </p><p>b
405 </p>
406 <hr />
407 <p>a
408 </p><p><br />
409 b
410 </p>
411 <hr />
412
413 !! end
414
415 !! test
416 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
417 !! wikitext
418 ----
419 a
420 <!--foo-->
421 b
422 ----
423 a
424 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
425 b
426 ----
427 a
428
429 <!--foo-->
430 <!--bar-->
431 b
432 ----
433 a
434
435 <!--foo-->
436 <!--bar-->
437
438 b
439 ----
440 !! html
441 <hr />
442 <p>a
443 b
444 </p>
445 <hr />
446 <p>a
447 b
448 </p>
449 <hr />
450 <p>a
451 </p><p>b
452 </p>
453 <hr />
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 <hr />
459
460 !! end
461
462 !! test
463 Extra newlines: More paragraphs with indented comment
464 !! wikitext
465 a
466
467 <!--boo-->
468
469 b
470 !! html
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 !!end
476
477 !! test
478 Extra newlines followed by heading
479 !! wikitext
480 a
481
482
483
484 =b=
485 [[a]]
486
487
488 =b=
489 !! html
490 <p>a
491 </p><p><br />
492 </p>
493 <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>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p><p><br />
496 </p>
497 <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>
498
499 !! end
500
501 !! test
502 Extra newlines between heading and content are swallowed
503 !! wikitext
504 =b=
505
506
507
508 [[a]]
509 !! html
510 <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>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p>
513 !! end
514
515 !! test
516 Parsing an URL
517 !! wikitext
518 http://fr.wikipedia.org/wiki/🍺
519 <!-- EasterEgg we love beer, better be able be able to link to it -->
520 !! html
521 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
522 </p>
523 !! end
524
525 # Note that the html+tidy output removes the spaces after the <li>,
526 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
527 # This is an issue for all tests with lists. We intentionally do
528 # *not* add html+tidy clauses for these, as we don't want to
529 # document/test the broken behavior. (Parsoid matches the non-tidy
530 # output in these cases.)
531
532 !! test
533 Simple list
534 !! wikitext
535 * Item 1
536 * Item 2
537 !! html
538 <ul><li> Item 1</li>
539 <li> Item 2</li></ul>
540
541 !! end
542
543 !! test
544 Italics and bold
545 !! wikitext
546 * plain
547 * plain''italic''plain
548 * plain''italic''plain''italic''plain
549 * plain'''bold'''plain
550 * plain'''bold'''plain'''bold'''plain
551 * plain''italic''plain'''bold'''plain
552 * plain'''bold'''plain''italic''plain
553 * plain''italic'''bold-italic'''italic''plain
554 * plain'''bold''bold-italic''bold'''plain
555 * plain'''''bold-italic'''italic''plain
556 * plain'''''bold-italic''bold'''plain
557 * plain''italic'''bold-italic'''''plain
558 * plain'''bold''bold-italic'''''plain
559 * plain l'''italic''plain
560 * plain l''''bold''' plain
561 !! html
562 <ul><li> plain</li>
563 <li> plain<i>italic</i>plain</li>
564 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
565 <li> plain<b>bold</b>plain</li>
566 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
567 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
568 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
569 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
570 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
571 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
572 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
573 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
574 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
575 <li> plain l'<i>italic</i>plain</li>
576 <li> plain l'<b>bold</b> plain</li></ul>
577
578 !! end
579
580 # this example taken from the [[simple:Moon]] article (bug 47326)
581 !! test
582 Italics and possessives (1)
583 !! wikitext
584 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
585 !! html
586 <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
587 </p>
588 !! end
589
590 # this example taken from [[en:Flaming Pie]] (bug 49926)
591 !! test
592 Italics and possessives (2)
593 !! wikitext
594 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
595 !! html
596 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
597 </p>
598 !! end
599
600 # this example taken from [[en:Dictionary]] (bug 49926)
601 !! test
602 Italics and possessives (3)
603 !! wikitext
604 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''.
605 !! html
606 <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>.
607 </p>
608 !! end
609
610
611 ###
612 ### 2-quote opening sequence tests
613 ###
614 !! test
615 Italics and bold: 2-quote opening sequence: (2,2)
616 !! wikitext
617 ''foo''
618 !! html
619 <p><i>foo</i>
620 </p>
621 !!end
622
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,3)
625 !! wikitext
626 ''foo'''
627 !! html/*
628 <p><i>foo'</i>
629 </p>
630 !!end
631
632 !! test
633 Italics and bold: 2-quote opening sequence: (2,4)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 ''foo''''
638 !! html/*
639 <p><i>foo''</i>
640 </p>
641 !!end
642
643 # same html as previous, but wikitext adjusted to match parsoid html2wt
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
646 !! wikitext
647 ''foo<nowiki>''</nowiki>''
648 !! html
649 <p><i>foo''</i>
650 </p>
651 !! end
652
653 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
654 !! test
655 Italics and bold: 2-quote opening sequence: (2,5)
656 !! options
657 parsoid=wt2html
658 !! wikitext
659 ''foo'''''
660 !! html/php
661 <p><i>foo</i>
662 </p>
663 !! html/parsoid
664 <p><i>foo</i><b></b>
665 </p>
666 !!end
667
668 # same html as previous, but wikitext adjusted to match parsoid html2wt
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
671 !! wikitext
672 ''foo'''''<nowiki/>'''
673 !! html/php
674 <p><i>foo</i>
675 </p>
676 !! html/parsoid
677 <p><i>foo</i><b></b>
678 </p>
679 !! end
680
681
682 ###
683 ### 3-quote opening sequence tests
684 ###
685
686 !! test
687 Italics and bold: 3-quote opening sequence: (3,2)
688 !! wikitext
689 '''foo''
690 !! html/*
691 <p>'<i>foo</i>
692 </p>
693 !!end
694
695 !! test
696 Italics and bold: 3-quote opening sequence: (3,3)
697 !! wikitext
698 '''foo'''
699 !! html
700 <p><b>foo</b>
701 </p>
702 !!end
703
704 !! test
705 Italics and bold: 3-quote opening sequence: (3,4)
706 !! wikitext
707 '''foo''''
708 !! html/*
709 <p><b>foo'</b>
710 </p>
711 !!end
712
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 '''foo'''''
720 !! html/php
721 <p><b>foo</b>
722 </p>
723 !! html/parsoid
724 <p><b>foo</b><i></i>
725 </p>
726 !!end
727
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
731 !! wikitext
732 '''foo'''''<nowiki/>''
733 !! html/php
734 <p><b>foo</b>
735 </p>
736 !! html/parsoid
737 <p><b>foo</b><i></i>
738 </p>
739 !! end
740
741
742 ###
743 ### 4-quote opening sequence tests
744 ###
745
746 !! test
747 Italics and bold: 4-quote opening sequence: (4,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 ''''foo''
752 !! html/*
753 <p>''<i>foo</i>
754 </p>
755 !!end
756
757 # same html as previous, but wikitext adjusted to match parsoid html2wt
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
760 !! wikitext
761 <nowiki>''</nowiki>''foo''
762 !! html
763 <p>''<i>foo</i>
764 </p>
765 !! end
766
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,3)
769 !! wikitext
770 ''''foo'''
771 !! html/*
772 <p>'<b>foo</b>
773 </p>
774 !!end
775
776 !! test
777 Italics and bold: 4-quote opening sequence: (4,4)
778 !! options
779 parsoid=wt2html
780 !! wikitext
781 ''''foo''''
782 !! html/*
783 <p>'<b>foo'</b>
784 </p>
785 !!end
786
787 # same html as previous, but wikitext adjusted to match parsoid html2wt
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
790 !! wikitext
791 '<nowiki/>'''foo''''
792 !! html
793 <p>'<b>foo'</b>
794 </p>
795 !! end
796
797 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
798 !! test
799 Italics and bold: 4-quote opening sequence: (4,5)
800 !! options
801 parsoid=wt2html
802 !! wikitext
803 ''''foo'''''
804 !! html/php
805 <p>'<b>foo</b>
806 </p>
807 !! html/parsoid
808 <p>'<b>foo</b><i></i>
809 </p>
810 !!end
811
812 # same html as previous, but wikitext adjusted to match parsoid html2wt
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
815 !! wikitext
816 '<nowiki/>'''foo'''''<nowiki/>''
817 !! html/php
818 <p>'<b>foo</b>
819 </p>
820 !! html/parsoid
821 <p>'<b>foo</b><i></i>
822 </p>
823 !! end
824
825
826 ###
827 ### 5-quote opening sequence tests
828 ###
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,2)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 '''''foo''
836 !! html/*
837 <p><b><i>foo</i></b>
838 </p>
839 !!end
840
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! wikitext
845 '''''foo'''''
846 !! html/*
847 <p><i><b>foo</b></i>
848 </p>
849 !! end
850
851 !! test
852 Italics and bold: 5-quote opening sequence: (5,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 '''''foo'''
857 !! html/*
858 <p><i><b>foo</b></i>
859 </p>
860 !!end
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3+2)
865 !! wikitext
866 '''''foo'''''
867 !! html
868 <p><i><b>foo</b></i>
869 </p>
870 !! end
871
872 !! test
873 Italics and bold: 5-quote opening sequence: (5,4)
874 !! options
875 parsoid=wt2html
876 !! wikitext
877 '''''foo''''
878 !! html/*
879 <p><i><b>foo'</b></i>
880 </p>
881 !!end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,5)
885 !! wikitext
886 '''''foo'''''
887 !! html
888 <p><i><b>foo</b></i>
889 </p>
890 !!end
891
892 !! test
893 Italics and bold: 5-quote opening sequence: (5,6)
894 !! wikitext
895 '''''foo''''''
896 !! html/*
897 <p><i><b>foo'</b></i>
898 </p>
899 !! end
900
901 ###
902 ### multiple quote sequences in a line
903 ###
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,2)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 ''foo''''bar''
910 !! html/*
911 <p><i>foo'<b>bar</b></i>
912 </p>
913 !!end
914
915
916 # same html as previous, but wikitext adjusted to match parsoid html2wt
917 !! test
918 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
919 !! wikitext
920 ''foo'<nowiki/>'''bar'''''
921 !! html
922 <p><i>foo'<b>bar</b></i>
923 </p>
924 !! end
925
926
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,3)
929 !! options
930 parsoid=wt2html
931 !! wikitext
932 ''foo''''bar'''
933 !! html/*
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !!end
937
938
939 # same html as previous, but wikitext adjusted to match parsoid html2wt
940 !! test
941 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
942 !! wikitext
943 ''foo'<nowiki/>'''bar'''''
944 !! html
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,4)
952 !! options
953 parsoid=wt2html
954 !! wikitext
955 ''foo''''bar''''
956 !! html/*
957 <p><i>foo'<b>bar'</b></i>
958 </p>
959 !!end
960
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'<nowiki/>'''''
967 !! html
968 <p><i>foo'<b>bar'</b></i>
969 </p>
970 !! end
971
972
973 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
974 !! test
975 Italics and bold: multiple quote sequences: (3,4,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''foo''''bar''
980 !! html/php
981 <p><b>foo'</b>bar
982 </p>
983 !! html/parsoid
984 <p><b>foo'</b>bar<i></i>
985 </p>
986 !!end
987
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
991 !! options
992 parsoid
993 !! wikitext
994 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
995 !! html/php
996 <p><b>foo'</b>bar
997 </p>
998 !! html/parsoid
999 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1000 </p>
1001 !! end
1002
1003
1004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,3)
1007 !! options
1008 parsoid=wt2html
1009 !! wikitext
1010 '''foo''''bar'''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b>foo'</b>bar<b></b>
1016 </p>
1017 !!end
1018
1019 # same html as previous, but wikitext adjusted to match parsoid html2wt
1020 !! test
1021 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1022 !! wikitext
1023 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1024 !! html/php
1025 <p><b>foo'</b>bar
1026 </p>
1027 !! html/parsoid
1028 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### other quote tests
1034 ###
1035 !! test
1036 Italics and bold: other quote tests: (2,3,5)
1037 !! wikitext
1038 ''this is about '''foo's family'''''
1039 !! html
1040 <p><i>this is about <b>foo's family</b></i>
1041 </p>
1042 !!end
1043
1044
1045 !! test
1046 Italics and bold: other quote tests: (2,(3,3),2)
1047 !! wikitext
1048 ''this is about '''foo's''' family''
1049 !! html
1050 <p><i>this is about <b>foo's</b> family</i>
1051 </p>
1052 !!end
1053
1054
1055 !! test
1056 Italics and bold: other quote tests: (3,2,3,2)
1057 !! options
1058 parsoid=wt2html
1059 !! wikitext
1060 '''this is about ''foo'''s family''
1061 !! html/*
1062 <p><b>this is about <i>foo</i></b><i>s family</i>
1063 </p>
1064 !!end
1065
1066
1067 # same html as previous, but wikitext adjusted to match parsoid html2wt
1068 !! test
1069 Italics and bold: other quote tests: (3,2,3+2+2,2)
1070 !! wikitext
1071 '''this is about ''foo'''''<nowiki/>''s family''
1072 !! html
1073 <p><b>this is about <i>foo</i></b><i>s family</i>
1074 </p>
1075 !! end
1076
1077
1078 !! test
1079 Italics and bold: other quote tests: (3,2,3,3)
1080 !! wikitext
1081 '''this is about ''foo'''s family'''
1082 !! html/*
1083 <p>'<i>this is about </i>foo<b>s family</b>
1084 </p>
1085 !!end
1086
1087
1088 !! test
1089 Italics and bold: other quote tests: (3,(2,2),3)
1090 !! wikitext
1091 '''this is about ''foo's'' family'''
1092 !! html
1093 <p><b>this is about <i>foo's</i> family</b>
1094 </p>
1095 !!end
1096
1097
1098 !! test
1099 Italicized possessive
1100 !! wikitext
1101 The ''[[Main Page]]'''s talk page.
1102 !! html/php
1103 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1104 </p>
1105 !! html/parsoid
1106 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1107 !! end
1108
1109 !! test
1110 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1111 (Requires tidy for PHP parser output to be fixed up)
1112 !! options
1113 parsoid=wt2html,wt2wt
1114 !! wikitext
1115 {|
1116 !''a!!''b
1117 |''a||''b
1118 |}
1119 !! html/php+tidy
1120 <table>
1121 <tr>
1122 <th><i>a</i></th>
1123 <th><i>b</i></th>
1124 <td><i>a</i></td>
1125 <td><i>b</i></td>
1126 </tr>
1127 </table>
1128 !! html/parsoid
1129 <table>
1130 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1131 <td><i>a</i></td><td><i>b</i></td></tr>
1132 </tbody></table>
1133 !! end
1134
1135 ###
1136 ### Non-html5 tags
1137 ###
1138
1139 !! test
1140 Non-html5 tags should be accepted
1141 !! wikitext
1142 <center>''foo''</center>
1143 <big>''foo''</big>
1144 <font>''foo''</font>
1145 <strike>''foo''</strike>
1146 <tt>''foo''</tt>
1147 !! html
1148 <center><i>foo</i></center>
1149 <p><big><i>foo</i></big>
1150 <font><i>foo</i></font>
1151 <strike><i>foo</i></strike>
1152 <tt><i>foo</i></tt>
1153 </p>
1154 !! end
1155
1156 !! test
1157 <wbr> is valid wikitext (bug 52468)
1158 !! wikitext
1159 <wbr>
1160 !! html
1161 <p><wbr />
1162 </p>
1163 !! end
1164
1165 # <strike> is HTML4, <s> is HTML4/5.
1166 !! test
1167 <s> or <strike> for strikethrough
1168 !! wikitext
1169 <strike>strike</strike>
1170
1171 <s>s</s>
1172 !! html
1173 <p><strike>strike</strike>
1174 </p><p><s>s</s>
1175 </p>
1176 !! end
1177
1178 ## a not permitted
1179 ## i,b,br omitted
1180 !! test
1181 Text-level semantic html elements in wikitext
1182 !! wikitext
1183 <em>text</em>
1184 <strong>text</strong>
1185 <small>text</small>
1186 <s>text</s>
1187 <cite>text</cite>
1188 <q>text</q>
1189 <dfn>text</dfn>
1190 <abbr>text</abbr>
1191 <data>text</data>
1192 <time>text</time>
1193 <code>text</code>
1194 <var>text</var>
1195 <samp>text</samp>
1196 <kbd>text</kbd>
1197 <sub>text</sub>
1198 <u>text</u>
1199 <mark>text</mark>
1200 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1201 <bdi>text</bdi>
1202 <bdo>text</bdo>
1203 <span>text</span>
1204 <wbr />
1205 !! html
1206 <p><em>text</em>
1207 <strong>text</strong>
1208 <small>text</small>
1209 <s>text</s>
1210 <cite>text</cite>
1211 <q>text</q>
1212 <dfn>text</dfn>
1213 <abbr>text</abbr>
1214 <data>text</data>
1215 <time>text</time>
1216 <code>text</code>
1217 <var>text</var>
1218 <samp>text</samp>
1219 <kbd>text</kbd>
1220 <sub>text</sub>
1221 <u>text</u>
1222 <mark>text</mark>
1223 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1224 <bdi>text</bdi>
1225 <bdo>text</bdo>
1226 <span>text</span>
1227 <wbr />
1228 </p>
1229 !! end
1230
1231 # test cases taken from
1232 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1233 !! test
1234 Ruby markup (W3C-style)
1235 !! wikitext
1236 ; Mono-ruby for individual base characters
1237 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1238 ; Group ruby
1239 : <ruby>今日<rt>きょう</rt></ruby>
1240 ; Jukugo ruby
1241 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1242 ; Inline ruby
1243 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1244 ; Double-sided ruby
1245 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1246 <ruby>
1247 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1248 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1249 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1250 </ruby>
1251 !! html
1252 <dl><dt> Mono-ruby for individual base characters</dt>
1253 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1254 <dt> Group ruby</dt>
1255 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1256 <dt> Jukugo ruby</dt>
1257 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1258 <dt> Inline ruby</dt>
1259 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1260 <dt> Double-sided ruby</dt>
1261 <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>
1262 <p><ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 </p>
1268 !! end
1269
1270 # The next two test different paths in the sanitizer.
1271 !! test
1272 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1273 !! wikitext
1274 <blockquote|>a</blockquote>
1275
1276 <b→> doesn't terminate </b→>
1277
1278 <bä> doesn't terminate </bä>
1279
1280 <boo> doesn't terminate </boo>
1281
1282 <s.foo> doesn't terminate </s.foo>
1283
1284 <sub-ID#1>
1285 !! html
1286 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1287 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1288 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1289 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1290 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1291 </p><p>&lt;sub-ID#1&gt;
1292 </p>
1293 !! end
1294
1295 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1296 # If the non-word-character tag made it through the sanitizer, tidy
1297 # would munge it up.
1298 !! test
1299 Non-word characters don't terminate tag names + tidy
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html+tidy
1313 <p>&lt;blockquote|&gt;a</p>
1314 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1315 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1316 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1317 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1318 <p>&lt;sub-ID#1&gt;</p>
1319 !! end
1320
1321 ###
1322 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1323 ### This checks that HTML5 tags (with non-word characters in the tag
1324 ### name) make it safely through the parser -- the Sanitizer will
1325 ### munge them later, as it should.
1326 ###
1327 !! test
1328 Non-word characters are valid in extension tags (T19663)
1329 !! wikitext
1330 <tåg>tåg</tåg>
1331 !! html/php
1332 <pre>
1333 'tåg'
1334 array (
1335 )
1336 </pre>
1337
1338 !! html/parsoid
1339 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! wikitext
1464 {{echo|&ndash;}}
1465 !! html/php+tidy
1466 <p>–</p>
1467 !! html/parsoid
1468 <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>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html/parsoid
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <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>
1525 <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>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <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>
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 }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <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>
1539 <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>
1540 <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>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|<nowiki>a }} b</nowiki>}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1790 a
1791 {{blank}} <!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html/php
1807 <ul><li>a</li>
1808 <li>b</li></ul>
1809
1810 !! html/parsoid
1811 <!--c1--><ul>
1812 <li>a
1813 </li>
1814 <!--c2--><!--c3--><!--c4-->
1815 <li>b
1816 </li>
1817 </ul>
1818 !! end
1819
1820 ###
1821 ### paragraph wrapping tests
1822 ###
1823 !! test
1824 No block tags
1825 !! wikitext
1826 a
1827
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Block tag on one line (<div>)
1837 !! wikitext
1838 a <div>foo</div>
1839
1840 b
1841 !! html
1842 a <div>foo</div>
1843 <p>b
1844 </p>
1845 !! html+tidy
1846 <p>a</p>
1847 <div>foo</div>
1848 <p>b</p>
1849 !! end
1850
1851 !! test
1852 Block tag on one line (<blockquote>)
1853 !! wikitext
1854 a <blockquote>foo</blockquote>
1855
1856 b
1857 !! html
1858 a <blockquote>foo</blockquote>
1859 <p>b
1860 </p>
1861 !! html+tidy
1862 <p>a</p>
1863 <blockquote>
1864 <p>foo</p>
1865 </blockquote>
1866 <p>b</p>
1867 !! end
1868
1869 !! test
1870 Block tag on both lines (<div>)
1871 !! wikitext
1872 a <div>foo</div>
1873
1874 b <div>foo</div>
1875 !! html
1876 a <div>foo</div>
1877 b <div>foo</div>
1878
1879 !! html+tidy
1880 <p>a</p>
1881 <div>foo</div>
1882 <p>b</p>
1883 <div>foo</div>
1884 !! end
1885
1886 !! test
1887 Block tag on both lines (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b <blockquote>foo</blockquote>
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 b <blockquote>foo</blockquote>
1895
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 <blockquote>
1903 <p>foo</p>
1904 </blockquote>
1905 !! end
1906
1907 !! test
1908 Multiple lines without block tags
1909 !! wikitext
1910 <div>foo</div> a
1911 b
1912 c
1913 d<!--foo--> e
1914 x <div>foo</div> z
1915 !! html
1916 <div>foo</div> a
1917 <p>b
1918 c
1919 d e
1920 </p>
1921 x <div>foo</div> z
1922
1923 !! html+tidy
1924 <div>foo</div>
1925 <p>a</p>
1926 <p>b c d e</p>
1927 <p>x</p>
1928 <div>foo</div>
1929 <p>z</p>
1930 !! end
1931
1932 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1933 # So, we have a separate section for Parsoid. We don't want
1934 # to mimic this stripping behavior in Parsoid. It affects
1935 # editing experience and also requires us to maintain additional
1936 # info for RT-ing.
1937 !! test
1938 Empty lines between lines with block tags
1939 !! wikitext
1940 <div></div>
1941
1942
1943 <div></div>a
1944
1945 b
1946 <div>a</div>b
1947
1948 <div>b</div>d
1949
1950
1951 <div>e</div>
1952 !! html
1953 <div></div>
1954 <p><br />
1955 </p>
1956 <div></div>a
1957 <p>b
1958 </p>
1959 <div>a</div>b
1960 <div>b</div>d
1961 <p><br />
1962 </p>
1963 <div>e</div>
1964
1965 !! html+tidy
1966 <p><br /></p>
1967 <p>a</p>
1968 <p>b</p>
1969 <div>a</div>
1970 <p>b</p>
1971 <div>b</div>
1972 <p>d</p>
1973 <p><br /></p>
1974 <div>e</div>
1975 !! html/parsoid
1976 <div data-parsoid='{"stx":"html"}'></div>
1977
1978 <p><br /></p>
1979 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1980
1981 <p>b</p>
1982 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1983
1984 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1985
1986 <p><br /></p>
1987 <div data-parsoid='{"stx":"html"}'>e</div>
1988 !! end
1989
1990 ## PHP parser emits output which is broken
1991 !! test
1992 Unclosed HTML p-tags should be handled properly
1993 !! wikitext
1994 <div><p>foo</div>
1995 a
1996
1997 b
1998 !! html/php+tidy
1999 <div>
2000 <p>foo</p>
2001 </div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! html/parsoid
2005 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2006 <p>a</p>
2007 <p>b</p>
2008 !! end
2009
2010 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2011 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2012 ## them for now.
2013 !! test
2014 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2015 !! options
2016 parsoid=wt2html
2017 !! wikitext
2018 a [[Category:A1]] [[Category:A2]]
2019 [[Category:A3]]
2020 [[Category:A4]]
2021 !! html/parsoid
2022 <p>a</p>
2023 <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"/>
2024 !! end
2025
2026 !! test
2027 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2028 !! options
2029 parsoid=wt2html
2030 !! wikitext
2031 [[Category:A1]]a
2032 !! html/parsoid
2033 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2034 !! end
2035
2036 ###
2037 ### Preformatted text
2038 ###
2039 !! test
2040 Preformatted text
2041 !! wikitext
2042 This is some
2043 Preformatted text
2044 With ''italic''
2045 And '''bold'''
2046 And a [[Main Page|link]]
2047 !! html
2048 <pre>This is some
2049 Preformatted text
2050 With <i>italic</i>
2051 And <b>bold</b>
2052 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2053 </pre>
2054 !! end
2055
2056 !! test
2057 Tabs don't trigger preformatted text
2058 !! wikitext
2059 This is not
2060 preformatted text.
2061 This is preformatted text.
2062 So is this.
2063 !! html/php
2064 <p> This is not
2065 preformatted text.
2066 </p>
2067 <pre>This is preformatted text.
2068 So is this.
2069 </pre>
2070 !! html/parsoid
2071 <p> This is not
2072 preformatted text.</p>
2073 <pre>This is preformatted text.
2074 So is this.</pre>
2075 !! end
2076
2077 !! test
2078 Space before tab needs nowiki pre protection
2079 !! options
2080 parsoid=html2wt
2081 !! html/parsoid
2082 <p> a</p>
2083 !! wikitext
2084 <nowiki> </nowiki> a
2085 !! end
2086
2087 !! test
2088 Ident preformatting with inline content
2089 !! wikitext
2090 a
2091 ''b''
2092 !! html
2093 <pre>a
2094 <i>b</i>
2095 </pre>
2096 !! end
2097
2098 !! test
2099 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2100 !! wikitext
2101 <pre><nowiki>
2102 <b>
2103 <cite>
2104 <em>
2105 </nowiki></pre>
2106 !! html
2107 <pre>
2108 &lt;b&gt;
2109 &lt;cite&gt;
2110 &lt;em&gt;
2111 </pre>
2112
2113 !! end
2114
2115 !! test
2116 Regression with preformatted in <center>
2117 !! wikitext
2118 <center>
2119 Blah
2120 </center>
2121 !! html
2122 <center>
2123 <pre>Blah
2124 </pre>
2125 </center>
2126
2127 !! end
2128
2129 !! test
2130 Bug 52763: Preformatted in <blockquote>
2131 !! wikitext
2132 <blockquote>
2133 Blah
2134 {|
2135 |
2136 indented cell (no pre-wrapping!)
2137 |}
2138 </blockquote>
2139 !! html
2140 <blockquote>
2141 <p> Blah
2142 </p>
2143 <table>
2144 <tr>
2145 <td>
2146 <p> indented cell (no pre-wrapping!)
2147 </p>
2148 </td></tr></table>
2149 </blockquote>
2150
2151 !! end
2152
2153 !! test
2154 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2155 !! wikitext
2156 <blockquote>
2157 Foo
2158
2159 Bar
2160 </blockquote>
2161 !! html
2162 <blockquote>
2163 <p>Foo
2164 </p><p>Bar
2165 </p>
2166 </blockquote>
2167
2168 !! end
2169
2170 !! test
2171 Bug 15491: <ins>/<del> in blockquote
2172 !! wikitext
2173 <blockquote>
2174 Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p>Foo <del>bar</del> <ins>baz</ins> quux
2179 </p>
2180 </blockquote>
2181
2182 !! end
2183
2184 # Note that the p-wrapping is newline sensitive, which could be
2185 # considered a bug: tidy will wrap only the 'Foo' in the example
2186 # below in a <p> tag. (see comment 23-25 of bug #6200)
2187 !! test
2188 Bug 15491: <ins>/<del> in blockquote (2)
2189 !! wikitext
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192 !! html
2193 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2194 </blockquote>
2195
2196 !! html+tidy
2197 <blockquote>
2198 <p>Foo</p>
2199 <del>bar</del> <ins>baz</ins> quux</blockquote>
2200 !! end
2201
2202 !! test
2203 <pre> with attributes (bug 3202)
2204 !! wikitext
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206 !! html
2207 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2208
2209 !! end
2210
2211 !! test
2212 <pre> with width attribute (bug 3202)
2213 !! wikitext
2214 <pre width="8">Narrow screen goodies</pre>
2215 !! html
2216 <pre width="8">Narrow screen goodies</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute (bug 3202)
2222 !! wikitext
2223 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 Entities inside <pre>
2231 !! wikitext
2232 <pre>&lt;</pre>
2233 !! html
2234 <pre>&lt;</pre>
2235
2236 !! end
2237
2238 !! test
2239 <pre> with forbidden attribute values (bug 3202)
2240 !! wikitext
2241 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2244
2245 !! end
2246
2247 !! test
2248 <nowiki> inside <pre> (bug 13238)
2249 !! wikitext
2250 <pre>
2251 <nowiki>
2252 </pre>
2253 <pre>
2254 <nowiki></nowiki>
2255 </pre>
2256 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2257 !! html
2258 <pre>
2259 &lt;nowiki&gt;
2260 </pre>
2261 <pre>
2262
2263 </pre>
2264 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2265
2266 !! end
2267
2268 !! test
2269 <nowiki> and <pre> preference (first one wins)
2270 !! wikitext
2271 <pre>
2272 <nowiki>
2273 </pre>
2274 </nowiki>
2275 </pre>
2276
2277 <nowiki>
2278 <pre>
2279 <nowiki>
2280 </pre>
2281 </nowiki>
2282 </pre>
2283
2284 !! html/php
2285 <pre>
2286 &lt;nowiki&gt;
2287 </pre>
2288 <p>&lt;/nowiki&gt;
2289 &lt;/pre&gt;
2290 </p><p>
2291 &lt;pre&gt;
2292 &lt;nowiki&gt;
2293 &lt;/pre&gt;
2294
2295 &lt;/pre&gt;
2296 </p>
2297 !! html/parsoid
2298 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2299 </pre>
2300 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2301 &lt;/pre></p>
2302
2303 <p><span typeof="mw:Nowiki">
2304 &lt;pre>
2305 &lt;nowiki>
2306 &lt;/pre>
2307 </span>
2308 &lt;/pre></p>
2309 !! end
2310
2311 !! test
2312 </pre> inside nowiki
2313 !! wikitext
2314 <nowiki></pre></nowiki>
2315 !! html
2316 <p>&lt;/pre&gt;
2317 </p>
2318 !! end
2319
2320 # Parsoid doesn't strip empty tags, like Tidy does.
2321 !! test
2322 Empty pre; pre inside other HTML tags (bug 54946)
2323 !! options
2324 parsoid=wt2html,wt2wt
2325 !! wikitext
2326 a
2327
2328 <div><pre>
2329 foo
2330 </pre></div>
2331 <pre></pre>
2332 !! html/php
2333 <p>a
2334 </p>
2335 <div><pre>
2336 foo
2337 </pre></div>
2338 <pre></pre>
2339
2340 !! html/php+tidy
2341 <p>a</p>
2342 <div>
2343 <pre>
2344 foo
2345 </pre></div>
2346 !! html/parsoid
2347 <p>a</p>
2348
2349 <div><pre>foo
2350 </pre></div>
2351 <pre></pre>
2352 !! end
2353
2354 !! test
2355 HTML pre followed by indent-pre
2356 !! wikitext
2357 <pre>foo</pre>
2358 bar
2359 !! html
2360 <pre>foo</pre>
2361 <pre>bar
2362 </pre>
2363 !! end
2364
2365 # Note that tidy removes the empty <p> tags from the start and end.
2366 # Parsoid does not, by design.
2367 !!test
2368 Block tag pre
2369 !! wikitext
2370 <p><pre>foo</pre></p>
2371 !! html/php+tidy
2372 <pre>
2373 foo
2374 </pre>
2375 !! html/parsoid
2376 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2377 !!end
2378
2379 !!test
2380 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2381 !! wikitext
2382 {{echo|}}
2383 !! html
2384
2385 !!end
2386
2387 !!test
2388 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2389 !! wikitext
2390 {{echo|
2391 foo}}
2392 !! html
2393 <p>foo
2394 </p>
2395 !!end
2396
2397 !! test
2398 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2399 !! wikitext
2400 {{echo|a
2401 b}}
2402 !! html
2403 <pre>a
2404 </pre>
2405 <p>b
2406 </p>
2407 !!end
2408
2409 !! test
2410 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2411 !! wikitext
2412 {{echo|a
2413 b
2414 c
2415 d
2416 e
2417 }}
2418 !! html
2419 <pre>a
2420 </pre>
2421 <p>b
2422 c
2423 </p>
2424 <pre>d
2425 </pre>
2426 <p>e
2427 </p>
2428 !!end
2429
2430 !!test
2431 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2432 !! wikitext
2433 {{echo| foo}}
2434
2435 {{echo| foo}}{{echo| bar}}
2436
2437 {{echo| foo}}
2438 {{echo| bar}}
2439
2440 {{echo|<!--cmt--> foo}}
2441
2442 <!--cmt-->{{echo| foo}}
2443
2444 {{echo|{{echo| }}bar}}
2445 !! html
2446 <pre>foo
2447 </pre>
2448 <pre>foo bar
2449 </pre>
2450 <pre>foo
2451 bar
2452 </pre>
2453 <pre>foo
2454 </pre>
2455 <pre>foo
2456 </pre>
2457 <pre>bar
2458 </pre>
2459 !!end
2460
2461 !! test
2462 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2463 !! wikitext
2464 {{echo| }}a
2465
2466 {{echo|
2467 }}a
2468
2469 {{echo|
2470 b}}
2471
2472 {{echo|a
2473 }}b
2474
2475 {{echo|a
2476 }} b
2477 !! html
2478 <pre>a
2479 </pre>
2480 <p><br />
2481 </p>
2482 <pre>a
2483 </pre>
2484 <p><br />
2485 </p>
2486 <pre>b
2487 </pre>
2488 <p>a
2489 </p>
2490 <pre>b
2491 </pre>
2492 <p>a
2493 </p>
2494 <pre>b
2495 </pre>
2496 !!end
2497
2498 !! test
2499 Pres with newline attributes
2500 !! wikitext
2501 <pre class="one
2502 two">hi</pre>
2503 !! html/php
2504 <pre class="one two">hi</pre>
2505
2506 !! html/parsoid
2507 <pre class="one
2508 two" data-parsoid='{"stx":"html"}'>hi</pre>
2509 !! end
2510
2511 !! test
2512 Things that look like <pre> tags aren't treated as such
2513 !! wikitext
2514 Barack Obama <President> of the United States
2515 <President></President>
2516 !! html
2517 <p>Barack Obama &lt;President&gt; of the United States
2518 &lt;President&gt;&lt;/President&gt;
2519 </p>
2520 !! end
2521
2522 !! test
2523 Handle broken pre-like tags (bug 64025)
2524 !! options
2525 parsoid=wt2html
2526 !! wikitext
2527 {{echo|<pre <pre>x</pre>}}
2528
2529 <table><pre </table>
2530 !! html/php
2531 <pre>x</pre>
2532 <table>&lt;pre </table>
2533
2534 !! html/php+tidy
2535 <pre>
2536 x
2537 </pre>
2538 <p>&lt;pre</p>
2539 !! html/parsoid
2540 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2541
2542
2543 <p>&lt;pre </p>
2544
2545 <table></table>
2546 !! end
2547
2548 !! test
2549 Parsoid: handle pre with space after attribute
2550 !! options
2551 parsoid=wt2html
2552 !! wikitext
2553 <pre style="width:50%;" >{{echo|foo}}</pre>
2554 !! html/php
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556
2557 !! html/parsoid
2558 <pre style="width:50%;">{{echo|foo}}</pre>
2559 !! end
2560
2561 # TODO / maybe: fix wt2wt for this
2562 !! test
2563 Parsoid: Don't paragraph-wrap fosterable content
2564 !! options
2565 parsoid=wt2html
2566 !! wikitext
2567 {|
2568 <td></td>
2569 <td></td>
2570
2571
2572
2573 |}
2574 !! html
2575 <table>
2576
2577 <tbody>
2578 <tr>
2579 <td></td>
2580
2581 <td></td></tr>
2582
2583
2584
2585 </tbody></table>
2586 !! end
2587
2588 !! test
2589 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2590 !! options
2591 parsoid=wt2html
2592 !! wikitext
2593 {|
2594 <td>
2595 <td>
2596 </td>
2597
2598
2599
2600 |}
2601 !! html
2602 <table>
2603
2604 <tbody>
2605 <tr>
2606 <td></td>
2607
2608 <td>
2609 </td></tr>
2610
2611
2612
2613 </tbody></table>
2614 !! end
2615
2616
2617 #--------------------------------------------------------------------
2618 # Transclusion parameter whitespace stripping tests
2619 # Behavior is different for positional and named parameters
2620 #--------------------------------------------------------------------
2621 !! test
2622 Templates: Strip leading and trailing whitespace from named-param values
2623 !! wikitext
2624 {{echo|1= a }}
2625
2626 {{echo|1= {{echo|b}} }}
2627
2628 {{echo| 1 =
2629 c }}
2630
2631 {{echo| 1 =
2632 * d
2633 }}
2634 !! html
2635 <p>a
2636 </p><p>b
2637 </p><p>c
2638 </p>
2639 <ul><li> d</li></ul>
2640
2641 !! end
2642
2643 !! test
2644 Templates: Don't strip whitespace from positional-param values
2645 !! wikitext
2646 {{echo|a }}
2647
2648 {{echo|{{echo|b}} }}
2649
2650 {{echo| c
2651 }}
2652
2653 {{echo| {{echo|d}}
2654 }}
2655
2656 {{echo|
2657 e}}
2658
2659 {{echo|
2660 * f}}
2661
2662 {{echo|
2663 }}g
2664 !! html
2665 <p>a
2666 </p><p>b
2667 </p>
2668 <pre>c
2669 </pre>
2670 <p><br />
2671 </p>
2672 <pre>d
2673 </pre>
2674 <p><br />
2675 </p>
2676 <pre>e
2677 </pre>
2678 <p><br />
2679 </p>
2680 <ul><li> f</li></ul>
2681 <p><br />
2682 </p>
2683 <pre>g
2684 </pre>
2685 !! end
2686
2687 !! test
2688 Templates: Handle empty comment-and-ws-only lines correctly
2689 !! wikitext
2690 {{echo|foo
2691 <!--should be ignored-->
2692 <!--should be ignored as well-->
2693 bar}}
2694 !! html
2695 <p>foo
2696 bar
2697 </p>
2698 !! end
2699
2700 !! test
2701 Templates: Handle comments in the target
2702 !! wikitext
2703 {{echo
2704 <!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->
2708 |foo}}
2709
2710 {{echo<!-- should be ignored -->|foo}}
2711
2712 {{<!-- should be ignored -->echo|foo}}
2713 !!html/parsoid
2714 <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>
2715
2716 <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>
2717
2718 <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>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2721 !!end
2722
2723 !! test
2724 Templates: Handle comments in parameter names (bug 67657)
2725 !! wikitext
2726 {{echo|1
2727 <!-- should be ignored -->
2728 =foo}}
2729
2730 {{echo|
2731 <!-- should be ignored -->
2732 1 = foo}}
2733
2734 {{echo|1<!-- should be ignored -->=foo}}
2735
2736 {{echo|<!-- should be ignored -->1=foo}}
2737 !!html/parsoid
2738 <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>
2739
2740 <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>
2741
2742 <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>
2743
2744 <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>
2745 !!end
2746
2747 !! test
2748 Templates: Other wikitext in parameter names (bug 67657)
2749 !! wikitext
2750 {{echo|''1''=foo}}
2751 !!html/parsoid
2752 <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>
2753 !!html/php
2754 <p>{{{1}}}
2755 </p>
2756 !!end
2757
2758 #--------------------------------------------------------------------
2759 # Transclusion parameter escaping tests
2760 #--------------------------------------------------------------------
2761 !! test
2762 Templates: Parsoid parameter escaping test 1
2763 !! wikitext
2764 {{echo|[foo]|{{echo|[bar]}}}}
2765 !! html/php+tidy
2766 <p>[foo]</p>
2767 !! html/parsoid
2768 <p about="#mwt1" typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipes in external links in template parameter
2774 !! wikitext
2775 {{echo|[{{echo|http://example.com}} link]}}
2776 !! html/php+tidy
2777 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2778 !! html/parsoid
2779 <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>
2780 !! end
2781
2782 !! test
2783 Parsoid: pipe in transclusion parameter
2784 !! wikitext
2785 {{echo|http://foo.com/a&#124;b}}
2786 !! html/php+tidy
2787 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2788 !! html/parsoid
2789 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2790 typeof="mw:Transclusion"
2791 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>
2792 !! end
2793
2794 !! test
2795 Parsoid: Pipe in external link target and content in template parameter
2796 !! options
2797 parsoid=html2wt,wt2wt
2798 !! wikitext
2799 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2800 !! html/php+tidy
2801 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2802 !! html/parsoid
2803 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2804 typeof="mw:Transclusion"
2805 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2806 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2807 !! end
2808
2809 !! test
2810 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2811 !! options
2812 parsoid
2813 !! wikitext
2814 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2815 !! html
2816 <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>
2817 !! end
2818
2819 !! test
2820 Templates: Don't escape already nowiki-escaped text in template parameters
2821 !! options
2822 parsoid=html2wt,wt2wt
2823 !! wikitext
2824 {{echo|foo<nowiki>|</nowiki>bar}}
2825 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2826 {{echo|<nowiki></nowiki>}}
2827 !! html/php+tidy
2828 <p>foo|bar &lt;div&gt;</p>
2829 !! html/parsoid
2830 <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>
2831 <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>
2832 <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>
2833 </p>
2834 !! end
2835
2836 ## Bug 52824
2837 !! test
2838 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2839 !! options
2840 parsoid=html2wt,wt2wt
2841 !! wikitext
2842 {{echo|{{echo|1=bar}}}}
2843 !! html/php+tidy
2844 <p>bar</p>
2845 !! html/parsoid
2846 <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>
2847 !! end
2848
2849 ## Bug 56733
2850 !! test
2851 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2852 !! wikitext
2853 {{echo|a : b}}
2854 !! html/php+tidy
2855 <p>a&#160;: b</p>
2856 !! html/parsoid
2857 <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>
2858 !! end
2859
2860 ## Bug T73412
2861 !! test
2862 Templates: Preserve blank parameter names
2863 !! wikitext
2864 {{echo|=foo}}
2865 !! html/php+tidy
2866 <p>{{{1}}}</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2869 !! end
2870
2871 !! test
2872 Templates: Preserve blank parameter names in other positions
2873 !! wikitext
2874 {{blank_param|bar|=foo}}
2875 !! html/php+tidy
2876 <p>bar foo</p>
2877 !! html/parsoid
2878 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2879 foo</p>
2880 !! end
2881
2882 ###
2883 ### Parsoid-centric tests for testing RT edge cases for pre
2884 ###
2885
2886 !!test
2887 1a. Indent-Pre and Comments
2888 !! wikitext
2889 a
2890 <!--a-->
2891 c
2892 !! html
2893 <pre>a
2894 </pre>
2895 <p>c
2896 </p>
2897 !!end
2898
2899 !!test
2900 1b. Indent-Pre and Comments
2901 !! wikitext
2902 a
2903 <!--a-->
2904 c
2905 !! html
2906 <pre>a
2907 </pre>
2908 <p>c
2909 </p>
2910 !!end
2911
2912 !!test
2913 1c. Indent-Pre and Comments
2914 !! wikitext
2915 <!--a--> a
2916
2917 <!--a--> a
2918 !! html
2919 <pre> a
2920 </pre>
2921 <pre> a
2922 </pre>
2923 !!end
2924
2925 !!test
2926 1d. Indent-Pre and Comments
2927 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2928 !! wikitext
2929 <!--a--> a
2930
2931 <!--b-->b
2932 !! html
2933 <pre>a
2934 </pre>
2935 <pre>b
2936 </pre>
2937 !!end
2938
2939 !!test
2940 2a. Indent-Pre and tables
2941 !! wikitext
2942 {|
2943 |-
2944 !h1!!h2
2945 |foo||bar
2946 |}
2947 !! html
2948 <table>
2949
2950 <tr>
2951 <th>h1</th>
2952 <th>h2
2953 </th>
2954 <td>foo</td>
2955 <td>bar
2956 </td></tr></table>
2957
2958 !!end
2959
2960 !!test
2961 2b. Indent-Pre and tables
2962 !! wikitext
2963 {|
2964 |-
2965 |foo
2966 |}
2967 !! html
2968 <table>
2969
2970 <tr>
2971 <td>foo
2972 </td></tr></table>
2973
2974 !!end
2975
2976 !!test
2977 2c. Indent-Pre and tables (bug 42252)
2978 !! wikitext
2979 {|
2980 |+ foo
2981 ! | bar
2982 |}
2983 !! html
2984 <table>
2985 <caption> foo
2986 </caption>
2987 <tr>
2988 <th> bar
2989 </th></tr></table>
2990
2991 !!end
2992
2993 !!test
2994 2d. Indent-Pre and tables
2995 !! wikitext
2996 a
2997 {|
2998 | b
2999 |}
3000 !! html/php
3001 <pre>a
3002 </pre>
3003 <table>
3004 <tr>
3005 <td> b
3006 </td></tr></table>
3007
3008 !! html/parsoid
3009 <pre>a</pre>
3010 <table>
3011 <tbody><tr><td> b</td></tr>
3012 </tbody></table>
3013 !!end
3014
3015 !!test
3016 2e. Indent-Pre and table-line syntax
3017 !! wikitext
3018 a
3019 | b
3020 | c
3021 !! html/php
3022 <pre>a
3023 | b
3024 | c
3025 </pre>
3026 !!end
3027
3028 !!test
3029 2f. Indent-pre started by table-line syntax
3030 !! wikitext
3031 a
3032 | b
3033 | c
3034 !! html/php
3035 <p>a
3036 </p>
3037 <pre>| b
3038 | c
3039 </pre>
3040 !! html/parsoid
3041 <p>a</p>
3042 <pre>
3043 | b
3044 | c</pre>
3045 !!end
3046
3047 !!test
3048 3a. Indent-Pre and block tags (single-line html)
3049 !! wikitext
3050 a <p> foo </p>
3051 b <div> foo </div>
3052 c <blockquote> foo </blockquote>
3053 <span> foo </span>
3054 !! html
3055 a <p> foo </p>
3056 b <div> foo </div>
3057 c <blockquote> foo </blockquote>
3058 <pre><span> foo </span>
3059 </pre>
3060 !! html/parsoid
3061 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3062 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3063 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3064 <pre><span> foo </span>
3065 </pre>
3066 !! html+tidy
3067 <p>a</p>
3068 <p>foo</p>
3069 <p>b</p>
3070 <div>foo</div>
3071 <p>c</p>
3072 <blockquote>
3073 <p>foo</p>
3074 </blockquote>
3075 <pre>
3076 <span> foo </span>
3077 </pre>
3078 !! end
3079
3080 !!test
3081 3b. Indent-Pre and block tags (multi-line html)
3082 !! wikitext
3083 a <span>foo</span>
3084 b <div> foo </div>
3085 !! html
3086 <pre>a <span>foo</span>
3087 </pre>
3088 b <div> foo </div>
3089
3090 !! html/parsoid
3091 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3092 b <div data-parsoid='{"stx":"html"}'> foo </div>
3093 !! html+tidy
3094 <pre>
3095 a <span>foo</span>
3096 </pre>
3097 <p>b</p>
3098 <div>foo</div>
3099 !!end
3100
3101 !!test
3102 3c. Indent-Pre and block tags (pre-content on separate line)
3103 !! wikitext
3104 <p>
3105 foo
3106 </p>
3107
3108 <div>
3109 foo
3110 </div>
3111
3112 <center>
3113 foo
3114 </center>
3115
3116 <blockquote>
3117 foo
3118 </blockquote>
3119
3120 <blockquote>
3121 <pre>
3122 foo
3123 </pre>
3124 </blockquote>
3125
3126 <table><tr><td>
3127 foo
3128 </td></tr></table>
3129
3130 <ul><li>
3131 foo
3132 </li></ul>
3133
3134 !! html
3135 <p>
3136 foo
3137 </p>
3138 <div>
3139 <pre>foo
3140 </pre>
3141 </div>
3142 <center>
3143 <pre>foo
3144 </pre>
3145 </center>
3146 <blockquote>
3147 <p> foo
3148 </p>
3149 </blockquote>
3150 <blockquote>
3151 <pre>
3152 foo
3153 </pre>
3154 </blockquote>
3155 <table><tr><td>
3156 <pre>foo
3157 </pre>
3158 </td></tr></table>
3159 <ul><li>
3160 foo
3161 </li></ul>
3162
3163 !!end
3164
3165 !!test
3166 4. Indent-Pre and extension tags
3167 !! wikitext
3168 a <gallery>
3169 File:foobar.jpg
3170 </gallery>
3171 !! html
3172 a <ul class="gallery mw-gallery-traditional">
3173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3174 <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>
3175 <div class="gallerytext">
3176 </div>
3177 </div></li>
3178 </ul>
3179
3180 !! html+tidy
3181 <p>a</p>
3182 <ul class="gallery mw-gallery-traditional">
3183 <li class="gallerybox" style="width: 155px">
3184 <div style="width: 155px">
3185 <div class="thumb" style="width: 150px;">
3186 <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>
3187 </div>
3188 <div class="gallerytext"></div>
3189 </div>
3190 </li>
3191 </ul>
3192 !!end
3193
3194 !! test
3195 Table wikitext syntax outside wiki-tables
3196 !! wikitext
3197 a
3198 ! not a table heading
3199 |- not a table row
3200 | not a table cell
3201 | class="foo bar" | baz
3202 b
3203 |}
3204 |-
3205 c
3206 !! html
3207 <p>a
3208 ! not a table heading
3209 |- not a table row
3210 | not a table cell
3211 | class="foo bar" | baz
3212 b
3213 |}
3214 |-
3215 c
3216 </p>
3217 !! end
3218
3219 !!test
3220 Render paragraphs when indent-pre is suppressed in blocklevels
3221 !! wikitext
3222 <blockquote>
3223 foo
3224
3225 bar
3226 </blockquote>
3227 !! html
3228 <blockquote>
3229 <p> foo
3230 </p><p> bar
3231 </p>
3232 </blockquote>
3233
3234 !!end
3235
3236 !!test
3237 4. Multiple spaces at start-of-line
3238 !! wikitext
3239 <p> foo </p>
3240 foo
3241 {|
3242 |foo
3243 |}
3244 !! html
3245 <p> foo </p>
3246 <pre> foo
3247 </pre>
3248 <table>
3249 <tr>
3250 <td>foo
3251 </td></tr></table>
3252
3253 !!end
3254
3255 ## NOTE: the leading white-space chars on empty line are significant
3256 !! test
3257 5a. White-space in indent-pre
3258 !! wikitext
3259 a<br />
3260
3261 b
3262 !! html
3263 <pre>a<br />
3264
3265 b
3266 </pre>
3267 !! end
3268
3269 ## NOTE: the leading white-space chars on empty line are significant
3270 !! test
3271 5b. White-space in indent-pre
3272 !! wikitext
3273 a
3274
3275 b
3276
3277
3278 c
3279 !! html
3280 <pre>a
3281
3282 b
3283
3284
3285 c
3286 </pre>
3287 !! end
3288
3289 !! test
3290 5c. White-space in indent-pre
3291 !! wikitext
3292 ''a''
3293 ''b''
3294 ''c''
3295 !! html
3296 <pre><i>a</i>
3297 <i>b</i>
3298 <i>c</i>
3299 </pre>
3300 !! end
3301
3302 !! test
3303 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3304 !! wikitext
3305 a
3306
3307 <!-- continue -->
3308 b
3309
3310 c
3311
3312 d
3313 !! html
3314 <pre>a
3315
3316 b
3317 </pre>
3318 <pre>c
3319
3320 </pre>
3321 <p>d
3322 </p>
3323 !! end
3324
3325 !! test
3326 7a. Indent-pre and category links
3327 !! options
3328 parsoid=wt2html,wt2wt
3329 !! wikitext
3330 [[Category:foo]] <!-- No pre-wrapping -->
3331 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3332 !! html/php+tidy
3333 !! html/parsoid
3334 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3335 <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 -->
3336 !! end
3337
3338 ## We used to, but no longer wt2wt this test since the default serializer
3339 ## will normalize all categories to serialize on their own line.
3340 ## This wikitext usage is going to be fairly uncommon in production and
3341 ## selser will take care of preserving formatting in those scenarios.
3342 !! test
3343 7b. Indent-pre and category links
3344 !! options
3345 parsoid=wt2html
3346 !! wikitext
3347 [[Category:foo]] a
3348 [[Category:foo]] {{echo|b}}
3349 !! html/parsoid
3350 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3351 <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>
3352 !! end
3353
3354 !! test
3355 Indent-Pre: Newlines in comments shouldn't affect sol state
3356 !! wikitext
3357 a <!--
3358 foo
3359 --> b
3360 !! html/php+tidy
3361 <p>a b</p>
3362 !! html/parsoid
3363 <p>a <!--
3364 foo
3365 --> b</p>
3366 !! end
3367
3368 ###
3369 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3370 ###
3371
3372 !!test
3373 HTML-pre: 1. embedded newlines
3374 !! wikitext
3375 <pre>foo</pre>
3376
3377 <pre>
3378 foo
3379 </pre>
3380
3381 <pre>
3382
3383 foo
3384 </pre>
3385
3386 <pre>
3387
3388
3389 foo
3390 </pre>
3391 !! html/php+tidy
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396 foo
3397 </pre>
3398 <pre>
3399
3400 foo
3401 </pre>
3402 <pre>
3403
3404
3405 foo
3406 </pre>
3407 !! html/parsoid
3408 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3409
3410 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3411 foo
3412 </pre>
3413
3414 <pre data-parsoid='{"stx":"html"}'>
3415
3416 foo
3417 </pre>
3418
3419 <pre data-parsoid='{"stx":"html"}'>
3420
3421
3422 foo
3423 </pre>
3424 !!end
3425
3426 !! test
3427 HTML-pre: big spaces
3428 !! wikitext
3429 <pre>
3430
3431
3432
3433
3434 haha
3435
3436
3437
3438
3439 haha
3440
3441
3442
3443
3444 </pre>
3445 !! html/php+tidy
3446 <pre>
3447
3448
3449
3450
3451 haha
3452
3453
3454
3455
3456 haha
3457
3458
3459
3460
3461 </pre>
3462 !! html/parsoid
3463 <pre data-parsoid='{"stx":"html"}'>
3464
3465
3466
3467
3468 haha
3469
3470
3471
3472
3473 haha
3474
3475
3476
3477
3478 </pre>
3479 !! end
3480
3481 !!test
3482 HTML-pre: 2: indented text
3483 !! wikitext
3484 <pre>
3485 foo
3486 </pre>
3487 !! html
3488 <pre>
3489 foo
3490 </pre>
3491
3492 !!end
3493
3494 !!test
3495 HTML-pre: 3: other wikitext
3496 !! wikitext
3497 <pre>
3498 * foo
3499 # bar
3500 = no-h =
3501 '' no-italic ''
3502 [[ NoLink ]]
3503 </pre>
3504 !! html/php
3505 <pre>
3506 * foo
3507 # bar
3508 = no-h =
3509 '' no-italic ''
3510 [[ NoLink ]]
3511 </pre>
3512
3513 !! html/parsoid
3514 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3515 # bar
3516 = no-h =
3517 '' no-italic ''
3518 [[ NoLink ]]
3519 </pre>
3520 !!end
3521
3522 ###
3523 ### Definition lists
3524 ###
3525 !! test
3526 Simple definition
3527 !! wikitext
3528 ; name : Definition
3529 !! html
3530 <dl><dt> name&#160;</dt>
3531 <dd> Definition</dd></dl>
3532
3533 !! end
3534
3535 !! test
3536 Definition list for indentation only
3537 !! wikitext
3538 : Indented text
3539 !! html
3540 <dl><dd> Indented text</dd></dl>
3541
3542 !! end
3543
3544 !! test
3545 Definition list with no space
3546 !! wikitext
3547 ;name:Definition
3548 !! html
3549 <dl><dt>name</dt>
3550 <dd>Definition</dd></dl>
3551
3552 !!end
3553
3554 !! test
3555 Definition list with URL link
3556 !! wikitext
3557 ; http://example.com/ : definition
3558 !! html
3559 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3560 <dd> definition</dd></dl>
3561
3562 !! end
3563
3564 !! test
3565 Definition list with bracketed URL link
3566 !! wikitext
3567 ;[http://www.example.com/ Example]:Something about it
3568 !! html
3569 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3570 <dd>Something about it</dd></dl>
3571
3572 !! end
3573
3574 !! test
3575 Definition list with wikilink containing colon
3576 !! wikitext
3577 ; [[Help:FAQ]]: The least-read page on Wikipedia
3578 !! html
3579 <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>
3580 <dd> The least-read page on Wikipedia</dd></dl>
3581
3582 !! end
3583
3584 # At Brion's and JeLuF's insistence... :)
3585 !! test
3586 Definition list with news link containing colon
3587 !! wikitext
3588 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3589 !! html/php
3590 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3591 <dd> This isn't even a real newsgroup!</dd></dl>
3592
3593 !! html/parsoid
3594 <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>
3595 !! end
3596
3597 !! test
3598 Malformed definition list with colon
3599 !! wikitext
3600 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3601 !! html
3602 <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>
3603
3604 !! end
3605
3606 !! test
3607 Definition lists: colon in external link text
3608 !! wikitext
3609 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3610 !! html
3611 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3612 <dd> OK, I made that up</dd></dl>
3613
3614 !! end
3615
3616 !! test
3617 Definition lists: colon in HTML attribute
3618 !! wikitext
3619 ;<b style="display: inline">bold</b>
3620 !! html
3621 <dl><dt><b style="display: inline">bold</b></dt></dl>
3622
3623 !! end
3624
3625 !! test
3626 Definition lists: self-closed tag
3627 !! wikitext
3628 ;one<br/>two : two-line fun
3629 !! html
3630 <dl><dt>one<br />two&#160;</dt>
3631 <dd> two-line fun</dd></dl>
3632
3633 !! end
3634
3635 !! test
3636 Bug 11748: Literal closing tags
3637 !! wikitext
3638 <dl>
3639 <dt>test 1</dt>
3640 <dd>test test test test test</dd>
3641 <dt>test 2</dt>
3642 <dd>test test test test test</dd>
3643 </dl>
3644 !! html
3645 <dl>
3646 <dt>test 1</dt>
3647 <dd>test test test test test</dd>
3648 <dt>test 2</dt>
3649 <dd>test test test test test</dd>
3650 </dl>
3651
3652 !! end
3653
3654 !! test
3655 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3656 !! wikitext
3657 <ul><li>
3658 ; term : description
3659 * unordered
3660 </li></ul>
3661 !! html
3662 <ul><li>
3663 <dl><dt> term&#160;</dt>
3664 <dd> description</dd></dl>
3665 <ul><li> unordered</li></ul>
3666 </li></ul>
3667
3668 !! end
3669
3670 !! test
3671
3672 Definition list with empty definition and following paragraph
3673 !! wikitext
3674 ; term:
3675 Paragraph text
3676 !! html
3677 <dl><dt> term</dt>
3678 <dd></dd></dl>
3679 <p>Paragraph text
3680 </p>
3681 !! end
3682
3683 !! test
3684 Nested definition lists using html syntax
3685 !! wikitext
3686 <dl><dt>x</dt>
3687 <dd>a</dd>
3688 <dd>b</dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: No nesting: Multiple dd's
3694 !! wikitext
3695 ;x
3696 :a
3697 :b
3698 !! html
3699 <dl><dt>x</dt>
3700 <dd>a</dd>
3701 <dd>b</dd></dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition Lists: Indentation: Regular
3707 !! wikitext
3708 :i1
3709 ::i2
3710 :::i3
3711 !! html
3712 <dl><dd>i1
3713 <dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Missing 1st level
3720 !! wikitext
3721 ::i2
3722 :::i3
3723 !! html
3724 <dl><dd><dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Multi-level indent
3731 !! wikitext
3732 :::i3
3733 !! html
3734 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition Lists: Hacky use to indent tables
3740 !! wikitext
3741 ::{|
3742 |foo
3743 |bar
3744 |}
3745 this text
3746 should be left alone
3747 !! html
3748 <dl><dd><dl><dd><table>
3749 <tr>
3750 <td>foo
3751 </td>
3752 <td>bar
3753 </td></tr></table></dd></dl></dd></dl>
3754 <p>this text
3755 should be left alone
3756 </p>
3757 !! end
3758
3759 !! test
3760 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3761 !! wikitext
3762 <!-- foo -->
3763 ::{|
3764 |foo
3765 |bar
3766 |}<!-- bar -->
3767 this text
3768 should be left alone
3769 !! html/parsoid
3770 <!-- foo -->
3771 <dl><dd><dl><dd><table><tr>
3772 <td>foo</td>
3773 <td>bar</td>
3774 </tr></table><!-- bar --></dd></dl></dd></dl>
3775 <p>this text
3776 should be left alone</p>
3777 !! end
3778
3779 !! test
3780 Definition Lists: Hacky use to indent tables, with comment before table
3781 !! wikitext
3782 ::<!-- foo -->{|
3783 |foo
3784 |}
3785 !! html/parsoid
3786 <dl><dd><dl><dd><!-- foo --><table><tr>
3787 <td>foo</td>
3788 </tr></table></dd></dl></dd></dl>
3789 !! end
3790
3791 # The trailing whitespace in this test is to catch a regression in
3792 # Parsoid after T54473.
3793 !! test
3794 Definition Lists: Hacky use to indent tables (WS-insensitive)
3795 !! wikitext
3796 : {|
3797 |a
3798 |}
3799 !! html/php
3800 <dl><dd><table>
3801 <tr>
3802 <td>a
3803 </td></tr></table></dd></dl>
3804
3805 !! html/parsoid
3806 <dl><dd> <table>
3807 <tbody><tr><td>a</td></tr>
3808 </tbody></table> </dd></dl>
3809 !! end
3810
3811 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3812 ## as an empty dt item. It also ignores all but the last ";" when followed
3813 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3814 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3815 ## ";"s.
3816 ##
3817 ## Ex: ";;t2 ::d2" is transformed into:
3818 ##
3819 ## <dl>
3820 ## <dt>t2 </dt>
3821 ## <dd>
3822 ## <dl>
3823 ## <dt></dt>
3824 ## <dd>d2</dd>
3825 ## </dl>
3826 ## </dd>
3827 ## </dl>
3828 ##
3829 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3830 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3831 ##
3832 ## <dl>
3833 ## <dt>
3834 ## <dl>
3835 ## <dt>t2 </dt>
3836 ## <dd>:d2</dd>
3837 ## </dl>
3838 ## </dt>
3839 ## </dl>
3840 ##
3841 ## All Parsoid only definition list tests have this difference.
3842 ##
3843 ## See also: https://phabricator.wikimedia.org/T8569
3844 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3845
3846 !! test
3847 Table / list interaction: indented table with lists in table contents
3848 !! wikitext
3849 :{|
3850 |-
3851 | a
3852 * b
3853 |-
3854 | c
3855 * d
3856 |}
3857 !! html
3858 <dl><dd><table>
3859
3860 <tr>
3861 <td> a
3862 <ul><li> b</li></ul>
3863 </td></tr>
3864 <tr>
3865 <td> c
3866 <ul><li> d</li></ul>
3867 </td></tr></table></dd></dl>
3868
3869 !! end
3870
3871 !!test
3872 Table / list interaction: lists nested in tables nested in indented lists
3873 !! wikitext
3874 :{|
3875 |
3876 :a
3877 :b
3878 |
3879 *c
3880 *d
3881 |}
3882
3883 *e
3884 *f
3885 !! html
3886 <dl><dd><table>
3887 <tr>
3888 <td>
3889 <dl><dd>a</dd>
3890 <dd>b</dd></dl>
3891 </td>
3892 <td>
3893 <ul><li>c</li>
3894 <li>d</li></ul>
3895 </td></tr></table></dd></dl>
3896 <ul><li>e</li>
3897 <li>f</li></ul>
3898
3899 !!end
3900
3901 !! test
3902 Definition Lists: Nesting: Multi-level (Parsoid only)
3903 !! options
3904 parsoid
3905 !! wikitext
3906 ;t1 :d1
3907 ;;t2 ::d2
3908 ;;;t3 :::d3
3909 !! html
3910 <dl>
3911 <dt>t1 </dt>
3912 <dd>d1</dd>
3913 <dt>
3914 <dl>
3915 <dt>t2 </dt>
3916 <dd>:d2</dd>
3917 <dt>
3918 <dl>
3919 <dt>t3 </dt>
3920 <dd>::d3</dd>
3921 </dl>
3922 </dt>
3923 </dl>
3924 </dt>
3925 </dl>
3926
3927
3928 !! end
3929
3930
3931 !! test
3932 Definition Lists: Nesting: Test 2 (Parsoid only)
3933 !! wikitext
3934 ;t1
3935 ::d2
3936 !! html/php+tidy
3937 <dl>
3938 <dt>t1</dt>
3939 <dd>
3940 <dl>
3941 <dd>d2</dd>
3942 </dl>
3943 </dd>
3944 </dl>
3945 !! html/parsoid
3946 <dl>
3947 <dt>t1</dt>
3948 <dd>
3949 <dl>
3950 <dd>d2</dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954
3955 !! end
3956
3957
3958 !! test
3959 Definition Lists: Nesting: Test 3 (Parsoid only)
3960 !! wikitext
3961 :;t1
3962 ::::d2
3963 !! html/php+tidy
3964 <dl>
3965 <dd>
3966 <dl>
3967 <dt>t1</dt>
3968 <dd>
3969 <dl>
3970 <dd>
3971 <dl>
3972 <dd>d2</dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976 </dd>
3977 </dl>
3978 </dd>
3979 </dl>
3980 !! html/parsoid
3981 <dl>
3982 <dd>
3983 <dl>
3984 <dt>t1</dt>
3985 <dd>
3986 <dl>
3987 <dd>
3988 <dl>
3989 <dd>d2</dd>
3990 </dl>
3991 </dd>
3992 </dl>
3993 </dd>
3994 </dl>
3995 </dd>
3996 </dl>
3997
3998 !! end
3999
4000
4001 !! test
4002 Definition Lists: Nesting: Test 4
4003 !! wikitext
4004 ::;t3
4005 :::d3
4006 !! html
4007 <dl><dd><dl><dd><dl><dt>t3</dt>
4008 <dd>d3</dd></dl></dd></dl></dd></dl>
4009
4010 !! end
4011
4012
4013 ## The Parsoid team believes the following three test exposes a
4014 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4015 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4016 ## It also exposes a "misfeature" in tidy, which doesn't like
4017 ## <dl> tags with a single <dt> child; it converts the <dt> into
4018 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4019 !! test
4020 Definition Lists: Mixed Lists: Test 1
4021 !! wikitext
4022 :;* foo
4023 ::* bar
4024 :; baz
4025 !! html/php
4026 <dl><dd><dl><dt><ul><li> foo</li>
4027 <li> bar</li></ul></dt></dl>
4028 <dl><dt> baz</dt></dl></dd></dl>
4029
4030 !! html/php+tidy
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dd>
4035 <ul>
4036 <li>foo</li>
4037 <li>bar</li>
4038 </ul>
4039 </dd>
4040 </dl>
4041 <dl>
4042 <dt>baz</dt>
4043 </dl>
4044 </dd>
4045 </dl>
4046 !! html/parsoid
4047 <dl>
4048 <dd><dl>
4049 <dt><ul>
4050 <li> foo
4051 </li>
4052 </ul></dt>
4053 <dd><ul>
4054 <li> bar
4055 </li>
4056 </ul></dd>
4057 <dt> baz</dt>
4058 </dl></dd>
4059 </dl>
4060 !! end
4061
4062 !! test
4063 Definition Lists: Mixed Lists: Test 2
4064 !! wikitext
4065 *: d1
4066 *: d2
4067 !! html
4068 <ul><li><dl><dd> d1</dd>
4069 <dd> d2</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 3
4076 !! wikitext
4077 *::: d1
4078 *::: d2
4079 !! html
4080 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4081 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 4
4088 !! wikitext
4089 *;d1 :d2
4090 *;d3 :d4
4091 !! html
4092 <ul><li><dl><dt>d1&#160;</dt>
4093 <dd>d2</dd>
4094 <dt>d3&#160;</dt>
4095 <dd>d4</dd></dl></li></ul>
4096
4097 !! end
4098
4099
4100 !! test
4101 Definition Lists: Mixed Lists: Test 5
4102 !! wikitext
4103 *:d1
4104 *:: d2
4105 !! html
4106 <ul><li><dl><dd>d1
4107 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4108
4109 !! end
4110
4111
4112 !! test
4113 Definition Lists: Mixed Lists: Test 6
4114 !! wikitext
4115 #*:d1
4116 #*::: d3
4117 !! html
4118 <ol><li><ul><li><dl><dd>d1
4119 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Mixed Lists: Test 7
4126 !! wikitext
4127 :* d1
4128 :* d2
4129 !! html
4130 <dl><dd><ul><li> d1</li>
4131 <li> d2</li></ul></dd></dl>
4132
4133 !! end
4134
4135
4136 !! test
4137 Definition Lists: Mixed Lists: Test 8
4138 !! wikitext
4139 :* d1
4140 ::* d2
4141 !! html
4142 <dl><dd><ul><li> d1</li></ul>
4143 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 9
4150 !! wikitext
4151 *;foo :bar
4152 !! html
4153 <ul><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ul>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 10
4161 !! wikitext
4162 *#;foo :bar
4163 !! html
4164 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ol></li></ul>
4166
4167 !! end
4168
4169 # The Parsoid team disagrees with the PHP parser's seemingly-random
4170 # rules regarding dd/dt on the next two tests. Parsoid is more
4171 # consistent, and recognizes the shared nesting and keeps the
4172 # still-open tags around until the nesting is complete.
4173 # (And tidy again converts <dt> to <dd> before 'bar'.)
4174
4175 !! test
4176 Definition Lists: Mixed Lists: Test 11
4177 !! wikitext
4178 *#*#;*;;foo :bar
4179 *#*#;boo :baz
4180 !! html/php
4181 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4182 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4183 <dl><dt>boo&#160;</dt>
4184 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4185
4186 !! html/php+tidy
4187 <ul>
4188 <li>
4189 <ol>
4190 <li>
4191 <ul>
4192 <li>
4193 <ol>
4194 <li>
4195 <dl>
4196 <dt>foo&#160;</dt>
4197 <dd>
4198 <ul>
4199 <li>
4200 <dl>
4201 <dd>
4202 <dl>
4203 <dt>bar</dt>
4204 </dl>
4205 </dd>
4206 </dl>
4207 </li>
4208 </ul>
4209 </dd>
4210 </dl>
4211 <dl>
4212 <dt>boo&#160;</dt>
4213 <dd>baz</dd>
4214 </dl>
4215 </li>
4216 </ol>
4217 </li>
4218 </ul>
4219 </li>
4220 </ol>
4221 </li>
4222 </ul>
4223 !! html/parsoid
4224 <ul>
4225 <li>
4226 <ol>
4227 <li>
4228 <ul>
4229 <li>
4230 <ol>
4231 <li>
4232 <dl>
4233 <dt>
4234 <ul>
4235 <li>
4236 <dl>
4237 <dt>
4238 <dl>
4239 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4240 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4241 </dl></dt>
4242 </dl></li>
4243 </ul></dt>
4244 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4245 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4246 </dl></li>
4247 </ol></li>
4248 </ul></li>
4249 </ol></li>
4250 </ul>
4251 !! end
4252
4253
4254 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4255 # From whitelist:
4256 # * The test is wrong, there are two colons where there should be :;
4257 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4258 !! test
4259 Definition Lists: Weird Ones: Test 1
4260 !! wikitext
4261 *#;*::;; foo : bar (who uses this?)
4262 !! html/php
4263 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4264 <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>
4265
4266 !! html/php+tidy
4267 <ul>
4268 <li>
4269 <ol>
4270 <li>
4271 <dl>
4272 <dt>foo&#160;</dt>
4273 <dd>
4274 <ul>
4275 <li>
4276 <dl>
4277 <dd>
4278 <dl>
4279 <dd>
4280 <dl>
4281 <dd>
4282 <dl>
4283 <dt>bar (who uses this?)</dt>
4284 </dl>
4285 </dd>
4286 </dl>
4287 </dd>
4288 </dl>
4289 </dd>
4290 </dl>
4291 </li>
4292 </ul>
4293 </dd>
4294 </dl>
4295 </li>
4296 </ol>
4297 </li>
4298 </ul>
4299 !! html/parsoid
4300 <ul>
4301 <li>
4302 <ol>
4303 <li>
4304 <dl>
4305 <dt>
4306 <ul>
4307 <li>
4308 <dl>
4309 <dd>
4310 <dl>
4311 <dd>
4312 <dl>
4313 <dt>
4314 <dl>
4315 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4316 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4317 </dl></dt>
4318 </dl></dd>
4319 </dl></dd>
4320 </dl></li>
4321 </ul></dt>
4322 </dl></li>
4323 </ol></li>
4324 </ul>
4325 !! end
4326
4327 !! test
4328 Definition Lists: colons occurring in tags
4329 !! wikitext
4330 ;a:b
4331 ;'''a:b'''
4332 ;<i>a:b</i>
4333 ;<span>a:b</span>
4334 ;<div>a:b</div>
4335 ;<div>a
4336 :b</div>
4337 ;{{echo|a:b}}
4338 ;{{echo|''a:b''}}
4339 ;;;''a:b''
4340 !! html+tidy
4341 <dl>
4342 <dt>a</dt>
4343 <dd>b</dd>
4344 <dt><b>a:b</b></dt>
4345 <dt><i>a:b</i></dt>
4346 <dt><span>a:b</span></dt>
4347 <dd>
4348 <div>a:b</div>
4349 </dd>
4350 <dd>
4351 <div>a
4352 <dl>
4353 <dd>b</dd>
4354 </dl>
4355 </div>
4356 </dd>
4357 <dt>a</dt>
4358 <dd>b</dd>
4359 <dt><i>a:b</i></dt>
4360 </dl>
4361 <dl>
4362 <dd>
4363 <dl>
4364 <dd>
4365 <dl>
4366 <dt><i>a:b</i></dt>
4367 </dl>
4368 </dd>
4369 </dl>
4370 </dd>
4371 </dl>
4372 !! html/parsoid
4373 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4374 <dt><b>a:b</b></dt>
4375 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4376 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4377 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4378 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4379 <dd>b</dd>
4380 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4381 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4382 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4383 !! end
4384
4385 !! test
4386 Definition Lists: colons and tables 1
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd></dl>
4399 <dl><dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403
4404 !! end
4405
4406 # Parsoid's output (as documented below) differs from php's in this case.
4407 # This is probably a bug. If we fixup parsoid to match php's output, the
4408 # above test should pass and the below test case can be removed. It is
4409 # unclear which output is more desirable.
4410
4411 !! test
4412 Definition Lists: colons and tables 2
4413 !! wikitext
4414 :{|
4415 | x
4416 |}
4417 :{|
4418 | y
4419 |}
4420 !! html/parsoid
4421 <dl><dd><table>
4422 <tr>
4423 <td> x
4424 </td></tr></table></dd>
4425 <dd><table>
4426 <tr>
4427 <td> y
4428 </td></tr></table></dd></dl>
4429 !! end
4430
4431 !! test
4432 Definition Lists: template interaction
4433 !! wikitext
4434 ::{{definition_list}}
4435
4436 :one
4437 ::{{definition_list}}
4438 :::two
4439 :::three
4440 ::four
4441 !! html/parsoid
4442 <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">
4443 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4444
4445 <dl><dd data-parsoid='{}'>one
4446 <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">
4447 </span><dd about="#mwt2">two
4448 <dl><dd>two</dd>
4449 <dd>three</dd></dl></dd>
4450 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4451 !! end
4452
4453
4454 ###
4455 ### External links
4456 ###
4457 !! test
4458 External links: non-bracketed
4459 !! wikitext
4460 Non-bracketed: http://example.com
4461 !! html
4462 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4463 </p>
4464 !! end
4465
4466 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4467 !! test
4468 External links: numbered
4469 !! wikitext
4470 Numbered: [http://example.com]
4471 Numbered: [http://example.net]
4472 Numbered: [http://example.com]
4473 !! html/php
4474 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4475 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4476 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4477 </p>
4478 !! html/parsoid
4479 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4480 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4481 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4482 !!end
4483
4484 !! test
4485 External links: specified text
4486 !! wikitext
4487 Specified text: [http://example.com link]
4488 !! html
4489 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4490 </p>
4491 !!end
4492
4493 !! test
4494 External links: trail
4495 !! wikitext
4496 Linktrails should not work for external links: [http://example.com link]s
4497 !! html
4498 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4499 </p>
4500 !! end
4501
4502 !! test
4503 External links: dollar sign in URL
4504 !! wikitext
4505 http://example.com/1$2345
4506 !! html
4507 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4508 </p>
4509 !! end
4510
4511 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4512 !! test
4513 External links: dollar sign in URL (autonumber)
4514 !! wikitext
4515 [http://example.com/1$2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4521 !!end
4522
4523 !! test
4524 External links: open square bracket forbidden in URL (bug 4377)
4525 !! options
4526 parsoid=wt2html,wt2wt,html2html
4527 !! wikitext
4528 http://example.com/1[2345
4529 !! html/php
4530 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4531 </p>
4532 !! html/parsoid
4533 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4534 !! end
4535
4536 !! test
4537 External links: open square bracket forbidden in URL (named) (bug 4377)
4538 !! options
4539 parsoid=wt2html,html2html
4540 !! wikitext
4541 [http://example.com/1[2345]
4542 !! html/php
4543 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4544 </p>
4545 !! html/parsoid
4546 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4547 !!end
4548
4549 # parsoid adds a space before the link name
4550 !! test
4551 External links: open square bracket forbidden in URL (named) (bug 4377)
4552 Parsoid variant.
4553 !! wikitext
4554 [http://example.com/1 [2345]
4555 !! html
4556 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4557 </p>
4558 !!end
4559
4560 !! test
4561 External links: nowiki in URL link text (bug 6230)
4562 !! wikitext
4563 [http://example.com/ <nowiki>''example site''</nowiki>]
4564 !! html
4565 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4566 </p>
4567 !! end
4568
4569 !! test
4570 External links: newline forbidden in text (bug 6230 regression check)
4571 !! wikitext
4572 [http://example.com/ first
4573 second]
4574 !! html
4575 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4576 second]
4577 </p>
4578 !!end
4579
4580 !! test
4581 External links: Pipe char between url and text
4582 !! wikitext
4583 [http://example.com | link]
4584 !! html
4585 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4586 </p>
4587 !!end
4588
4589 !! test
4590 External links: protocol-relative URL in brackets
4591 !! wikitext
4592 [//example.com/ Test]
4593 !! html
4594 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4595 </p>
4596 !! end
4597
4598 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4599 !! test
4600 External links: protocol-relative URL in brackets without text
4601 !! wikitext
4602 [//example.com]
4603 !! html/php
4604 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4608 !! end
4609
4610 !! test
4611 External links: protocol-relative URL in free text is left alone
4612 !! wikitext
4613 //example.com/Foo
4614 !! html
4615 <p>//example.com/Foo
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4621 !! wikitext
4622 foo//example.com/Foo
4623 !! html
4624 <p>foo//example.com/Foo
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: with no contents
4630 !! wikitext
4631 [http://en.wikipedia.org/wiki/Foo]
4632
4633 [[wikipedia:Foo|Bar]]
4634
4635 [[wikipedia:Foo|<span>Bar</span>]]
4636 !! html/php
4637 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4638 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4639 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4640 </p>
4641 !! html/parsoid
4642 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4644 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4645 !! end
4646
4647 !! test
4648 External links: Free with trailing punctuation
4649 !! wikitext
4650 http://example.com,
4651 http://example.com;
4652 http://example.com\
4653 http://example.com.
4654 http://example.com:
4655 http://example.com!
4656 http://example.com?
4657 http://example.com)
4658 http://example.com/url_with_(brackets)
4659 (http://example.com/url_without_brackets)
4660 http://example.com/url_with_entity&amp;
4661 http://example.com/url_with_entity&#x26;
4662 http://example.com/url_with_entity&#038;
4663 http://example.com/url_with_entity&nbsp;
4664 http://example.com/url_with_entity&#xA0;
4665 http://example.com/url_with_entity&#160;
4666 http://example.com/url_with_entity&lt;
4667 http://example.com/url_with_entity&#x3C;
4668 http://example.com/url_with_entity&#60;
4669 !! html/php
4670 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4677 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4679 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4689 </p>
4690 !! html/parsoid
4691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4696 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4698 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4700 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4707 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4708 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4709 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4710 !! end
4711
4712 !! test
4713 External links: tricky Parsoid html2html case
4714 !! options
4715 parsoid=wt2html,wt2wt,html2html
4716 !! wikitext
4717 http://example.com/url_with_entity&amp;amp;
4718 !! html/php
4719 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4720 </p>
4721 !! html/parsoid
4722 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4723 !! end
4724
4725 !! test
4726 External links: Free with trailing quotes (T113666)
4727 !! wikitext
4728 '''News:''' Stuff here
4729
4730 news:'a'b''c''d e
4731 !! html/php
4732 <p><b>News:</b> Stuff here
4733 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4734 </p>
4735 !! html/parsoid
4736 <p><b>News:</b> Stuff here</p>
4737 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4738 !! end
4739
4740 !! test
4741 External links: Lone protocols are never linked (T105697)
4742 !! wikitext
4743 http://
4744 http://;
4745 (http://)
4746 bitcoin:
4747 bitcoin:;
4748 (bitcoin:)
4749 !! html
4750 <p>http://
4751 http://;
4752 (http://)
4753 bitcoin:
4754 bitcoin:;
4755 (bitcoin:)
4756 </p>
4757 !! end
4758
4759 !! test
4760 External links: No preceding word characters allowed (bug 65278)
4761 !! wikitext
4762 NOPEhttp://example.com
4763 N0http://example.com
4764 ok:http://example.com
4765 ok-http://example.com
4766 !! html
4767 <p>NOPEhttp://example.com
4768 N0http://example.com
4769 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4770 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4771 </p>
4772 !! end
4773
4774 !! test
4775 External image
4776 !! wikitext
4777 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4778 !! html
4779 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4780 </p>
4781 !! end
4782
4783 !! test
4784 External image from https
4785 !! wikitext
4786 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4787 !! html
4788 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4789 </p>
4790 !! end
4791
4792 !! test
4793 External image (when not allowed)
4794 !! options
4795 wgAllowExternalImages=0
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <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>
4800 </p>
4801 !! end
4802
4803 !! test
4804 Link to non-http image, no img tag
4805 !! wikitext
4806 Link to non-http image, no img tag: ftp://example.com/test.jpg
4807 !! html
4808 <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>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External links: terminating separator
4814 !! wikitext
4815 Terminating separator: http://example.com/thing,
4816 !! html
4817 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4818 </p>
4819 !! end
4820
4821 !! test
4822 External links: intervening separator
4823 !! wikitext
4824 Intervening separator: http://example.com/1,2,3
4825 !! html
4826 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4827 </p>
4828 !! end
4829
4830 !! test
4831 External links: old bug with URL in query
4832 !! wikitext
4833 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4834 !! html
4835 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4836 </p>
4837 !! end
4838
4839 !! test
4840 External links: old URL-in-URL bug, mixed protocols
4841 !! wikitext
4842 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4843 !! html
4844 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4845 </p>
4846 !!end
4847
4848 !! test
4849 External links: URL in text
4850 !! wikitext
4851 URL in text: [http://example.com http://example.com]
4852 !! html
4853 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4854 </p>
4855 !! end
4856
4857 !! test
4858 External links: Clickable images
4859 !! wikitext
4860 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4861 !! html/php
4862 <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>
4863 </p>
4864 !! html/parsoid
4865 <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>
4866 !! end
4867
4868 !! test
4869 External links: raw ampersand
4870 !! wikitext
4871 Old &amp; use: http://x&y
4872 !! html
4873 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: encoded ampersand
4879 !! wikitext
4880 Old &amp; use: http://x&amp;y
4881 !! html/php
4882 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4883 </p>
4884 !! html/parsoid
4885 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4886 !! end
4887
4888 !! test
4889 External links: encoded equals (bug 6102)
4890 !! wikitext
4891 http://example.com/?foo&#61;bar
4892 !! html/php
4893 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4894 </p>
4895 !! html/parsoid
4896 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4897 !! end
4898
4899 ##
4900 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4901 ## does it number them. As discussed in bug 53505, we can identify
4902 ## autonumbered links via CSS.
4903 ##
4904
4905 !! test
4906 External links: [raw ampersand]
4907 !! wikitext
4908 Old &amp; use: [http://x&y]
4909 !! html/php
4910 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4911 </p>
4912 !! html/parsoid
4913 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4914 !! end
4915
4916 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4917 # mode will return the [raw ampersand] wikitext
4918 !! test
4919 External links: [encoded ampersand]
4920 !! options
4921 parsoid=wt2html,wt2wt,html2html
4922 !! wikitext
4923 Old &amp; use: [http://x&amp;y]
4924 !! html/php
4925 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4926 </p>
4927 !! html/parsoid
4928 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4929 !! end
4930
4931 !! test
4932 External links: [raw equals]
4933 !! wikitext
4934 [http://example.com/?foo=bar]
4935 !! html/php
4936 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4940 !! end
4941
4942 # note that parsoid html is identical to [raw equals] case; so html2wt
4943 # mode will return the [raw equals] wikitext
4944 !! test
4945 External links: [encoded equals] (bug 6102)
4946 !! options
4947 parsoid=wt2html,wt2wt,html2html
4948 !! wikitext
4949 [http://example.com/?foo&#61;bar]
4950 !! html/php
4951 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4952 </p>
4953 !! html/parsoid
4954 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4955 !! end
4956
4957 # xxx parsoid strips the IDN character, so the round-trip tests will
4958 # obviously fail and are disabled. --cscott
4959 !! test
4960 External links: [IDN ignored character reference in hostname; strip it right off]
4961 !! options
4962 parsoid=wt2html,wt2wt,html2html
4963 !! wikitext
4964 [http://e&zwnj;xample.com/]
4965 !! html/php
4966 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4967 </p>
4968 !! html/parsoid
4969 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4970 !! end
4971
4972 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4973 # Where an external link could easily circumvent the sanitization of the text of
4974 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4975 # test demands a higher standard. That's a bit strange.
4976 #
4977 # Example:
4978 #
4979 # http://e‌xample.com -> [http://example.com|http://example.com]
4980 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4981 #
4982 # The first example is sanitized, but the second is not. Any security benefits
4983 # from this production are trivial to circumvent. Either remove this test and
4984 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4985 # the test accordingly.
4986 #
4987 # All our love,
4988 # The Parsoid team.
4989 # xxx parsoid strips the IDN character, so the round-trip tests will
4990 # obviously fail and are disabled. --cscott
4991 !! test
4992 External links: IDN ignored character reference in hostname; strip it right off
4993 !! options
4994 parsoid=wt2html,html2html
4995 !! wikitext
4996 http://e&zwnj;xample.com/
4997 !! html/php
4998 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4999 </p>
5000 !! html/parsoid
5001 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5002 !! end
5003
5004 !! test
5005 External links: www.jpeg.org (bug 554)
5006 !! wikitext
5007 http://www.jpeg.org
5008 !! html
5009 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5010 </p>
5011 !! end
5012
5013 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5014 !! test
5015 External links: URL within URL (original bug 2)
5016 !! wikitext
5017 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5018 !! html/php
5019 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5020 </p>
5021 !! html/parsoid
5022 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5023 !! end
5024
5025 !! test
5026 BUG 361: URL inside bracketed URL
5027 !! wikitext
5028 [http://www.example.com/foo http://www.example.com/bar]
5029 !! html
5030 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5031 </p>
5032 !! end
5033
5034 !! test
5035 BUG 361: URL within URL, not bracketed
5036 !! wikitext
5037 http://www.example.com/foo?=http://www.example.com/bar
5038 !! html
5039 <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>
5040 </p>
5041 !! end
5042
5043 !! test
5044 BUG 289: ">"-token in URL-tail
5045 !! wikitext
5046 http://www.example.com/<hello>
5047 !! html
5048 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5049 </p>
5050 !!end
5051
5052 !! test
5053 BUG 289: literal ">"-token in URL-tail
5054 !! wikitext
5055 http://www.example.com/<b>html</b>
5056 !! html/php
5057 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5058 </p>
5059 !! html/parsoid
5060 <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>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in bracketed URL
5065 !! wikitext
5066 [http://www.example.com/<hello> stuff]
5067 !! html
5068 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in bracketed URL
5074 !! wikitext
5075 [http://www.example.com/<b>html</b> stuff]
5076 !! html
5077 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5078 </p>
5079 !!end
5080
5081 !! test
5082 BUG 289: literal double quote at end of URL
5083 !! wikitext
5084 http://www.example.com/"hello"
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5087 </p>
5088 !!end
5089
5090 !! test
5091 BUG 289: literal double quote in bracketed URL
5092 !! wikitext
5093 [http://www.example.com/"hello" stuff]
5094 !! html
5095 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5096 </p>
5097 !!end
5098
5099 !! test
5100 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5101 !! wikitext
5102 [http://www.example.com test]
5103 !! html
5104 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5105 </p>
5106 !! end
5107
5108 !! test
5109 External links: link text with spaces
5110 !! wikitext
5111 [http://www.example.com a b c]
5112 [http://www.example.com ''a'' ''b'']
5113 !! html
5114 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5115 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: wiki links within external link (Bug 3695)
5121 !! options
5122 parsoid=wt2html,html2html
5123 !! wikitext
5124 [http://example.com [[wikilink]] embedded in ext link]
5125 !! html/php
5126 <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>
5127 </p>
5128 !! html/parsoid
5129 <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>
5130 !! end
5131
5132 !! test
5133 BUG 787: Links with one slash after the url protocol are invalid
5134 !! wikitext
5135 http:/example.com
5136
5137 [http:/example.com title]
5138 !! html
5139 <p>http:/example.com
5140 </p><p>[http:/example.com title]
5141 </p>
5142 !! end
5143
5144 !! test
5145 Bracketed external links with template-generated invalid target
5146 !! wikitext
5147 [{{echo|http:/example.com}} title]
5148 !! html
5149 <p>[http:/example.com title]
5150 </p>
5151 !! end
5152
5153 !! test
5154 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5155 !! wikitext
5156 ''[http://example.com text'']
5157 [http://example.com '''text]'''
5158 ''Something [http://example.com in italic'']
5159 ''Something [http://example.com mixed''''', even bold]'''
5160 '''''Now [http://example.com both''''']
5161 !! html
5162 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5163 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5164 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5165 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5166 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5167 </p>
5168 !! end
5169
5170
5171 !! test
5172 Bug 4781: %26 in URL
5173 !! wikitext
5174 http://www.example.com/?title=AT%26T
5175 !! html/php
5176 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5177 </p>
5178 !! html/parsoid
5179 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5180 !! end
5181
5182 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5183 # % is actually legal in HTML5. Any change in output would need testing though.
5184 !! test
5185 Bug 4781, 5267: %25 in URL
5186 !! wikitext
5187 http://www.example.com/?title=100%25_Bran
5188 !! html/php
5189 <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>
5190 </p>
5191 !! html/parsoid
5192 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5193 !! end
5194
5195 !! test
5196 Bug 4781, 5267: %28, %29 in URL
5197 !! wikitext
5198 http://www.example.com/?title=Ben-Hur_%281959_film%29
5199 !! html/php
5200 <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>
5201 </p>
5202 !! html/parsoid
5203 <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>
5204 !! end
5205
5206
5207 !! test
5208 Bug 4781: %26 in autonumber URL
5209 !! wikitext
5210 [http://www.example.com/?title=AT%26T]
5211 !! html/php
5212 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5216 !! end
5217
5218 !! test
5219 Bug 4781, 5267: %26 in autonumber URL
5220 !! wikitext
5221 [http://www.example.com/?title=100%25_Bran]
5222 !! html/php
5223 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5224 </p>
5225 !! html/parsoid
5226 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5227 !! end
5228
5229 !! test
5230 Bug 4781, 5267: %28, %29 in autonumber URL
5231 !! wikitext
5232 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5233 !! html/php
5234 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5238 !! end
5239
5240
5241 !! test
5242 Bug 4781: %26 in bracketed URL
5243 !! wikitext
5244 [http://www.example.com/?title=AT%26T link]
5245 !! html/php
5246 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5250 !! end
5251
5252 !! test
5253 Bug 4781, 5267: %25 in bracketed URL
5254 !! wikitext
5255 [http://www.example.com/?title=100%25_Bran link]
5256 !! html
5257 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5258 </p>
5259 !! end
5260
5261 !! test
5262 Bug 4781, 5267: %28, %29 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5270 !! end
5271
5272 !! test
5273 External link containing a period in the anchor. (bug 63947)
5274 !! wikitext
5275 [//foo.org/bar#baz. bang]
5276
5277 [//foo.org/bar. bang]
5278 !! html/php
5279 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5280 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5281 </p>
5282 !! html/parsoid
5283 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5284 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5285 !! end
5286
5287 !! test
5288 External link containing a single quote. (bug 63947)
5289 !! wikitext
5290 [//foo.org/bar'baz]
5291
5292 [//foo.org/bar'baz bang]
5293 !! html/php
5294 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5295 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5300 !! end
5301
5302 !! test
5303 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5304 !! wikitext
5305 Some [http://example.com/ pretty ''italics'' and stuff]!
5306 !! html
5307 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5308 </p>
5309 !! end
5310
5311 !! test
5312 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5313 !! wikitext
5314 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5315 !! html
5316 <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>
5317 </p>
5318 !! end
5319
5320 !! test
5321 External link containing double-single-quotes with no space separating the url from text in italics
5322 !! wikitext
5323 [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]].]
5324 !! html/php
5325 <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>
5326 </p>
5327 !! html/php+tidy
5328 <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>
5329 !! html/parsoid
5330 <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>
5331 !! end
5332
5333 !! test
5334 External link with comments in link text
5335 !! wikitext
5336 [http://www.google.com Google <!-- comment -->]
5337 !! html/php
5338 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5342 !! end
5343
5344 !! test
5345 External link to bare IPv4 address
5346 !! wikitext
5347 [http://192.168.0.1 Link]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5353 !! end
5354
5355 !! test
5356 URL-encoding in URL functions (single parameter)
5357 !! wikitext
5358 {{localurl:Some page|amp=&}}
5359 !! html
5360 <p>/index.php?title=Some_page&amp;amp=&amp;
5361 </p>
5362 !! end
5363
5364 !! test
5365 URL-encoding in URL functions (multiple parameters)
5366 !! wikitext
5367 {{localurl:Some page|q=?&amp=&}}
5368 !! html
5369 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5370 </p>
5371 !! end
5372
5373 !! test
5374 Brackets in urls
5375 !! wikitext
5376 http://example.com/index.php?foozoid%5B%5D=bar
5377
5378 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5379 !! html/php
5380 <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>
5381 </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>
5382 </p>
5383 !! html/parsoid
5384 <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>
5385
5386 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5387 !! end
5388
5389 !! test
5390 IPv6 urls, autolink format (T23261)
5391 !! wikitext
5392 http://[2404:130:0:1000::187:2]/index.php
5393
5394 Examples from RFC 2373, section 2.2:
5395 * http://[1080::8:800:200C:417A]/unicast
5396 * http://[FF01::101]/multicast
5397 * http://[::1]/loopback
5398 * http://[::]/unspecified
5399 * http://[::13.1.68.3]/ipv4compat
5400 * http://[::FFFF:129.144.52.38]/ipv4compat
5401
5402 Examples from RFC 2732, section 2:
5403 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5404 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5405 * http://[3ffe:2a00:100:7031::1]
5406 * http://[1080::8:800:200C:417A]/foo
5407 * http://[::192.9.5.5]/ipng
5408 * http://[::FFFF:129.144.52.38]:80/index.html
5409 * http://[2010:836B:4179::836B:4179]
5410
5411 !! html/php
5412 <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>
5413 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5414 </p>
5415 <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>
5416 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5418 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5419 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5420 <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>
5421 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5422 </p>
5423 <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>
5424 <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>
5425 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5428 <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>
5429 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5430
5431 !! html/parsoid
5432 <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>
5433
5434 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5435 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441
5442 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5443 <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>
5444 <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>
5445 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <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>
5449 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450 !! end
5451
5452 !! test
5453 IPv6 urls, bracketed format (T23261)
5454 !! wikitext
5455 [http://[2404:130:0:1000::187:2]/index.php test]
5456
5457 Examples from RFC 2373, section 2.2:
5458 * [http://[1080::8:800:200C:417A] unicast]
5459 * [http://[FF01::101] multicast]
5460 * [http://[::1]/ loopback]
5461 * [http://[::] unspecified]
5462 * [http://[::13.1.68.3] ipv4compat]
5463 * [http://[::FFFF:129.144.52.38] ipv4compat]
5464
5465 Examples from RFC 2732, section 2:
5466 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5467 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5468 * [http://[3ffe:2a00:100:7031::1] 3]
5469 * [http://[1080::8:800:200C:417A]/foo 4]
5470 * [http://[::192.9.5.5]/ipng 5]
5471 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5472 * [http://[2010:836B:4179::836B:4179] 7]
5473
5474 !! html/php
5475 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5476 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5477 </p>
5478 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5484 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5485 </p>
5486 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5493
5494 !! html/parsoid
5495 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5496
5497 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5498 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504
5505 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5506 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513 !! end
5514
5515 !! test
5516 Non-extlinks in brackets
5517 !! wikitext
5518 [foo]
5519 [foo bar]
5520 [foo ''bar'']
5521 [fool's] errand
5522 [fool's errand]
5523 [{{echo|foo}}]
5524 [{{echo|foo}} bar]
5525 [{{echo|foo}} ''bar'']
5526 [{{echo|foo}}l's] errand
5527 [{{echo|foo}}l's errand]
5528 [url={{echo|foo}}]
5529 [url=http://example.com]
5530 [http:// bare protocols don't count]
5531 !! html/php
5532 <p>[foo]
5533 [foo bar]
5534 [foo <i>bar</i>]
5535 [fool's] errand
5536 [fool's errand]
5537 [foo]
5538 [foo bar]
5539 [foo <i>bar</i>]
5540 [fool's] errand
5541 [fool's errand]
5542 [url=foo]
5543 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5544 [http:// bare protocols don't count]
5545 </p>
5546 !! html/parsoid
5547 <p>[foo]
5548 [foo bar]
5549 [foo <i>bar</i>]
5550 [fool's] errand
5551 [fool's errand]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5555 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5556 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5557 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5558 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5559 [http:// bare protocols don't count]</p>
5560 !! end
5561
5562 !! test
5563 Percent encoding in external links
5564 !! wikitext
5565 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5566 !! html/php
5567 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink"
5571 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5572 !! end
5573
5574 !! test
5575 Use url link syntax for links where the content is equal the link target
5576 !! wikitext
5577 http://example.com
5578 !! html/php
5579 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5580 </p>
5581 !! html/parsoid
5582 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5583 !! end
5584
5585 !! test
5586 Parenthesis in external links, especially URL links
5587 !! wikitext
5588 http://example.com)
5589
5590 http://example.com/test)
5591
5592 http://example.com/(test)
5593
5594 http://example.com/((test)
5595
5596 (http://example.com/(test))
5597
5598 (http://example.com/(test)))))
5599
5600 http://example.com/a)b
5601
5602 [http://example.com) foo]
5603 !! html/php
5604 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5605 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5606 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5608 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5609 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5610 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5611 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5612 </p>
5613 !! html/parsoid
5614 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5615 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5616 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5618 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5619 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5620 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5621 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5622 !! end
5623
5624 !! test
5625 Parenthesis in external links, w/ transclusion or comment
5626 !! wikitext
5627 (http://example.com/{{echo|hi}})
5628
5629 (http://example.com<!-- hi -->)
5630 !! html/php
5631 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5632 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5633 </p>
5634 !! html/parsoid
5635 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5636
5637 <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>
5638 !! end
5639
5640 !! test
5641 Serialize <a> tags with invalid link targets as plain text
5642 !! options
5643 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5644 !! html/parsoid
5645 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5646 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5647 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5648 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5649 !! wikitext
5650 text
5651 <nowiki>*</nowiki>text
5652 <nowiki>[[foo]]</nowiki>
5653 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5654 !! end
5655
5656 !! test
5657 mw:ExtLink -vs- mw:WikiLink (T94723)
5658 !! options
5659 parsoid=html2wt
5660 !! html/parsoid
5661 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5662 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5663 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5664 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5665 <p>
5666 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5667 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5668 </p>
5669 !! wikitext
5670 [[Foo|Bar]]
5671 [[Foo|Bar]]
5672 [[wikipedia:Foo|Bar]]
5673 [[wikipedia:Foo|Bar]]
5674
5675 [[wikipedia:European_Robin|European Robin]]
5676 [[wikipedia:European_Robin|European Robin]]
5677 !! end
5678
5679 !! test
5680 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5681 !! options
5682 parsoid=wt2wt
5683 !! wikitext
5684 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5685 !! html/parsoid
5686 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5687 !! end
5688
5689
5690 ###
5691 ### Quotes
5692 ###
5693
5694 !! test
5695 Quotes
5696 !! wikitext
5697 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5698
5699 Normal text. '''''Bold italic text.''''' Normal text.
5700 !! html
5701 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5702 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5703 </p>
5704 !! end
5705
5706
5707 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5708 # parser strips. The wikitext contains just the first half of the bold
5709 # quote pair.
5710 !! test
5711 Unclosed and unmatched quotes
5712 !! wikitext
5713 '''''Bold italic text '''with bold deactivated''' in between.'''''
5714
5715 '''''Bold italic text ''with italic deactivated'' in between.'''''
5716
5717 '''Bold text..
5718
5719 ..spanning two paragraphs (should not work).'''
5720
5721 '''Bold tag left open
5722
5723 ''Italic tag left open
5724
5725 Normal text.
5726
5727 <!-- Unmatching number of opening, closing tags: -->
5728 '''This year''''s election ''should'' beat '''last year''''s.
5729
5730 ''Tom'''s car is bigger than ''Susan'''s.
5731
5732 Plain ''italic'''s plain
5733 !! html/php
5734 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5735 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5736 </p><p><b>Bold text..</b>
5737 </p><p>..spanning two paragraphs (should not work).
5738 </p><p><b>Bold tag left open</b>
5739 </p><p><i>Italic tag left open</i>
5740 </p><p>Normal text.
5741 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5742 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5743 </p><p>Plain <i>italic'</i>s plain
5744 </p>
5745 !! html/parsoid
5746 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5747 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5748 </p><p><b>Bold text..</b>
5749 </p><p>..spanning two paragraphs (should not work).<b></b>
5750 </p><p><b>Bold tag left open</b>
5751 </p><p><i>Italic tag left open</i>
5752 </p><p>Normal text.
5753 </p>
5754 <!-- Unmatching number of opening, closing tags: -->
5755 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5756 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5757 </p><p>Plain <i>italic'</i>s plain
5758 </p>
5759 !! end
5760
5761 ###
5762 ### Tables
5763 ###
5764 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5765 ###
5766
5767 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5768 # is the bare minimum required by the spec, see:
5769 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5770 # Parsoid team replies: empty table tags are legal in HTML5
5771 !! test
5772 A table with no data.
5773 !! options
5774 parsoid=wt2html
5775 !! wikitext
5776 {||}
5777 !! html/php
5778
5779 !! html/parsoid
5780 <table></table>
5781
5782 !! end
5783
5784 !! test
5785 A table with stray table end tags on start tag line (wt2html)
5786 !! options
5787 parsoid=wt2html
5788 !! wikitext
5789 {|style="color: red;"|}
5790
5791 {|style="color: red;" |}
5792 |foo
5793 |}
5794
5795 {|style="color: red;"|} id="foo"
5796 |foo
5797 |}
5798
5799 {|style="color: red;" |} id="foo"
5800 |foo
5801 |}
5802 !! html
5803 <table style="color: red;"></table>
5804
5805 <table style="color: red;">
5806 <tbody><tr>
5807 <td>foo</td>
5808 </tr></tbody>
5809 </table>
5810
5811 <table style="color: red;" id="foo">
5812 <tbody><tr>
5813 <td>foo</td>
5814 </tr></tbody>
5815 </table>
5816
5817 <table style="color: red;" id="foo">
5818 <tbody><tr>
5819 <td>foo</td>
5820 </tr></tbody>
5821 </table>
5822
5823 !! end
5824
5825 !! test
5826 A table with no data (take 2)
5827 !! wikitext
5828 {|
5829 |}
5830 !! html/parsoid
5831 <table></table>
5832 !! end
5833
5834 # A table with nothing but a caption is invalid XHTML, we might want to render
5835 # this as <p>caption</p>
5836 # Parsoid team replies: table with only a caption is legal in HTML5
5837 !! test
5838 A table with nothing but a caption
5839 !! wikitext
5840 {|
5841 |+ caption
5842 |}
5843 !! html/php
5844 <table>
5845 <caption> caption
5846 </caption><tr><td></td></tr></table>
5847
5848 !! html/parsoid
5849 <table><caption> caption</caption></table>
5850 !! end
5851
5852 !! test
5853 A table with caption with default-spaced attributes and a table row
5854 !! wikitext
5855 {|
5856 |+ style="color: red;" | caption1
5857 |-
5858 | foo
5859 |}
5860 !! html
5861 <table>
5862 <caption style="color: red;"> caption1
5863 </caption>
5864 <tr>
5865 <td> foo
5866 </td></tr></table>
5867
5868 !! end
5869
5870 !! test
5871 A table with captions with non-default spaced attributes and a table row
5872 !! wikitext
5873 {|
5874 |+style="color: red;"|caption2
5875 |+ style="color: red;"| caption3
5876 |-
5877 | foo
5878 |}
5879 !! html
5880 <table>
5881 <caption style="color: red;">caption2
5882 </caption>
5883 <caption style="color: red;"> caption3
5884 </caption>
5885 <tr>
5886 <td> foo
5887 </td></tr></table>
5888
5889 !! end
5890
5891 !! test
5892 Table td-cell syntax variations
5893 !! wikitext
5894 {|
5895 | foo bar foo | baz
5896 | foo bar foo || baz
5897 | style='color:red;' | baz
5898 | style='color:red;' || baz
5899 |}
5900 !! html
5901 <table>
5902 <tr>
5903 <td> baz
5904 </td>
5905 <td> foo bar foo </td>
5906 <td> baz
5907 </td>
5908 <td style="color:red;"> baz
5909 </td>
5910 <td> style='color:red;' </td>
5911 <td> baz
5912 </td></tr></table>
5913
5914 !! end
5915
5916 !! test
5917 Simple table
5918 !! wikitext
5919 {|
5920 | 1 || 2
5921 |-
5922 | 3 || 4
5923 |}
5924 !! html
5925 <table>
5926 <tr>
5927 <td> 1 </td>
5928 <td> 2
5929 </td></tr>
5930 <tr>
5931 <td> 3 </td>
5932 <td> 4
5933 </td></tr></table>
5934
5935 !! end
5936
5937 !! test
5938 Simple table but with multiple dashes for row wikitext
5939 !! wikitext
5940 {|
5941 | foo
5942 |-----
5943 | bar
5944 |}
5945 !! html
5946 <table>
5947 <tr>
5948 <td> foo
5949 </td></tr>
5950 <tr>
5951 <td> bar
5952 </td></tr></table>
5953
5954 !! end
5955
5956 !! test
5957 Multiplication table
5958 !! wikitext
5959 {| border="1" cellpadding="2"
5960 |+Multiplication table
5961 |-
5962 ! &times; !! 1 !! 2 !! 3
5963 |-
5964 ! 1
5965 | 1 || 2 || 3
5966 |-
5967 ! 2
5968 | 2 || 4 || 6
5969 |-
5970 ! 3
5971 | 3 || 6 || 9
5972 |-
5973 ! 4
5974 | 4 || 8 || 12
5975 |-
5976 ! 5
5977 | 5 || 10 || 15
5978 |}
5979 !! html
5980 <table border="1" cellpadding="2">
5981 <caption>Multiplication table
5982 </caption>
5983 <tr>
5984 <th> &#215; </th>
5985 <th> 1 </th>
5986 <th> 2 </th>
5987 <th> 3
5988 </th></tr>
5989 <tr>
5990 <th> 1
5991 </th>
5992 <td> 1 </td>
5993 <td> 2 </td>
5994 <td> 3
5995 </td></tr>
5996 <tr>
5997 <th> 2
5998 </th>
5999 <td> 2 </td>
6000 <td> 4 </td>
6001 <td> 6
6002 </td></tr>
6003 <tr>
6004 <th> 3
6005 </th>
6006 <td> 3 </td>
6007 <td> 6 </td>
6008 <td> 9
6009 </td></tr>
6010 <tr>
6011 <th> 4
6012 </th>
6013 <td> 4 </td>
6014 <td> 8 </td>
6015 <td> 12
6016 </td></tr>
6017 <tr>
6018 <th> 5
6019 </th>
6020 <td> 5 </td>
6021 <td> 10 </td>
6022 <td> 15
6023 </td></tr></table>
6024
6025 !! end
6026
6027 !! test
6028 Accept "||" in table headings
6029 !! wikitext
6030 {|
6031 !h1 || h2
6032 |}
6033 !! html
6034 <table>
6035 <tr>
6036 <th>h1 </th>
6037 <th> h2
6038 </th></tr></table>
6039
6040 !! end
6041
6042 !! test
6043 Accept "!!" in table data
6044 !! wikitext
6045 {|
6046 | Foo!! ||
6047 |}
6048 !! html
6049 <table>
6050 <tr>
6051 <td> Foo!! </td>
6052 <td>
6053 </td></tr></table>
6054
6055 !! html/parsoid
6056 <table>
6057 <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>
6058 </tbody></table>
6059 !! end
6060
6061 !! test
6062 Accept "||" in indented table headings
6063 !! wikitext
6064 :{|
6065 !h1 || h2
6066 |}
6067 !! html
6068 <dl><dd><table>
6069 <tr>
6070 <th>h1 </th>
6071 <th> h2
6072 </th></tr></table></dd></dl>
6073
6074 !! end
6075
6076 !! test
6077 Accept "!!" in templates
6078 !! wikitext
6079 {|
6080 !a {{echo|b!!c}}
6081 |}
6082 !! html/php
6083 <table>
6084 <tr>
6085 <th>a b</th>
6086 <th>c
6087 </th></tr></table>
6088
6089 !! html/parsoid
6090 <table>
6091 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' 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>
6092 !! end
6093
6094 !! test
6095 Accept "!!" in table headings after newline
6096 !! wikitext
6097 {|
6098 !a
6099 b!!c
6100 |}
6101 !! html/php
6102 <table>
6103 <tr>
6104 <th>a
6105 <p>b!!c
6106 </p>
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th>a
6112 <p>b!!c</p></th></tr>
6113 </tbody></table>
6114 !! end
6115
6116 !! test
6117 Accept "!!" in table data of mixed wikitext / html syntax
6118 !! wikitext
6119 {|
6120 !a
6121 <tr><td>b!!c</td></tr>
6122 |}
6123 !! html+tidy
6124 <table>
6125 <tr>
6126 <th>a</th>
6127 </tr>
6128 <tr>
6129 <td>b!!c</td>
6130 </tr>
6131 </table>
6132 !! html/parsoid
6133 <table>
6134 <tbody><tr><th>a</th></tr>
6135 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6136 </tbody></table>
6137 !! end
6138
6139 !! test
6140 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6141 !! wikitext
6142 {|
6143 !| h1
6144 || a
6145 |}
6146 !! html
6147 <table>
6148 <tr>
6149 <th> h1
6150 </th>
6151 <td> a
6152 </td></tr></table>
6153
6154 !! end
6155
6156 !!test
6157 Accept "| !" at start of line in tables (ignore !-attribute)
6158 !! wikitext
6159 {|
6160 |-
6161 | !style="color:red" | bar
6162 |}
6163 !! html
6164 <table>
6165
6166 <tr>
6167 <td> bar
6168 </td></tr></table>
6169
6170 !!end
6171
6172 !!test
6173 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 +/-
6174 !! wikitext
6175 {|
6176 |-
6177 |style='color:red;'|+1
6178 |style='color:blue;'|-1
6179 |-
6180 | 1 || 2 || 3
6181 | 1 ||+2 ||-3
6182 |-
6183 | +1
6184 | -1
6185 |}
6186 !! html
6187 <table>
6188
6189 <tr>
6190 <td style="color:red;">+1
6191 </td>
6192 <td style="color:blue;">-1
6193 </td></tr>
6194 <tr>
6195 <td> 1 </td>
6196 <td> 2 </td>
6197 <td> 3
6198 </td>
6199 <td> 1 </td>
6200 <td>+2 </td>
6201 <td>-3
6202 </td></tr>
6203 <tr>
6204 <td> +1
6205 </td>
6206 <td> -1
6207 </td></tr></table>
6208
6209 !!end
6210
6211 !! test
6212 Table rowspan
6213 !! wikitext
6214 {| border=1
6215 | Cell 1, row 1
6216 |rowspan=2| Cell 2, row 1 (and 2)
6217 | Cell 3, row 1
6218 |-
6219 | Cell 1, row 2
6220 | Cell 3, row 2
6221 |}
6222 !! html
6223 <table border="1">
6224 <tr>
6225 <td> Cell 1, row 1
6226 </td>
6227 <td rowspan="2"> Cell 2, row 1 (and 2)
6228 </td>
6229 <td> Cell 3, row 1
6230 </td></tr>
6231 <tr>
6232 <td> Cell 1, row 2
6233 </td>
6234 <td> Cell 3, row 2
6235 </td></tr></table>
6236
6237 !! end
6238
6239 !! test
6240 Nested table
6241 !! wikitext
6242 {| border=1
6243 | &alpha;
6244 |
6245 {| bgcolor=#ABCDEF border=2
6246 |nested
6247 |-
6248 |table
6249 |}
6250 |the original table again
6251 |}
6252 !! html
6253 <table border="1">
6254 <tr>
6255 <td> &#945;
6256 </td>
6257 <td>
6258 <table bgcolor="#ABCDEF" border="2">
6259 <tr>
6260 <td>nested
6261 </td></tr>
6262 <tr>
6263 <td>table
6264 </td></tr></table>
6265 </td>
6266 <td>the original table again
6267 </td></tr></table>
6268
6269 !! end
6270
6271 !! test
6272 Invalid attributes in table cell (bug 1830)
6273 !! wikitext
6274 {|
6275 |Cell:|broken
6276 |}
6277 !! html
6278 <table>
6279 <tr>
6280 <td>broken
6281 </td></tr></table>
6282
6283 !! end
6284
6285 !! test
6286 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6287 !! wikitext
6288 {|
6289 | title="foo" |bar
6290 | title="foo<nowiki>|</nowiki>" |bar
6291 | title="foo<nowiki>|</nowiki>" bar
6292 |}
6293 !! html/php
6294 <table>
6295 <tr>
6296 <td title="foo">bar
6297 </td>
6298 <td title="foo&#124;">bar
6299 </td>
6300 <td> title="foo|" bar
6301 </td></tr></table>
6302
6303 !! html/parsoid
6304 <table>
6305 <tbody><tr><td title="foo">bar</td>
6306 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6307 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6308 </tbody></table>
6309 !! end
6310
6311 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6312 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6313 # *2wt modes will fail.
6314 !! test
6315 Table security: embedded pipes
6316 !! options
6317 parsoid=wt2html,html2html
6318 !! wikitext
6319 {|
6320 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6321 !! html/php
6322 <table>
6323 <tr>
6324 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6325 <td>]" onmouseover="alert(document.cookie)"&gt;test
6326 </td>
6327 </tr>
6328 </table>
6329
6330 !! html/parsoid
6331 <table><tbody>
6332 <tr>
6333 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6334 !! end
6335
6336 !! test
6337 Element attributes with double ! should not be broken up by <th>
6338 !! wikitext
6339 {|
6340 ! hi <div class="!!">ha</div> ho
6341 |}
6342 !! html/php
6343 <table>
6344 <tr>
6345 <th> hi <div class="!!">ha</div> ho
6346 </th></tr></table>
6347
6348 !! html/parsoid
6349 <table>
6350 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6351 </tbody></table>
6352 !! end
6353
6354 !! test
6355 ! and || in element attributes should not be parsed as <th>/<td>
6356 !! wikitext
6357 {|
6358 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6359 |}
6360 !! html/php
6361 <table>
6362 <tr>
6363 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6364 </td></tr></table>
6365
6366 !! html/parsoid
6367 <table>
6368 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6369 </tbody></table>
6370 !! end
6371
6372 # FIXME: The output seems broken. Filed as T110268.
6373 !! test
6374 ! and || in td attributes should not be parsed as <th>/<td>
6375 !! options
6376 parsoid=wt2html
6377 !! wikitext
6378 {|
6379 | style="color: red !important;" data-contrived="put this here ||" | foo
6380 |}
6381 !! html/php
6382 <table>
6383 <tr>
6384 <td> style="color: red !important;" data-contrived="put this here </td>
6385 <td> foo
6386 </td></tr></table>
6387
6388 !! html/parsoid
6389 <table>
6390 <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>
6391 </tbody></table>
6392 !! end
6393
6394 !! test
6395 Break on | in element attribute in template
6396 !! options
6397 parsoid=wt2html,html2html
6398 !! wikitext
6399 {{echo|1=<div class="hi|ho">ha</div>}}
6400 !! html/php
6401 <p>ho"&gt;ha&lt;/div&gt;
6402 </p>
6403 !! html/parsoid
6404 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6405 !! end
6406
6407 !! test
6408 Indented table markup mixed with indented pre content (proposed in bug 6200)
6409 !! wikitext
6410 <table>
6411 <tr>
6412 <td>
6413 Text that should be rendered preformatted
6414 </td>
6415 </tr>
6416 </table>
6417 !! html
6418 <table>
6419 <tr>
6420 <td>
6421 <pre>Text that should be rendered preformatted
6422 </pre>
6423 </td>
6424 </tr>
6425 </table>
6426
6427 !! end
6428
6429 !! test
6430 1. Template-generated table cell attributes and cell content
6431 !! wikitext
6432 {|
6433 |{{table_attribs}}
6434 | {{table_attribs}}
6435 || {{table_attribs_5}}
6436 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6437 |align=center {{table_attribs}}
6438 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6439 |}
6440 !! html
6441 <table>
6442 <tr>
6443 <td style="color:red;">Foo
6444 </td>
6445 <td style="color:red;">Foo
6446 </td>
6447 <td> style="color:red;"</td>
6448 <td>Bar
6449 </td>
6450 <td style="color:red;">Foo
6451 </td>
6452 <td align="center" style="color:red;">Foo
6453 </td>
6454 <td align="center" style="color:red;">Foo
6455 </td></tr></table>
6456
6457 !! end
6458
6459 !! test
6460 2. Template-generated table cell attributes and cell content
6461 !! wikitext
6462 {|
6463 |{{table_attribs_2}}
6464 |}
6465 !! html/php
6466 <table>
6467 <tr>
6468 <td style="color:red;">Foo
6469 </td>
6470 <td>Bar</td>
6471 <td>Baz
6472 </td></tr></table>
6473
6474 !! html/parsoid
6475 <table>
6476 <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>
6477 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6478 </tbody></table>
6479 !! end
6480
6481 !! test
6482 3. Template-generated table cell attributes and cell content
6483 !! wikitext
6484 {|
6485 !align=center {{table_header_cells}}
6486 |-
6487 |align=center {{table_cells}}
6488 |}
6489 !! html/php
6490 <table>
6491 <tr>
6492 <th align="center" style="color:red;">Foo</th>
6493 <th style="color:red;"><i>Bar</i></th>
6494 <th style="color:brown;"><i>Foo</i> and Baz
6495 </th></tr>
6496 <tr>
6497 <td align="center" style="color:red;">Foo</td>
6498 <td style="color:red;"><i>Bar</i></td>
6499 <td style="color:brown;"><i>Foo</i> and Baz
6500 </td></tr></table>
6501
6502 !! html/parsoid
6503 <table>
6504 <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>
6505 <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>
6506 </tbody></table>
6507 !! end
6508
6509 !! test
6510 4. Template-generated table cell attributes and cell content inside a templated table
6511 !! wikitext
6512 {{tbl-start}}
6513 !align=center {{table_header_cells}}
6514 |-
6515 |align=center {{table_cells}}
6516 {{tbl-end}}
6517 !! html/php
6518 <table>
6519 <tr>
6520 <th align="center" style="color:red;">Foo</th>
6521 <th style="color:red;"><i>Bar</i></th>
6522 <th style="color:brown;"><i>Foo</i> and Baz
6523 </th></tr>
6524 <tr>
6525 <td align="center" style="color:red;">Foo</td>
6526 <td style="color:red;"><i>Bar</i></td>
6527 <td style="color:brown;"><i>Foo</i> and Baz
6528 </td></tr></table>
6529
6530 !! html/parsoid
6531 <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}}]}'>
6532 <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>
6533 <tr>
6534 <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>
6535 </tbody></table>
6536 !! end
6537
6538 ## Edge case fix to prevent future regressions
6539 !! test
6540 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6541 !! wikitext
6542 {|
6543 |{{table_attribs_7}}
6544 |}
6545 <references />
6546 !! html/parsoid
6547 <table>
6548 <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>
6549 </tbody></table>
6550 <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>
6551 !! end
6552
6553 !! test
6554 Table with row followed by newlines and table heading
6555 !! wikitext
6556 {|
6557 |-
6558
6559 ! foo
6560 |}
6561 !! html
6562 <table>
6563
6564
6565 <tr>
6566 <th> foo
6567 </th></tr></table>
6568
6569 !! end
6570
6571 !! test
6572 Table with empty line following the start tag
6573 !! wikitext
6574 {|
6575
6576 |-
6577 | foo
6578 |}
6579 !! html
6580 <table>
6581
6582
6583 <tr>
6584 <td> foo
6585 </td></tr></table>
6586
6587 !! end
6588
6589 !! test
6590 Table attributes with empty value
6591 !! options
6592 parsoid=wt2html,html2html
6593 !! wikitext
6594 {|
6595 | style=| hello
6596 |}
6597 !! html/php
6598 <table>
6599 <tr>
6600 <td style=""> hello
6601 </td></tr></table>
6602
6603 !! html/parsoid
6604 <table>
6605 <tbody><tr><td style=""> hello</td></tr>
6606 </tbody></table>
6607 !! end
6608
6609 !! test
6610 Wikitext table with a lot of comments
6611 !! wikitext
6612 {|
6613 <!-- c0 -->
6614 | foo
6615 <!-- c1 -->
6616 |-<!-- c2 -->
6617 <!-- c3 -->
6618 |<!-- c4 -->
6619 <!-- c5 -->
6620 |}
6621 !! html
6622 <table>
6623 <tr>
6624 <td> foo
6625 </td></tr>
6626 <tr>
6627 <td>
6628 </td></tr></table>
6629
6630 !! end
6631
6632 !! test
6633 Wikitext table comments represented in parsoid dom
6634 !! wikitext
6635 {|<!--c1--><!--c2-->
6636 |-<!--c3-->
6637 | x
6638 |}
6639 !! html/php+tidy
6640 <table>
6641 <tr>
6642 <td>x</td>
6643 </tr>
6644 </table>
6645 !! html/parsoid
6646 <table><!--c1--><!--c2-->
6647 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6648 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6649 </tbody></table>
6650 !! end
6651
6652 !! test
6653 Wikitext table with double-line table cell
6654 !! wikitext
6655 {|
6656 |a
6657 b
6658 |}
6659 !! html
6660 <table>
6661 <tr>
6662 <td>a
6663 <p>b
6664 </p>
6665 </td></tr></table>
6666
6667 !! end
6668
6669 !! test
6670 Table cell with a single comment
6671 !! wikitext
6672 {|
6673 | <!-- c1 -->
6674 | a
6675 |}
6676 !! html
6677 <table>
6678 <tr>
6679 <td>
6680 </td>
6681 <td> a
6682 </td></tr></table>
6683
6684 !! end
6685
6686 !! test
6687 Table-cell after a comment-only-empty-line
6688 !! wikitext
6689 {|
6690 |a
6691 <!--c1-->
6692 <!--c2-->| b
6693 |}
6694 !! html
6695 <table>
6696 <tr>
6697 <td>a
6698 </td>
6699 <td> b
6700 </td></tr></table>
6701
6702 !! html/parsoid
6703 <table>
6704 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6705 <!--c1-->
6706 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6707 </tbody></table>
6708
6709 !! end
6710
6711 !! test
6712 Build table with {{!}}
6713 !! wikitext
6714 {{{!}} class="wikitable"
6715 ! header
6716 ! second header
6717 {{!}}- style="color:red;"
6718 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6719 {{!}}}
6720 !! html
6721 <table class="wikitable">
6722 <tr>
6723 <th> header
6724 </th>
6725 <th> second header
6726 </th></tr>
6727 <tr style="color:red;">
6728 <td> data </td>
6729 <td style="color:red;"> second data
6730 </td></tr></table>
6731
6732 !! end
6733
6734 !! test
6735 Build table with pipe as data
6736 !! wikitext
6737 {| class="wikitable"
6738 ! header
6739 ! second header
6740 |- style="color:red;"
6741 | data || style="color:red;" | second data
6742 |-
6743 | style="color:red;" | data with | || style="color:red;" | second data with |
6744 |-
6745 || data with | ||| second data with |
6746 |}
6747 !! html
6748 <table class="wikitable">
6749 <tr>
6750 <th> header
6751 </th>
6752 <th> second header
6753 </th></tr>
6754 <tr style="color:red;">
6755 <td> data </td>
6756 <td style="color:red;"> second data
6757 </td></tr>
6758 <tr>
6759 <td style="color:red;"> data with | </td>
6760 <td style="color:red;"> second data with |
6761 </td></tr>
6762 <tr>
6763 <td> data with | </td>
6764 <td> second data with |
6765 </td></tr></table>
6766
6767 !! end
6768
6769 !! test
6770 Build table with wikilink
6771 !! wikitext
6772 {| class="wikitable"
6773 ! header || second header
6774 |- style="color:red;"
6775 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6776 |-
6777 | data || second data [[Main Page|link|text with pipe]]
6778 |}
6779 !! html
6780 <table class="wikitable">
6781 <tr>
6782 <th> header </th>
6783 <th> second header
6784 </th></tr>
6785 <tr style="color:red;">
6786 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6787 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6788 </td></tr>
6789 <tr>
6790 <td> data </td>
6791 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6792 </td></tr></table>
6793
6794 !! end
6795
6796 # The expected HTML structure in this test is debatable. The PHP parser does
6797 # not parse this kind of table at all. The main focus for Parsoid is on
6798 # round-tripping, so this output is ok for now. TODO: revisit!
6799 !! test
6800 Wikitext table with html-syntax row
6801 !! wikitext
6802 {|
6803 |-
6804 <td>foo</td>
6805 |}
6806 !! html/parsoid
6807 <table>
6808 <tbody>
6809 <tr>
6810 <td>foo</td></tr></tbody></table>
6811 !! end
6812
6813 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6814 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6815 ## PHP parser, which tidy then compounds by fostering the content
6816 ## entirely out of the table. Parsoid recognizes the table context
6817 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6818 ## depends on PHP's treatment of broken table markup!
6819 !! test
6820 Implicit <td> after a |-
6821 !! options
6822 parsoid=wt2html,html2html
6823 !! wikitext
6824 {|
6825 |-
6826 a
6827 |}
6828 !! html/php
6829 <table>
6830
6831 a
6832 </table>
6833
6834 !! html/php+tidy
6835 <p>a</p>
6836 !! html/parsoid
6837 <table>
6838 <tr><td>a</td></tr>
6839 </table>
6840 !! end
6841
6842 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6843 !! test
6844 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6845 !! options
6846 parsoid=wt2html,html2html
6847 !! wikitext
6848 {|
6849 |-
6850 |
6851 a
6852 |-
6853 b
6854 |}
6855 !! html/php
6856 <table>
6857
6858 <tr>
6859 <td>
6860 <pre>a
6861 </pre>
6862 </td></tr>
6863 b
6864 </table>
6865
6866 !! html/php+tidy
6867 <p>b</p>
6868 <table>
6869 <tr>
6870 <td>
6871 <pre>
6872 a
6873 </pre></td>
6874 </tr>
6875 </table>
6876 !! html/parsoid
6877 <table>
6878 <tbody>
6879 <tr><td><pre>a</pre></td></tr>
6880 <tr><td> b</td></tr>
6881 </tbody>
6882 </table>
6883 !! end
6884
6885 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6886 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6887 !! test
6888 Lists should be recognized in an implicit <td> context
6889 !! options
6890 parsoid=wt2html,html2html
6891 !! wikitext
6892 {|
6893 |-
6894 *a
6895 |}
6896 !! html/php
6897 <table>
6898
6899 <ul><li>a</li></ul>
6900 </table>
6901
6902 !! html/php+tidy
6903 <ul>
6904 <li>a</li>
6905 </ul>
6906 !! html/parsoid
6907 <table>
6908 <tr>
6909 <td><ul>
6910 <li>a</li>
6911 </ul></td>
6912 </tr>
6913 </table>
6914 !! end
6915
6916 !! test
6917 Table cells not properly parsed in an implicit-td context
6918 !! wikitext
6919 {|
6920 |-
6921 {{table_attribs_4}} || a || b
6922 |}
6923 !! html/php+tidy
6924 <table>
6925 <tr>
6926 <td style="background-color:#DC241f;" width="10px"></td>
6927 <td>a</td>
6928 <td>b</td>
6929 </tr>
6930 </table>
6931 !! html/parsoid
6932 <table>
6933 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6934 <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>
6935 </tbody></table>
6936 !! end
6937
6938 !! test
6939 Parsoid: Round-trip tables directly followed by content (bug 51219)
6940 !! options
6941 parsoid=wt2html,wt2wt
6942 !! wikitext
6943 {|
6944 |foo
6945 |} bar
6946
6947 {|
6948 |baz
6949 |}<b>quux</b>
6950 !! html+tidy
6951 <table>
6952 <tr>
6953 <td>foo</td>
6954 </tr>
6955 </table>
6956 <p>bar</p>
6957 <table>
6958 <tr>
6959 <td>baz</td>
6960 </tr>
6961 </table>
6962 <p><b>quux</b></p>
6963 !! end
6964
6965 !! test
6966 Parsoid: Default to a newline after tables in new content (bug 51219)
6967 !! options
6968 parsoid=html2wt
6969 !! html/parsoid
6970 <table><tbody>
6971 <tr><td>foo</td></tr></tbody></table> bar
6972 <table><tbody>
6973 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6974 !! wikitext
6975 {|
6976 |foo
6977 |}
6978 <nowiki> </nowiki>bar
6979 {|
6980 |baz
6981 |}
6982 '''quux'''
6983 !! end
6984
6985 !! test
6986 Parsoid: newline inducing block nodes don't suppress <nowiki>
6987 !! options
6988 parsoid=html2wt
6989 !! html/parsoid
6990 a<h1>foo</h1>
6991 !! wikitext
6992 <nowiki> </nowiki>a
6993
6994 = foo =
6995 !! end
6996
6997 !! test
6998 Parsoid: Row-syntax table headings followed by comment & table cells
6999 !! options
7000 parsoid=wt2html,wt2wt
7001 !! wikitext
7002 {|
7003 ! foo || bar
7004 <!-- foo --> || baz || quux
7005 |}
7006 !! html/php
7007 <table>
7008 <tr>
7009 <th> foo </th>
7010 <th> bar
7011 </th>
7012 <td> baz </td>
7013 <td> quux
7014 </td></tr></table>
7015
7016 !! html/parsoid
7017 <table>
7018 <tbody><tr><th> foo </th><th> bar
7019 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7020 </tbody></table>
7021 !! end
7022
7023 !!test
7024 Parsoid: Recover better from broken table attributes
7025 !!options
7026 parsoid=wt2html
7027 !!wikitext
7028 {| class="foo
7029 | class="bar" |
7030 foo
7031 |}
7032 !!html/php+tidy
7033 <table class="foo">
7034 <tr>
7035 <td class="bar">
7036 <p>foo</p>
7037 </td>
7038 </tr>
7039 </table>
7040 !!html/parsoid
7041 <table class="foo">
7042 <tr>
7043 <td class="bar">
7044 <p>foo</p></td></tr>
7045 </tbody></table>
7046 !!end
7047
7048 !! test
7049 Tables: Digest broken attributes on table and tr tag
7050 !! options
7051 parsoid=wt2html
7052 !! wikitext
7053 {| || |} ++
7054 |- || || ++ --
7055 |- > [
7056 |}
7057 !! html
7058 <table>
7059 <tbody>
7060 <tr></tr>
7061 <tr></tr>
7062 </tbody></table>
7063 !! end
7064
7065 !! test
7066 Strip unsupported table tags
7067 !! options
7068 parsoid=html2wt
7069 !! html/parsoid
7070 <table>
7071 <thead>
7072 <tr>
7073 <th>Month</th>
7074 <th>Savings</th>
7075 </tr>
7076 </thead>
7077 <tbody>
7078 <tr>
7079 <td>January</td>
7080 <td>$100</td>
7081 </tr>
7082 <tr>
7083 <td>February</td>
7084 <td>$80</td>
7085 </tr>
7086 </tbody>
7087 <tfoot>
7088 <tr>
7089 <td>Sum</td>
7090 <td>$180</td>
7091 </tr>
7092 </tfoot>
7093 </table>
7094 !! wikitext
7095 {|
7096
7097 !Month
7098 !Savings
7099
7100 |January
7101 |$100
7102
7103 |-
7104 |February
7105 |$80
7106
7107 |Sum
7108 |$180
7109
7110 |}
7111 !! end
7112
7113 !! test
7114 Testing serialization after deletion in references
7115 !! options
7116 parsoid={
7117 "modes": ["wt2wt"],
7118 "changes": [
7119 ["#x", "remove"]
7120 ]
7121 }
7122 !! wikitext
7123 hi <ref><div id="x">ho</div></ref>
7124
7125 <references />
7126 !! wikitext/edited
7127 hi <ref></ref>
7128
7129 <references />
7130 !! end
7131
7132 !!test
7133 Testing serialization after deletion of table cells
7134 !!options
7135 parsoid={
7136 "modes": ["wt2wt", "selser"],
7137 "changes": [
7138 ["#x", "remove"]
7139 ]
7140 }
7141 !!wikitext
7142 {|
7143 !h1 !!h2 !!h3
7144 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7145 |}
7146 !! wikitext/edited
7147 {|
7148 !h1 !!h2 !!h3
7149 |c2 |||c3
7150 |}
7151 !!end
7152
7153 ###
7154 ### Internal links
7155 ###
7156 !! test
7157 Plain link, capitalized
7158 !! wikitext
7159 [[Main Page]]
7160 !! html
7161 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7162 </p>
7163 !! end
7164
7165 !! test
7166 Plain link, uncapitalized
7167 !! wikitext
7168 [[main Page]]
7169 !! html
7170 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7171 </p>
7172 !! end
7173
7174 !! test
7175 Piped link
7176 !! wikitext
7177 [[Main Page|The Main Page]]
7178 !! html
7179 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7180 </p>
7181 !! end
7182
7183 !! test
7184 Piped link with comment in link text
7185 !! wikitext
7186 [[Main Page|The Main<!--front--> Page]]
7187 !! html
7188 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7189 </p>
7190 !! end
7191
7192 !! test
7193 Piped link with multiple pipe characters in link text
7194 !! wikitext
7195 [[Main Page||The|Main|Page|]]
7196 !! html/php
7197 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7198 </p>
7199 !! html/parsoid
7200 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7201 !! end
7202
7203 !! test
7204 Piped link with no link text
7205 !! wikitext
7206 [[Thomas Bek (bishop of St David's)|]]
7207 !! html/php
7208 <p>[[Thomas Bek (bishop of St David's)|]]
7209 </p>
7210 !! html/parsoid
7211 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7212 !! end
7213
7214 !! test
7215 Broken link
7216 !! wikitext
7217 [[Zigzagzogzagzig]]
7218 !! html
7219 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7220 </p>
7221 !! end
7222
7223 !! test
7224 Broken link with fragment
7225 !! wikitext
7226 [[Zigzagzogzagzig#zug]]
7227 !! html
7228 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7229 </p>
7230 !! end
7231
7232 !! test
7233 Special page link with fragment
7234 !! wikitext
7235 [[Special:Version#anchor]]
7236 !! html
7237 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7238 </p>
7239 !! end
7240
7241 !! test
7242 Nonexistent special page link with fragment
7243 !! wikitext
7244 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7245 !! html
7246 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7247 </p>
7248 !! end
7249
7250 !! test
7251 Link with prefix
7252 !! wikitext
7253 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7254 !! html
7255 <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>
7256 </p>
7257 !! end
7258
7259 !! test
7260 Link with suffix
7261 !! wikitext
7262 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7263 !! html
7264 <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>!!!
7265 </p>
7266 !! end
7267
7268 !! article
7269 prefixed article
7270 !! text
7271 Some text
7272 !! endarticle
7273
7274 !! test
7275 Bug 43661: Piped links with identical prefixes
7276 !! wikitext
7277 [[prefixed article|prefixed articles with spaces]]
7278
7279 [[prefixed article|prefixed articlesaoeu]]
7280
7281 [[Main Page|Main Page test]]
7282 !! html
7283 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7284 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7285 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7286 </p>
7287 !! end
7288
7289
7290 !! test
7291 Link with HTML entity in suffix / tail
7292 !! wikitext
7293 [[Main Page]]&quot;, [[Main Page]]&#97;
7294 !! html/php
7295 <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;
7296 </p>
7297 !! html/parsoid
7298 <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>
7299 !! end
7300
7301 !! test
7302 Link with 3 brackets
7303 !! wikitext
7304 [[[Main Page]]]
7305 Foo [[[Main Page]]]
7306 !! html
7307 <p>[[[Main Page]]]
7308 Foo [[[Main Page]]]
7309 </p>
7310 !! end
7311
7312 !! test
7313 Link with 4 brackets
7314 !! wikitext
7315 [[[[Main Page]]]]
7316 !! html
7317 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7318 </p>
7319 !! end
7320
7321 !! test
7322 Piped link with 3 brackets
7323 !! wikitext
7324 [[[main page|the main page]]]
7325 !! html
7326 <p>[[[main page|the main page]]]
7327 </p>
7328 !! end
7329
7330 !! test
7331 Piped link with extlink-like text
7332 !! wikitext
7333 [[Main Page|[bar]]]
7334 [[Main Page|This is a [bar]]]
7335 !! html/php
7336 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7337 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7338 </p>
7339 !! html/parsoid
7340 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7341 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7342 !! end
7343
7344 !! test
7345 Link with multiple pipes
7346 !! wikitext
7347 [[Main Page|The|Main|Page]]
7348 !! html
7349 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7350 </p>
7351 !! end
7352
7353 # Note that parsoid does not munge anchor text; all non-space
7354 # characters are valid in HTML5 ids.
7355 !! test
7356 Anchor containing a #. (bug 63430)
7357 !! wikitext
7358 [[Main Page#And#Link]]
7359 !! html/php
7360 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7361 </p>
7362 !! html/parsoid
7363 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7364 !! end
7365
7366 !! test
7367 Link to namespaces
7368 !! wikitext
7369 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7370 !! html
7371 <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>
7372 </p>
7373 !! end
7374
7375 !! test
7376 Link with space in namespace
7377 !! wikitext
7378 [[User talk:Foo bar]]
7379 !! html
7380 <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>
7381 </p>
7382 !! end
7383
7384 !! article
7385 MemoryAlpha:AlphaTest
7386 !! text
7387 This is an article in the MemoryAlpha namespace
7388 (which shadows the memoryalpha interwiki link).
7389 !! endarticle
7390
7391 !! test
7392 Namespace takes precedence over interwiki link (bug 51680)
7393 !! wikitext
7394 [[MemoryAlpha:AlphaTest]]
7395 !! html
7396 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7397 </p>
7398 !! end
7399
7400 # The previous test doesn't work correctly in html2*, due to not recognizing the
7401 # link as an internal one. This one checks for the correct behavior.
7402 !! test
7403 Link to namespace preferred over interwiki with correct rel attribute
7404 !! options
7405 parsoid=html2wt,html2html
7406 !! html/parsoid
7407 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7408 !! wikitext
7409 [[MemoryAlpha:AlphaTest]]
7410 !! end
7411
7412 !! test
7413 Piped link to namespace
7414 !! wikitext
7415 [[Meta:Disclaimers|The disclaimers]]
7416 !! html
7417 <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>
7418 </p>
7419 !! end
7420
7421 !! test
7422 Link containing }
7423 !! wikitext
7424 [[Usually caused by a typo (oops}]]
7425 !! html
7426 <p>[[Usually caused by a typo (oops}]]
7427 </p>
7428 !! end
7429
7430 !! article
7431 7% Solution
7432 !! text
7433 Just a test of an article title containing a percent.
7434 !! endarticle
7435
7436 !! test
7437 Link containing % (not as a hex sequence)
7438 !! wikitext
7439 [[7% Solution]]
7440 !! html/php
7441 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7442 </p>
7443 !! html/parsoid
7444 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7445 !! end
7446
7447 # note that the parsoid HTML is identical to the previous test output,
7448 # so the previous test ensures that the html2wt mode will generate the
7449 # "not as a hex sequence" wikitext.
7450 !! test
7451 Link containing % as a single hex sequence interpreted to char
7452 !! options
7453 parsoid=wt2wt,wt2html,html2html
7454 !! wikitext
7455 [[7%25 Solution]]
7456 !! html/php
7457 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7458 </p>
7459 !! html/parsoid
7460 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7461 !!end
7462
7463 !! test
7464 Link containing % as a double hex sequence interpreted to hex sequence
7465 !! wikitext
7466 [[7%2525 Solution]]
7467 !! html
7468 <p>[[7%2525 Solution]]
7469 </p>
7470 !!end
7471
7472 # note that parsoid does not munge anchor text; all non-space
7473 # characters are valid in HTML5 anchors.
7474 !! test
7475 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7476 Example for such a section: == < ==
7477 !! wikitext
7478 [[%23%3c]][[%23%3e]]
7479 !! html/php
7480 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7481 </p>
7482 !! html/parsoid
7483 <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>
7484 !! end
7485
7486 !! test
7487 Link containing "<#" and ">#" as a hex sequences
7488 !! wikitext
7489 [[%3c%23]][[%3e%23]]
7490 !! html
7491 <p>[[%3c%23]][[%3e%23]]
7492 </p>
7493 !! end
7494
7495 !! test
7496 Link containing an equals sign
7497 !! wikitext
7498 [[Special:BookSources/isbn=4-00-026157-6]]
7499 !! html/php
7500 <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>
7501 </p>
7502 !! html/parsoid
7503 <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>
7504 !! end
7505
7506 !! article
7507 Foo~bar
7508 !! text
7509 Just a test of an article title containing a tilde.
7510 !! endarticle
7511
7512 # note that links containing signatures, like [[Foo~~~~]], are
7513 # massaged by the pre-save transform (PST) and so the tildes are never
7514 # seen by the parser.
7515 !! test
7516 Link containing a tilde
7517 !! wikitext
7518 [[Foo~bar]]
7519 !! html/php
7520 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7521 </p>
7522 !! html/parsoid
7523 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7524 !! end
7525
7526 !! test
7527 Link containing double-single-quotes '' (bug 4598)
7528 !! wikitext
7529 [[Lista d''e paise d''o munno]]
7530 !! html/php
7531 <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>
7532 </p>
7533 !! html/parsoid
7534 <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>
7535 !! end
7536
7537 !! test
7538 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7539 !! wikitext
7540 Some [[Link|pretty ''italics'' and stuff]]!
7541 !! html/php
7542 <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>!
7543 </p>
7544 !! html/parsoid
7545 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7546 !! end
7547
7548 !! test
7549 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7550 !! wikitext
7551 ''Some [[Link|pretty ''italics'' and stuff]]!''
7552 !! html
7553 <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>
7554 </p>
7555 !! end
7556
7557 !! test
7558 Link with double quotes in title part (literal) and alternate part (interpreted)
7559 !! wikitext
7560 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7561
7562 [[''Pentecoste'']]
7563
7564 [[''Pentecoste''|Pentecoste]]
7565
7566 [[''Pentecoste''|''Pentecoste'']]
7567 !! html/php
7568 <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>
7569 </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>
7570 </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>
7571 </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>
7572 </p>
7573 !! html/parsoid
7574 <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>
7575 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7576 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7577 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7578 !! end
7579
7580 !! test
7581 Broken image links with HTML captions (bug 39700)
7582 !! wikitext
7583 [[File:Nonexistent|<script></script>]]
7584 [[File:Nonexistent|100x100px|<script></script>]]
7585 [[File:Nonexistent|&lt;]]
7586 [[File:Nonexistent|a<i>b</i>c]]
7587 !! html/php
7588 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7589 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7590 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7591 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7592 </p>
7593 !! html/parsoid
7594 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7595 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7596 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7597 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7598 !! end
7599
7600 !! test
7601 Plain link to URL
7602 !! wikitext
7603 [[http://www.example.com]]
7604 !! html/php
7605 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7606 </p>
7607 !! html/parsoid
7608 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7609 !! end
7610
7611 !! test
7612 Plain link to URL with link text
7613 !! wikitext
7614 [[http://www.example.com Link text]]
7615 !! html
7616 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7617 </p>
7618 !! end
7619
7620 !! test
7621 Plain link to protocol-relative URL
7622 !! wikitext
7623 [[//www.example.com]]
7624 !! html/php
7625 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7626 </p>
7627 !! html/parsoid
7628 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7629 !! end
7630
7631 !! test
7632 Plain link to protocol-relative URL with link text
7633 !! wikitext
7634 [[//www.example.com Link text]]
7635 !! html
7636 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7637 </p>
7638 !! end
7639
7640 !! test
7641 Plain link to page with question mark in title
7642 !! wikitext
7643 [[A?b]]
7644
7645 [[A?b|Baz]]
7646 !! html
7647 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7648 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7649 </p>
7650 !! end
7651
7652
7653 # I'm fairly sure the expected result here is wrong.
7654 # We want these to be URL links, not pseudo-pages with URLs for titles....
7655 # However the current output is also pretty screwy.
7656 #
7657 # ----
7658 # I'm changing it to match the current output--it arguably makes more
7659 # sense in the light of the test above. Old expected result was:
7660 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7661 #</p>
7662 # But I think this test is bordering on "garbage in, garbage out" anyway.
7663 # -- wtm
7664 !! test
7665 Piped link to URL
7666 !! wikitext
7667 Piped link to URL: [[http://www.example.com|an example URL]]
7668 !! html/php
7669 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7670 </p>
7671 !! html/parsoid
7672 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7673 !! end
7674
7675 !! test
7676 BUG 2: [[page|http://url/]] should link to page, not http://url/
7677 !! wikitext
7678 [[Main Page|http://url/]]
7679 !! html/php
7680 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7681 </p>
7682 !! html/parsoid
7683 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7684 !! end
7685
7686 # Parsoid does not mark self-links, by design.
7687 !! test
7688 BUG 337: Escaped self-links should be bold
7689 !! options
7690 title=[[Bug462]]
7691 !! wikitext
7692 [[Bu&#103;462]] [[Bug462]]
7693 !! html/php
7694 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7695 </p>
7696 !! html/php+tidy
7697 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7698 !! html/parsoid
7699 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7700 !! end
7701
7702 !! test
7703 Self-link to section should not be bold
7704 !! options
7705 title=[[Main Page]]
7706 !! wikitext
7707 [[Main Page#section]]
7708 !! html
7709 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7710 </p>
7711 !! end
7712
7713 !! article
7714 00
7715 !! text
7716 This is 00.
7717 !! endarticle
7718
7719 !!test
7720 Self-link to numeric title
7721 !!options
7722 title=[[0]]
7723 !! wikitext
7724 [[0]]
7725 !! html
7726 <p><strong class="selflink">0</strong>
7727 </p>
7728 !!end
7729
7730 !!test
7731 Link to numeric-equivalent title
7732 !!options
7733 title=[[0]]
7734 !! wikitext
7735 [[00]]
7736 !! html
7737 <p><a href="/wiki/00" title="00">00</a>
7738 </p>
7739 !!end
7740
7741 !! test
7742 <nowiki> inside a link
7743 !! wikitext
7744 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7745 !! html
7746 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7747 </p>
7748 !! end
7749
7750 !! test
7751 Non-breaking spaces in title
7752 !! wikitext
7753 [[&nbsp; Main &nbsp; Page &nbsp;]]
7754 !! html
7755 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7756 </p>
7757 !!end
7758
7759 !! test
7760 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7761 !! options
7762 language=ca
7763 !! wikitext
7764 '''[[Main Page]]'''
7765 !! html
7766 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7767 </p>
7768 !! end
7769
7770 !! test
7771 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7772 !! options
7773 language=ca
7774 !! wikitext
7775 ''[[Main Page]]''
7776 !! html
7777 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7778 </p>
7779 !! end
7780
7781 !! test
7782 Internal link with en linktrail: no apostrophes (bug 27473)
7783 !! options
7784 language=en
7785 !! wikitext
7786 [[Something]]'nice
7787 !! html
7788 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7789 </p>
7790 !! end
7791
7792 !! test
7793 Internal link with ca linktrail with apostrophes (bug 27473)
7794 !! options
7795 language=ca
7796 !! wikitext
7797 [[Something]]'nice
7798 !! html
7799 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7800 </p>
7801 !! end
7802
7803 !! test
7804 Internal link with kaa linktrail with apostrophes (bug 27473)
7805 !! options
7806 language=kaa
7807 !! wikitext
7808 [[Something]]'nice
7809 !! html
7810 <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>
7811 </p>
7812 !! end
7813
7814 !! test
7815 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7816 !! wikitext
7817 [[User:Foo/Test/63636:Bar|Test]]
7818 !! html/php
7819 <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>
7820 </p>
7821 !! html/parsoid
7822 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7823 !! end
7824
7825 !! test
7826 Purely hash wikilink
7827 !! options
7828 title=[[User:test/123]]
7829 !! wikitext
7830 [[#a|b]]
7831 !! html/php
7832 <p><a href="#a">b</a>
7833 </p>
7834 !! html/parsoid
7835 <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>
7836 !! end
7837
7838 !! test
7839 1. Interaction of linktrail and template encapsulation
7840 !! options
7841 parsoid
7842 !! wikitext
7843 {{echo|[[Foo]]}}l
7844 !! html
7845 <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>
7846 !! end
7847
7848 !! test
7849 2. Interaction of linktrail and template encapsulation
7850 !! options
7851 parsoid
7852 !! wikitext
7853 {{echo|Some [[Fool]]}}s
7854 !! html
7855 <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"}]]}'>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>
7856 !! end
7857
7858 !! test
7859 3. Interaction of linktrail and template encapsulation
7860 !! options
7861 parsoid
7862 !! wikitext
7863 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7864 !! html
7865 <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"}]]}'>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>
7866 !! end
7867
7868 !! article
7869 Söfnuður
7870 !! text
7871 Test.
7872 !! endarticle
7873
7874 !! test
7875 Internal link with is link prefix
7876 !! options
7877 language=is
7878 !! wikitext
7879 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7880 !! html
7881 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7882 </p>
7883 !! end
7884
7885 !! article
7886 Mótmælendatrú
7887 !! text
7888 Test.
7889 !! endarticle
7890
7891 !! test
7892 Internal link with is link trail and link prefix
7893 !! options
7894 language=is
7895 !! wikitext
7896 [[mótmælendatrú|xxx]]ar
7897 [[mótmælendatrú]]ar
7898 mótmælenda[[söfnuður]]
7899 mótmælenda[[söfnuður|söfnuðir]]
7900 mótmælenda[[söfnuður|söfnuðir]]xxx
7901 !! html
7902 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7903 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7904 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7905 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7906 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7907 </p>
7908 !! end
7909
7910 !! test
7911 Parsoid link trail escaping
7912 !! options
7913 parsoid=html2wt,html2html
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7916 !! wikitext
7917 [[apple]]<nowiki/>s
7918 !! end
7919
7920 !! test
7921 Parsoid link prefix escaping
7922 !! options
7923 language=is
7924 parsoid=html2wt,html2html
7925 !! html/parsoid
7926 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7927 !! wikitext
7928 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7929 !! end
7930
7931 !! test
7932 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7933 !! wikitext
7934 [[Foo| bar]]
7935
7936 [[Foo| ''bar'']]
7937
7938 [http://wp.org foo]
7939
7940 [http://wp.org ''foo'']
7941 !! html
7942 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7943 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7944 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7945 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7946 </p>
7947 !! end
7948
7949 !! test
7950 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7951 !! options
7952 parsoid
7953 !! wikitext
7954 [[Foo|{{echo|a}} b {{echo|c}}]]
7955 !! html
7956 <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>
7957 !! end
7958
7959 !! test
7960 Link with angle bracket after anchor
7961 !! wikitext
7962 [[Foo#<bar>]]
7963 !! html/php
7964 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7965 </p>
7966 !! html/parsoid
7967 <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>
7968 !! end
7969
7970 ###
7971 ### Interwiki links (see maintenance/interwiki.sql)
7972 ###
7973
7974 !! test
7975 Inline interwiki link
7976 !! options
7977 parsoid=wt2html,wt2wt,html2html
7978 !! wikitext
7979 [[MeatBall:SoftSecurity]]
7980 !! html/php
7981 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7982 </p>
7983 !! html/parsoid
7984 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7985 !! end
7986
7987 !! test
7988 Inline interwiki link with empty title (bug 2372)
7989 !! options
7990 parsoid=wt2html,wt2wt,html2html
7991 !! wikitext
7992 [[MeatBall:]]
7993 !! html/php
7994 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7995 </p>
7996 !! html/parsoid
7997 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7998 !! end
7999
8000 !! test
8001 Interwiki link encoding conversion (bug 1636)
8002 !! wikitext
8003 *[[Wikipedia:ro:Olteni&#0355;a]]
8004 *[[Wikipedia:ro:Olteni&#355;a]]
8005 !! html
8006 <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>
8007 <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>
8008
8009 !! html+tidy
8010 <ul>
8011 <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>
8012 <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>
8013 </ul>
8014 !! end
8015
8016 !! test
8017 Interwiki link with fragment (bug 2130)
8018 !! wikitext
8019 [[MeatBall:SoftSecurity#foo]]
8020 !! html
8021 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8022 </p>
8023 !! end
8024
8025 # Ideally the wikipedia: prefix here should be proto-relative too
8026 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8027 # define the 'en' prefix, and originally the test used 'wikipedia',
8028 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8029 # article.
8030 !! test
8031 Different interwiki prefixes mapping to the same URL
8032 !! wikitext
8033 [[:en:Foo]]
8034
8035 [[:en:Foo|Foo]]
8036
8037 [[wikipedia:Foo]]
8038
8039 [[:wikipedia:Foo|Foo]]
8040
8041 [[wikipedia:en:Foo]]
8042
8043 [[:wikipedia:en:Foo]]
8044
8045 [[ wikiPEdia :Foo]]
8046 !! html/parsoid
8047 <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>
8048
8049 <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>
8050
8051 <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>
8052
8053 <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>
8054
8055 <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>
8056
8057 <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>
8058
8059 <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>
8060 !! end
8061
8062 !! test
8063 Interwiki links that cannot be represented in wiki syntax
8064 !! wikitext
8065 [[meatball:ok]]
8066 [[meatball:ok#foo|ok with fragment]]
8067 [[meatball:ok_as_well?|ok ending with ? mark]]
8068 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8069 [http://de.wikipedia.org/wiki/#foo is just fragment]
8070
8071 !! html/php
8072 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8073 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8074 <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>
8075 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8076 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8077 </p>
8078 !! html/parsoid
8079 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8080 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8081 <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>
8082 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8083 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8084 !! end
8085
8086 !! test
8087 Interwiki links: trail
8088 !! wikitext
8089 [[wikipedia:Foo|Ba]]r
8090 !! html/php
8091 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8092 </p>
8093 !! html/parsoid
8094 <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>
8095 !! end
8096
8097 !! test
8098 Local interwiki link
8099 !! options
8100 parsoid=wt2html,wt2wt,html2html
8101 !! wikitext
8102 [[local:Template:Foo]]
8103 !! html/php
8104 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8105 </p>
8106 !! html/parsoid
8107 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8108 !! end
8109
8110 # Parsoid does not mark self-links, by design.
8111 !! test
8112 Local interwiki link: self-link to current page
8113 !! options
8114 title=[[Main Page]]
8115 parsoid=wt2html,wt2wt,html2html
8116 !! wikitext
8117 [[local:Main Page]]
8118 !! html/php
8119 <p><strong class="selflink">local:Main Page</strong>
8120 </p>
8121 !! html/parsoid
8122 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8123 !! end
8124
8125 !! test
8126 Local interwiki link: prefix only (bug 64167)
8127 !! options
8128 parsoid=wt2html,wt2wt,html2html
8129 !! wikitext
8130 [[local:]]
8131 !! html/php
8132 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8133 </p>
8134 !! html/parsoid
8135 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8136 !! end
8137
8138 !! test
8139 Local interwiki link: with additional interwiki prefix (bug 61357)
8140 !! options
8141 parsoid=wt2html,wt2wt,html2html
8142 !! wikitext
8143 [[local:meatball:Hello]]
8144 !! html/php
8145 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8146 </p>
8147 !! html/parsoid
8148 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8149 !! end
8150
8151 !! test
8152 Multiple local interwiki link prefixes
8153 !! wikitext
8154 [[local:local:local:local:mi:local:Foo]]
8155 !! options
8156 parsoid=wt2html,wt2wt,html2html
8157 !! html/php
8158 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8159 </p>
8160 !! html/parsoid
8161 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8162 !! end
8163
8164 ###
8165 ### Interlanguage links
8166 ### Language links (so that searching for '### language' matches..)
8167 ###
8168
8169 !! test
8170 Interlanguage link
8171 !! options
8172 parsoid=wt2html,wt2wt,html2html
8173 !! wikitext
8174 Blah blah blah
8175 [[zh:Chinese]]
8176 !! html/php
8177 <p>Blah blah blah
8178 </p>
8179 !! html/parsoid
8180 <p>Blah blah blah</p>
8181 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8182 !! end
8183
8184 !! test
8185 Interlanguage link with spacing
8186 !! options
8187 parsoid=wt2html,wt2wt,html2html
8188 !! wikitext
8189 Blah blah blah
8190 [[ zh : Chinese ]]
8191 !! html/php
8192 <p>Blah blah blah
8193 </p>
8194 !! html/parsoid
8195 <p>Blah blah blah</p>
8196 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8197 !! end
8198
8199 !! test
8200 Double interlanguage link
8201 !! options
8202 parsoid=wt2html,wt2wt,html2html
8203 !! wikitext
8204 Blah blah blah
8205 [[es:Spanish]]
8206 [[zh:Chinese]]
8207 !! html/php
8208 <p>Blah blah blah
8209 </p>
8210 !! html/parsoid
8211 <p>Blah blah blah</p>
8212 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8213 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8214 !! end
8215
8216 !! test
8217 Interlanguage link variations
8218 !! options
8219 parsoid=wt2html,wt2wt,html2html
8220 !! wikitext
8221 Blah blah blah
8222 [[ es :Spanish]]
8223 [[ ZH :Chinese]]
8224 [[es:Foo_bar]]
8225 !! html/php
8226 <p>Blah blah blah
8227 </p>
8228 !! html/parsoid
8229 <p>Blah blah blah</p>
8230 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8231 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8232 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8233 !! end
8234
8235 !! test
8236 Space and question mark encoding in interlanguage links (T95473)
8237 !! options
8238 parsoid=wt2html,wt2wt,html2html
8239 !! wikitext
8240 Blah blah blah
8241 [[es:Foo bar?]]
8242 !! html/php
8243 <p>Blah blah blah
8244 </p>
8245 !! html/parsoid
8246 <p>Blah blah blah</p>
8247 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8248 !! end
8249
8250 !! test
8251 Interlanguage link, with prefix links
8252 !! options
8253 language=ln
8254 !! wikitext
8255 Blah blah blah
8256 [[zh:Chinese]]
8257 !! html/php
8258 <p>Blah blah blah
8259 </p>
8260 !! html/parsoid
8261 <p>Blah blah blah</p>
8262 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8263 !! end
8264
8265 !! test
8266 Double interlanguage link, with prefix links (bug 8897)
8267 !! options
8268 language=ln
8269 !! wikitext
8270 Blah blah blah
8271 [[es:Spanish]]
8272 [[zh:Chinese]]
8273 !! html/php
8274 <p>Blah blah blah
8275 </p>
8276 !! html/parsoid
8277 <p>Blah blah blah</p>
8278 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8279 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8280 !! end
8281
8282 !! test
8283 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8284 !! wikitext
8285 Blah blah blah
8286 [[mul:Article]]
8287 !! html/php
8288 <p>Blah blah blah
8289 </p>
8290 !! html/parsoid
8291 <p>Blah blah blah</p>
8292 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8293 !! end
8294
8295 !! test
8296 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8297 !! options
8298 language=ln
8299 !! wikitext
8300 [[WW&nbsp;II]]
8301 !! html
8302 <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>
8303 </p>
8304 !! end
8305
8306 !! test
8307 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8308 !! options
8309 parsoid=html2wt
8310 !! html/parsoid
8311 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8312 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8313 !! wikitext
8314 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8315
8316 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8317 !! end
8318
8319 !! test
8320 Parsoid: handle constructor well
8321 !! wikitext
8322 [[constructor]]
8323
8324 [[constructor:foo]]
8325 !! html/php
8326 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8327 </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>
8328 </p>
8329 !! html/parsoid
8330 <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>
8331
8332 <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>
8333 !! end
8334
8335 !! article
8336 ko:
8337 !! text
8338 Test.
8339 !! endarticle
8340
8341 # Note that `ko` isn't a known interlanguage prefix
8342 !! test
8343 Parsoid: recognize interlanguage links without a target page
8344 !! options
8345 ill
8346 !! wikitext
8347 [[es:]]
8348
8349 [[ko:]]
8350 !! html/php
8351 es:
8352 !! html/parsoid
8353 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8354
8355 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8356 !! end
8357
8358 # Note that `ko` isn't a known interwiki prefix
8359 !! test
8360 Parsoid: recognize interwiki links without a target page
8361 !! options
8362 parsoid=wt2html,wt2wt,html2html
8363 !! wikitext
8364 [[:es:]]
8365
8366 [[:ko:]]
8367 !! html/php
8368 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8369 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8370 </p>
8371 !! html/parsoid
8372 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8373 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8374 !! end
8375
8376 !! test
8377 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8378 !! wikitext
8379 [[mi:Foo]]
8380 !! html/php
8381 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8382 </p>
8383 !! html/parsoid
8384 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8385 !! end
8386
8387 !! test
8388 Interlanguage link with preceding local interwiki link (bug 68085)
8389 !! options
8390 parsoid=wt2html,wt2wt,html2html
8391 !! wikitext
8392 Blah blah blah
8393 [[local:es:Spanish]]
8394 !! html/php
8395 <p>Blah blah blah
8396 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8397 </p>
8398 !! html/parsoid
8399 <p>Blah blah blah
8400 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8401 !! end
8402
8403 !! test
8404 Looks like an interlanguage link, but is actually a local interwiki
8405 !! options
8406 parsoid=wt2html,wt2wt,html2html
8407 !! wikitext
8408 Blah blah blah
8409 [[mi:Template:Foo]]
8410 !! html/php
8411 <p>Blah blah blah
8412 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8413 </p>
8414 !! html/parsoid
8415 <p>Blah blah blah
8416 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8417 !! end
8418
8419 ###
8420 ### Redirects, Parsoid-only
8421 ###
8422
8423 !! test
8424 1. Simple redirect to page
8425 !! wikitext
8426 #REDIRECT [[Main Page]]
8427 !! html/parsoid
8428 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8429 !! end
8430
8431 !! test
8432 2. Other redirect variants
8433 !! wikitext
8434 #REDIRECT [[Main_Page]]
8435 !! html/parsoid
8436 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8437 !! end
8438
8439 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8440 # This tests the Parsoid bail-out code.
8441 !! test
8442 3. Other redirect variants
8443 !! wikitext
8444 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8445 !! html/parsoid
8446 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8447 !! end
8448
8449 !! test
8450 4. Redirect to a templated destination
8451 !! wikitext
8452 #REDIRECT [[{{echo|Foo}}bar]]
8453 !! html/parsoid
8454 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8455 !! end
8456
8457 !! test
8458 Empty redirect
8459 !! options
8460 parsoid=wt2html,wt2wt
8461 !! wikitext
8462 #REDIRECT [[]]
8463 !! html/parsoid
8464 <ol>
8465 <li>REDIRECT [[]]</li></ol>
8466 !! end
8467
8468 !! test
8469 Optional colon in #REDIRECT
8470 !! options
8471 # the colon is archaic syntax. we support it for wt2html, but we
8472 # don't care that it roundtrips back to the modern syntax.
8473 parsoid=wt2html,html2html
8474 !! wikitext
8475 #REDIRECT:[[Main Page]]
8476 !! html/parsoid
8477 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8478 !! end
8479
8480 !! test
8481 Whitespace in #REDIRECT with optional colon
8482 !! options
8483 # the colon and gratuitous whitespace is archaic syntax. we support
8484 # it for wt2html, but we don't care that it roundtrips back to the
8485 # modern syntax (without extra whitespace)
8486 parsoid=wt2html,html2html
8487 !! wikitext
8488
8489 #REDIRECT
8490 :
8491 [[Main Page]]
8492 !! html/parsoid
8493 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8494 !! end
8495
8496 !! test
8497 Piped link in #REDIRECT
8498 !! options
8499 # content after piped link is ignored. we support this syntax,
8500 # but don't care that the piped link is lost when we roundtrip this.
8501 parsoid=wt2html
8502 !! wikitext
8503 #REDIRECT [[Main Page|bar]]
8504 !! html/parsoid
8505 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8506 !! end
8507
8508 !! test
8509 Redirect to category (T104502)
8510 !! options
8511 parsoid=wt2html,wt2wt
8512 !! wikitext
8513 #REDIRECT [[Category:Foo]]
8514 !! html/parsoid
8515 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8516 !! end
8517
8518 !! test
8519 Redirect to category with URL encoding (T104502)
8520 !! options
8521 parsoid=wt2html
8522 !! wikitext
8523 #REDIRECT [[Category%3AFoo]]
8524 !! html/parsoid
8525 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8526 !! end
8527
8528 !! test
8529 Redirect to category page
8530 !! wikitext
8531 #REDIRECT [[:Category:Foo]]
8532 !! html/parsoid
8533 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8534 !! end
8535
8536 !! test
8537 Redirect to image page (1)
8538 !! wikitext
8539 #REDIRECT [[File:Wiki.png]]
8540 !! html/parsoid
8541 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8542 !! end
8543
8544 !! test
8545 Redirect to image page (2)
8546 !! wikitext
8547 #REDIRECT [[Image:Wiki.png]]
8548 !! html/parsoid
8549 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8550 !! end
8551
8552 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8553 # Next test confirms this.
8554 !! test
8555 Redirect to language (1) (T104918)
8556 !! options
8557 parsoid=wt2html,wt2wt,html2html
8558 !! wikitext
8559 #REDIRECT [[en:File:Wiki.png]]
8560 !! html/parsoid
8561 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8562 !! end
8563
8564 !! test
8565 Redirect to language (2) (T104918)
8566 !! wikitext
8567 #REDIRECT [[:en:File:Wiki.png]]
8568 !! html/parsoid
8569 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8570 !! end
8571
8572 !! test
8573 Redirect to interwiki (T104918)
8574 !! wikitext
8575 #REDIRECT [[meatball:File:Wiki.png]]
8576 !! html/parsoid
8577 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8578 !! end
8579
8580 !! test
8581 Non-English #REDIRECT
8582 !! options
8583 language=is
8584 !! wikitext
8585 #TILVÍSUN [[Main Page]]
8586 !! html/parsoid
8587 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8588 !! end
8589
8590 !! test
8591 Redirect syntax under text isn't considered a redirect
8592 !! wikitext
8593 some text
8594 #redirect [[Main Page]]
8595 !! html/parsoid
8596 <p>some text</p>
8597 <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>
8598 !! end
8599
8600 # FIXME: Should hoist the redirect to the top of the page and ensure there
8601 # is only one.
8602 !! test
8603 New redirect
8604 !! options
8605 parsoid=html2wt
8606 !! html/parsoid
8607 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8608 !! wikitext
8609 Foo
8610 #REDIRECT [[Foo]]
8611 !! end
8612
8613 ##
8614 ## XHTML tidiness
8615 ###
8616
8617 !! test
8618 <br> to <br />
8619 !! wikitext
8620 1<br>2<br />3
8621 !! html
8622 <p>1<br />2<br />3
8623 </p>
8624 !! end
8625
8626 !! test
8627 Broken br tag sanitization
8628 !! wikitext
8629 </br>
8630 !! html/php
8631 <p>&lt;/br&gt;
8632 </p>
8633 !! end
8634
8635 # TODO: Fix html2html mode (bug 51055)!
8636 !! test
8637 Parsoid: Broken br tag recognition
8638 !! options
8639 parsoid=wt2html
8640 !! wikitext
8641 </br>
8642
8643 <br/ >
8644 !! html+tidy
8645 <p><br /></p>
8646 <p><br /></p>
8647 !! end
8648
8649 !! test
8650 Incorrecly removing closing slashes from correctly formed XHTML
8651 !! wikitext
8652 <br style="clear:both;" />
8653 !! html
8654 <p><br style="clear:both;" />
8655 </p>
8656 !! end
8657
8658 !! test
8659 Failing to transform badly formed HTML into correct XHTML
8660 !! wikitext
8661 <br style="clear: left;">
8662 <br style="clear: right;">
8663 <br style="clear: both;">
8664 !! html
8665 <p><br style="clear: left;" />
8666 <br style="clear: right;" />
8667 <br style="clear: both;" />
8668 </p>
8669 !!end
8670
8671 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8672 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8673 !! test
8674 Handling html with a div self-closing tag
8675 !! wikitext
8676 <div title />
8677 <div title/>
8678 <div title/ >
8679 <div title=bar />
8680 <div title=bar/>
8681 <div title=bar/ >
8682 !! html/php
8683 <p>&lt;div title /&gt;
8684 &lt;div title/&gt;
8685 </p>
8686 <div>
8687 <p>&lt;div title=bar /&gt;
8688 &lt;div title=bar/&gt;
8689 </p>
8690 <div title="bar/"></div>
8691 </div>
8692
8693 !! html/parsoid
8694 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8695 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8696 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8697 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8698 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8699 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8700 !! end
8701
8702 !! test
8703 Handling html with a br self-closing tag
8704 !! wikitext
8705 <br title />
8706 <br title/>
8707 <br title/ >
8708 <br title=bar />
8709 <br title=bar/>
8710 <br title=bar/ >
8711 !! html/php
8712 <p><br title="" />
8713 <br title="" />
8714 <br />
8715 <br title="bar" />
8716 <br title="bar" />
8717 <br title="bar/" />
8718 </p>
8719 !! html/parsoid
8720 <p><br title="" />
8721 <br title="" />
8722 <br title="" />
8723 <br title="bar" />
8724 <br title="bar" />
8725 <br title="bar/" />
8726 </p>
8727 !! end
8728
8729 !! test
8730 Horizontal ruler (should it add that extra space?)
8731 !! wikitext
8732 <hr>
8733 <hr >
8734 foo <hr
8735 > bar
8736 !! html+tidy
8737 <hr />
8738 <hr />
8739 <p>foo</p>
8740 <hr />
8741 <p>bar</p>
8742 !! end
8743
8744 !! test
8745 Horizontal ruler -- 4+ dashes render hr
8746 !! wikitext
8747 ----
8748 !! html
8749 <hr />
8750
8751 !! end
8752
8753 !! test
8754 Horizontal ruler -- eats additional dashes on the same line
8755 !! wikitext
8756 ---------
8757 !! html
8758 <hr />
8759
8760 !! end
8761
8762 !! test
8763 Horizontal ruler -- does not collapse dashes on consecutive lines
8764 !! wikitext
8765 ----
8766 ----
8767 !! html
8768 <hr />
8769 <hr />
8770
8771 !! end
8772
8773 !! test
8774 Horizontal ruler -- <4 dashes render as plain text
8775 !! wikitext
8776 ---
8777 !! html
8778 <p>---
8779 </p>
8780 !! end
8781
8782 !! test
8783 Horizontal ruler -- Supports content following dashes on same line
8784 !! wikitext
8785 ---- Foo
8786 !! html
8787 <hr /> Foo
8788
8789 !! html+tidy
8790 <hr />
8791 <p>Foo</p>
8792 !! end
8793
8794 ###
8795 ### Block-level elements
8796 ###
8797 !! test
8798 Common list
8799 !! wikitext
8800 *Common list
8801 * item 2
8802 *item 3
8803 !! html
8804 <ul><li>Common list</li>
8805 <li> item 2</li>
8806 <li>item 3</li></ul>
8807
8808 !! end
8809
8810 !! test
8811 Numbered list
8812 !! wikitext
8813 #Numbered list
8814 #item 2
8815 # item 3
8816 !! html
8817 <ol><li>Numbered list</li>
8818 <li>item 2</li>
8819 <li> item 3</li></ol>
8820
8821 !! end
8822
8823 !! test
8824 Mixed list
8825 !! wikitext
8826 *Mixed list
8827 *# with numbers
8828 ** and bullets
8829 *# and numbers
8830 *bullets again
8831 **bullet level 2
8832 ***bullet level 3
8833 ***#Number on level 4
8834 **bullet level 2
8835 **#Number on level 3
8836 **#Number on level 3
8837 *#number level 2
8838 *Level 1
8839 *** Level 3
8840 #** Level 3, but ordered
8841 !! html
8842 <ul><li>Mixed list
8843 <ol><li> with numbers</li></ol>
8844 <ul><li> and bullets</li></ul>
8845 <ol><li> and numbers</li></ol></li>
8846 <li>bullets again
8847 <ul><li>bullet level 2
8848 <ul><li>bullet level 3
8849 <ol><li>Number on level 4</li></ol></li></ul></li>
8850 <li>bullet level 2
8851 <ol><li>Number on level 3</li>
8852 <li>Number on level 3</li></ol></li></ul>
8853 <ol><li>number level 2</li></ol></li>
8854 <li>Level 1
8855 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8856 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8857
8858 !! end
8859
8860 !! test
8861 1. Nested mixed wikitext and html list
8862 !! wikitext
8863 * hi
8864 * <ul><li>ho</li></ul>
8865 * hi
8866 ** ho
8867 !! html/php
8868 <ul><li> hi</li>
8869 <li> <ul><li>ho</li></ul></li>
8870 <li> hi
8871 <ul><li> ho</li></ul></li></ul>
8872
8873 !! html/parsoid
8874 <ul><li> hi</li>
8875 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8876 <li> hi
8877 <ul><li> ho</li></ul></li></ul>
8878 !! end
8879
8880 !! test
8881 2. Nested mixed wikitext and html list (incompatible)
8882 !! wikitext
8883 ; hi
8884 : {{echo|<li>ho</li>}}
8885 !! html/php
8886 <dl><dt> hi</dt>
8887 <dd> <li>ho</li></dd></dl>
8888
8889 !! html/parsoid
8890 <dl><dt> hi</dt>
8891 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
8892 !! end
8893
8894 !! test
8895 Nested lists 1
8896 !! wikitext
8897 *foo
8898 **bar
8899 !! html
8900 <ul><li>foo
8901 <ul><li>bar</li></ul></li></ul>
8902
8903 !! end
8904
8905 !! test
8906 Nested lists 2
8907 !! wikitext
8908 **foo
8909 *bar
8910 !! html
8911 <ul><li><ul><li>foo</li></ul></li>
8912 <li>bar</li></ul>
8913
8914 !! end
8915
8916 !! test
8917 Nested lists 3 (first element empty)
8918 !! wikitext
8919 *
8920 **bar
8921 !! html
8922 <ul><li>
8923 <ul><li>bar</li></ul></li></ul>
8924
8925 !! end
8926
8927 !! test
8928 Nested lists 4 (first element empty)
8929 !! wikitext
8930 **
8931 *bar
8932 !! html
8933 <ul><li><ul><li></li></ul></li>
8934 <li>bar</li></ul>
8935
8936 !! end
8937
8938 !! test
8939 Nested lists 5 (both elements empty)
8940 !! wikitext
8941 **
8942 *
8943 !! html
8944 <ul><li><ul><li></li></ul></li>
8945 <li></li></ul>
8946
8947 !! end
8948
8949 !! test
8950 Nested lists 6 (both elements empty)
8951 !! wikitext
8952 *
8953 **
8954 !! html
8955 <ul><li>
8956 <ul><li></li></ul></li></ul>
8957
8958 !! end
8959
8960 !! test
8961 Nested lists 7 (skip initial nesting levels)
8962 !! wikitext
8963 *** foo
8964 !! html
8965 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8966
8967 !! end
8968
8969 !! test
8970 Nested lists 8 (multiple nesting transitions)
8971 !! wikitext
8972 * foo
8973 *** bar
8974 ** baz
8975 * boo
8976 !! html
8977 <ul><li> foo
8978 <ul><li><ul><li> bar</li></ul></li>
8979 <li> baz</li></ul></li>
8980 <li> boo</li></ul>
8981
8982 !! end
8983
8984 !! test
8985 Nested lists 9 (extension interaction)
8986 !! options
8987 parsoid
8988 !! wikitext
8989 *<references />
8990 !! html/parsoid
8991 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8992 !! end
8993
8994 !! test
8995 1. Lists with start-of-line-transparent tokens before bullets: Comments
8996 !! wikitext
8997 *foo
8998 *<!--cmt-->bar
8999 <!--cmt-->*baz
9000 !! html
9001 <ul><li>foo</li>
9002 <li>bar</li>
9003 <li>baz</li></ul>
9004
9005 !! end
9006
9007 !! test
9008 2. Lists with start-of-line-transparent tokens before bullets: Template close
9009 !! wikitext
9010 *foo {{echo|bar
9011 }}*baz
9012 !! html
9013 <ul><li>foo bar</li>
9014 <li>baz</li></ul>
9015
9016 !! end
9017
9018 !! test
9019 List items are not parsed correctly following a <pre> block (bug 785)
9020 !! wikitext
9021 * <pre>foo</pre>
9022 * <pre>bar</pre>
9023 * zar
9024 !! html/php
9025 <ul><li> <pre>foo</pre></li>
9026 <li> <pre>bar</pre></li>
9027 <li> zar</li></ul>
9028
9029 !! html/parsoid
9030 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9031 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9032 <li> zar</li></ul>
9033 !! end
9034
9035 !! test
9036 List items from template
9037 !! wikitext
9038
9039 {{inner list}}
9040 * item 2
9041
9042 * item 0
9043 {{inner list}}
9044 * item 2
9045
9046 * item 0
9047 * notSOL{{inner list}}
9048 * item 2
9049 !! html
9050 <ul><li> item 1</li>
9051 <li> item 2</li></ul>
9052 <ul><li> item 0</li>
9053 <li> item 1</li>
9054 <li> item 2</li></ul>
9055 <ul><li> item 0</li>
9056 <li> notSOL</li>
9057 <li> item 1</li>
9058 <li> item 2</li></ul>
9059
9060 !! end
9061
9062 !! test
9063 List interrupted by empty line or heading
9064 !! wikitext
9065 * foo
9066
9067 ** bar
9068 == A heading ==
9069 * Another list item
9070 !! html
9071 <ul><li> foo</li></ul>
9072 <ul><li><ul><li> bar</li></ul></li></ul>
9073 <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>
9074 <ul><li> Another list item</li></ul>
9075
9076 !!end
9077
9078 !!test
9079 Multiple list tags generated by templates
9080 !! wikitext
9081 {{echo|<li>}}a
9082 {{echo|<li>}}b
9083 {{echo|<li>}}c
9084 !! html
9085 <li>a
9086 <li>b
9087 <li>c</li>
9088 </li>
9089 </li>
9090
9091 !! html+tidy
9092 <ul>
9093 <li>a</li>
9094 <li>b</li>
9095 <li>c</li>
9096 </ul>
9097 !!end
9098
9099 !!test
9100 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9101 !! wikitext
9102 *a
9103 <!--This line will NOT split the list-->
9104 *b
9105 <!--This line will NOT split the list either-->
9106 *c
9107 <!--foo--> <!----> <!--This line NOT split the list either-->
9108 *d
9109 !! html
9110 <ul><li>a</li>
9111 <li>b</li>
9112 <li>c</li>
9113 <li>d</li></ul>
9114
9115 !!end
9116
9117 !!test
9118 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9119 !! wikitext
9120 *a
9121 <!--This line will NOT split the list-->
9122 *b
9123 <!--This line will NOT split the list either-->
9124 *c
9125 <!--foo--> <!----> <!--This line NOT split the list
9126 either-->
9127 *d
9128 !! html
9129 <ul><li>a</li>
9130 <li>b</li>
9131 <li>c</li>
9132 <li>d</li></ul>
9133
9134 !!end
9135
9136 !!test
9137 Test the li-hack
9138 (The PHP parser relies on Tidy for the hack)
9139 !!options
9140 parsoid=wt2html,wt2wt
9141 !! wikitext
9142 * foo
9143 * <li>li-hack
9144 * {{echo|<li>templated li-hack}}
9145 * <!--foo--> <li> unsupported li-hack with preceding comments
9146
9147 <ul>
9148 <li><li>not a li-hack
9149 </li>
9150 </ul>
9151 !! html+tidy
9152 <ul>
9153 <li>foo</li>
9154 <li>li-hack</li>
9155 <li>templated li-hack</li>
9156 <li>unsupported li-hack with preceding comments</li>
9157 </ul>
9158 <ul>
9159 <li>not a li-hack</li>
9160 </ul>
9161 !!end
9162
9163 !! test
9164 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9165 !! options
9166 parsoid
9167 !! wikitext
9168 # foo
9169 ## bar
9170 * foo
9171 ** bar
9172 : foo
9173 :: bar
9174 !! html
9175 <ol>
9176 <li> foo<ol>
9177 <li> bar</li>
9178 </ol></li>
9179 </ol><ul>
9180 <li> foo<ul>
9181 <li> bar</li>
9182 </ul></li>
9183 </ul><dl>
9184 <dd> foo<dl>
9185 <dd> bar</dd>
9186 </dl></dd>
9187 </dl>
9188 !! end
9189
9190 !! test
9191 Parsoid: Test of whitespace serialization with Templated bullets
9192 !! options
9193 parsoid
9194 !! wikitext
9195 * {{bullet}}
9196 !! html
9197 <ul>
9198 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9199 </ul>
9200 !! end
9201
9202 # ------------------------------------------------------------------------
9203 # The next set of tests are about Parsoid's ability to handle badly nested
9204 # tags (parse, minimize scope of fixup, and roundtrip back)
9205 # ------------------------------------------------------------------------
9206
9207 !! test
9208 Unbalanced closing block tags break a list
9209 (php parser relies on Tidy to fix up)
9210 !! wikitext
9211 <div>
9212 *a</div><div>
9213 *b</div>
9214 !! html+tidy
9215 <div>
9216 <ul>
9217 <li>a</li>
9218 </ul>
9219 </div>
9220 <div>
9221 <ul>
9222 <li>b</li>
9223 </ul>
9224 </div>
9225 !! end
9226
9227 # Parsoid fails this test, but it might be tricky to support properly.
9228 # See bug 68395.
9229 !! test
9230 Unbalanced closing non-block tags don't break a list
9231 (php parser relies on Tidy to fix up)
9232 !! wikitext
9233 <span>
9234 *a</span><span>
9235 *b</span>
9236 !! html/php+tidy
9237 <ul>
9238 <li><span>a</span></li>
9239 <li><span>b</span></li>
9240 </ul>
9241 !! html/parsoid
9242 <span>
9243 <ul>
9244 <li>a<span></span>
9245 </li>
9246 <li>b
9247 </li>
9248 </ul>
9249 </span>
9250 !! end
9251
9252 !! test
9253 Unclosed formatting tags that straddle lists are closed and reopened
9254 (php parser relies on Tidy to fix up)
9255 !! options
9256 parsoid=wt2html,wt2wt,html2html
9257 !! wikitext
9258 # <s> a
9259 # b </s>
9260 !! html/php+tidy
9261 <ol>
9262 <li><s>a</s></li>
9263 <li><s>b</s></li>
9264 </ol>
9265 !! html/parsoid
9266 <ol><li> <s> a</s></li>
9267 <li><s> b </s></li></ol>
9268 !! end
9269
9270 # See bug 68395.
9271 !!test
9272 1. List embedded in a formatting tag
9273 !! wikitext
9274 <small>
9275 * foo
9276 </small>
9277 !! html/php+tidy
9278 <ul>
9279 <li><small>foo</small></li>
9280 </ul>
9281 !! html/parsoid
9282 <small>
9283 <ul>
9284 <li> foo</li>
9285 </ul>
9286 </small>
9287 !!end
9288
9289 ## Ugly Parsoid output here
9290 ## Not sure what the right output is.
9291 !!test
9292 2. List embedded in a formatting tag
9293 !! wikitext
9294 <small>
9295 *a
9296 *b</small>
9297 !! html/php+tidy
9298 <ul>
9299 <li><small>a</small></li>
9300 <li><small>b</small></li>
9301 </ul>
9302 !! html/parsoid
9303 <small></small>
9304 <ul><small>
9305 <li>a</li>
9306 </small>
9307 <li><small>b</small></li>
9308 </ul>
9309 !!end
9310
9311 # Ugly Parsoid and PHP parser output here
9312 # Not sure if we want to make this a test!
9313 #
9314 ## !!test
9315 ## 3. Unclosed formatting tags in list elements
9316 ## !! wikitext
9317 ## *<small>a
9318 ## *<small>b
9319 ## !! html/php+tidy
9320 ## <ul>
9321 ## <li><small>a</small></li>
9322 ## <li><small><small>b</small></small></li>
9323 ## </ul>
9324 ## !! html/parsoid
9325 ## <ul>
9326 ## <li><small>a</small></li>
9327 ## <small>
9328 ## <li><small>b</small></li>
9329 ## </small></ul>
9330 ## !!end
9331
9332 # This is a bug in the PHP parser + tidy combination.
9333 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9334 # and then fostered out of the table by tidy.)
9335 # We believe the Parsoid output to be correct.
9336 !! test
9337 Table with missing opening <tr> tag
9338 !! options
9339 parsoid=wt2html,wt2wt
9340 !! wikitext
9341 <table>
9342 <td>foo</td>
9343 </tr>
9344 </table>
9345 !! html+tidy
9346 <table>
9347 <tr>
9348 <td>foo</td>
9349 </tr>
9350 </table>
9351 !! end
9352
9353 ###
9354 ### Magic Words
9355 ###
9356
9357 # Note that the current date is hard-coded as
9358 # 1970-01-01T00:02:03Z (a Thursday)
9359 # when running parser tests. The timezone is also fixed to GMT, so
9360 # local date will be identical to current date.
9361
9362 !! test
9363 Magic Word: {{CURRENTDAY}}
9364 !! wikitext
9365 {{CURRENTDAY}}
9366 !! html
9367 <p>1
9368 </p>
9369 !! end
9370
9371 !! test
9372 Magic Word: {{CURRENTDAY2}}
9373 !! wikitext
9374 {{CURRENTDAY2}}
9375 !! html
9376 <p>01
9377 </p>
9378 !! end
9379
9380 !! test
9381 Magic Word: {{CURRENTDAYNAME}}
9382 !! wikitext
9383 {{CURRENTDAYNAME}}
9384 !! html
9385 <p>Thursday
9386 </p>
9387 !! end
9388
9389 !! test
9390 Magic Word: {{CURRENTDOW}}
9391 !! wikitext
9392 {{CURRENTDOW}}
9393 !! html
9394 <p>4
9395 </p>
9396 !! end
9397
9398 !! test
9399 Magic Word: {{CURRENTMONTH}}
9400 !! wikitext
9401 {{CURRENTMONTH}}
9402 !! html
9403 <p>01
9404 </p>
9405 !! end
9406
9407 !! test
9408 Magic Word: {{CURRENTMONTH1}}
9409 !! wikitext
9410 {{CURRENTMONTH1}}
9411 !! html
9412 <p>1
9413 </p>
9414 !! end
9415
9416 !! test
9417 Magic Word: {{CURRENTMONTHABBREV}}
9418 !! wikitext
9419 {{CURRENTMONTHABBREV}}
9420 !! html
9421 <p>Jan
9422 </p>
9423 !! end
9424
9425 !! test
9426 Magic Word: {{CURRENTMONTHNAME}}
9427 !! wikitext
9428 {{CURRENTMONTHNAME}}
9429 !! html
9430 <p>January
9431 </p>
9432 !! end
9433
9434 !! test
9435 Magic Word: {{CURRENTMONTHNAMEGEN}}
9436 !! wikitext
9437 {{CURRENTMONTHNAMEGEN}}
9438 !! html
9439 <p>January
9440 </p>
9441 !! end
9442
9443 !! test
9444 Magic Word: {{CURRENTTIME}}
9445 !! wikitext
9446 {{CURRENTTIME}}
9447 !! html
9448 <p>00:02
9449 </p>
9450 !! end
9451
9452 !! test
9453 Magic Word: {{CURRENTHOUR}}
9454 !! wikitext
9455 {{CURRENTHOUR}}
9456 !! html
9457 <p>00
9458 </p>
9459 !! end
9460
9461 !! test
9462 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9463 !! wikitext
9464 {{CURRENTWEEK}}
9465 !! html
9466 <p>1
9467 </p>
9468 !! end
9469
9470 !! test
9471 Magic Word: {{CURRENTYEAR}}
9472 !! wikitext
9473 {{CURRENTYEAR}}
9474 !! html
9475 <p>1970
9476 </p>
9477 !! end
9478
9479 !! test
9480 Magic Word: {{CURRENTTIMESTAMP}}
9481 !! wikitext
9482 {{CURRENTTIMESTAMP}}
9483 !! html
9484 <p>19700101000203
9485 </p>
9486 !! end
9487
9488 !! test
9489 Magic Words LOCAL (UTC)
9490 !! wikitext
9491 * {{LOCALMONTH}}
9492 * {{LOCALMONTH1}}
9493 * {{LOCALMONTHNAME}}
9494 * {{LOCALMONTHNAMEGEN}}
9495 * {{LOCALMONTHABBREV}}
9496 * {{LOCALDAY}}
9497 * {{LOCALDAY2}}
9498 * {{LOCALDAYNAME}}
9499 * {{LOCALYEAR}}
9500 * {{LOCALTIME}}
9501 * {{LOCALHOUR}}
9502 * {{LOCALWEEK}}
9503 * {{LOCALDOW}}
9504 * {{LOCALTIMESTAMP}}
9505 !! html
9506 <ul><li> 01</li>
9507 <li> 1</li>
9508 <li> January</li>
9509 <li> January</li>
9510 <li> Jan</li>
9511 <li> 1</li>
9512 <li> 01</li>
9513 <li> Thursday</li>
9514 <li> 1970</li>
9515 <li> 00:02</li>
9516 <li> 00</li>
9517 <li> 1</li>
9518 <li> 4</li>
9519 <li> 19700101000203</li></ul>
9520
9521 !! end
9522
9523 !! test
9524 Magic Word: {{FULLPAGENAME}}
9525 !! options
9526 title=[[User:Ævar Arnfjörð Bjarmason]]
9527 !! wikitext
9528 {{FULLPAGENAME}}
9529 !! html
9530 <p>User:Ævar Arnfjörð Bjarmason
9531 </p>
9532 !! end
9533
9534 !! test
9535 Magic Word: {{FULLPAGENAMEE}}
9536 !! options
9537 title=[[User:Ævar Arnfjörð Bjarmason]]
9538 !! wikitext
9539 {{FULLPAGENAMEE}}
9540 !! html
9541 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9542 </p>
9543 !! end
9544
9545 !! test
9546 Magic Word: {{TALKSPACE}}
9547 !! options
9548 title=[[User:Ævar Arnfjörð Bjarmason]]
9549 !! wikitext
9550 {{TALKSPACE}}
9551 !! html
9552 <p>User talk
9553 </p>
9554 !! end
9555
9556 !! test
9557 Magic Word: {{TALKSPACE}}, same namespace
9558 !! options
9559 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9560 !! wikitext
9561 {{TALKSPACE}}
9562 !! html
9563 <p>User talk
9564 </p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{TALKSPACE}}, main namespace
9569 !! options
9570 title=[[Parser Test]]
9571 !! wikitext
9572 {{TALKSPACE}}
9573 !! html
9574 <p>Talk
9575 </p>
9576 !! end
9577
9578 !! test
9579 Magic Word: {{TALKSPACEE}}
9580 !! options
9581 title=[[User:Ævar Arnfjörð Bjarmason]]
9582 !! wikitext
9583 {{TALKSPACEE}}
9584 !! html
9585 <p>User_talk
9586 </p>
9587 !! end
9588
9589 !! test
9590 Magic Word: {{SUBJECTSPACE}}
9591 !! options
9592 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9593 !! wikitext
9594 {{SUBJECTSPACE}}
9595 !! html
9596 <p>User
9597 </p>
9598 !! end
9599
9600 !! test
9601 Magic Word: {{SUBJECTSPACE}}, same namespace
9602 !! options
9603 title=[[User:Ævar Arnfjörð Bjarmason]]
9604 !! wikitext
9605 {{SUBJECTSPACE}}
9606 !! html
9607 <p>User
9608 </p>
9609 !! end
9610
9611 !! test
9612 Magic Word: {{SUBJECTSPACE}}, main namespace
9613 !! options
9614 title=[[Parser Test]]
9615 !! wikitext
9616 {{SUBJECTSPACE}}
9617 !! html
9618
9619 !! end
9620
9621 !! test
9622 Magic Word: {{SUBJECTSPACEE}}
9623 !! options
9624 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9625 !! wikitext
9626 {{SUBJECTSPACEE}}
9627 !! html
9628 <p>User
9629 </p>
9630 !! end
9631
9632 !! test
9633 Magic Word: {{NAMESPACE}}
9634 !! options
9635 title=[[User:Ævar Arnfjörð Bjarmason]]
9636 !! wikitext
9637 {{NAMESPACE}}
9638 !! html
9639 <p>User
9640 </p>
9641 !! end
9642
9643 !! test
9644 Magic Word: {{NAMESPACEE}}
9645 !! options
9646 title=[[User:Ævar Arnfjörð Bjarmason]]
9647 !! wikitext
9648 {{NAMESPACEE}}
9649 !! html
9650 <p>User
9651 </p>
9652 !! end
9653
9654 !! test
9655 Magic Word: {{NAMESPACENUMBER}}
9656 !! options
9657 title=[[User:Ævar Arnfjörð Bjarmason]]
9658 !! wikitext
9659 {{NAMESPACENUMBER}}
9660 !! html
9661 <p>2
9662 </p>
9663 !! end
9664
9665 !! test
9666 Magic Word: {{SUBPAGENAME}}
9667 !! options
9668 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9669 !! wikitext
9670 {{SUBPAGENAME}}
9671 !! html
9672 <p>sub ö
9673 </p>
9674 !! end
9675
9676 !! test
9677 Magic Word: {{SUBPAGENAMEE}}
9678 !! options
9679 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9680 !! wikitext
9681 {{SUBPAGENAMEE}}
9682 !! html
9683 <p>sub_%C3%B6
9684 </p>
9685 !! end
9686
9687 !! test
9688 Magic Word: {{ROOTPAGENAME}}
9689 !! options
9690 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9691 !! wikitext
9692 {{ROOTPAGENAME}}
9693 !! html
9694 <p>Ævar Arnfjörð Bjarmason
9695 </p>
9696 !! end
9697
9698 !! test
9699 Magic Word: {{ROOTPAGENAMEE}}
9700 !! options
9701 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9702 !! wikitext
9703 {{ROOTPAGENAMEE}}
9704 !! html
9705 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9706 </p>
9707 !! end
9708
9709 !! test
9710 Magic Word: {{BASEPAGENAME}}
9711 !! options
9712 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9713 !! wikitext
9714 {{BASEPAGENAME}}
9715 !! html
9716 <p>Ævar Arnfjörð Bjarmason
9717 </p>
9718 !! end
9719
9720 !! test
9721 Magic Word: {{BASEPAGENAMEE}}
9722 !! options
9723 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9724 !! wikitext
9725 {{BASEPAGENAMEE}}
9726 !! html
9727 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9728 </p>
9729 !! end
9730
9731 !! test
9732 Magic Word: {{TALKPAGENAME}}
9733 !! options
9734 title=[[User:Ævar Arnfjörð Bjarmason]]
9735 !! wikitext
9736 {{TALKPAGENAME}}
9737 !! html
9738 <p>User talk:Ævar Arnfjörð Bjarmason
9739 </p>
9740 !! end
9741
9742 !! test
9743 Magic Word: {{TALKPAGENAMEE}}
9744 !! options
9745 title=[[User:Ævar Arnfjörð Bjarmason]]
9746 !! wikitext
9747 {{TALKPAGENAMEE}}
9748 !! html
9749 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9750 </p>
9751 !! end
9752
9753 !! test
9754 Magic Word: {{SUBJECTPAGENAME}}
9755 !! options
9756 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9757 !! wikitext
9758 {{SUBJECTPAGENAME}}
9759 !! html
9760 <p>User:Ævar Arnfjörð Bjarmason
9761 </p>
9762 !! end
9763
9764 !! test
9765 Magic Word: {{SUBJECTPAGENAMEE}}
9766 !! options
9767 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9768 !! wikitext
9769 {{SUBJECTPAGENAMEE}}
9770 !! html
9771 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9772 </p>
9773 !! end
9774
9775 !! test
9776 Magic Word: {{NUMBEROFFILES}}
9777 !! wikitext
9778 {{NUMBEROFFILES}}
9779 !! html
9780 <p>6
9781 </p>
9782 !! end
9783
9784 !! test
9785 Magic Word: {{PAGENAME}}
9786 !! options
9787 title=[[User:Ævar Arnfjörð Bjarmason]]
9788 !! wikitext
9789 {{PAGENAME}}
9790 !! html
9791 <p>Ævar Arnfjörð Bjarmason
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{PAGENAME}} with metacharacters
9797 !! options
9798 title=[['foo & bar = baz']]
9799 !! wikitext
9800 ''{{PAGENAME}}''
9801 !! html/php
9802 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9803 </p>
9804 !! html+tidy
9805 <p><i>'foo &amp; bar = baz'</i></p>
9806 !! end
9807
9808 !! test
9809 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9810 !! options
9811 title=[[*RFC 1234 http://example.com/]]
9812 !! wikitext
9813 {{PAGENAME}}
9814 !! html/php
9815 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9816 </p>
9817 !! html+tidy
9818 <p>*RFC 1234 http://example.com/</p>
9819 !! end
9820
9821 !! test
9822 Magic Word: {{PAGENAMEE}}
9823 !! options
9824 title=[[User:Ævar Arnfjörð Bjarmason]]
9825 !! wikitext
9826 {{PAGENAMEE}}
9827 !! html
9828 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9829 </p>
9830 !! end
9831
9832 !! test
9833 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9834 !! options
9835 title=[[*RFC 1234 http://example.com/]]
9836 !! wikitext
9837 {{PAGENAMEE}}
9838 !! html/php
9839 <p>&#42;RFC_1234_http&#58;//example.com/
9840 </p>
9841 !! html+tidy
9842 <p>*RFC_1234_http://example.com/</p>
9843 !! end
9844
9845 !! test
9846 Magic Word: {{REVISIONID}}
9847 !! wikitext
9848 {{REVISIONID}}
9849 !! html
9850 <p>1337
9851 </p>
9852 !! end
9853
9854 !! test
9855 Magic Word: {{SCRIPTPATH}}
9856 !! wikitext
9857 {{SCRIPTPATH}}
9858 !! html
9859
9860 !! end
9861
9862 !! test
9863 Magic Word: {{STYLEPATH}}
9864 !! wikitext
9865 {{STYLEPATH}}
9866 !! html
9867 <p>/skins
9868 </p>
9869 !! end
9870
9871 !! test
9872 Magic Word: {{SERVER}}
9873 !! wikitext
9874 {{SERVER}}
9875 !! html
9876 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9877 </p>
9878 !! end
9879
9880 !! test
9881 Magic Word: {{SERVERNAME}}
9882 !! wikitext
9883 {{SERVERNAME}}
9884 !! html
9885 <p>example.org
9886 </p>
9887 !! end
9888
9889 !! test
9890 Magic Word: {{SITENAME}}
9891 !! wikitext
9892 {{SITENAME}}
9893 !! html
9894 <p>MediaWiki
9895 </p>
9896 !! end
9897
9898 !! test
9899 Case-sensitive magic words, when cased differently, should just be template transclusions
9900 !! wikitext
9901 {{CurrentMonth}}
9902 {{currentday}}
9903 {{cURreNTweEK}}
9904 {{currentHour}}
9905 !! html
9906 <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>
9907 <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>
9908 <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>
9909 <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>
9910 </p>
9911 !! end
9912
9913 !! test
9914 Case-insensitive magic words should still work with weird casing.
9915 !! wikitext
9916 {{sErVeRNaMe}}
9917 {{LCFirst:AOEU}}
9918 {{ucFIRST:aoeu}}
9919 {{SERver}}
9920 !! html
9921 <p>example.org
9922 aOEU
9923 Aoeu
9924 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9925 </p>
9926 !! end
9927
9928 # From plwiki:PLOS_ONE
9929 !! test
9930 Parsoid: Page property magic word with magic word contents
9931 !! wikitext
9932 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9933 !! html/parsoid
9934 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
9935 !! end
9936
9937 !! test
9938 Parsoid: Template-generated DISPLAYTITLE
9939 !! wikitext
9940 {{{{echo|DISPLAYTITLE}}:Foo}}
9941 !! html/parsoid
9942 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9943 !! end
9944
9945 !! test
9946 Namespace 1 {{ns:1}}
9947 !! wikitext
9948 {{ns:1}}
9949 !! html
9950 <p>Talk
9951 </p>
9952 !! end
9953
9954 !! test
9955 Namespace 1 {{ns:01}}
9956 !! wikitext
9957 {{ns:01}}
9958 !! html
9959 <p>Talk
9960 </p>
9961 !! end
9962
9963 !! test
9964 Namespace 0 {{ns:0}} (bug 4783)
9965 !! wikitext
9966 {{ns:0}}
9967 !! html
9968
9969 !! end
9970
9971 !! test
9972 Namespace 0 {{ns:00}} (bug 4783)
9973 !! wikitext
9974 {{ns:00}}
9975 !! html
9976
9977 !! end
9978
9979 !! test
9980 Namespace -1 {{ns:-1}}
9981 !! wikitext
9982 {{ns:-1}}
9983 !! html
9984 <p>Special
9985 </p>
9986 !! end
9987
9988 !! test
9989 Namespace User {{ns:User}}
9990 !! wikitext
9991 {{ns:User}}
9992 !! html
9993 <p>User
9994 </p>
9995 !! end
9996
9997 !! test
9998 Namespace User talk {{ns:User_talk}}
9999 !! wikitext
10000 {{ns:User_talk}}
10001 !! html
10002 <p>User talk
10003 </p>
10004 !! end
10005
10006 !! test
10007 Namespace User talk {{ns:uSeR tAlK}}
10008 !! wikitext
10009 {{ns:uSeR tAlK}}
10010 !! html
10011 <p>User talk
10012 </p>
10013 !! end
10014
10015 !! test
10016 Namespace File {{ns:File}}
10017 !! wikitext
10018 {{ns:File}}
10019 !! html
10020 <p>File
10021 </p>
10022 !! end
10023
10024 !! test
10025 Namespace File {{ns:Image}}
10026 !! wikitext
10027 {{ns:Image}}
10028 !! html
10029 <p>File
10030 </p>
10031 !! end
10032
10033 !! test
10034 Namespace (lang=de) Benutzer {{ns:User}}
10035 !! options
10036 language=de
10037 !! wikitext
10038 {{ns:User}}
10039 !! html
10040 <p>Benutzer
10041 </p>
10042 !! end
10043
10044 !! test
10045 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10046 !! options
10047 language=de
10048 !! wikitext
10049 {{ns:3}}
10050 !! html
10051 <p>Benutzer Diskussion
10052 </p>
10053 !! end
10054
10055
10056 !! test
10057 Urlencode
10058 !! wikitext
10059 {{urlencode:hi world?!}}
10060 {{urlencode:hi world?!|WIKI}}
10061 {{urlencode:hi world?!|PATH}}
10062 {{urlencode:hi world?!|QUERY}}
10063 !! html
10064 <p>hi+world%3F%21
10065 hi_world%3F!
10066 hi%20world%3F%21
10067 hi+world%3F%21
10068 </p>
10069 !! end
10070
10071 !! test
10072 Magic Word: prioritize type info over data-parsoid
10073 !! options
10074 parsoid=html2wt
10075 !! html/parsoid
10076 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10077 !! wikitext
10078 __FORCETOC__
10079 !! end
10080
10081 !! test
10082 Magic Word: serialize on separate line (parsoid)
10083 !! options
10084 parsoid=wt2wt,html2wt
10085 !! wikitext
10086 foo
10087 __NOTOC__
10088 bar
10089 !! html/parsoid
10090 foo<meta property="mw:PageProp/notoc"/>bar
10091 !! end
10092
10093 !! test
10094 Magic Word: rt non-english wikis
10095 !! options
10096 parsoid=wt2wt
10097 language=de
10098 !! wikitext
10099 __NOEDITSECTION__
10100 !! html/parsoid
10101 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10102 !! end
10103
10104 !!test
10105 __proto__ is treated as normal wikitext (T105997)
10106 !!wikitext
10107 __proto__
10108 !!html
10109 <p>__proto__
10110 </p>
10111 !!end
10112
10113 ###
10114 ### Magic links
10115 ###
10116 !! test
10117 Magic links: internal link to RFC (bug 479)
10118 !! wikitext
10119 [[RFC 123]]
10120 !! html/php
10121 <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>
10122 </p>
10123 !! html/parsoid
10124 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10125 !! end
10126
10127 !! test
10128 Magic links: RFC (bug 479)
10129 !! wikitext
10130 RFC 822
10131 !! html/php
10132 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10133 </p>
10134 !! html/parsoid
10135 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10136 !! end
10137
10138 !! test
10139 Magic links: RFC (bug 65278)
10140 !! wikitext
10141 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10142 !! html/php
10143 <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.
10144 </p>
10145 !! html/parsoid
10146 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10147 !! end
10148
10149 !! test
10150 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10151 !! wikitext
10152 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10153 RFC
10154 822
10155 !! html/php
10156 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10157 RFC
10158 822
10159 </p>
10160 !! html/parsoid
10161 <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>
10162 RFC
10163 822</p>
10164 !! end
10165
10166 !! test
10167 Magic links: ISBN (bug 1937)
10168 !! wikitext
10169 ISBN 0-306-40615-2
10170 !! html/php
10171 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10172 </p>
10173 !! html/parsoid
10174 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10175 !! end
10176
10177 !! test
10178 Magic links: ISBN (bug 65278)
10179 !! wikitext
10180 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10181 !! html/php
10182 <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.
10183 </p>
10184 !! html/parsoid
10185 <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>
10186 !! end
10187
10188 !! test
10189 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10190 !! wikitext
10191 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10192 ISBN
10193 9780316098113
10194 ISBN 978
10195 0316098113
10196 !! html/php
10197 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10198 ISBN
10199 9780316098113
10200 ISBN 978
10201 0316098113
10202 </p>
10203 !! html/parsoid
10204 <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>
10205 ISBN
10206 9780316098113
10207 ISBN 978
10208 0316098113</p>
10209 !! end
10210
10211 !! test
10212 Magic links: PMID incorrectly converts space to underscore
10213 !! wikitext
10214 PMID 1234
10215 !! html/php
10216 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10217 </p>
10218 !! html/parsoid
10219 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10220 !! end
10221
10222 !! test
10223 Magic links: PMID (bug 65278)
10224 !! wikitext
10225 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10226 !! html/php
10227 <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.
10228 </p>
10229 !! html/parsoid
10230 <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>
10231 !! end
10232
10233 !! test
10234 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10235 !! wikitext
10236 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10237 PMID
10238 1234
10239 !! html/php
10240 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10241 PMID
10242 1234
10243 </p>
10244 !! html/parsoid
10245 <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>
10246 PMID
10247 1234</p>
10248 !! end
10249
10250 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10251 # since these are ExtLinkText, not MagicLinkText
10252 !! test
10253 Magic links: use appropriate serialization for "almost" magic links.
10254 !! wikitext
10255 X[[Special:BookSources/0978739256|foo]]
10256
10257 X[//tools.ietf.org/html/rfc1234 foo]
10258 !! html/php
10259 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10260 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10261 </p>
10262 !! html/parsoid
10263 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10264 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10265 !! end
10266
10267 ###
10268 ### Templates
10269 ####
10270
10271 !! test
10272 Nonexistent template
10273 !! wikitext
10274 {{thistemplatedoesnotexist}}
10275 !! html
10276 <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>
10277 </p>
10278 !! end
10279
10280 !! test
10281 Template with invalid target containing tags
10282 !! wikitext
10283 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10284 !! html
10285 <p>{{a<b>b</b>|foo|a=b|a = b}}
10286 </p>
10287 !! end
10288
10289 !! test
10290 Template with invalid target containing unclosed tag
10291 !! wikitext
10292 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10293 !! html
10294 <p>{{a<b>|foo|a=b|a = b}}</b>
10295 </p>
10296 !! end
10297
10298 !! test
10299 Template with invalid target containing wikilink
10300 !! wikitext
10301 {{[[Main Page]]}}
10302 !! html/php
10303 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10304 </p>
10305 !! html/parsoid
10306 <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>
10307 !! end
10308
10309 !! test
10310 Template with just whitespace in it, bug #68421
10311 !! wikitext
10312 {{echo|{{ }}}}
10313 !! html/parsoid
10314 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10315 !! end
10316
10317 !! article
10318 Template:test
10319 !! text
10320 This is a test template
10321 !! endarticle
10322
10323 !! test
10324 Simple template
10325 !! wikitext
10326 {{test}}
10327 !! html
10328 <p>This is a test template
10329 </p>
10330 !! end
10331
10332 !! test
10333 Template with explicit namespace
10334 !! wikitext
10335 {{Template:test}}
10336 !! html
10337 <p>This is a test template
10338 </p>
10339 !! end
10340
10341
10342 !! article
10343 Template:paramtest
10344 !! text
10345 This is a test template with parameter {{{param}}}
10346 !! endarticle
10347
10348 !! test
10349 Template parameter
10350 !! wikitext
10351 {{paramtest|param=foo}}
10352 !! html
10353 <p>This is a test template with parameter foo
10354 </p>
10355 !! end
10356
10357 !! article
10358 Template:paramtestnum
10359 !! text
10360 [[{{{1}}}|{{{2}}}]]
10361 !! endarticle
10362
10363 !! test
10364 Template unnamed parameter
10365 !! wikitext
10366 {{paramtestnum|Main Page|the main page}}
10367 !! html
10368 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10369 </p>
10370 !! end
10371
10372 !! article
10373 Template:templatesimple
10374 !! text
10375 (test)
10376 !! endarticle
10377
10378 !! article
10379 Template:templateredirect
10380 !! text
10381 #redirect [[Template:templatesimple]]
10382 !! endarticle
10383
10384 !! article
10385 Template:templateasargtestnum
10386 !! text
10387 {{{{{1}}}}}
10388 !! endarticle
10389
10390 !! article
10391 Template:templateasargtest
10392 !! text
10393 {{template{{{templ}}}}}
10394 !! endarticle
10395
10396 !! article
10397 Template:templateasargtest2
10398 !! text
10399 {{{{{templ}}}}}
10400 !! endarticle
10401
10402 !! test
10403 Template with template name as unnamed argument
10404 !! wikitext
10405 {{templateasargtestnum|templatesimple}}
10406 !! html
10407 <p>(test)
10408 </p>
10409 !! end
10410
10411 !! test
10412 Template with template name as argument
10413 !! wikitext
10414 {{templateasargtest|templ=simple}}
10415 !! html
10416 <p>(test)
10417 </p>
10418 !! end
10419
10420 !! test
10421 Template with template name as argument (2)
10422 !! wikitext
10423 {{templateasargtest2|templ=templatesimple}}
10424 !! html
10425 <p>(test)
10426 </p>
10427 !! end
10428
10429 !! article
10430 Template:templateasargtestdefault
10431 !! text
10432 {{{{{templ|templatesimple}}}}}
10433 !! endarticle
10434
10435 !! article
10436 Template:templa
10437 !! text
10438 '''templ'''
10439 !! endarticle
10440
10441 !! test
10442 Template with default value
10443 !! wikitext
10444 {{templateasargtestdefault}}
10445 !! html
10446 <p>(test)
10447 </p>
10448 !! end
10449
10450 !! test
10451 Template with default value (value set)
10452 !! wikitext
10453 {{templateasargtestdefault|templ=templa}}
10454 !! html
10455 <p><b>templ</b>
10456 </p>
10457 !! end
10458
10459 !! test
10460 Template redirect
10461 !! wikitext
10462 {{templateredirect}}
10463 !! html/php
10464 <p>(test)
10465 </p>
10466 !! html/parsoid
10467 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10468 !! end
10469
10470 !! test
10471 Template with argument in separate line
10472 !! wikitext
10473 {{ templateasargtest |
10474 templ = simple }}
10475 !! html
10476 <p>(test)
10477 </p>
10478 !! end
10479
10480 !! test
10481 Template with complex template as argument
10482 !! wikitext
10483 {{paramtest|
10484 param ={{ templateasargtest |
10485 templ = simple }}}}
10486 !! html
10487 <p>This is a test template with parameter (test)
10488 </p>
10489 !! end
10490
10491 !! test
10492 Template with thumb image (with link in description)
10493 !! wikitext
10494 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10495 !! html/php
10496 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>
10497
10498 !! html+tidy
10499 <p>This is a test template with parameter</p>
10500 <div class="thumb tright">
10501 <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>
10502 <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>
10503 </div>
10504 </div>
10505 !! html/parsoid
10506 <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>
10507 !! end
10508
10509 !! article
10510 Template:complextemplate
10511 !! text
10512 {{{1}}} {{paramtest|
10513 param ={{{param}}}}}
10514 !! endarticle
10515
10516 !! test
10517 Template with complex arguments
10518 !! wikitext
10519 {{complextemplate|
10520 param ={{ templateasargtest |
10521 templ = simple }}|[[Template:complextemplate|link]]}}
10522 !! html
10523 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10524 </p>
10525 !! end
10526
10527 !! test
10528 BUG 553: link with two variables in a piped link
10529 !! wikitext
10530 {|
10531 |[[{{{1}}}|{{{2}}}]]
10532 |}
10533 !! html/php
10534 <table>
10535 <tr>
10536 <td>[[{{{1}}}|{{{2}}}]]
10537 </td></tr></table>
10538
10539 !! html/parsoid
10540 <table>
10541 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10542 !! end
10543
10544 # See: T2553
10545 !! test
10546 Abort table cell attribute parsing on wikilink
10547 !! wikitext
10548 {|
10549 | testing [[one|two]] | three || four
10550 | testing one two | three || four
10551 | testing="[[one|two]]" | three || four
10552 |}
10553 !! html/php
10554 <table>
10555 <tr>
10556 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10557 <td> four
10558 </td>
10559 <td> three </td>
10560 <td> four
10561 </td>
10562 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
10563 <td> four
10564 </td></tr></table>
10565
10566 !! html/parsoid
10567 <table>
10568 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10569 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10570 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10571 </tbody></table>
10572 !! end
10573
10574 !! test
10575 Don't abort table cell attribute parsing if wikilink is found in template arg
10576 !! wikitext
10577 {|
10578 | Test {{#tag:ref|One two "[[three]]" four}}
10579 |}
10580 !! html/parsoid
10581 <table>
10582 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10583 </tbody></table>
10584 !! end
10585
10586 !! test
10587 Magic variable as template parameter
10588 !! wikitext
10589 {{paramtest|param={{SITENAME}}}}
10590 !! html
10591 <p>This is a test template with parameter MediaWiki
10592 </p>
10593 !! end
10594
10595 !! article
10596 Template:linktest
10597 !! text
10598 [[{{{param}}}|link]]
10599 !! endarticle
10600
10601 !! test
10602 Template parameter as link source
10603 !! wikitext
10604 {{linktest|param=Main Page}}
10605 !! html
10606 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10607 </p>
10608 !! end
10609
10610 !!article
10611 Template:paramtest2
10612 !! text
10613 including another template, {{paramtest|param={{{arg}}}}}
10614 !! endarticle
10615
10616 !! test
10617 Template passing argument to another template
10618 !! wikitext
10619 {{paramtest2|arg='hmm'}}
10620 !! html
10621 <p>including another template, This is a test template with parameter 'hmm'
10622 </p>
10623 !! end
10624
10625 !! article
10626 Template:Linktest2
10627 !! text
10628 Main Page
10629 !! endarticle
10630
10631 !! test
10632 Template as link source
10633 !! wikitext
10634 [[{{linktest2}}]]
10635
10636 [[{{linktest2}}|Main Page]]
10637
10638 [[{{linktest2}}]]Page
10639 !! html
10640 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10641 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10642 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10643 </p>
10644 !! end
10645
10646
10647 !! article
10648 Template:loop1
10649 !! text
10650 {{loop2}}
10651 !! endarticle
10652
10653 !! article
10654 Template:loop2
10655 !! text
10656 {{loop1}}
10657 !! endarticle
10658
10659 !! test
10660 Template infinite loop
10661 !! wikitext
10662 {{loop1}}
10663 !! html
10664 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10665 </p>
10666 !! end
10667
10668 !! test
10669 Template from main namespace
10670 !! wikitext
10671 {{:Main Page}}
10672 !! html
10673 <p>blah blah
10674 </p>
10675 !! end
10676
10677 !! article
10678 Template:table
10679 !! text
10680 {|
10681 | 1 || 2
10682 |-
10683 | 3 || 4
10684 |}
10685 !! endarticle
10686
10687 !! test
10688 BUG 529: Template with table, not included at beginning of line
10689 !! wikitext
10690 foo {{table}}
10691 !! html
10692 <p>foo
10693 </p>
10694 <table>
10695 <tr>
10696 <td> 1 </td>
10697 <td> 2
10698 </td></tr>
10699 <tr>
10700 <td> 3 </td>
10701 <td> 4
10702 </td></tr></table>
10703
10704 !! end
10705
10706 !! test
10707 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10708 !! wikitext
10709 foo
10710 {{table}}
10711 !! html
10712 <p>foo
10713 </p>
10714 <table>
10715 <tr>
10716 <td> 1 </td>
10717 <td> 2
10718 </td></tr>
10719 <tr>
10720 <td> 3 </td>
10721 <td> 4
10722 </td></tr></table>
10723
10724 !! end
10725
10726 !! test
10727 BUG 41: Template parameters shown as broken links
10728 !! wikitext
10729 {{{parameter}}}
10730 !! html
10731 <p>{{{parameter}}}
10732 </p>
10733 !! end
10734
10735 !! test
10736 Template with targets containing wikilinks
10737 !! wikitext
10738 {{[[foo]]}}
10739
10740 {{[[{{echo|foo}}]]}}
10741
10742 {{{{echo|[[foo}}]]}}
10743 !! html
10744 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10745 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10746 </p><p>{{[[foo}}]]
10747 </p>
10748 !! end
10749
10750 !! article
10751 Template:''
10752 !! text
10753 bar
10754 !! endarticle
10755
10756 !! test
10757 Templates: Double quotes as template target
10758 !! wikitext
10759 foo {{''}} baz
10760 !! html/php
10761 <p>foo bar baz
10762 </p>
10763 !! html/parsoid
10764 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10765 </p>
10766 !! end
10767
10768 ## This test is about making sure Parsoid's data-mw is well formed in the
10769 ## face of multiple templates with intersecting and overlapping ranges. The
10770 ## wikitext itself is wretched.
10771 !! test
10772 Templates with intersecting and overlapping ranges
10773 !! wikitext
10774 {|{{echo|
10775 <p>ha</p>}}
10776 {|{{echo|
10777 <p>ho</p>}}
10778 {{echo|{{!}}hi}}
10779 |}
10780 !! html/php+tidy
10781 <p>ha</p>
10782 <p>ho</p>
10783 <table>
10784 <tr>
10785 <td></td>
10786 </tr>
10787 <tr>
10788 <td>hi</td>
10789 </tr>
10790 </table>
10791 <table>
10792 <tr>
10793 <td></td>
10794 </tr>
10795 </table>
10796 !! html/parsoid
10797 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10798
10799 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10800
10801 <tbody><tr><td>hi</td></tr>
10802 </tbody></table>
10803 !! end
10804
10805 !! article
10806 Template:MSGNW test
10807 !! text
10808 ''None'' of '''this''' should be
10809 * interpreted
10810 but rather passed unmodified
10811 {{test}}
10812 <gallery>
10813 File:Foobar.jpg
10814 </gallery>
10815 <!-- comment -->
10816 !! endarticle
10817
10818 # hmm, fix this or just deprecate msgnw and document its behavior?
10819 !! test
10820 msgnw keyword
10821 !! wikitext
10822 {{msgnw:MSGNW test}}
10823 !! html/php
10824 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10825 &#42; interpreted
10826 &#32;but rather passed unmodified
10827 &#123;&#123;test&#125;&#125;
10828 &#60;gallery&#62;
10829 File:Foobar.jpg
10830 &#60;/gallery&#62;
10831 &#60;!-- comment --&#62;
10832 </p>
10833 !! end
10834
10835 !! test
10836 int keyword
10837 !! wikitext
10838 {{int:youhavenewmessages|lots of money|not!}}
10839 !! html
10840 <p>You have lots of money (not!).
10841 </p>
10842 !! end
10843
10844 !! test
10845 int keyword - non-existing message
10846 !! wikitext
10847 {{int:var}}
10848 !! html
10849 <p>&lt;var&gt;
10850 </p>
10851 !! end
10852
10853 !! article
10854 Template:Includes
10855 !! text
10856 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10857 !! endarticle
10858
10859 !! test
10860 <includeonly> and <noinclude> being included
10861 !! wikitext
10862 {{Includes}}
10863 !! html
10864 <p>Foobar
10865 </p>
10866 !! end
10867
10868 !! article
10869 Template:Includes2
10870 !! text
10871 <onlyinclude>Foo</onlyinclude>bar
10872 !! endarticle
10873
10874 !! test
10875 <onlyinclude> being included
10876 !! wikitext
10877 {{Includes2}}
10878 !! html
10879 <p>Foo
10880 </p>
10881 !! end
10882
10883
10884 !! article
10885 Template:Includes3
10886 !! text
10887 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10888 !! endarticle
10889
10890 !! test
10891 <onlyinclude> and <includeonly> being included
10892 !! wikitext
10893 {{Includes3}}
10894 !! html
10895 <p>Foo
10896 </p>
10897 !! end
10898
10899 !! test
10900 <includeonly> and <noinclude> on a page
10901 !! wikitext
10902 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10903 !! html
10904 <p>Foozar
10905 </p>
10906 !! end
10907
10908 !! test
10909 Un-closed <noinclude>
10910 !! wikitext
10911 <noinclude>
10912 !! html
10913 !! end
10914
10915 !! test
10916 <onlyinclude> on a page
10917 !! wikitext
10918 <onlyinclude>Foo</onlyinclude>bar
10919 !! html
10920 <p>Foobar
10921 </p>
10922 !! end
10923
10924 !! test
10925 Un-closed <onlyinclude>
10926 !! wikitext
10927 <onlyinclude>
10928 !! html
10929 !! end
10930
10931 !!test
10932 Self-closed noinclude, includeonly, onlyinclude tags
10933 !! wikitext
10934 <noinclude />
10935 <includeonly />
10936 <onlyinclude />
10937 !! html
10938 <p><br />
10939 </p>
10940 !!end
10941
10942 !!test
10943 Unbalanced includeonly and noinclude tags
10944 !! wikitext
10945 {|
10946 |a</noinclude>
10947 |b</noinclude></noinclude>
10948 |c</noinclude></includeonly>
10949 |d</includeonly></includeonly>
10950 |}
10951 !! html
10952 <table>
10953 <tr>
10954 <td>a
10955 </td>
10956 <td>b
10957 </td>
10958 <td>c&lt;/includeonly&gt;
10959 </td>
10960 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10961 </td></tr></table>
10962
10963 !!end
10964
10965 !! article
10966 Template:Includeonly section
10967 !! text
10968 <includeonly>
10969 ==Includeonly section==
10970 </includeonly>
10971 ==Section T-1==
10972 !!endarticle
10973
10974 !! test
10975 Bug 6563: Edit link generation for section shown by <includeonly>
10976 !! wikitext
10977 {{includeonly section}}
10978 !! html
10979 <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>
10980 <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>
10981
10982 !! end
10983
10984 # Uses same input as the contents of [[Template:Includeonly section]]
10985 !! test
10986 Bug 6563: Section extraction for section shown by <includeonly>
10987 !! options
10988 section=T-2
10989 !! wikitext
10990 <includeonly>
10991 ==Includeonly section==
10992 </includeonly>
10993 ==Section T-2==
10994 !! html
10995 ==Section T-2==
10996 !! end
10997
10998 !! test
10999 Bug 6563: Edit link generation for section suppressed by <includeonly>
11000 !! wikitext
11001 <includeonly>
11002 ==Includeonly section==
11003 </includeonly>
11004 ==Section 1==
11005 !! html
11006 <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>
11007
11008 !! end
11009
11010 !! test
11011 Bug 6563: Section extraction for section suppressed by <includeonly>
11012 !! options
11013 section=1
11014 !! wikitext
11015 <includeonly>
11016 ==Includeonly section==
11017 </includeonly>
11018 ==Section 1==
11019 !! html
11020 ==Section 1==
11021 !! end
11022
11023 !! test
11024 Un-closed <includeonly>
11025 !! wikitext
11026 <includeonly>
11027 !! html/php
11028 !! html/parsoid
11029 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11030 !! end
11031
11032 ## We used to, but no longer wt2wt this test since the default serializer
11033 ## will normalize the include directives to serialize on their own line.
11034 ## Selser will take care of preserving formatting in scenarios where they
11035 ## intermingled with other wikitext.
11036 !! test
11037 Includes and comments at SOL
11038 !! options
11039 parsoid=wt2html,html2html
11040 !! wikitext
11041 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11042
11043 <noinclude>
11044 some
11045 </noinclude>* stuff
11046 * here
11047
11048 <includeonly>can have stuff</includeonly>=== here ===
11049
11050 !! html/php
11051 <h2><span class="mw-headline" id="hu">hu</span></h2>
11052 <p>some
11053 </p>
11054 <ul><li> stuff</li>
11055 <li> here</li></ul>
11056 <h3><span class="mw-headline" id="here">here</span></h3>
11057
11058 !! html/parsoid
11059 <!-- 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>
11060
11061 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11062 <p>some</p>
11063 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11064 <li> here</li></ul>
11065
11066 <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>
11067
11068 !! end
11069
11070 # TODO: test with DOM fragment reuse!
11071 !! test
11072 Parsoid: DOM fragment reuse
11073 !! options
11074 parsoid=wt2wt,wt2html
11075 !! wikitext
11076 a{{echo|b<table></table>c}}d
11077
11078 a{{echo|b
11079 <table></table>
11080 c}}d
11081
11082 {{echo|a
11083
11084 <table></table>
11085
11086 b}}
11087 !! html
11088 <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"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11089
11090 <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"}]]}'>ab</p><span about="#mwt2">
11091 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11092 </span><p about="#mwt2">cd</p>
11093
11094 <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"}]]}'>a</p><span about="#mwt3">
11095
11096 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11097
11098 </span><p about="#mwt3">b</p>
11099 !! end
11100
11101 !! test
11102 Parsoid: Merge double tds (T52603)
11103 !! options
11104 parsoid
11105 !! wikitext
11106 {|
11107 |{{echo|{{!}} foo}}
11108 |}
11109 !! html
11110 <table><tbody>
11111 <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>
11112 </tbody></table>
11113 !! end
11114
11115 !! test
11116 Parsoid: Merge double tds in nested transclusion content (T52603)
11117 !! options
11118 parsoid
11119 !! wikitext
11120 {{echo|<div>}}
11121 {|
11122 |{{echo|{{!}} foo}}
11123 |}
11124 {{echo|</div>}}
11125 !! html
11126 <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}}]}'>
11127 <table><tbody>
11128 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11129 </tbody></table>
11130 </div>
11131 !! end
11132
11133 ###
11134 ### <includeonly> and <noinclude> in attributes
11135 ###
11136 !!test
11137 0. includeonly around the entire attribute
11138 !! wikitext
11139 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11140 !! html
11141 <p><span id="v2">bar</span>
11142 </p>
11143 !!end
11144
11145 !!test
11146 1. includeonly in html attr key
11147 !! wikitext
11148 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11149 !! html
11150 <p><span id="foo">bar</span>
11151 </p>
11152 !!end
11153
11154 !!test
11155 2. includeonly in html attr value
11156 !! wikitext
11157 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11158 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11159 !! html
11160 <p><span id="v1">bar</span>
11161 <span id="v1">bar</span>
11162 </p>
11163 !!end
11164
11165 !!test
11166 3. includeonly in part of an attr value
11167 !! wikitext
11168 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11169 !! html
11170 <p><span style="color:red;">bar</span>
11171 </p>
11172 !!end
11173
11174 !!test
11175 4. includeonly in table attributes
11176 !! wikitext
11177 {|
11178 |- <noinclude>
11179 |-
11180 |a
11181 </noinclude>
11182 |- <includeonly>
11183 |-
11184 |b
11185 </includeonly>
11186 |}
11187 !! html
11188 <table>
11189
11190
11191 <tr>
11192 <td>a
11193 </td></tr>
11194 </table>
11195
11196 !!end
11197
11198 ###
11199 ### Token Stream Patcher tests
11200 ###
11201 ### These tests won't always pass wt2wt and other modes because
11202 ### on serialization, the table will be output on a new line.
11203 ### For now, we are blacklisting them, and using this to test selser.
11204 ###
11205
11206 !!test
11207 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11208 !!options
11209 parsoid=wt2html,wt2wt
11210 !!wikitext
11211 {{echo|}}{| width = '100%'
11212 |foo
11213 |}
11214 !!html/parsoid
11215 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11216 <tbody><tr><td>foo</td></tr>
11217 </tbody></table>
11218 !!end
11219
11220 ## We used to, but no longer wt2wt this test since the default serializer
11221 ## will normalize the include directives to serialize on their own line.
11222 ## Selser will take care of preserving formatting in scenarios where they
11223 ## intermingled with other wikitext.
11224 !!test
11225 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11226 !!options
11227 parsoid=wt2html
11228 !!wikitext
11229 <includeonly>a</includeonly>{| {{{b}}}
11230 |c
11231 |}
11232 !!html/parsoid
11233 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11234 <tbody><tr><td>c</td></tr>
11235 </tbody></table>
11236 !!end
11237
11238 ###
11239 ### Testing parsing of templates where a template arg
11240 ### has the same name as the template itself.
11241 ###
11242
11243 !! article
11244 Template:quote
11245 !! text
11246 {{{quote|{{{1}}}}}}
11247 !! endarticle
11248
11249 !!test
11250 Templates: Template Name/Arg clash: 1. Use of positional param
11251 !! wikitext
11252 {{quote|foo}}
11253 !! html
11254 <p>foo
11255 </p>
11256 !!end
11257
11258 !!test
11259 Templates: Template Name/Arg clash: 2. Use of named param
11260 !! wikitext
11261 {{quote|quote=foo}}
11262 !! html
11263 <p>foo
11264 </p>
11265 !!end
11266
11267 !!test
11268 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11269 !! wikitext
11270 {{quote|quote}}
11271 !! html
11272 <p>quote
11273 </p>
11274 !!end
11275
11276 ###
11277 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11278 ###
11279
11280 !!test
11281 Templates: 1. Simple use
11282 !! wikitext
11283 {{echo|Foo}}
11284 !! html
11285 <p>Foo
11286 </p>
11287 !!end
11288
11289 !!test
11290 Templates: 2. Inside a block tag
11291 !! wikitext
11292 <div>{{echo|Foo}}</div>
11293 <blockquote>{{echo|Foo}}</blockquote>
11294 !! html
11295 <div>Foo</div>
11296 <blockquote>Foo</blockquote>
11297
11298 !! html+tidy
11299 <div>Foo</div>
11300 <blockquote>
11301 <p>Foo</p>
11302 </blockquote>
11303 !!end
11304
11305 !!test
11306 Templates: P-wrapping: 1a. Templates on consecutive lines
11307 !! wikitext
11308 {{echo|Foo}}
11309 {{echo|bar}}
11310 !! html
11311 <p>Foo
11312 bar
11313 </p>
11314 !!end
11315
11316 !!test
11317 Templates: P-wrapping: 1b. Templates on consecutive lines
11318 !! wikitext
11319 Foo
11320
11321 {{echo|bar}}
11322 {{echo|baz}}
11323 !! html
11324 <p>Foo
11325 </p><p>bar
11326 baz
11327 </p>
11328 !!end
11329
11330 !!test
11331 Templates: P-wrapping: 1c. Templates on consecutive lines
11332 !! wikitext
11333 {{echo|Foo}}
11334 {{echo|bar}} <div>baz</div>
11335 !! html
11336 <p>Foo
11337 </p>
11338 bar <div>baz</div>
11339
11340 !! html+tidy
11341 <p>Foo</p>
11342 <p>bar</p>
11343 <div>baz</div>
11344 !! end
11345
11346 !!test
11347 Templates: P-wrapping: 1d. Template preceded by comment-only line
11348 !!options
11349 parsoid
11350 !! wikitext
11351 <!-- foo -->
11352 {{echo|Bar}}
11353 !! html
11354 <!-- foo -->
11355
11356 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11357 !!end
11358
11359 !!test
11360 Templates: Inline Text: 1. Multiple template uses
11361 !! wikitext
11362 {{echo|Foo}}bar{{echo|baz}}
11363 !! html
11364 <p>Foobarbaz
11365 </p>
11366 !!end
11367
11368 !!test
11369 Templates: Inline Text: 2. Back-to-back template uses
11370 !! wikitext
11371 {{echo|Foo}}{{echo|bar}}
11372 !! html
11373 <p>Foobar
11374 </p>
11375 !!end
11376
11377 !!test
11378 Templates: Block Tags: 1. Multiple template uses
11379 !! wikitext
11380 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11381 !! html
11382 <div>Foo</div><div>bar</div><div>baz</div>
11383
11384 !!end
11385
11386 !!test
11387 Templates: Block Tags: 2. Back-to-back template uses
11388 !! wikitext
11389 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11390 !! html
11391 <div>Foo</div><div>bar</div>
11392
11393 !!end
11394
11395 # This is an edge case relating to paragraph wrapping.
11396 !!test
11397 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11398 !! wikitext
11399 {{echo|a
11400 b</p>}}
11401 !! html/parsoid
11402 <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
11403 b</p>
11404 !!end
11405
11406 !!test
11407 Templates: Links: 1. Simple example
11408 !! wikitext
11409 {{echo|[[Foo|bar]]}}
11410 !! html
11411 <p><a href="/wiki/Foo" title="Foo">bar</a>
11412 </p>
11413 !!end
11414
11415 !!test
11416 Templates: Links: 2. Generation of link href
11417 !! wikitext
11418 [[{{echo|Foo}}|bar]]
11419 !! html
11420 <p><a href="/wiki/Foo" title="Foo">bar</a>
11421 </p>
11422 !!end
11423
11424 !!test
11425 Templates: Links: 3. Generation of part of a link href
11426 !! wikitext
11427 [[Fo{{echo|o}}|bar]]
11428
11429 [[Foo{{echo|bar}}]]
11430
11431 [[Foo{{echo|bar}}baz]]
11432
11433 [[Foo{{echo|bar}}|bar]]
11434
11435 [[:Foo{{echo|bar}}]]
11436
11437 [[:Foo{{echo|bar}}|bar]]
11438 !! html
11439 <p><a href="/wiki/Foo" title="Foo">bar</a>
11440 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11441 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11442 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11443 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11444 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11445 </p>
11446 !!end
11447
11448 !!test
11449 Templates: Links: 4. Multiple templates generating link href
11450 !! wikitext
11451 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11452 !! html
11453 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11454 </p>
11455 !!end
11456
11457 !!test
11458 Templates: Links: 5. Generation of link text
11459 !! wikitext
11460 [[Foo|{{echo|bar}}]]
11461 !! html
11462 <p><a href="/wiki/Foo" title="Foo">bar</a>
11463 </p>
11464 !!end
11465
11466 !!test
11467 Templates: Links: 5. Nested templates (only outermost template should be marked)
11468 !! wikitext
11469 {{echo|[[{{echo|Foo}}|bar]]}}
11470 !! html
11471 <p><a href="/wiki/Foo" title="Foo">bar</a>
11472 </p>
11473 !!end
11474
11475 !!test
11476 Templates: HTML Tag: 1. Generation of HTML attr. key
11477 !! wikitext
11478 <div {{echo|style}}="color:red;">foo</div>
11479 !! html
11480 <div style="color:red;">foo</div>
11481
11482 !!end
11483
11484 !!test
11485 Templates: HTML Tag: 2. Generation of HTML attr. value
11486 !! wikitext
11487 <div style={{echo|'color:red;'}}>foo</div>
11488 !! html
11489 <div style="color:red;">foo</div>
11490
11491 !!end
11492
11493 !!test
11494 Templates: HTML Tag: 3. Generation of HTML attr key and value
11495 !! wikitext
11496 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11497 !! html
11498 <div style="color:red;">foo</div>
11499
11500 !!end
11501
11502 !!test
11503 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11504 !! wikitext
11505 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11506 !! html
11507 <div title="This is a long title with just one piece templated">foo</div>
11508
11509 !!end
11510
11511 !!test
11512 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11513 !! wikitext
11514 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11515 !! html
11516 <div title="This is a long title with just one piece templated">foo</div>
11517
11518 !!end
11519
11520 !!test
11521 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11522 !! wikitext
11523 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11524 !! html
11525 <div title="This is a long title with just one piece templated">foo</div>
11526
11527 !!end
11528
11529 # SSS FIXME: While it is great we added support for all this,
11530 # do we want to make this part of the spec? Maybe we want to
11531 # deprecate this kind of usage in the future?
11532 !!test
11533 Templates: HTML Tag: 7. Generation of partial attribute key string
11534 !! wikitext
11535 <div st{{echo|yle}}="color:red;">foo</div>
11536 !! html
11537 <div style="color:red;">foo</div>
11538
11539 !!end
11540
11541 !! test
11542 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11543 !! wikitext
11544 <div {{echo|1=id="v1"}}>bar</div>
11545 !! html
11546 <div id="v1">bar</div>
11547
11548 !!end
11549
11550 !! test
11551 Templates: HTML Tag: 9. Multiple template-generated attributes
11552 !! wikitext
11553 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11554 !! html
11555 <div id="v1" title="foo">bar</div>
11556
11557 !!end
11558
11559 !! test
11560 Templates: Support for templates generating attributes and content
11561 !! wikitext
11562 {| {{mixed_attr_content_template}}
11563 |-
11564 |bar
11565 |}
11566 !! html/php
11567 <table style="color:red;" title="T48811">
11568
11569 <tr>
11570 <td>foo
11571 </td></tr>
11572 <tr>
11573 <td>bar
11574 </td></tr></table>
11575
11576 !! html/parsoid
11577 <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|}"]}'>
11578 <tbody><tr>
11579 <td>foo</td></tr>
11580 <tr>
11581 <td>bar</td></tr>
11582 </tbody></table>
11583 !!end
11584
11585 !! test
11586 1. Entities and nowikis inside templated attributes should be handled correctly
11587 !! wikitext
11588 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11589 !! html/php
11590 <div style="background:#f9f9f9;">foo</div>
11591
11592 !! html/parsoid
11593 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>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=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11594 !! end
11595
11596 !! test
11597 2. Entities and nowikis inside templated attributes should be handled correctly
11598 !! wikitext
11599 {|
11600 |{{table_attribs_3}}
11601 |}
11602 !! html/php
11603 <table>
11604 <tr>
11605 <td style="background:#f9f9f9;">Foo
11606 </td></tr></table>
11607
11608 !! html/parsoid
11609 <table>
11610 <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>
11611 </tbody></table>
11612 !! end
11613
11614 !! test
11615 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11616 !! wikitext
11617 {{tbl-start}}
11618 |{{table_attribs_3}}
11619 {{tbl-end}}
11620 !! html/php
11621 <table>
11622 <tr>
11623 <td style="background:#f9f9f9;">Foo
11624 </td></tr></table>
11625
11626 !! html/parsoid
11627 <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}}]}'>
11628 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11629 </tbody></table>
11630 !! end
11631
11632 # T107622
11633 !! test
11634 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11635 !! wikitext
11636 {|
11637 | {{table_attribs_6}} hi
11638 |}
11639 !! html/php
11640 <table>
11641 <tr>
11642 <td style="background: red;"> hi
11643 </td></tr></table>
11644
11645 !! html/parsoid
11646 <table>
11647 <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>
11648 </tbody></table>
11649 !! end
11650
11651 !!test
11652 Templates: HTML Tables: 1. Generating start of a HTML table
11653 !! wikitext
11654 {{echo|<table><tr><td>foo</td>}}</tr></table>
11655 !! html
11656 <table><tr><td>foo</td></tr></table>
11657
11658 !!end
11659
11660 !!test
11661 Templates: HTML Tables: 2a. Generating middle of a HTML table
11662 !! wikitext
11663 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11664 !! html
11665 <table><tr><td>foo</td></tr></table>
11666
11667 !!end
11668
11669 !!test
11670 Templates: HTML Tables: 2b. Generating middle of a HTML table
11671 !! wikitext
11672 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11673 !! html
11674 <table><tr><td>foo</td></tr></table>
11675
11676 !!end
11677
11678 !!test
11679 Templates: HTML Tables: 3. Generating end of a HTML table
11680 !! wikitext
11681 <table><tr>{{echo|<td>foo</td></tr></table>}}
11682 !! html
11683 <table><tr><td>foo</td></tr></table>
11684
11685 !!end
11686
11687 !!test
11688 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11689 !! wikitext
11690 {{echo|<table>}}<tr><td>foo</td></tr></table>
11691 !! html
11692 <table><tr><td>foo</td></tr></table>
11693
11694 !!end
11695
11696 !!test
11697 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11698 !! wikitext
11699 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11700 !! html
11701 <table><tr><td>foo</td></tr></table>
11702
11703 !!end
11704
11705 !!test
11706 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11707 !! wikitext
11708 <table><tr>{{echo|<td>}}foo</td></tr></table>
11709 !! html
11710 <table><tr><td>foo</td></tr></table>
11711
11712 !!end
11713
11714 !!test
11715 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11716 !! wikitext
11717 <table><tr><td>foo{{echo|</td>}}</tr></table>
11718 !! html
11719 <table><tr><td>foo</td></tr></table>
11720
11721 !!end
11722
11723 !!test
11724 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11725 !! wikitext
11726 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11727 !! html
11728 <table><tr><td>foo</td></tr></table>
11729
11730 !!end
11731
11732 !!test
11733 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11734 !! wikitext
11735 <table><tr><td>foo</td></tr>{{echo|</table>}}
11736 !! html
11737 <table><tr><td>foo</td></tr></table>
11738
11739 !!end
11740
11741 !!test
11742 Templates: HTML Tables: 5. Proper fostering of categories from inside
11743 !!options
11744 parsoid=wt2html,wt2wt
11745 !! wikitext
11746 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11747 <!--Two categories (Bug 50330)-->
11748 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11749 !! html
11750 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11751 <!--Two categories (Bug 50330)-->
11752 <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>
11753 !!end
11754
11755 !!test
11756 Templates: Wiki Tables: 1a. Fostering of entire template content
11757 !! wikitext
11758 {|
11759 {{echo|a}}
11760 |}
11761 !! html
11762 <table>
11763 a
11764 <tr><td></td></tr></table>
11765
11766 !! html+tidy
11767 <p>a</p>
11768 <table>
11769 <tr>
11770 <td></td>
11771 </tr>
11772 </table>
11773 !! end
11774
11775 !!test
11776 Templates: Wiki Tables: 1b. Fostering of entire template content
11777 !! wikitext
11778 {|
11779 {{echo|<div>}}
11780 foo
11781 {{echo|</div>}}
11782 |}
11783 !! html
11784 <table>
11785 <div>
11786 <p>foo
11787 </p>
11788 </div>
11789 <tr><td></td></tr></table>
11790
11791 !! html+tidy
11792 <div>
11793 <p>foo</p>
11794 </div>
11795 <table>
11796 <tr>
11797 <td></td>
11798 </tr>
11799 </table>
11800 !! end
11801
11802 !!test
11803 Templates: Wiki Tables: 2. Fostering of partial template content
11804 !! wikitext
11805 {|
11806 {{echo|a
11807 <div>b</div>}}
11808 |}
11809 !! html
11810 <table>
11811 a
11812 <div>b</div>
11813 <tr><td></td></tr></table>
11814
11815 !! html+tidy
11816 <p>a</p>
11817 <div>b</div>
11818 <table>
11819 <tr>
11820 <td></td>
11821 </tr>
11822 </table>
11823 !! end
11824
11825 !!test
11826 Templates: Wiki Tables: 3. td-content via multiple templates
11827 !! wikitext
11828 {|
11829 {{echo|{{pipe}}a}}{{echo|b}}
11830 |}
11831 !! html
11832 <table>
11833 <tr>
11834 <td>ab
11835 </td></tr></table>
11836
11837 !!end
11838
11839 !!test
11840 Templates: Wiki Tables: 4. Templated tags, no content
11841 !! wikitext
11842 {{tbl-start}}
11843 {{tbl-end}}
11844 !! html
11845 <table>
11846 <tr><td></td></tr></table>
11847
11848 !!end
11849
11850 !!test
11851 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11852 !! wikitext
11853 {{tbl-start}}
11854 |foo
11855 {{tbl-end}}
11856 !! html
11857 <table>
11858 <tr>
11859 <td>foo
11860 </td></tr></table>
11861
11862 !!end
11863
11864 !!test
11865 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11866 !! wikitext
11867 {{tbl-start}}
11868 {{!}}foo
11869 {{tbl-end}}
11870 !! html
11871 <table>
11872 <tr>
11873 <td>foo
11874 </td></tr></table>
11875
11876 !!end
11877
11878 ## This test case is very specific to Parsoid's internals
11879 ## and is hence only tested for Parsoid's code. Parsoid uses
11880 ## a <meta> marker tag for <ref> tags and they are expanded
11881 ## much later. We are verifying that this <meta> tag usage
11882 ## doesn't prevent foster parenting.
11883 !!test
11884 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11885 !!wikitext
11886 {{PartialTable}}<ref>foo</ref>
11887 |}
11888
11889 <references />
11890 !!html/parsoid
11891 <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">
11892 <tbody>
11893 </tbody></table>
11894
11895 <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>
11896 !!end
11897
11898 !! test
11899 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11900 !! wikitext
11901 {{echo|
11902 {{{!}}
11903 {{!}}-}}
11904 <onlyinclude>
11905 |foo
11906 </onlyinclude>
11907 {{!}}}
11908 !! html/parsoid
11909 <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{{!}}}"]}'>
11910 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11911 <tbody><tr>
11912
11913 <td>foo
11914 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11915 </tbody></table>
11916 !! end
11917
11918 !!test
11919 Templates: Lists: Multi-line list-items via templates
11920 !! wikitext
11921 *{{echo|a {{nonexistent|
11922 unused}}}}
11923 *{{echo|b {{nonexistent|
11924 unused}}}}
11925 !! html
11926 <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>
11927 <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>
11928
11929 !!end
11930
11931 !!test
11932 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11933 !! wikitext
11934 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11935 !! html
11936 <p><i>ab</i>c<i>d</i>e
11937 </p>
11938 !!end
11939
11940 !!test
11941 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11942 (PHP parser generates misnested html)
11943 !! wikitext
11944 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11945 !! html/parsoid
11946 <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>
11947 !!end
11948
11949 !!test
11950 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11951 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11952 !! options
11953 parsoid=wt2html,wt2wt
11954 !! wikitext
11955 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11956 !! html
11957 <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>
11958 <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>
11959 <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>
11960 !!end
11961
11962 !!test
11963 Templates: Ugly nesting: 4. Divs opened/closed across templates
11964 !! wikitext
11965 a<div>b{{echo|c</div>d}}e
11966 !! html
11967 a<div>bc</div>de
11968
11969 !! html+tidy
11970 <p>a</p>
11971 <div>bc</div>
11972 <p>de</p>
11973 !! end
11974
11975 !!test
11976 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11977 (Parsoid-centric)
11978 !! options
11979 parsoid
11980 !! wikitext
11981 {|
11982 |{{echo|foo</table>}}
11983 |bar
11984 |}
11985 !! html
11986 <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|}"]}'>
11987
11988 <tbody>
11989 <tr>
11990 <td>foo</td></tr></tbody></table><span about="#mwt1">
11991 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11992 |}</span>
11993 !!end
11994
11995 !!test
11996 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11997 (Parsoid-centric)
11998 !! options
11999 parsoid
12000 !! wikitext
12001 <table>
12002 <tr>
12003 <td>
12004 <table>
12005 <tr>
12006 <td>1. {{echo|foo </table>}}</td>
12007 <td> bar </td>
12008 <td>2. {{echo|baz </table>}}</td>
12009 </tr>
12010 <tr>
12011 <td>abc</td>
12012 </tr>
12013 </table>
12014 </td>
12015 </tr>
12016 <tr>
12017 <td>xyz</td>
12018 </tr>
12019 </table>
12020 !! html
12021 <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>"]}'>
12022 <tbody><tr>
12023 <td>
12024 <table>
12025 <tbody><tr>
12026 <td>1. foo </td></tr></tbody></table></td>
12027 <td> bar </td>
12028 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12029 </span><span about="#mwt2">
12030 </span><span about="#mwt2">
12031 </span><span about="#mwt2">abc</span><span about="#mwt2">
12032 </span><span about="#mwt2">
12033 </span><span about="#mwt2">
12034 </span><span about="#mwt2">
12035 </span><span about="#mwt2">
12036 </span><span about="#mwt2">
12037 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12038 </span><span about="#mwt2">
12039 </span>
12040 !!end
12041
12042 !! test
12043 Templates: Ugly templates: 3. newline-only template parameter
12044 !! wikitext
12045 foo {{echo|
12046 }}
12047 !! html
12048 <p>foo
12049 </p>
12050 !! end
12051
12052 # This looks like a bug: a single newline triggers p/br for some reason.
12053 !! test
12054 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12055 !! wikitext
12056 {{echo|
12057 }}
12058 !! html
12059 <p><br />
12060 </p>
12061 !! end
12062
12063 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12064 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12065 !! test
12066 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12067 !! wikitext
12068 {{echo|<table>}}
12069 {{echo|<div>foo}}
12070 {{echo|</table>}}
12071 !! html/parsoid
12072 <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"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12073 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12074 </table>
12075 !! end
12076
12077 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12078 # that are "identical" and generate nesting cycles in the algorithm
12079 !! test
12080 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12081 !! wikitext
12082 {{echo|<table><tr><td><table>}}
12083 {{echo|<div>}}
12084 {{echo|</div>}}
12085 !! html/parsoid
12086 <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"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12087 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12088 </table></td></tr></tbody></table>
12089 !! end
12090
12091 !! test
12092 Templates: Parameters substituted at the top-level
12093 !! wikitext
12094 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12095 !! html/php
12096 <p><i>who</i> me? <b>never!</b>
12097 </p>
12098 !! html/parsoid
12099 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12100 !! end
12101
12102 !!test
12103 Parser Functions: 1. Simple example
12104 !! wikitext
12105 {{uc:foo}}
12106 !! html
12107 <p>FOO
12108 </p>
12109 !!end
12110
12111 !!test
12112 Parser Functions: 2. Nested use (only outermost should be marked up)
12113 !! wikitext
12114 {{uc:{{lc:FOO}}}}
12115 !! html
12116 <p>FOO
12117 </p>
12118 !!end
12119
12120 ###
12121 ### Pre-save transform tests
12122 ###
12123 !! test
12124 pre-save transform: subst:
12125 !! options
12126 pst
12127 !! wikitext
12128 {{subst:test}}
12129 !! html/php
12130 This is a test template
12131 !! end
12132
12133 !! test
12134 pre-save transform: normal template
12135 !! options
12136 pst
12137 !! wikitext
12138 {{test}}
12139 !! html/php
12140 {{test}}
12141 !! end
12142
12143 !! test
12144 pre-save transform: nonexistent template
12145 !! options
12146 pst
12147 !! wikitext
12148 {{thistemplatedoesnotexist}}
12149 !! html/php
12150 {{thistemplatedoesnotexist}}
12151 !! end
12152
12153 !! test
12154 pre-save transform: subst magic variables
12155 !! options
12156 pst
12157 !! wikitext
12158 {{subst:SITENAME}}
12159 !! html/php
12160 MediaWiki
12161 !! end
12162
12163 # This is bug 89, which I fixed. -- wtm
12164 !! test
12165 pre-save transform: subst: templates with parameters
12166 !! options
12167 pst
12168 !! wikitext
12169 {{subst:paramtest|param="something else"}}
12170 !! html/php
12171 This is a test template with parameter "something else"
12172 !! end
12173
12174 !! article
12175 Template:nowikitest
12176 !! text
12177 <nowiki>'''not wiki'''</nowiki>
12178 !! endarticle
12179
12180 !! test
12181 pre-save transform: nowiki in subst (bug 1188)
12182 !! options
12183 pst
12184 !! wikitext
12185 {{subst:nowikitest}}
12186 !! html/php
12187 <nowiki>'''not wiki'''</nowiki>
12188 !! end
12189
12190 !! article
12191 Template:commenttest
12192 !! text
12193 This template has <!-- a comment --> in it.
12194 !! endarticle
12195
12196 !! test
12197 pre-save transform: comment in subst (bug 1936)
12198 !! options
12199 pst
12200 !! wikitext
12201 {{subst:commenttest}}
12202 !! html/php
12203 This template has <!-- a comment --> in it.
12204 !! end
12205
12206 !! test
12207 pre-save transform: unclosed tag
12208 !! options
12209 pst
12210 !! wikitext
12211 <nowiki>'''not wiki'''
12212 !! html/php
12213 <nowiki>'''not wiki'''
12214 !! end
12215
12216 !! test
12217 pre-save transform: mixed tag case
12218 !! options
12219 pst
12220 !! wikitext
12221 <NOwiki>'''not wiki'''</noWIKI>
12222 !! html/php
12223 <NOwiki>'''not wiki'''</noWIKI>
12224 !! end
12225
12226 !! test
12227 pre-save transform: unclosed comment in <nowiki>
12228 !! options
12229 pst
12230 !! wikitext
12231 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12232 !! html/php
12233 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12234 !!end
12235
12236 # Leading @ in this template definition works around a limitation
12237 # in parsoid's parserTests which otherwise strips the <span> from the
12238 # result (confusing it for a template wrapper)
12239 !! article
12240 Template:dangerous
12241 !!text
12242 @<span onmouseover="alert('crap')">Oh no</span>
12243 !!endarticle
12244
12245 !!test
12246 (confirming safety of fix for subst bug 1936)
12247 !! wikitext
12248 {{Template:dangerous}}
12249 !! html
12250 <p>@<span>Oh no</span>
12251 </p>
12252 !! end
12253
12254 !! test
12255 pre-save transform: comment containing gallery (bug 5024)
12256 !! options
12257 pst
12258 !! wikitext
12259 <!-- <gallery>data</gallery> -->
12260 !! html/php
12261 <!-- <gallery>data</gallery> -->
12262 !!end
12263
12264 !! test
12265 pre-save transform: comment containing extension
12266 !! options
12267 pst
12268 !! wikitext
12269 <!-- <tag>data</tag> -->
12270 !! html/php
12271 <!-- <tag>data</tag> -->
12272 !!end
12273
12274 !! test
12275 pre-save transform: comment containing nowiki
12276 !! options
12277 pst
12278 !! wikitext
12279 <!-- <nowiki>data</nowiki> -->
12280 !! html/php
12281 <!-- <nowiki>data</nowiki> -->
12282 !!end
12283
12284 !! test
12285 pre-save transform: <noinclude> in subst (bug 3298)
12286 !! options
12287 pst
12288 !! wikitext
12289 {{subst:Includes}}
12290 !! html/php
12291 Foobar
12292 !! end
12293
12294 !! test
12295 pre-save transform: <onlyinclude> in subst (bug 3298)
12296 !! options
12297 pst
12298 !! wikitext
12299 {{subst:Includes2}}
12300 !! html/php
12301 Foo
12302 !! end
12303
12304 !! article
12305 Template:SubstTest
12306 !!text
12307 {{<includeonly>subst:</includeonly>Includes}}
12308 !! endarticle
12309
12310 !! article
12311 Template:SafeSubstTest
12312 !! text
12313 {{<includeonly>safesubst:</includeonly>Includes}}
12314 !! endarticle
12315
12316 !! test
12317 bug 22297: safesubst: works during PST
12318 !! options
12319 pst
12320 !! wikitext
12321 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12322 !! html/php
12323 FoobarFoobar
12324 !! end
12325
12326 !! test
12327 bug 22297: safesubst: works during normal parse
12328 !! wikitext
12329 {{SafeSubstTest}}
12330 !! html
12331 <p>Foobar
12332 </p>
12333 !! end
12334
12335 !! test
12336 subst: does not work during normal parse
12337 !! wikitext
12338 {{SubstTest}}
12339 !! html
12340 <p>{{subst:Includes}}
12341 </p>
12342 !! end
12343
12344 !! test
12345 pre-save transform: context links ("pipe trick")
12346 !! options
12347 pst
12348 !! wikitext
12349 [[Article (context)|]]
12350 [[Bar:Article|]]
12351 [[:Bar:Article|]]
12352 [[Bar:Article (context)|]]
12353 [[:Bar:Article (context)|]]
12354 [[|Article]]
12355 [[|Article (context)]]
12356 [[Bar:X (Y) Z|]]
12357 [[:Bar:X (Y) Z|]]
12358 !! html/php
12359 [[Article (context)|Article]]
12360 [[Bar:Article|Article]]
12361 [[:Bar:Article|Article]]
12362 [[Bar:Article (context)|Article]]
12363 [[:Bar:Article (context)|Article]]
12364 [[Article]]
12365 [[Article (context)]]
12366 [[Bar:X (Y) Z|X (Y) Z]]
12367 [[:Bar:X (Y) Z|X (Y) Z]]
12368 !! end
12369
12370 !! test
12371 pre-save transform: context links ("pipe trick") with interwiki prefix
12372 !! options
12373 pst
12374 !! wikitext
12375 [[interwiki:Article|]]
12376 [[:interwiki:Article|]]
12377 [[interwiki:Bar:Article|]]
12378 [[:interwiki:Bar:Article|]]
12379 !! html/php
12380 [[interwiki:Article|Article]]
12381 [[:interwiki:Article|Article]]
12382 [[interwiki:Bar:Article|Bar:Article]]
12383 [[:interwiki:Bar:Article|Bar:Article]]
12384 !! end
12385
12386 !! test
12387 pre-save transform: context links ("pipe trick") with parens in title
12388 !! options
12389 pst title=[[Somearticle (context)]]
12390 !! wikitext
12391 [[|Article]]
12392 !! html/php
12393 [[Article (context)|Article]]
12394 !! end
12395
12396 !! test
12397 pre-save transform: context links ("pipe trick") with comma in title
12398 !! options
12399 pst title=[[Someplace, Somewhere]]
12400 !! wikitext
12401 [[|Otherplace]]
12402 [[Otherplace, Elsewhere|]]
12403 [[Otherplace, Elsewhere, Anywhere|]]
12404 !! html/php
12405 [[Otherplace, Somewhere|Otherplace]]
12406 [[Otherplace, Elsewhere|Otherplace]]
12407 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12408 !! end
12409
12410 !! test
12411 pre-save transform: context links ("pipe trick") with parens and comma
12412 !! options
12413 pst title=[[Someplace (IGNORED), Somewhere]]
12414 !! wikitext
12415 [[|Otherplace]]
12416 [[Otherplace (place), Elsewhere|]]
12417 !! html/php
12418 [[Otherplace, Somewhere|Otherplace]]
12419 [[Otherplace (place), Elsewhere|Otherplace]]
12420 !! end
12421
12422 !! test
12423 pre-save transform: context links ("pipe trick") with comma and parens
12424 !! options
12425 pst title=[[Who, me? (context)]]
12426 !! wikitext
12427 [[|Yes, you.]]
12428 [[Me, Myself, and I (1937 song)|]]
12429 !! html/php
12430 [[Yes, you. (context)|Yes, you.]]
12431 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12432 !! end
12433
12434 !! test
12435 pre-save transform: context links ("pipe trick") with namespace
12436 !! options
12437 pst title=[[Ns:Somearticle]]
12438 !! wikitext
12439 [[|Article]]
12440 !! html/php
12441 [[Ns:Article|Article]]
12442 !! end
12443
12444 !! test
12445 pre-save transform: context links ("pipe trick") with namespace and parens
12446 !! options
12447 pst title=[[Ns:Somearticle (context)]]
12448 !! wikitext
12449 [[|Article]]
12450 !! html/php
12451 [[Ns:Article (context)|Article]]
12452 !! end
12453
12454 !! test
12455 pre-save transform: context links ("pipe trick") with namespace and comma
12456 !! options
12457 pst title=[[Ns:Somearticle, Context, Whatever]]
12458 !! wikitext
12459 [[|Article]]
12460 !! html/php
12461 [[Ns:Article, Context, Whatever|Article]]
12462 !! end
12463
12464 !! test
12465 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12466 !! options
12467 pst title=[[Ns:Somearticle, Context (context)]]
12468 !! wikitext
12469 [[|Article]]
12470 !! html/php
12471 [[Ns:Article (context)|Article]]
12472 !! end
12473
12474 !! test
12475 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12476 !! options
12477 pst title=[[Ns:Somearticle (IGNORED), Context]]
12478 !! wikitext
12479 [[|Article]]
12480 !! html/php
12481 [[Ns:Article, Context|Article]]
12482 !! end
12483
12484 !! test
12485 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12486 !! options
12487 pst
12488 !! wikitext
12489 [[Article(context)|]]
12490 [[Bar:Article(context)|]]
12491 [[:Bar:Article(context)|]]
12492 [[|Article(context)]]
12493 [[Bar:X(Y)Z|]]
12494 [[:Bar:X(Y)Z|]]
12495 !! html/php
12496 [[Article(context)|Article]]
12497 [[Bar:Article(context)|Article]]
12498 [[:Bar:Article(context)|Article]]
12499 [[Article(context)]]
12500 [[Bar:X(Y)Z|X(Y)Z]]
12501 [[:Bar:X(Y)Z|X(Y)Z]]
12502 !! end
12503
12504 !! test
12505 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12506 !! options
12507 pst
12508 !! wikitext
12509 [[Article (context)|]]
12510 [[Bar:Article (context)|]]
12511 [[:Bar:Article (context)|]]
12512 [[|Article (context)]]
12513 [[Bar:X (Y) Z|]]
12514 [[:Bar:X (Y) Z|]]
12515 !! html/php
12516 [[Article (context)|Article]]
12517 [[Bar:Article (context)|Article]]
12518 [[:Bar:Article (context)|Article]]
12519 [[Article (context)]]
12520 [[Bar:X (Y) Z|X (Y) Z]]
12521 [[:Bar:X (Y) Z|X (Y) Z]]
12522 !! end
12523
12524 !! test
12525 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12526 !! options
12527 pst
12528 !! wikitext
12529 [[Article(context)|]]
12530 [[Bar:Article(context)|]]
12531 [[:Bar:Article(context)|]]
12532 [[|Article(context)]]
12533 [[Bar:X(Y)Z|]]
12534 [[:Bar:X(Y)Z|]]
12535 !! html/php
12536 [[Article(context)|Article]]
12537 [[Bar:Article(context)|Article]]
12538 [[:Bar:Article(context)|Article]]
12539 [[Article(context)]]
12540 [[Bar:X(Y)Z|X(Y)Z]]
12541 [[:Bar:X(Y)Z|X(Y)Z]]
12542 !! end
12543
12544 !! test
12545 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12546 !! options
12547 pst
12548 !! wikitext
12549 [[Article (context), context|]]
12550 [[Article (context),context|]]
12551 [[Bar:Article (context), context|]]
12552 [[Bar:Article (context),context|]]
12553 [[:Bar:Article (context), context|]]
12554 [[:Bar:Article (context),context|]]
12555 !! html/php
12556 [[Article (context), context|Article]]
12557 [[Article (context),context|Article]]
12558 [[Bar:Article (context), context|Article]]
12559 [[Bar:Article (context),context|Article]]
12560 [[:Bar:Article (context), context|Article]]
12561 [[:Bar:Article (context),context|Article]]
12562 !! end
12563
12564 !! test
12565 pre-save transform: trim trailing empty lines
12566 !! options
12567 pst
12568 !! wikitext
12569 Empty lines are trimmed
12570
12571
12572
12573
12574 !! html/php
12575 Empty lines are trimmed
12576 !! end
12577
12578 !! test
12579 pre-save transform: Signature expansion
12580 !! options
12581 pst
12582 !! wikitext
12583 * ~~~
12584 * <noinclude>~~~</noinclude>
12585 * <includeonly>~~~</includeonly>
12586 * <onlyinclude>~~~</onlyinclude>
12587 !! html/php
12588 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12589 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12590 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12591 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12592 !! end
12593
12594
12595 !! test
12596 pre-save transform: Signature expansion in nowiki tags (bug 93)
12597 !! options
12598 pst disabled
12599 !! wikitext
12600 Shall not expand:
12601
12602 <nowiki>~~~~</nowiki>
12603
12604 <includeonly><nowiki>~~~~</nowiki></includeonly>
12605
12606 <noinclude><nowiki>~~~~</nowiki></noinclude>
12607
12608 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12609
12610 {{subst:Foo}} shall be converted to FOO
12611
12612 As well as inside noinclude/onlyinclude
12613 <noinclude>{{subst:Foo}}</noinclude>
12614 <onlyinclude>{{subst:Foo}}</onlyinclude>
12615
12616 But not inside includeonly
12617 <includeonly>{{subst:Foo}}</includeonly>
12618 !! html/php
12619 Shall not expand:
12620
12621 <nowiki>~~~~</nowiki>
12622
12623 <includeonly><nowiki>~~~~</nowiki></includeonly>
12624
12625 <noinclude><nowiki>~~~~</nowiki></noinclude>
12626
12627 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12628
12629 FOO shall be converted to FOO
12630
12631 As well as inside noinclude/onlyinclude
12632 <noinclude>FOO</noinclude>
12633 <onlyinclude>FOO</onlyinclude>
12634
12635 But not inside includeonly
12636 <includeonly>{{subst:Foo}}</includeonly>
12637 !! end
12638
12639 !! test
12640 Parsoid: Recognize nowiki with trailing space in tags
12641 !! options
12642 parsoid=wt2html
12643 !! wikitext
12644 <nowiki ><div>[[foo]]</nowiki >
12645
12646 a<nowiki / >b
12647
12648 c<nowiki />d
12649
12650 e<nowiki/ >f
12651 !! html
12652 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12653 <p>ab</p>
12654 <p>cd</p>
12655 <p>ef</p>
12656 !! end
12657
12658 !! test
12659 Parsoid: Recognize nowiki with odd capitalization
12660 !! options
12661 parsoid=wt2html
12662 !! wikitext
12663 <noWikI ><div>[[foo]]</Nowiki >
12664 !! html
12665 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12666 !! end
12667
12668
12669 !! test
12670 Parsoid: Escape nowiki with trailing space in tags
12671 !! options
12672 parsoid=html2wt
12673 !! html/parsoid
12674 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12675 <p>a&lt;nowiki /&gt;b</p>
12676 <p>c&lt;nowiki/ &gt;d</p>
12677 !! wikitext
12678 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12679
12680 a&lt;nowiki /&gt;b
12681
12682 c&lt;nowiki/ &gt;d
12683 !! end
12684
12685 !! test
12686 Parsoid: Escape weird noWikI capitalizations
12687 !! options
12688 parsoid=html2wt
12689 !! html/parsoid
12690 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12691 !! wikitext
12692 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12693 !! end
12694
12695 ###
12696 ### Message transform tests
12697 ###
12698 !! test
12699 message transform: magic variables
12700 !! options
12701 msg
12702 !! wikitext
12703 {{SITENAME}}
12704 !! html
12705 MediaWiki
12706 !! end
12707
12708 !! test
12709 message transform: should not transform wiki markup
12710 !! options
12711 msg
12712 !! wikitext
12713 ''test''
12714 !! html
12715 ''test''
12716 !! end
12717
12718 !! test
12719 message transform: <noinclude> in transcluded template (bug 4926)
12720 !! options
12721 msg
12722 !! wikitext
12723 {{Includes}}
12724 !! html
12725 Foobar
12726 !! end
12727
12728 !! test
12729 message transform: <onlyinclude> in transcluded template (bug 4926)
12730 !! options
12731 msg
12732 !! wikitext
12733 {{Includes2}}
12734 !! html
12735 Foo
12736 !! end
12737
12738 !! test
12739 {{#special:}} page name, known
12740 !! options
12741 msg
12742 !! wikitext
12743 {{#special:Recentchanges}}
12744 !! html
12745 Special:RecentChanges
12746 !! end
12747
12748 !! test
12749 {{#special:}} page name with subpage, known
12750 !! options
12751 msg
12752 !! wikitext
12753 {{#special:Recentchanges/param}}
12754 !! html
12755 Special:RecentChanges/param
12756 !! end
12757
12758 !! test
12759 {{#special:}} page name, unknown
12760 !! options
12761 msg
12762 !! wikitext
12763 {{#special:foobar nonexistent}}
12764 !! html
12765 Special:Foobar nonexistent
12766 !! end
12767
12768 !! test
12769 {{#speciale:}} page name, known
12770 !! options
12771 msg
12772 !! wikitext
12773 {{#speciale:Recentchanges}}
12774 !! html
12775 Special:RecentChanges
12776 !! end
12777
12778 !! test
12779 {{#speciale:}} page name with subpage, known
12780 !! options
12781 msg
12782 !! wikitext
12783 {{#speciale:Recentchanges/param}}
12784 !! html
12785 Special:RecentChanges/param
12786 !! end
12787
12788 !! test
12789 {{#speciale:}} page name, unknown
12790 !! options
12791 msg
12792 !! wikitext
12793 {{#speciale:foobar nonexistent}}
12794 !! html
12795 Special:Foobar_nonexistent
12796 !! end
12797
12798 ###
12799 ### Images
12800 ###
12801 ### For Parsoid-specific tests, see
12802 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12803
12804 !! test
12805 Simple image
12806 !! options
12807 parsoid=wt2html,wt2wt,html2html
12808 !! wikitext
12809 [[Image:foobar.jpg]]
12810 !! html/php
12811 <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>
12812 </p>
12813 !! html/parsoid
12814 <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>
12815 !! end
12816
12817 !! test
12818 Simple image (using File: namespace, now canonical)
12819 !! wikitext
12820 [[File:Foobar.jpg]]
12821 !! html/php
12822 <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>
12823 </p>
12824 !! html/parsoid
12825 <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>
12826 !! end
12827
12828 !! test
12829 Right-aligned image
12830 !! wikitext
12831 [[File:Foobar.jpg|right]]
12832 !! html/php
12833 <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>
12834
12835 !! html/parsoid
12836 <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>
12837 !! end
12838
12839 !! test
12840 Image with caption
12841 !! wikitext
12842 [[File:Foobar.jpg|right|Caption text]]
12843 !! html/php
12844 <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>
12845
12846 !! html/parsoid
12847 <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>
12848 !! end
12849
12850 !! test
12851 Image with caption, bug 53312 #1
12852 !! wikitext
12853 [[File:Foobar.jpg|right|Caption page stuff]]
12854 !! html/php
12855 <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>
12856
12857 !! html/parsoid
12858 <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>
12859 !! end
12860
12861 !! test
12862 Image with caption, bug 53312 #2
12863 !! wikitext
12864 [[File:Foobar.jpg|right|Caption page=]]
12865 !! html/php
12866 <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>
12867
12868 !! html/parsoid
12869 <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>
12870 !! end
12871
12872 !! test
12873 Image with caption, bug 53312 #3
12874 !! wikitext
12875 [[File:Foobar.jpg|right|Caption page=stuff]]
12876 !! html/php
12877 <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>
12878
12879 !! html/parsoid
12880 <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>
12881 !! end
12882
12883 !! test
12884 Allow empty links in image captions (Bug 60753)
12885 !! options
12886 thumbsize=220
12887 !! wikitext
12888 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12889 [[]]
12890 [[Link2]]
12891 ]]
12892 !! html/php
12893 <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>
12894
12895 !! html/parsoid
12896 <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>
12897 [[]]
12898 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12899 </figcaption></figure>
12900 !! end
12901
12902 !! test
12903 Titles in unlinked images (T23454)
12904 !! wikitext
12905 [[File:Foobar.jpg|link=|stuff]]
12906 !! html/php
12907 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12908 </p>
12909 !! end
12910
12911 !! test
12912 Link with empty target
12913 !! wikitext
12914 [[]]
12915 !! html
12916 <p>[[]]
12917 </p>
12918 !! end
12919
12920 !! test
12921 Image with link trail
12922 !! wikitext
12923 Linktrails should not work for images: [[File:Foobar.jpg]]s
12924 !! html/php
12925 <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
12926 </p>
12927 !! html/parsoid
12928 <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>
12929 !! end
12930
12931 !! test
12932 Image with empty attribute
12933 !! options
12934 parsoid=wt2html,wt2wt,html2html
12935 !! wikitext
12936 [[File:Foobar.jpg|right||Caption text]]
12937 !! html/php
12938 <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>
12939
12940 !! html/parsoid
12941 <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>
12942 !! end
12943
12944 !! test
12945 1. Block image with individual attributes from templates
12946 !! wikitext
12947 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12948 !! html/php
12949 <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>
12950
12951 !! html/parsoid
12952 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
12953 !! end
12954
12955 !! test
12956 2. Block Image with individual attributes from templates
12957 !! wikitext
12958 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12959 !! html/php
12960 <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>
12961
12962 !! html/parsoid
12963 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
12964 !! end
12965
12966 !! test
12967 3. Inline image with individual attributes from templates
12968 !! wikitext
12969 [[File:Foobar.jpg|{{echo|50px}}]]
12970 !! html/php
12971 <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>
12972 </p>
12973 !! html/parsoid
12974 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12975 !! end
12976
12977 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12978 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12979 !! test
12980 Image with multiple attributes from the same template
12981 !! wikitext
12982 [[File:Foobar.jpg|{{image_attribs}}]]
12983 !! html/php
12984 <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>
12985
12986 !! html/parsoid
12987 <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>
12988 !! end
12989
12990 !! test
12991 Image with link tails
12992 !! options
12993 thumbsize=220
12994 !! wikitext
12995 123[[File:Foobar.jpg]]456
12996 123[[File:Foobar.jpg|right]]456
12997 123[[File:Foobar.jpg|thumb]]456
12998 !! html/php
12999 <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
13000 </p>
13001 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
13002 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
13003
13004 !! html/php+tidy
13005 <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>
13006 <p>123</p>
13007 <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>
13008 <p>456 123</p>
13009 <div class="thumb tright">
13010 <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>
13011 <div class="thumbcaption">
13012 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13013 </div>
13014 </div>
13015 </div>
13016 <p>456</p>
13017 !! html/parsoid
13018 <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>
13019 <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>
13020 <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>
13021 !! end
13022
13023 !! test
13024 Image with multiple captions -- only last one is accepted
13025 !! wikitext
13026 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13027 !! html/php
13028 <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>
13029
13030 !! html/parsoid
13031 <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>
13032 !! end
13033
13034 !! test
13035 Image with multiple widths -- use last
13036 !! wikitext
13037 [[File:Foobar.jpg|200px|300px|caption]]
13038 !! html/php
13039 <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>
13040 </p>
13041 !! html/parsoid
13042 <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>
13043 !! end
13044
13045 !! test
13046 Image with multiple alignments -- use first (bug 48664)
13047 !! options
13048 thumbsize=220
13049 !! wikitext
13050 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13051
13052 [[File:Foobar.jpg|middle|text-top|caption]]
13053 !! html/php
13054 <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>
13055 <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>
13056 </p>
13057 !! html/parsoid
13058 <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>
13059 <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>
13060 !! end
13061
13062 !! test
13063 Image with width attribute at different positions
13064 !! wikitext
13065 [[File:Foobar.jpg|200px|right|Caption]]
13066 [[File:Foobar.jpg|right|200px|Caption]]
13067 [[File:Foobar.jpg|right|Caption|200px]]
13068 !! html/php
13069 <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>
13070 <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>
13071 <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>
13072
13073 !! html/parsoid
13074 <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>
13075 <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>
13076 <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>
13077 !! end
13078
13079 # a sad bit of backward-compatibility
13080 !! test
13081 Image with size specified with pxpx (bug 13500, 51628)
13082 !! options
13083 parsoid=wt2html,wt2wt,html2html
13084 !! wikitext
13085 [[File:Foobar.jpg|20pxpx]]
13086 [[File:Foobar.jpg|200x20pxpx]]
13087 !! html/php
13088 <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>
13089 <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>
13090 </p>
13091 !! html/parsoid
13092 <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>
13093 !! end
13094
13095 !! test
13096 Image with link parameter, wiki target
13097 !! wikitext
13098 [[File:Foobar.jpg|link=Main Page]]
13099 !! html/php
13100 <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>
13101 </p>
13102 !! html/parsoid
13103 <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>
13104 !! end
13105
13106 # parsoid bug 49293 (part 1)
13107 !! test
13108 Image with link parameter, URL target
13109 !! wikitext
13110 [[File:Foobar.jpg|link=http://example.com/]]
13111 !! html/php
13112 <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>
13113 </p>
13114 !! html/parsoid
13115 <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>
13116 !! end
13117
13118 # parsoid bug 49293 (part 2)
13119 !! test
13120 Image with link parameter, protocol-less URL target
13121 !! wikitext
13122 [[File:Foobar.jpg|link=//example.com/]]
13123 !! html/php
13124 <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>
13125 </p>
13126 !! html/parsoid
13127 <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>
13128 !! end
13129
13130 !! test
13131 Escaping non-block captions (T107435)
13132 !! options
13133 parsoid={
13134 "modes": ["wt2wt"],
13135 "changes": [
13136 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13137 ]
13138 }
13139 !! wikitext
13140 [[Image:Foobar.jpg|caption]]
13141 !! wikitext/edited
13142 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13143 !! end
13144
13145 # wgExternalLinkTarget not supported by Parsoid
13146 !! test
13147 Image with link parameter, wgExternalLinkTarget
13148 !! wikitext
13149 [[Image:foobar.jpg|link=http://example.com/]]
13150 !! config
13151 wgExternalLinkTarget='foobar'
13152 !! html/php
13153 <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>
13154 </p>
13155 !! end
13156
13157 !! test
13158 Image with link parameter, wgNoFollowLinks set to false
13159 !! wikitext
13160 [[Image:foobar.jpg|link=http://example.com/]]
13161 !! config
13162 wgNoFollowLinks=false
13163 !! html
13164 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13165 </p>
13166 !! end
13167
13168 !! test
13169 Image with link parameter, wgNoFollowDomainExceptions
13170 !! wikitext
13171 [[Image:foobar.jpg|link=http://example.com/]]
13172 !! config
13173 wgNoFollowDomainExceptions='example.com'
13174 !! html
13175 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13176 </p>
13177 !! end
13178
13179 # wgExternalLinkTarget not supported by Parsoid
13180 !! test
13181 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13182 !! wikitext
13183 [[Image:foobar.jpg|link=http://example.com/|Title]]
13184 !! config
13185 wgExternalLinkTarget='foobar'
13186 !! html/php
13187 <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>
13188 </p>
13189 !! end
13190
13191 !! test
13192 Image with empty link parameter
13193 !! wikitext
13194 [[File:Foobar.jpg|link=]]
13195 !! html/php
13196 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13197 </p>
13198 !! html/parsoid
13199 <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>
13200 !! end
13201
13202 !! test
13203 Image with link parameter (wiki target) and unnamed parameter
13204 !! wikitext
13205 [[File:Foobar.jpg|link=Main_Page|Title]]
13206 !! html/php
13207 <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>
13208 </p>
13209 !! html/parsoid
13210 <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>
13211 !! end
13212
13213 !! test
13214 Image with link parameter (URL target) and unnamed parameter
13215 !! wikitext
13216 [[File:Foobar.jpg|link=http://example.com/|Title]]
13217 !! html/php
13218 <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>
13219 </p>
13220 !! html/parsoid
13221 <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>
13222 !! end
13223
13224 !! test
13225 Thumbnail image with link parameter
13226 !! options
13227 thumbsize=220
13228 parsoid=wt2html,wt2wt,html2html
13229 !! wikitext
13230 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13231 !! html/php
13232 <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>
13233
13234 !! html/parsoid
13235 <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>
13236 !! end
13237
13238 !! test
13239 Manually-specified thumbnail image
13240 !! options
13241 thumbsize=220
13242 !! wikitext
13243 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13244 !! html/php
13245 <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>
13246
13247 !! html/parsoid
13248 <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>
13249 !! end
13250
13251 !! test
13252 Manually-specified thumbnail image with explicit link to wiki page
13253 !! options
13254 thumbsize=220
13255 parsoid=wt2html,wt2wt,html2html
13256 !! wikitext
13257 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13258 !! html/php
13259 <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>
13260
13261 !! html/parsoid
13262 <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>
13263 !! end
13264
13265 !! test
13266 Manually-specified thumbnail image with explicit link to url
13267 !! options
13268 thumbsize=220
13269 parsoid=wt2html,wt2wt,html2html
13270 !! wikitext
13271 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13272 !! html/php
13273 <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>
13274
13275 !! html/parsoid
13276 <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>
13277 !! end
13278
13279 !! test
13280 Manually-specified thumbnail image with explicit no link
13281 !! options
13282 thumbsize=220
13283 parsoid=wt2html,wt2wt,html2html
13284 !! wikitext
13285 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13286 !! html/php
13287 <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>
13288
13289 !! html/parsoid
13290 <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>
13291 !! end
13292
13293 !! test
13294 Manually-specified thumbnail image with explicit link and alt text
13295 !! options
13296 thumbsize=220
13297 parsoid=wt2html,wt2wt,html2html
13298 !! wikitext
13299 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13300 !! html/php
13301 <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>
13302
13303 !! html/parsoid
13304 <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>
13305 !! end
13306
13307 !! test
13308 Image with frame and link
13309 !! options
13310 parsoid=wt2html,wt2wt,html2html
13311 !! wikitext
13312 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13313 !! html/php
13314 <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>
13315
13316 !! html/parsoid
13317 <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>
13318 !! end
13319
13320 !! test
13321 Image with frame and link and explicit alt
13322 !! options
13323 parsoid=wt2html,wt2wt,html2html
13324 !! wikitext
13325 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13326 !! html/php
13327 <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>
13328
13329 !! html/parsoid
13330 <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>
13331 !! end
13332
13333 !! test
13334 Image with wiki markup in implicit alt
13335 !! wikitext
13336 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13337
13338 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13339 !! html/php
13340 <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>
13341 </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>
13342 </p>
13343 !! html/parsoid
13344 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><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":"Image:Foobar.jpg"}}'/></a></span></p>
13345
13346 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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>
13347 !! end
13348
13349 !! test
13350 Alt image option should handle most kinds of wikitext without barfing
13351 !! wikitext
13352 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13353 !! html/php
13354 <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>
13355
13356 !! html/parsoid
13357 <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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>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>
13358 !! end
13359
13360 ###################
13361 # Conflicting image format options.
13362 # First option specified should 'win'.
13363 # All three cases in each test should be identical.
13364
13365 !! test
13366 Image with 'frameless' first.
13367 !! options
13368 parsoid=wt2html,wt2wt,html2html
13369 !! wikitext
13370 [[File:Foobar.jpg|frameless|caption]]
13371
13372 [[File:Foobar.jpg|frameless|frame|caption]]
13373
13374 [[File:Foobar.jpg|frameless|thumb|caption]]
13375 !! html/php
13376 <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>
13377 </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>
13378 </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>
13379 </p>
13380 !! html/parsoid
13381 <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>
13382 <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>
13383 <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>
13384 !! end
13385
13386 !! test
13387 Image with 'frame' first.
13388 !! options
13389 parsoid=wt2html,wt2wt,html2html
13390 !! wikitext
13391 [[File:Foobar.jpg|frame|caption]]
13392 [[File:Foobar.jpg|frame|frameless|caption]]
13393 [[File:Foobar.jpg|frame|thumb|caption]]
13394 !! html/php
13395 <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>
13396 <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>
13397 <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>
13398
13399 !! html/parsoid
13400 <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>
13401 <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>
13402 <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>
13403 !! end
13404
13405 !! test
13406 Image with 'thumb' first.
13407 !! options
13408 parsoid=wt2html,wt2wt,html2html
13409 !! wikitext
13410 [[File:Foobar.jpg|thumb|caption]]
13411 [[File:Foobar.jpg|thumb|frameless|caption]]
13412 [[File:Foobar.jpg|thumb|frame|caption]]
13413 !! html/php
13414 <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>
13415 <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>
13416 <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>
13417
13418 !! html/parsoid
13419 <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>
13420 <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>
13421 <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>
13422 !! end
13423
13424 ###################
13425 # Image sizing.
13426 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13427 # and https://phabricator.wikimedia.org/T64258
13428 # Foobar has actual size of 1941x220
13429 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13430 # a scalable format.
13431 # 2. Framed images always ignore size options; always render at default size.
13432 # 3. "Unspecified format" and border are the only types which can be
13433 # enlarged.
13434
13435 !! test
13436 Image: "unspecified format" and border enlarge
13437 !! options
13438 parsoid=wt2html,wt2wt,html2html
13439 !! wikitext
13440 [[File:Foobar.jpg|2000px]]
13441
13442 [[File:Foobar.jpg|border|2000px]]
13443 !! html/php
13444 <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>
13445 </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>
13446 </p>
13447 !! html/parsoid
13448 <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>
13449 <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>
13450 !! end
13451
13452 !! test
13453 Image: "unspecified format" and border reduce
13454 !! options
13455 parsoid=wt2html,wt2wt,html2html
13456 !! wikitext
13457 [[File:Foobar.jpg|1000px]]
13458
13459 [[File:Foobar.jpg|border|1000px]]
13460 !! html/php
13461 <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>
13462 </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>
13463 </p>
13464 !! html/parsoid
13465 <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>
13466 <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>
13467 !! end
13468
13469 !! test
13470 Image: thumbs reduce
13471 !! options
13472 parsoid=wt2html,wt2wt,html2html
13473 !! wikitext
13474 [[File:Foobar.jpg|thumb|50px]]
13475 !! html/php
13476 <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>
13477
13478 !! html/parsoid
13479 <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>
13480 !! end
13481
13482 !! test
13483 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13484 !! options
13485 parsoid=wt2html,wt2wt,html2html
13486 !! wikitext
13487 [[File:Foobar.jpg|thumb|2000px]]
13488
13489 [[File:Foobar.svg|thumb|2000px]]
13490 !! html/php
13491 <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>
13492 <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>
13493
13494 !! html/parsoid
13495 <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>
13496 <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>
13497 !! end
13498
13499 !! test
13500 Image: frameless can reduce in size
13501 !! options
13502 parsoid=wt2html,wt2wt,html2html
13503 !! wikitext
13504 [[File:Foobar.jpg|frameless|50px]]
13505 !! html/php
13506 <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>
13507 </p>
13508 !! html/parsoid
13509 <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>
13510 !! end
13511
13512 !! test
13513 Image: bitmap frameless can't be enlarged past original size, but vector can
13514 !! options
13515 parsoid=wt2html,wt2wt,html2html
13516 !! wikitext
13517 [[File:Foobar.jpg|frameless|2000px]]
13518
13519 [[File:Foobar.svg|frameless|2000px]]
13520 !! html/php
13521 <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>
13522 </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>
13523 </p>
13524 !! html/parsoid
13525 <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>
13526 <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>
13527 !! end
13528
13529 !! test
13530 Image: framed images are always unscaled.
13531 !! options
13532 parsoid=wt2html,wt2wt,html2html
13533 !! wikitext
13534 [[File:Foobar.jpg|frame]]
13535
13536 [[File:Foobar.jpg|frame|50px]]
13537
13538 [[File:Foobar.jpg|frame|50x50px]]
13539
13540 [[File:Foobar.jpg|frame|2000px]]
13541 !! html/php
13542 <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>
13543 <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>
13544 <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>
13545 <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>
13546
13547 !! html/parsoid
13548 <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>
13549 <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>
13550 <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>
13551 <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>
13552 !! end
13553
13554 ###################
13555
13556 !! test
13557 Link to image page- image page normally doesn't exists, hence edit link
13558 Add test with existing image page
13559 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13560 !! wikitext
13561 [[:Image:test]]
13562 !! html
13563 <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>
13564 </p>
13565 !! end
13566
13567 !! test
13568 bug 18784 Link to non-existent image page with caption should use caption as link text
13569 !! wikitext
13570 [[:Image:test|caption]]
13571 !! html
13572 <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>
13573 </p>
13574 !! end
13575
13576 !! test
13577 Frameless image caption with a free URL
13578 !! wikitext
13579 [[File:Foobar.jpg|http://example.com]]
13580 !! html/php
13581 <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>
13582 </p>
13583 !! html/parsoid
13584 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><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>
13585 !! end
13586
13587 !! test
13588 Thumbnail image caption with a free URL
13589 !! options
13590 thumbsize=220
13591 !! wikitext
13592 [[File:Foobar.jpg|thumb|http://example.com]]
13593 !! html/php
13594 <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>
13595
13596 !! html/parsoid
13597 <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>
13598 !! end
13599
13600 !! test
13601 Thumbnail image caption with a free URL and explicit alt
13602 !! options
13603 thumbsize=220
13604 parsoid=wt2html,wt2wt,html2html
13605 !! wikitext
13606 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13607 !! html/php
13608 <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>
13609
13610 !! html/parsoid
13611 <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>
13612 !! end
13613
13614 !! test
13615 SVG thumbnails with no language set
13616 !! options
13617 !! wikitext
13618 [[File:Foobar.svg|thumb|caption]]
13619 !! html/php
13620 <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>
13621
13622 !! html/parsoid
13623 <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>
13624 !! end
13625
13626 !! test
13627 SVG thumbnails with language de
13628 !! options
13629 parsoid=wt2html,wt2wt,html2html
13630 !! wikitext
13631 [[File:Foobar.svg|thumb|caption|lang=de]]
13632 !! html/php
13633 <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>
13634
13635 !! html/parsoid
13636 <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>
13637 !! end
13638
13639 !! test
13640 SVG thumbnails with invalid language code
13641 !! options
13642 parsoid=wt2html,wt2wt,html2html
13643 !! wikitext
13644 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13645 !! html/php
13646 <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>
13647
13648 !! html/parsoid
13649 <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>
13650 !! end
13651
13652 !! test
13653 BUG 1887: A ISBN with a thumbnail
13654 !! wikitext
13655 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13656 !! html/php
13657 <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>
13658
13659 !! html/parsoid
13660 <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>
13661 !! end
13662
13663 !! test
13664 BUG 1887: A RFC with a thumbnail
13665 !! wikitext
13666 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13667 !! html/php
13668 <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>
13669
13670 !! html/parsoid
13671 <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>
13672 !! end
13673
13674 !! test
13675 BUG 1887: A mailto link with a thumbnail
13676 !! wikitext
13677 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13678 !! html/php
13679 <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>
13680
13681 !! html/parsoid
13682 <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>
13683 !! end
13684
13685 # Pending resolution to bug 368
13686 !! test
13687 BUG 648: Frameless image caption with a link
13688 !! wikitext
13689 [[File:Foobar.jpg|text with a [[link]] in it]]
13690 !! html/php
13691 <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>
13692 </p>
13693 !! html/parsoid
13694 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><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>
13695 !! end
13696
13697 !! test
13698 BUG 648: Frameless image caption with a link (suffix)
13699 !! wikitext
13700 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13701 !! html/php
13702 <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>
13703 </p>
13704 !! html/parsoid
13705 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><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>
13706 !! end
13707
13708 !! test
13709 BUG 648: Frameless image caption with an interwiki link
13710 !! wikitext
13711 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13712 !! html/php
13713 <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>
13714 </p>
13715 !! html/parsoid
13716 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' 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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><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>
13717 !! end
13718
13719 !! test
13720 BUG 648: Frameless image caption with a piped interwiki link
13721 !! wikitext
13722 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13723 !! html/php
13724 <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>
13725 </p>
13726 !! html/parsoid
13727 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' 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=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><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>
13728 !! end
13729
13730 !! test
13731 T107474: Frameless image caption with <nowiki>
13732 !! wikitext
13733 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13734 !! html/parsoid
13735 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><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>
13736 !! end
13737
13738 !! test
13739 Escape HTML special chars in image alt text
13740 !! wikitext
13741 [[File:Foobar.jpg|& < > "]]
13742 !! html/php
13743 <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>
13744 </p>
13745 !! html/parsoid
13746 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><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>
13747 !! end
13748
13749 !! test
13750 BUG 499: Alt text should have &#1234;, not &amp;1234;
13751 !! wikitext
13752 [[File:Foobar.jpg|&#9792;]]
13753 !! html/php
13754 <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>
13755 </p>
13756 !! html/parsoid
13757 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><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>
13758 !! end
13759
13760 !! test
13761 Broken image caption with link
13762 !! options
13763 parsoid=wt2html,wt2wt,html2html
13764 !! wikitext
13765 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13766 !! html/php
13767 <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.
13768 </p>
13769 !! html/parsoid
13770 <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>
13771 !! end
13772
13773 !! test
13774 Image caption containing another image
13775 !! wikitext
13776 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13777 !! html/php
13778 <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>
13779
13780 !! html/parsoid
13781 <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>
13782 !! end
13783
13784 !! test
13785 Image: caption containing a newline
13786 !! wikitext
13787 [[File:Foobar.jpg|This
13788 *is some text]]
13789 !! html/php
13790 <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>
13791 </p>
13792 !! html/parsoid
13793 <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>
13794 !!end
13795
13796 !!test
13797 Image: caption containing leading space
13798 (The leading space should not trigger nowiki escaping in wt2wt mode)
13799 !! wikitext
13800 [[File:Foobar.jpg|thumb| bar]]
13801 !! html/php
13802 <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>
13803
13804 !! html/parsoid
13805 <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>
13806 !!end
13807
13808 !! test
13809 Image: caption containing a table
13810 !! options
13811 parsoid=wt2html,wt2wt,html2html
13812 !! wikitext
13813 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13814 {|
13815 ! Foo !! Bar
13816 |-
13817 | Foo1 || Bar1
13818 |}
13819 and some more text.]]
13820 !! html/php
13821 <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>
13822
13823 !! html/parsoid
13824 <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
13825 <table>
13826 <tbody>
13827 <tr><th>Foo </th><th>Bar</th></tr>
13828 <tr>
13829 <td>Foo1 </td>
13830 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13831 !! end
13832
13833 !! test
13834 Bug 3090: External links other than http: in image captions
13835 !! wikitext
13836 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13837 !! html/php
13838 <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>
13839
13840 !! html/parsoid
13841 <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>
13842 !! end
13843
13844 !! test
13845 Custom class
13846 !! options
13847 parsoid=wt2html,wt2wt,html2html
13848 !! wikitext
13849 [[Image:foobar.jpg|a|class=b]]
13850 !! html/php
13851 <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>
13852 </p>
13853 !! html/parsoid
13854 <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>
13855 !! end
13856
13857 !! test
13858 Localized image handling (1).
13859 !! options
13860 parsoid=wt2html,wt2wt,html2html
13861 language=es
13862 !! wikitext
13863 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13864 !! html/php
13865 <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>
13866
13867 !! html/parsoid
13868 <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>
13869 !! end
13870
13871 !! test
13872 Localized image handling (2).
13873 !! options
13874 thumbsize=220
13875 parsoid=wt2html,wt2wt,html2html
13876 language=es
13877 !! wikitext
13878 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13879 !! html/php
13880 <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>
13881
13882 !! html/parsoid
13883 <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>
13884 !! end
13885
13886 !! test
13887 Localized image handling (3).
13888 !! options
13889 language=fa
13890 parsoid=html2wt
13891 !! html/parsoid
13892 <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>
13893 !! wikitext
13894 [[File:Foobar.jpg|بندانگشتی]]
13895 !! end
13896
13897 !! test
13898 "border", "frameless" and "class" attributes on an image.
13899 !! options
13900 thumbsize=220
13901 parsoid=wt2html,wt2wt,html2html
13902 !! wikitext
13903 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13904 !! html/php
13905 <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>
13906 </p>
13907 !! html/parsoid
13908 <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>
13909 !! end
13910
13911 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13912 !! test
13913 Invalid image attributes (bug 62500)
13914 !! options
13915 thumbsize=220
13916 parsoid=wt2html,wt2wt,html2html
13917 !! wikitext
13918 [[File:Foobar.jpg|thumb|float|left|caption]]
13919
13920 [[File:Foobar.jpg|thumb|righ|caption]]
13921
13922 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13923 !! html/php
13924 <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>
13925 <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>
13926 <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>
13927
13928 !! html/parsoid
13929 <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>
13930 <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>
13931 <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>
13932 !! end
13933
13934 !! article
13935 File:Barfoo.jpg
13936 !! text
13937 #REDIRECT [[File:Barfoo.jpg]]
13938 !! endarticle
13939
13940 # FIXME: Parsoid should run this test -- but we'd need to teach the
13941 # mockAPI about the redirected Barfoo.jpg image.
13942 !! test
13943 Redirected image
13944 !! wikitext
13945 [[Image:Barfoo.jpg]]
13946 !! html/php
13947 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13948 </p>
13949 !! end
13950
13951 !! test
13952 Missing image with uploads disabled
13953 !! options
13954 wgEnableUploads=0
13955 !! wikitext
13956 [[File:Foobaz.jpg]]
13957 !! html/php
13958 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13959 </p>
13960 !! html/parsoid
13961 <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>
13962 !! end
13963
13964 # Parsoid-specific testing for images
13965 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13966 # Currently imperfect due to a flaw in the Parsoid testrunner
13967 # Work in progress
13968 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13969 # image tests.
13970
13971 !! test
13972 Parsoid-specific image handling - simple image with size and middle alignment
13973 !! wikitext
13974 [[File:Foobar.jpg|middle|50px]]
13975 !! html/parsoid
13976 <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>
13977 !! end
13978
13979 !! test
13980 Parsoid-specific image handling - simple image with size, middle alignment,
13981 non-standard namespace alias
13982 !! options
13983 parsoid=wt2wt,wt2html,html2html
13984 !! wikitext
13985 [[Image:Foobar.jpg|middle|50px]]
13986 !! html/parsoid
13987 <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>
13988 !! end
13989
13990 !! test
13991 Parsoid-specific image handling - simple image with size and middle alignment
13992 (existing content)
13993 !! wikitext
13994 [[File:Foobar.jpg|50px|middle]]
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 Parsoid-specific image handling - simple image with size and middle alignment
14001 and non-standard namespace name
14002 !! options
14003 parsoid=wt2html,wt2wt,html2html
14004 !! wikitext
14005 [[Image:Foobar.jpg|50px|middle]]
14006 !! html/parsoid
14007 <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>
14008 !! end
14009
14010 !! test
14011 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14012 !! wikitext
14013 [[File:Foobar.jpg|500x10px|baseline|caption]]
14014 !! html/parsoid
14015 <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>
14016 !! end
14017
14018 !! test
14019 Parsoid-specific image handling - simple image with border and size spec
14020 !! wikitext
14021 [[File:Foobar.jpg|50px|border|caption]]
14022 !! html/parsoid
14023 <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>
14024 !! end
14025
14026 !! test
14027 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14028 !! wikitext
14029 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14036 (existing content)
14037 !! wikitext
14038 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14039 !! html/parsoid
14040 <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>
14041 !! end
14042
14043 !! test
14044 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14045 !! wikitext
14046 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14047 !! html/parsoid
14048 <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>
14049 !! end
14050
14051 !! test
14052 Parsoid-specific image handling - thumbnail with specific size, halign,
14053 valign, and caption (existing content)
14054 !! wikitext
14055 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14056 !! html/parsoid
14057 <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>
14058 !! end
14059
14060 !! test
14061 Parsoid-specific image handling - framed image with specific size and caption
14062 (size is ignored)
14063 !! options
14064 parsoid=wt2html,wt2wt,html2html
14065 !! wikitext
14066 [[File:Foobar.jpg|frame|500x50px|caption]]
14067 !! html/parsoid
14068 <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>
14069 !! end
14070
14071 !! test
14072 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14073 (size is ignored)
14074 !! options
14075 parsoid=wt2html,wt2wt,html2html
14076 !! wikitext
14077 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14078 !! html/parsoid
14079 <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>
14080 !! end
14081
14082 !! test
14083 Parsoid-specific image handling - frameless image with specific size, border, and caption
14084 !! wikitext
14085 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14086 !! html/parsoid
14087 <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>
14088 !! end
14089
14090 !! test
14091 Parsoid-specific image handling - simple image with a formatted caption
14092 !! wikitext
14093 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14094 !! html/parsoid
14095 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><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>
14096 !! end
14097
14098 !! test
14099 Parsoid-specific image handling - caption with a template in it
14100 !! wikitext
14101 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14102 !! html/parsoid
14103 <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>
14104 !! end
14105
14106 !! test
14107 Parsoid-specific image handling - caption with unbalanced tags in it
14108 !! options
14109 parsoid=wt2html,wt2wt,html2html
14110 !! wikitext
14111 foo
14112 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14113 bar
14114 !! html/parsoid
14115 <p>foo</p>
14116 <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>
14117 <p>bar</p>
14118 !! end
14119
14120 !! test
14121 Parsoid-specific image handling - empty caption (1)
14122 !! options
14123 parsoid=wt2html,wt2wt
14124 !! wikitext
14125 [[File:Foobar.jpg|thumb|]]
14126 !! html/parsoid
14127 <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>
14128 !! end
14129
14130 # empty captions don't get serialized unless we're in the "round trip" case
14131 !! test
14132 Parsoid-specific image handling - empty caption (2)
14133 !! options
14134 parsoid=html2wt
14135 !! html/parsoid
14136 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14137 <a href="./File:Foobar.jpg">
14138 <img resource="./File:Foobar.jpg"
14139 src="//example.com/images/3/3a/Foobar.jpg"
14140 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14141 height="25" width="220"/>
14142 </a>
14143 <figcaption></figcaption>
14144 </figure>
14145 !! wikitext
14146 [[File:Foobar.jpg|thumb]]
14147 !! end
14148
14149 !! test
14150 Parsoid-specific image handling - whitespace caption
14151 !! wikitext
14152 [[File:Foobar.jpg|thumb| ]]
14153 !! html/parsoid
14154 <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>
14155 !! end
14156
14157 !! test
14158 Parsoid-specific image handling - lang option
14159 !! wikitext
14160 foo
14161 [[File:Foobar.svg|lang=de|caption]]
14162 bar
14163 !! html/parsoid
14164 <p>foo
14165 <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>
14166 bar</p>
14167 !! end
14168
14169 ## Edge case bugs in Parsoid from T93580
14170 !! test
14171 T93580: 1. Templated <ref> inside block images
14172 !! wikitext
14173 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14174
14175 <references />
14176 !! html/parsoid
14177 <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>
14178
14179 <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>
14180 !! end
14181
14182 !! test
14183 T93580: 2. <ref> inside inline images
14184 !! wikitext
14185 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14186
14187 <references />
14188 !! html/parsoid
14189 <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=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><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>
14190
14191 <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>
14192 !! end
14193
14194 !! test
14195 T93580: 3. Templated <ref> inside inline images
14196 !! wikitext
14197 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14198
14199 <references />
14200 !! html/parsoid
14201 <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=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><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>
14202
14203 <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>
14204 !! end
14205
14206 ###
14207 ### Subpages
14208 ###
14209 !! article
14210 Subpage test/subpage
14211 !! text
14212 foo
14213 !! endarticle
14214
14215 !! test
14216 Subpage link
14217 !! options
14218 subpage title=[[Subpage test]]
14219 !! wikitext
14220 [[/subpage]]
14221 !! html
14222 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14223 </p>
14224 !! end
14225
14226 !! test
14227 Subpage noslash link
14228 !! options
14229 subpage title=[[Subpage test]]
14230 !! wikitext
14231 [[/subpage/]]
14232 !! html
14233 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14234 </p>
14235 !! end
14236
14237 !! article
14238 Subpage test/1/2/subpage
14239 !! text
14240 blah
14241 !! endarticle
14242
14243 !! test
14244 Relative subpage noslash link
14245 !! options
14246 parsoid=wt2wt,wt2html,html2html
14247 subpage title=[[Subpage test/1/2/3/4]]
14248 !! wikitext
14249 [[../../subpage/]]
14250
14251 [[../../subpage]]
14252 !! html/php
14253 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14254 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14255 </p>
14256 !! html/parsoid
14257 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14258 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14259 !! end
14260
14261 !! test
14262 Parsoid: dot-slash prefixed wikilinks
14263 !! wikitext
14264 [[./foo]]
14265
14266 [[././bar]]
14267
14268 [[././baz/]]
14269 !! html/php
14270 <p>[[./foo]]
14271 </p><p>[[././bar]]
14272 </p><p>[[././baz/]]
14273 </p>
14274 !! html/parsoid
14275 <p>[[./foo]]
14276 </p><p>[[././bar]]
14277 </p><p>[[././baz/]]
14278 </p>
14279 !! end
14280
14281 !! test
14282 Render invalid page names as plain text (bug 51090)
14283 !! wikitext
14284 [[./../foo|bar]]
14285 [[foo�|bar]]
14286 [[foo/.|bar]]
14287 [[foo/..|bar]]
14288 [[foo~~~bar]]
14289 [[foo>bar]]
14290 [[foo[bar]]
14291 [[.]]
14292 [[..]]
14293 [[foo././bar]]
14294
14295 [[{{echo|./../foo}}|bar]]
14296 [[{{echo|foo/.}}|bar]]
14297 [[{{echo|foo/..}}|bar]]
14298 [[{{echo|foo~~~~bar}}]]
14299 [[{{echo|foo>bar}}]]
14300 [[{{echo|foo././bar}}]]
14301 [[{{echo|foo{bar}}]]
14302 [[{{echo|foo}bar}}]]
14303 [[{{echo|foo[bar}}]]
14304 [[{{echo|foo]bar}}]]
14305 [[{{echo|foo<bar}}]]
14306 !!html/php
14307 <p>[[./../foo|bar]]
14308 [[foo�|bar]]
14309 [[foo/.|bar]]
14310 [[foo/..|bar]]
14311 [[foo~~~bar]]
14312 [[foo&gt;bar]]
14313 [[foo[bar]]
14314 [[.]]
14315 [[..]]
14316 [[foo././bar]]
14317 </p><p>[[./../foo|bar]]
14318 [[foo/.|bar]]
14319 [[foo/..|bar]]
14320 [[foo~~~~bar]]
14321 [[foo&gt;bar]]
14322 [[foo././bar]]
14323 [[foo{bar]]
14324 [[foo}bar]]
14325 [[foo[bar]]
14326 [[foo]bar]]
14327 [[foo&lt;bar]]
14328 </p>
14329 !!html/parsoid
14330 <p>[[./../foo|bar]]
14331 [[foo�|bar]]
14332 [[foo/.|bar]]
14333 [[foo/..|bar]]
14334 [[foo~~~bar]]
14335 [[foo>bar]]
14336 [[foo[bar]]
14337 [[.]]
14338 [[..]]
14339 [[foo././bar]]</p>
14340
14341 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14342 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14343 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14344 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14345 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14346 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14347 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14348 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14349 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14350 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14351 [[<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>
14352 !!end
14353
14354 !! test
14355 Disabled subpages
14356 !! wikitext
14357 [[/subpage]]
14358 !! html
14359 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14360 </p>
14361 !! end
14362
14363 !! test
14364 BUG 561: {{/Subpage}}
14365 !! options
14366 subpage title=[[Page]]
14367 !! wikitext
14368 {{/Subpage}}
14369 !! html
14370 <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>
14371 </p>
14372 !! end
14373
14374 ###
14375 ### Categories
14376 ###
14377 !! article
14378 Category:MediaWiki User's Guide
14379 !! text
14380 blah
14381 !! endarticle
14382
14383 !! test
14384 Link to category
14385 !! wikitext
14386 [[:Category:MediaWiki User's Guide]]
14387 !! html
14388 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14389 </p>
14390 !! end
14391
14392 !! test
14393 Simple category
14394 !! options
14395 cat
14396 !! wikitext
14397 [[Category:MediaWiki User's Guide]]
14398 !! html
14399 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14400 !! end
14401
14402 !! test
14403 PAGESINCATEGORY invalid title fatal (r33546 fix)
14404 !! wikitext
14405 {{PAGESINCATEGORY:<bogus>}}
14406 !! html
14407 <p>0
14408 </p>
14409 !! end
14410
14411 !! test
14412 Category with different sort key
14413 !! options
14414 cat
14415 !! wikitext
14416 [[Category:MediaWiki User's Guide|Foo]]
14417 !! html
14418 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14419 !! end
14420
14421 !! test
14422 Category with identical sort key
14423 !! options
14424 cat
14425 !! wikitext
14426 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14427 !! html
14428 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14429 !! end
14430
14431 !! test
14432 Category with empty sort key
14433 !! options
14434 cat
14435 pst
14436 !! wikitext
14437 [[Category:MediaWiki User's Guide|]]
14438 !! html/php
14439 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14440 !! end
14441
14442 !! test
14443 Category with empty sort key and parentheses
14444 !! options
14445 cat
14446 pst
14447 !! wikitext
14448 [[Category:Foo (bar)|]]
14449 !! html/php
14450 [[Category:Foo (bar)|Foo]]
14451 !! end
14452
14453 ## We used to, but no longer wt2wt this test since the default serializer
14454 ## will normalize all categories to serialize on their own line.
14455 ## This wikitext usage is going to be fairly uncommon in production and
14456 ## selser will take care of preserving formatting in those scenarios.
14457 !! test
14458 Category with link tail
14459 !! options
14460 cat
14461 pst
14462 parsoid=wt2html
14463 !! wikitext
14464 123[[Category:Foo]]456
14465 !! html/php
14466 123[[Category:Foo]]456
14467 !! html/parsoid
14468 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14469 !! end
14470
14471 !! test
14472 Category with template
14473 !! options
14474 cat
14475 pst
14476 !! wikitext
14477 [[Category:{{echo|Foo}}]]
14478 !! html/php
14479 [[Category:{{echo|Foo}}]]
14480 !! end
14481
14482 !! test
14483 Category with template in sort key
14484 !! options
14485 cat
14486 pst
14487 !! wikitext
14488 [[Category:Foo|{{echo|Bar}}]]
14489 !! html/php
14490 [[Category:Foo|{{echo|Bar}}]]
14491 !! end
14492
14493 !! test
14494 Category with template in sort key and title
14495 !! options
14496 cat
14497 pst
14498 !! wikitext
14499 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14500 !! html/php
14501 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14502 !! end
14503
14504 ## We used to, but no longer wt2wt this test since the default serializer
14505 ## will normalize all categories to serialize on their own line.
14506 ## This wikitext usage is going to be fairly uncommon in production and
14507 ## selser will take care of preserving formatting in those scenarios.
14508 !! test
14509 Category / paragraph interactions
14510 !! options
14511 parsoid=wt2html
14512 !! wikitext
14513 Foo [[Category:Baz]] Bar
14514
14515 Foo [[Category:Baz]]
14516 Bar
14517
14518 Foo
14519 [[Category:Baz]]
14520 Bar
14521
14522 Foo
14523 [[Category:Baz]] Bar
14524
14525 Foo
14526 [[Category:Baz]]
14527 [[Category:Baz]]
14528 [[Category:Baz]]
14529 Bar
14530
14531 [[Category:Baz]]
14532 [[Category:Baz]]
14533 [[Category:Baz]]
14534
14535 [[Category:Baz]]
14536 {{echo|[[Category:Baz]]}}
14537 [[Category:Baz]]
14538 !! html/php
14539 <p>Foo Bar
14540 </p><p>Foo
14541 Bar
14542 </p><p>Foo
14543 Bar
14544 </p><p>Foo Bar
14545 </p><p>Foo
14546 Bar
14547 </p>
14548 !! html/parsoid
14549 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14550 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14551 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14552 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14553 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
14554 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14555 !! end
14556
14557 ## We used to, but no longer wt2wt this test since the default serializer
14558 ## will normalize all categories to serialize on their own line.
14559 ## This wikitext usage is going to be fairly uncommon in production and
14560 ## selser will take care of preserving formatting in those scenarios.
14561 ##
14562 ## The whitespace on the empty line is part of the test. Please do not delete
14563 !! test
14564 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14565 !! options
14566 parsoid=wt2html
14567 !! wikitext
14568 This
14569
14570 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14571
14572 {{echo|[[Category:Foo]] and so should this!}}
14573 !! html/php
14574 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14575 </p>
14576 !! html/parsoid
14577 <p>This
14578
14579 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14580
14581 <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>
14582 !! end
14583
14584 ## Parsoid will not try to wt2wt this while preserving newlines because
14585 ## it suppresses excess newlines within list items -- and we don't want to
14586 ## introduce a special case just for categories, which is, in reality somewhat
14587 ## odd behavior -- categories are unlikely to be used in list items like this
14588 ## in top-level pages and are only likely to show up in template-generated
14589 ## list items where this RT-ing is a non-issue.
14590 ##
14591 ## The whitespace on the empty line is part of the test. Please do not delete
14592 !! test
14593 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14594 !! options
14595 parsoid=wt2html
14596 !! wikitext
14597 * This
14598
14599 [[Category:Foo]] and this should be part of the same list item
14600 * So should this
14601
14602 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14603 !! html
14604 <ul><li>This and this should be part of the same list item</li>
14605 <li>So should this and this should be part of the same list item</li></ul>
14606 !! html/parsoid
14607 <ul>
14608 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14609 <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>
14610 </ul>
14611 !! end
14612
14613 ## Newlines and categories that follow the last item of a list
14614 ## are treated differently because this (list followed by categories)
14615 ## is an extremely common pattern on wikis.
14616 !! test
14617 3. Categories and newlines: newline suppression for last list item should RT properly
14618 !! wikitext
14619 * a
14620 * b
14621
14622 [[Category:Foo]]
14623
14624 [[Category:Bar]]
14625 [[Category:Baz]]
14626 !! html/parsoid
14627 <ul><li> a</li>
14628 <li> b</li></ul>
14629
14630 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14631
14632 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14633 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14634 !! end
14635
14636 !! test
14637 4. Categories and newlines: newline suppression for last list item should RT properly
14638 !! wikitext
14639 * a
14640 **** b
14641
14642 [[Category:Foo]]
14643 !! html/parsoid
14644 <ul><li> a
14645 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14646
14647 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14648 !! end
14649
14650 ## only wt2html for this to make sure the algo only applies to the rightmost path
14651 !! test
14652 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14653 !! options
14654 parsoid=wt2html
14655 !! wikitext
14656 * a
14657 ** b
14658 [[Category:Foo]]
14659 * c
14660 ** d
14661 [[Category:Foo]]
14662 !! html/parsoid
14663 <ul><li> a
14664 <ul><li> b
14665 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14666 <li> c
14667 <ul><li> d</li></ul></li></ul>
14668 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14669 !! end
14670
14671 ## We used to, but no longer wt2wt this test since the default serializer
14672 ## will normalize all categories to serialize on their own line.
14673 ## This wikitext usage is going to be fairly uncommon in production and
14674 ## selser will take care of preserving formatting in those scenarios.
14675 !! test
14676 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14677 !! options
14678 parsoid=wt2html
14679 !! wikitext
14680 * a [[Category:Foo]]
14681 !! html/parsoid
14682 <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>
14683 !! end
14684
14685 # This test also demonstrates because of newline+category tunneling
14686 # through the list hander, template wrapping doesn't expand to the
14687 # containing list when the list item swallows the category.
14688 !! test
14689 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14690 !! wikitext
14691 * {{echo|a
14692 [[Category:Foo]]}}
14693 !! html/parsoid
14694 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
14695 </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>
14696 !! end
14697
14698 !! test
14699 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14700 !! wikitext
14701 * a
14702
14703 {{echo|[[Category:Foo]]
14704 [[Category:Bar]]}}
14705 [[Category:Baz]]
14706 !! html/parsoid
14707 <ul><li> a</li></ul>
14708
14709 <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"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14710 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14711 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14712 !! end
14713
14714 !! test
14715 Parsoid: Serialize link to category page with colon escape
14716 !! options
14717 parsoid
14718 !! wikitext
14719
14720 [[:Category:Foo]]
14721 [[:Category:Foo|Bar]]
14722 !! html
14723 <p>
14724 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14725 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14726 </p>
14727 !! end
14728
14729 # We used to, but no longer wt2wt this test since the default serializer
14730 # will normalize all categories to serialize on their own line.
14731 # This wikitext usage is going to be fairly uncommon in production and
14732 # selser will take care of preventing whitespace insertion if this
14733 # occurs in an article.
14734 #
14735 # html2html disabled for the same reason (whitespace insertion between
14736 # x and y).
14737 #
14738 # html2wt disabled because it localizes the "Category" namespace.
14739 !! test
14740 Link prefix/suffixes aren't applied to category links
14741 !! options
14742 parsoid=wt2html
14743 language=is
14744 !! wikitext
14745 x[[Category:Foo]]y
14746 !! html/php
14747 <p>xy
14748 </p>
14749 !! html/parsoid
14750 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14751 !! end
14752
14753 !! test
14754 Parsoid: Serialize link to file page with colon escape
14755 !! options
14756 parsoid
14757 !! wikitext
14758
14759 [[:File:Foo.png]]
14760 [[:File:Foo.png|Bar]]
14761 !! html
14762 <p>
14763 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14764 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14765 </p>
14766 !! end
14767
14768 !! test
14769 Parsoid: Serialize a genuine category link without colon escape
14770 !! options
14771 parsoid
14772 !! wikitext
14773 [[Category:Foo]]
14774 [[Category:Foo|Bar]]
14775 !! html
14776 <link rel="mw:PageProp/Category" href="./Category:Foo">
14777 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14778 !! end
14779
14780 !! test
14781 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14782 !! options
14783 parsoid=html2wt
14784 !! html/parsoid
14785 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14786 !! wikitext
14787 [[Category:Toxine bactérienne]]
14788 !! end
14789
14790 !! test
14791 Parsoid: Defaultsort
14792 !! wikitext
14793 {{DEFAULTSORT:Foo}}
14794 !! html/parsoid
14795 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14796 !! end
14797
14798 !! test
14799 Parsoid: Defaultsort (template-generated)
14800 !! wikitext
14801 {{{{echo|DEFAULTSORT}}:Foo}}
14802 !! html/parsoid
14803 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14804 !! end
14805
14806 ###
14807 ### Inter-language links
14808 ###
14809 !! test
14810 Interlanguage links
14811 !! options
14812 ill
14813 !! wikitext
14814 [[es:Alimento]]
14815 [[fr:Nourriture]]
14816 [[zh:食品]]
14817 !! html/php
14818 es:Alimento fr:Nourriture zh:食品
14819 !! html/parsoid
14820 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14821 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14822 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14823 !! end
14824
14825 !! test
14826 Duplicate interlanguage links (bug 24502)
14827 !! options
14828 ill
14829 !! wikitext
14830 [[es:1]]
14831 [[es:2]]
14832 [[fr:1]]
14833 [[fr:2]]
14834 !! html/php
14835 es:1 fr:1
14836 !! html/parsoid
14837 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14838 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14839 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14840 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14841 !! end
14842
14843 ###
14844 ### Sections
14845 ###
14846 !! test
14847 Basic section headings
14848 !! wikitext
14849 == Headline 1 ==
14850 Some text
14851
14852 ==Headline 2==
14853 More
14854 ===Smaller headline===
14855 Blah blah
14856 !! html
14857 <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>
14858 <p>Some text
14859 </p>
14860 <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>
14861 <p>More
14862 </p>
14863 <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>
14864 <p>Blah blah
14865 </p>
14866 !! end
14867
14868 !! test
14869 Section headings with TOC
14870 !! wikitext
14871 == Headline 1 ==
14872 === Subheadline 1 ===
14873 ===== Skipping a level =====
14874 ====== Skipping a level ======
14875
14876 == Headline 2 ==
14877 Some text
14878 ===Another headline===
14879 !! html
14880 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14881 <ul>
14882 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14883 <ul>
14884 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14885 <ul>
14886 <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>
14887 <ul>
14888 <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>
14889 </ul>
14890 </li>
14891 </ul>
14892 </li>
14893 </ul>
14894 </li>
14895 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14896 <ul>
14897 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14898 </ul>
14899 </li>
14900 </ul>
14901 </div>
14902
14903 <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>
14904 <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>
14905 <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>
14906 <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>
14907 <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>
14908 <p>Some text
14909 </p>
14910 <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>
14911
14912 !! end
14913
14914 !! test
14915 TOC anchors don't collide
14916 !! wikitext
14917 __FORCETOC__
14918 == Headline 2 ==
14919 == Headline ==
14920 == Headline 2 ==
14921 == Headline ==
14922 !! html/php
14923 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14924 <ul>
14925 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14926 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14927 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14928 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14929 </ul>
14930 </div>
14931
14932 <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>
14933 <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>
14934 <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>
14935 <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>
14936
14937 !! end
14938
14939 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14940 !! test
14941 Handling of sections up to level 6 and beyond
14942 !! wikitext
14943 = Level 1 Heading=
14944 == Level 2 Heading==
14945 === Level 3 Heading===
14946 ==== Level 4 Heading====
14947 ===== Level 5 Heading=====
14948 ====== Level 6 Heading======
14949 ======= Level 7 Heading=======
14950 ======== Level 8 Heading========
14951 ========= Level 9 Heading=========
14952 ========== Level 10 Heading==========
14953 !! html
14954 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14955 <ul>
14956 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14957 <ul>
14958 <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>
14959 <ul>
14960 <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>
14961 <ul>
14962 <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>
14963 <ul>
14964 <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>
14965 <ul>
14966 <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>
14967 <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>
14968 <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>
14969 <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>
14970 <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>
14971 </ul>
14972 </li>
14973 </ul>
14974 </li>
14975 </ul>
14976 </li>
14977 </ul>
14978 </li>
14979 </ul>
14980 </li>
14981 </ul>
14982 </div>
14983
14984 <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>
14985 <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>
14986 <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>
14987 <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>
14988 <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>
14989 <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>
14990 <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>
14991 <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>
14992 <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>
14993 <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>
14994
14995 !! end
14996
14997 !! test
14998 TOC regression (T11764)
14999 !! wikitext
15000 == title 1 ==
15001 === title 1.1 ===
15002 ==== title 1.1.1 ====
15003 === title 1.2 ===
15004 == title 2 ==
15005 === title 2.1 ===
15006 !! html
15007 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15008 <ul>
15009 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15010 <ul>
15011 <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>
15012 <ul>
15013 <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>
15014 </ul>
15015 </li>
15016 <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>
15017 </ul>
15018 </li>
15019 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15020 <ul>
15021 <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>
15022 </ul>
15023 </li>
15024 </ul>
15025 </div>
15026
15027 <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>
15028 <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>
15029 <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>
15030 <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>
15031 <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>
15032 <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>
15033
15034 !! end
15035
15036 !! test
15037 TOC for heading containing <span id="..."></span> (T96153)
15038 !! wikitext
15039 __FORCETOC__
15040 ==<span id="old-anchor"></span>New title==
15041 !! html/php
15042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15043 <ul>
15044 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15045 </ul>
15046 </div>
15047
15048 <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>
15049
15050 !! end
15051
15052 !! test
15053 TOC with wgMaxTocLevel=3 (bug 6204)
15054 !! options
15055 wgMaxTocLevel=3
15056 !! wikitext
15057 == title 1 ==
15058 === title 1.1 ===
15059 ==== title 1.1.1 ====
15060 === title 1.2 ===
15061 == title 2 ==
15062 === title 2.1 ===
15063 !! html
15064 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15065 <ul>
15066 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15067 <ul>
15068 <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>
15069 <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>
15070 </ul>
15071 </li>
15072 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15073 <ul>
15074 <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>
15075 </ul>
15076 </li>
15077 </ul>
15078 </div>
15079
15080 <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>
15081 <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>
15082 <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>
15083 <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>
15084 <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>
15085 <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>
15086
15087 !! end
15088
15089 !! test
15090 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15091 !! options
15092 wgMaxTocLevel=3
15093 !! wikitext
15094 ==Section 1==
15095 ===Section 1.1===
15096 ====Section 1.1.1====
15097 ====Section 1.1.1.1====
15098 ==Section 2==
15099 !! html
15100 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15101 <ul>
15102 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15103 <ul>
15104 <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>
15105 </ul>
15106 </li>
15107 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15108 </ul>
15109 </div>
15110
15111 <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>
15112 <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>
15113 <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>
15114 <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>
15115 <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>
15116
15117 !! end
15118
15119
15120 !! test
15121 Resolving duplicate section names
15122 !! wikitext
15123 == Foo bar ==
15124 == Foo bar ==
15125 !! html
15126 <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>
15127 <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>
15128
15129 !! end
15130
15131 !! test
15132 Resolving duplicate section names with differing case (bug 10721)
15133 !! wikitext
15134 == Foo bar ==
15135 == Foo Bar ==
15136 !! html
15137 <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>
15138 <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>
15139
15140 !! end
15141
15142 !! article
15143 Template:sections
15144 !! text
15145 ===Section 1===
15146 ==Section 2==
15147 !! endarticle
15148
15149 !! test
15150 Template with sections, __NOTOC__
15151 !! wikitext
15152 __NOTOC__
15153 ==Section 0==
15154 {{sections}}
15155 ==Section 4==
15156 !! html
15157 <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>
15158 <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>
15159 <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>
15160 <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>
15161
15162 !! end
15163
15164 !! test
15165 __NOEDITSECTION__ keyword
15166 !! wikitext
15167 __NOEDITSECTION__
15168 ==Section 1==
15169 ==Section 2==
15170 !! html
15171 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15172 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15173
15174 !! end
15175
15176 !! test
15177 Link inside a section heading
15178 !! wikitext
15179 ==Section with a [[Main Page|link]] in it==
15180 !! html
15181 <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>
15182
15183 !! end
15184
15185 !! test
15186 TOC regression (T14077)
15187 !! wikitext
15188 __TOC__
15189 == title 1 ==
15190 === title 1.1 ===
15191 == title 2 ==
15192 !! html
15193 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15194 <ul>
15195 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15196 <ul>
15197 <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>
15198 </ul>
15199 </li>
15200 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15201 </ul>
15202 </div>
15203
15204 <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>
15205 <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>
15206 <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>
15207
15208 !! end
15209
15210 !! test
15211 BUG 1219 URL next to image (good)
15212 !! wikitext
15213 http://example.com [[File:Foobar.jpg]]
15214 !! html/php
15215 <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>
15216 </p>
15217 !! html/parsoid
15218 <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>
15219 !!end
15220
15221 !! test
15222 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15223 !! wikitext
15224 ===
15225 The line above must have a trailing space!
15226 === <!--
15227 --> <!-- -->
15228 But just in case it doesn't...
15229 !! html
15230 <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>
15231 <p>The line above must have a trailing space!
15232 </p>
15233 <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>
15234 <p>But just in case it doesn't...
15235 </p>
15236 !! end
15237
15238 !! test
15239 Header with special characters (bug 25462)
15240 !! wikitext
15241 The tooltips shall not show entities to the user (ie. be double escaped)
15242
15243 == text > text ==
15244 section 1
15245
15246 == text < text ==
15247 section 2
15248
15249 == text & text ==
15250 section 3
15251
15252 == text ' text ==
15253 section 4
15254
15255 == text " text ==
15256 section 5
15257 !! html
15258 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15259 </p>
15260 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15261 <ul>
15262 <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>
15263 <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>
15264 <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>
15265 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15266 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15267 </ul>
15268 </div>
15269
15270 <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>
15271 <p>section 1
15272 </p>
15273 <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>
15274 <p>section 2
15275 </p>
15276 <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>
15277 <p>section 3
15278 </p>
15279 <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>
15280 <p>section 4
15281 </p>
15282 <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>
15283 <p>section 5
15284 </p>
15285 !! end
15286
15287 !! test
15288 Header with space, plus and underscore as entity
15289 !! wikitext
15290 Id should not contain + for spaces
15291
15292 == Space between Text ==
15293 section 1
15294
15295 == Space-Entity&#32;between&#32;Text ==
15296 section 2
15297
15298 == Plus+between+Text ==
15299 section 3
15300
15301 == Plus-Entity&#43;between&#43;Text ==
15302 section 4
15303
15304 == Underscore_between_Text ==
15305 section 5
15306
15307 == Underscore-Entity&#95;between&#95;Text ==
15308 section 6
15309
15310 [[#Space between Text]]
15311 [[#Space-Entity&#32;between&#32;Text]]
15312 [[#Plus+between+Text]]
15313 [[#Plus-Entity&#43;between&#43;Text]]
15314 [[#Underscore_between_Text]]
15315 [[#Underscore-Entity&#95;between&#95;Text]]
15316 !! html
15317 <p>Id should not contain + for spaces
15318 </p>
15319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15320 <ul>
15321 <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>
15322 <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>
15323 <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>
15324 <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>
15325 <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>
15326 <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>
15327 </ul>
15328 </div>
15329
15330 <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>
15331 <p>section 1
15332 </p>
15333 <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>
15334 <p>section 2
15335 </p>
15336 <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>
15337 <p>section 3
15338 </p>
15339 <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>
15340 <p>section 4
15341 </p>
15342 <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>
15343 <p>section 5
15344 </p>
15345 <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>
15346 <p>section 6
15347 </p><p><a href="#Space_between_Text">#Space between Text</a>
15348 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15349 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15350 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15351 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15352 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15353 </p>
15354 !! end
15355
15356 !! test
15357 Headers with excess '=' characters
15358 (Are similar tests necessary beyond the 1st level?)
15359 !! wikitext
15360 =foo==
15361 ==foo=
15362 =''italic'' heading==
15363 ==''italic'' heading=
15364 !! html
15365 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15366 <ul>
15367 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15368 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15369 <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>
15370 <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>
15371 </ul>
15372 </div>
15373
15374 <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>
15375 <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>
15376 <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>
15377 <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>
15378
15379 !! end
15380
15381 !! test
15382 HTML headers vs TOC (bug 23393)
15383 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15384 !! wikitext
15385 <h1>Header 1</h1>
15386 == Header 1.1 ==
15387 == Header 1.2 ==
15388
15389 <h1>Header 2
15390 </h1>
15391 == Header 2.1 ==
15392 == Header 2.2 ==
15393 __NOEDITSECTION__
15394 !! html
15395 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15396 <ul>
15397 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15398 <ul>
15399 <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>
15400 <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>
15401 </ul>
15402 </li>
15403 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15404 <ul>
15405 <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>
15406 <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>
15407 </ul>
15408 </li>
15409 </ul>
15410 </div>
15411
15412 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15413 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15414 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15415 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15416 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15417 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15418
15419 !! end
15420
15421 !! test
15422 Single-line or multiline-comments can follow headings
15423 !! options
15424 parsoid=wt2html,wt2wt
15425 !! wikitext
15426 ==foo==<!---->
15427 ==bar==<!--c1-->
15428 ==baz==<!--
15429 c2
15430 c3-->
15431 !! html
15432 <h2><span class="mw-headline" id="foo">foo</span></h2>
15433 <h2><span class="mw-headline" id="bar">bar</span></h2>
15434 <h2><span class="mw-headline" id="baz">baz</span></h2>
15435
15436 !! end
15437
15438 !! test
15439 BUG 1219 URL next to image (broken)
15440 !! wikitext
15441 http://example.com[[File:Foobar.jpg]]
15442 !! html/php
15443 <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>
15444 </p>
15445 !! html/parsoid
15446 <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>
15447 !!end
15448
15449 !! test
15450 Bug 1186 news: in the middle of text
15451 !! wikitext
15452 http://en.wikinews.org/wiki/Wikinews:Workplace
15453 !! html
15454 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15455 </p>
15456 !!end
15457
15458
15459 !! test
15460 Namespaced link must have a title
15461 !! wikitext
15462 [[Project:]]
15463 !! html
15464 <p>[[Project:]]
15465 </p>
15466 !!end
15467
15468 !! test
15469 Namespaced link must have a title (bad fragment version)
15470 !! wikitext
15471 [[Project:#fragment]]
15472 !! html
15473 <p>[[Project:#fragment]]
15474 </p>
15475 !!end
15476
15477
15478 ###
15479 ### HTML tags and HTML attributes
15480 ###
15481
15482 !! test
15483 div with no attributes
15484 !! wikitext
15485 <div>HTML rocks</div>
15486 !! html
15487 <div>HTML rocks</div>
15488
15489 !! end
15490
15491 !! test
15492 div with double-quoted attribute
15493 !! wikitext
15494 <div id="rock">HTML rocks</div>
15495 !! html
15496 <div id="rock">HTML rocks</div>
15497
15498 !! end
15499
15500 !! test
15501 div with single-quoted attribute
15502 !! wikitext
15503 <div id='rock'>HTML rocks</div>
15504 !! html
15505 <div id="rock">HTML rocks</div>
15506
15507 !! end
15508
15509 !! test
15510 div with unquoted attribute
15511 !! wikitext
15512 <div id=rock>HTML rocks</div>
15513 !! html
15514 <div id="rock">HTML rocks</div>
15515
15516 !! end
15517
15518 !! test
15519 div with illegal double attributes
15520 !! wikitext
15521 <div id="a" id="b">HTML rocks</div>
15522 !! html
15523 <div id="b">HTML rocks</div>
15524
15525 !!end
15526
15527 !! test
15528 div with empty attribute value, space before equals
15529 !! options
15530 parsoid=wt2html,html2html
15531 !! wikitext
15532 <div class =>HTML rocks</div>
15533 !! html/php
15534 <div class="">HTML rocks</div>
15535
15536 !! html/parsoid
15537 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15538 !! end
15539
15540 !! test
15541 div with multiple empty attribute values
15542 !! options
15543 parsoid=wt2html,html2html
15544 !! wikitext
15545 <div id= title=>HTML rocks</div>
15546 !! html/php
15547 <div id="title.3D">HTML rocks</div>
15548
15549 !! html/parsoid
15550 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15551 !! end
15552
15553 !! test
15554 table with multiple empty attribute values
15555 !! options
15556 parsoid=wt2html,html2html
15557 !! wikitext
15558 {| title= id=
15559 | hi
15560 |}
15561 !! html/php
15562 <table title="id=">
15563 <tr>
15564 <td> hi
15565 </td></tr></table>
15566
15567 !! html/parsoid
15568 <table title="id=">
15569 <tbody><tr><td> hi</td></tr>
15570 </tbody></table>
15571 !! end
15572
15573 !! test
15574 div with braces in attribute value
15575 !! wikitext
15576 <div title="{}">Foo</div>
15577 !! html/php
15578 <div title="&#123;}">Foo</div>
15579
15580 !! html/parsoid
15581 <div title="{}">Foo</div>
15582 !! end
15583
15584 !! test
15585 div with empty attribute value, no space before equals
15586 !! options
15587 parsoid=wt2html,html2html
15588 !! wikitext
15589 <div class=>HTML rocks</div>
15590 !! html/php
15591 <div class="">HTML rocks</div>
15592
15593 !! html/parsoid
15594 <div class="">HTML rocks</div>
15595 !! end
15596
15597 !! test
15598 HTML multiple attributes correction
15599 !! wikitext
15600 <p class="error" class="awesome">Awesome!</p>
15601 !! html
15602 <p class="awesome">Awesome!</p>
15603
15604 !!end
15605
15606 !! test
15607 Table multiple attributes correction
15608 !! wikitext
15609 {|
15610 !+ class="error" class="awesome"| status
15611 |}
15612 !! html
15613 <table>
15614 <tr>
15615 <th class="awesome"> status
15616 </th></tr></table>
15617
15618 !!end
15619
15620 !! test
15621 DIV IN UPPERCASE
15622 !! wikitext
15623 <DIV ID="x">HTML ROCKS</DIV>
15624 !! html
15625 <div id="x">HTML ROCKS</div>
15626
15627 !!end
15628
15629 !! test
15630 Non-ASCII pseudo-tags are rendered as text
15631 !! wikitext
15632 <khyô>
15633 !! html
15634 <p>&lt;khyô&gt;
15635 </p>
15636 !! end
15637
15638 !! test
15639 Pseudo-tag with URL 'name' renders as url link
15640 !! wikitext
15641 <http://example.com/>
15642 !! html
15643 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15644 </p>
15645 !! end
15646
15647 !! test
15648 text with amp in the middle of nowhere
15649 !! wikitext
15650 Remember AT&T?
15651 !! html
15652 <p>Remember AT&amp;T?
15653 </p>
15654 !! end
15655
15656 !! test
15657 text with character entity: eacute
15658 !! wikitext
15659 I always thought &eacute; was a cute letter.
15660 !! html
15661 <p>I always thought &#233; was a cute letter.
15662 </p>
15663 !! html+tidy
15664 <p>I always thought é was a cute letter.</p>
15665 !! end
15666
15667 !! test
15668 text with entity-escaped character entity-like string: eacute
15669 !! wikitext
15670 I always thought &amp;eacute; was a cute letter.
15671 !! html
15672 <p>I always thought &amp;eacute; was a cute letter.
15673 </p>
15674 !! end
15675
15676 !! test
15677 text with undefined character entity: xacute
15678 !! wikitext
15679 I always thought &xacute; was a cute letter.
15680 !! html
15681 <p>I always thought &amp;xacute; was a cute letter.
15682 </p>
15683 !! end
15684
15685 !! test
15686 HTML5 tags
15687 !! wikitext
15688 <data value="5">five</data>
15689 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15690 <mark>This highlighted text</mark>
15691 !! html
15692 <p><data value="5">five</data>
15693 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15694 <mark>This highlighted text</mark>
15695 </p>
15696 !! end
15697
15698 !! test
15699 HTML tag with leading space is parsed as text
15700 !! wikitext
15701 < div>foo< /div>
15702 !! html
15703 <p>&lt; div&gt;foo&lt; /div&gt;
15704 </p>
15705 !! end
15706
15707 ###
15708 ### Nesting tests (see bug 41545, 50604, 51081)
15709 ###
15710
15711 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15712 # Note that html2wt is considerably more difficult if we use <b> in
15713 # the test case, instead of <big>
15714 !! test
15715 Ensure that HTML adoption agency algorithm is properly implemented.
15716 !! wikitext
15717 <big>X<big>Y</big>Z</big>
15718 !! html
15719 <p><big>X<big>Y</big>Z</big>
15720 </p>
15721 !! end
15722
15723 # This was bug 41545 in the PHP parser.
15724 # Note that tidy doesn't handle this correctly.
15725 !! test
15726 Nesting of <kbd>
15727 !! wikitext
15728 <kbd>X<kbd>Y</kbd>Z</kbd>
15729 !! html
15730 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15731 </p>
15732 !! end
15733
15734 # The following cases were bug 51081 in the PHP parser.
15735 # Note that there are some other nestable tags (b, i, etc) which are
15736 # not covered; see bug 51081 for discussion.
15737
15738 # Note that tidy doesn't handle this correctly.
15739 !! test
15740 Nesting of <em>
15741 !! wikitext
15742 <em>X<em>Y</em>Z</em>
15743 !! html
15744 <p><em>X<em>Y</em>Z</em>
15745 </p>
15746 !! end
15747
15748 # Note that tidy doesn't handle this correctly.
15749 !! test
15750 Nesting of <strong>
15751 !! wikitext
15752 <strong>X<strong>Y</strong>Z</strong>
15753 !! html
15754 <p><strong>X<strong>Y</strong>Z</strong>
15755 </p>
15756 !! end
15757
15758 !! test
15759 Nesting of <q>
15760 !! wikitext
15761 <q>X<q>Y</q>Z</q>
15762 !! html+tidy
15763 <p><q>X<q>Y</q>Z</q></p>
15764 !! end
15765
15766 # Note that tidy doesn't handle this correctly.
15767 !! test
15768 Nesting of <ruby>
15769 !! wikitext
15770 <ruby>X<ruby>Y</ruby>Z</ruby>
15771 !! html
15772 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15773 </p>
15774 !! end
15775
15776 # Note that tidy doesn't handle this correctly.
15777 !! test
15778 Nesting of <bdo>
15779 !! wikitext
15780 <bdo>X<bdo>Y</bdo>Z</bdo>
15781 !! html
15782 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15783 </p>
15784 !! end
15785
15786
15787 ###
15788 ### Media links
15789 ###
15790
15791 !! test
15792 Media link
15793 !! wikitext
15794 [[Media:Foobar.jpg]]
15795 !! html
15796 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15797 </p>
15798 !! end
15799
15800 !! test
15801 Media link with text
15802 !! wikitext
15803 [[Media:Foobar.jpg|A neat file to look at]]
15804 !! html
15805 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15806 </p>
15807 !! end
15808
15809 # FIXME: this is still bad HTML tag nesting
15810 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15811 !! test
15812 Media link with nasty text
15813 !! wikitext
15814 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15815 !! html
15816 <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>
15817
15818 !! html+tidy
15819 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15820 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15821 !! end
15822
15823 !! test
15824 Media link to nonexistent file (bug 1702)
15825 !! wikitext
15826 [[Media:No such.jpg]]
15827 !! html
15828 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15829 </p>
15830 !! end
15831
15832 !! test
15833 Image link to nonexistent file (bug 1850 - good)
15834 !! wikitext
15835 [[File:No_such.jpg]]
15836 !! html/php
15837 <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>
15838 </p>
15839 !! html/parsoid
15840 <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>
15841 !! end
15842
15843 !! test
15844 :Image link to nonexistent file (bug 1850 - bad)
15845 !! wikitext
15846 [[:Image:No such.jpg]]
15847 !! html/php
15848 <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>
15849 </p>
15850 !! html/parsoid
15851 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15852 !! end
15853
15854
15855
15856 !! test
15857 Character reference normalization in link text (bug 1938)
15858 !! wikitext
15859 [[Main Page|this&that]]
15860 !! html
15861 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15862 </p>
15863 !!end
15864
15865 !! article
15866 אַ
15867 !! text
15868 Test for unicode normalization
15869
15870 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15871 !! endarticle
15872
15873 !! test
15874 (bug 19451) Links should refer to the normalized form.
15875 !! wikitext
15876 [[&#xFB2E;]]
15877 [[&#x5d0;&#x5b7;]]
15878 [[&#x5d0;ַ]]
15879 [[א&#x5b7;]]
15880 [[אַ]]
15881 !! html
15882 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15883 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15884 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15885 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15886 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15887 </p>
15888 !! end
15889
15890 !! test
15891 Empty attribute crash test (bug 2067)
15892 !! wikitext
15893 <font color="">foo</font>
15894 !! html
15895 <p><font color="">foo</font>
15896 </p>
15897 !! end
15898
15899 !! test
15900 Empty attribute crash test single-quotes (bug 2067)
15901 !! wikitext
15902 <font color=''>foo</font>
15903 !! html
15904 <p><font color="">foo</font>
15905 </p>
15906 !! end
15907
15908 !! test
15909 Attribute test: equals, then nothing
15910 !! options
15911 parsoid=wt2html,html2html
15912 !! wikitext
15913 <font color=>foo</font>
15914 !! html/php
15915 <p><font color="">foo</font>
15916 </p>
15917 !! html/parsoid
15918 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15919 !! end
15920
15921 !! test
15922 Attribute test: unquoted value
15923 !! options
15924 parsoid=wt2html,html2html
15925 !! wikitext
15926 <font color=x>foo</font>
15927 !! html/php
15928 <p><font color="x">foo</font>
15929 </p>
15930 !! html/parsoid
15931 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15932 !! end
15933
15934 !! test
15935 Attribute test: unquoted but illegal value (hash)
15936 !! wikitext
15937 <font color=#x>foo</font>
15938 !! html
15939 <p><font color="#x">foo</font>
15940 </p>
15941 !! end
15942
15943 # Parsoid does not serialize to empty attribute syntax,
15944 # so wt2wt and html2wt cases are skipped
15945 !! test
15946 Attribute test: no value (T54330)
15947 !! options
15948 parsoid=wt2html,html2html
15949 !! wikitext
15950 <font color>foo</font>
15951 !! html/php
15952 <p><font color="">foo</font>
15953 </p>
15954 !! html/parsoid
15955 <p><font color="">foo</font></p>
15956 !! end
15957
15958 !! test
15959 Bug 2095: link with three closing brackets
15960 !! wikitext
15961 [[Main Page]]]
15962 !! html/php
15963 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15964 </p>
15965 !! html/parsoid
15966 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15967 !! end
15968
15969 !! test
15970 Bug 2095: link with pipe and three closing brackets
15971 !! wikitext
15972 [[Main Page|link]]]
15973 !! html/php
15974 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15975 </p>
15976 !! html/parsoid
15977 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15978 !! end
15979
15980 !! test
15981 Bug 2095: link with pipe and three closing brackets, version 2
15982 !! wikitext
15983 [[Main Page|[http://example.com/]]]
15984 !! html/php
15985 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15986 </p>
15987 !! html/parsoid
15988 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15989 !! end
15990
15991
15992 ###
15993 ### Safety
15994 ###
15995
15996 !! article
15997 Template:Dangerous attribute
15998 !! text
15999 " onmouseover="alert(document.cookie)
16000 !! endarticle
16001
16002 !! article
16003 Template:Dangerous style attribute
16004 !! text
16005 border-size: expression(alert(document.cookie))
16006 !! endarticle
16007
16008 !! article
16009 Template:Div style
16010 !! text
16011 <div style="float: right; {{{1}}}">Magic div</div>
16012 !! endarticle
16013
16014 !! test
16015 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16016 !! wikitext
16017 <div title="{{test}}"></div>
16018 !! html
16019 <div title="This is a test template"></div>
16020
16021 !! end
16022
16023 # Parsoid has enough context to handle this case
16024 !! test
16025 Bug 2304: HTML attribute safety (dangerous template; 2309)
16026 !! wikitext
16027 <div title="{{dangerous attribute}}"></div>
16028 !! html/php
16029 <div title=""></div>
16030
16031 !! html/parsoid
16032 <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=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16033 !! end
16034
16035 !! test
16036 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16037 !! wikitext
16038 <div style="{{dangerous style attribute}}"></div>
16039 !! html
16040 <div style="/* insecure input */"></div>
16041
16042 !! end
16043
16044 !! test
16045 Bug 2304: HTML attribute safety (safe parameter; 2309)
16046 !! wikitext
16047 {{div style|width: 200px}}
16048 !! html
16049 <div style="float: right; width: 200px">Magic div</div>
16050
16051 !! end
16052
16053 !! test
16054 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16055 !! wikitext
16056 {{div style|width: expression(alert(document.cookie))}}
16057 !! html
16058 <div style="/* insecure input */">Magic div</div>
16059
16060 !! end
16061
16062 !! test
16063 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16064 !! wikitext
16065 {{div style|"><script>alert(document.cookie)</script>}}
16066 !! html
16067 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16068
16069 !! end
16070
16071 !! test
16072 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16073 !! wikitext
16074 {{div style|" ><script>alert(document.cookie)</script>}}
16075 !! html
16076 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16077
16078 !! end
16079
16080 !! test
16081 Bug 2304: HTML attribute safety (link)
16082 !! wikitext
16083 <div title="[[Main Page]]"></div>
16084 !! html
16085 <div title="&#91;&#91;Main Page]]"></div>
16086
16087 !! end
16088
16089 !! test
16090 Bug 2304: HTML attribute safety (italics)
16091 !! wikitext
16092 <div title="''foobar''"></div>
16093 !! html
16094 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16095
16096 !! end
16097
16098 !! test
16099 Bug 2304: HTML attribute safety (bold)
16100 !! wikitext
16101 <div title="'''foobar'''"></div>
16102 !! html
16103 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16104
16105 !! end
16106
16107
16108 !! test
16109 Bug 2304: HTML attribute safety (ISBN)
16110 !! wikitext
16111 <div title="ISBN 1234567890"></div>
16112 !! html
16113 <div title="&#73;SBN 1234567890"></div>
16114
16115 !! end
16116
16117 !! test
16118 Bug 2304: HTML attribute safety (RFC)
16119 !! wikitext
16120 <div title="RFC 1234"></div>
16121 !! html
16122 <div title="&#82;FC 1234"></div>
16123
16124 !! end
16125
16126 !! test
16127 Bug 2304: HTML attribute safety (PMID)
16128 !! wikitext
16129 <div title="PMID 1234567890"></div>
16130 !! html
16131 <div title="&#80;MID 1234567890"></div>
16132
16133 !! end
16134
16135 !! test
16136 Bug 2304: HTML attribute safety (web link)
16137 !! wikitext
16138 <div title="http://example.com/"></div>
16139 !! html
16140 <div title="http&#58;//example.com/"></div>
16141
16142 !! end
16143
16144 !! test
16145 Bug 2304: HTML attribute safety (named web link)
16146 !! wikitext
16147 <div title="[http://example.com/ link]"></div>
16148 !! html
16149 <div title="&#91;http&#58;//example.com/ link]"></div>
16150
16151 !! end
16152
16153 !! test
16154 Bug 3244: HTML attribute safety (extension; safe)
16155 !! wikitext
16156 <div style="<nowiki>background:blue</nowiki>"></div>
16157 !! html
16158 <div style="background:blue"></div>
16159
16160 !! end
16161
16162 !! test
16163 Bug 3244: HTML attribute safety (extension; unsafe)
16164 !! wikitext
16165 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16166 !! html
16167 <div style="/* insecure input */"></div>
16168
16169 !! end
16170
16171 # More MSIE fun discovered by Tom Gilder
16172
16173 !! test
16174 MSIE CSS safety test: spurious slash
16175 !! wikitext
16176 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16177 !! html
16178 <div style="/* insecure input */">evil</div>
16179
16180 !! end
16181
16182 !! test
16183 MSIE CSS safety test: hex code
16184 !! wikitext
16185 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16186 !! html
16187 <div style="/* insecure input */">evil</div>
16188
16189 !! end
16190
16191 !! test
16192 MSIE CSS safety test: comment in url
16193 !! wikitext
16194 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16195 !! html
16196 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16197
16198 !! end
16199
16200 !! test
16201 MSIE CSS safety test: comment in expression
16202 !! wikitext
16203 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16204 !! html
16205 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16206
16207 !! end
16208
16209 !! test
16210 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16211 !! wikitext
16212 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16213 !! html
16214 <p style="/* invalid control char */">A</p>
16215
16216 !! end
16217
16218 !! test
16219 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16220 !! wikitext
16221 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16222 <div style="top:EXPRESSION(alert())">B</div>
16223 !! html
16224 <p style="/* insecure input */">A</p>
16225 <div style="/* insecure input */">B</div>
16226
16227 !! end
16228
16229 !! test
16230 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16231 !! wikitext
16232 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16233 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16234 !! html
16235 <div style="/* insecure input */">A</div>
16236 <p style="/* insecure input */">B</p>
16237
16238 !! end
16239
16240 !! test
16241 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16242 !! wikitext
16243 <div style="background-image:url⁽javascript:alert())">A</div>
16244 <div style="background-image:url₍javascript:alert())">B</div>
16245 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16246 !! html
16247 <div style="/* insecure input */">A</div>
16248 <div style="/* insecure input */">B</div>
16249 <p style="/* insecure input */">C</p>
16250
16251 !! end
16252
16253 # FIXME: Parsoid fails to sanitize this! See T58846.
16254 !! test
16255 Opera -o-link CSS
16256 !! wikitext
16257 <div
16258 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;"
16259 style="-o-link:attr(title);-o-link-source:current">X</div>
16260 !! html
16261 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16262
16263 !! end
16264
16265 !! test
16266 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16267 !! wikitext
16268 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16269 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16270 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16271 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16272 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16273 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16274 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16275 !! html
16276 <p style="/* insecure input */">A</p>
16277 <p style="/* insecure input */">B</p>
16278 <p style="/* insecure input */">C</p>
16279 <p style="/* insecure input */">D</p>
16280 <p style="/* insecure input */">E</p>
16281 <p style="/* insecure input */">F</p>
16282 <p style="/* insecure input */">G</p>
16283
16284 !! end
16285
16286 !! test
16287 Table attribute legitimate extension
16288 !! wikitext
16289 {|
16290 !+ style="<nowiki>color:blue</nowiki>"| status
16291 |}
16292 !! html
16293 <table>
16294 <tr>
16295 <th style="color:blue"> status
16296 </th></tr></table>
16297
16298 !!end
16299
16300 !! test
16301 Table attribute safety
16302 !! wikitext
16303 {|
16304 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16305 |}
16306 !! html
16307 <table>
16308 <tr>
16309 <th style="/* insecure input */"> status
16310 </th></tr></table>
16311
16312 !! end
16313
16314 !! test
16315 CSS line continuation 1
16316 !! wikitext
16317 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16318 !! html
16319 <div style="/* insecure input */"></div>
16320
16321 !! end
16322
16323 !! test
16324 CSS line continuation 2
16325 !! wikitext
16326 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16327 !! html
16328 <div style="/* invalid control char */"></div>
16329
16330 !! end
16331
16332 !! article
16333 Template:Identity
16334 !! text
16335 {{{1}}}
16336 !! endarticle
16337
16338 !! test
16339 Expansion of multi-line templates in attribute values (bug 6255)
16340 !! wikitext
16341 <div style="background: {{identity|#00FF00}}">-</div>
16342 !! html
16343 <div style="background: #00FF00">-</div>
16344
16345 !! end
16346
16347
16348 !! test
16349 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16350 !! wikitext
16351 <div style="background:
16352 #00FF00">-</div>
16353 !! html/php
16354 <div style="background: #00FF00">-</div>
16355
16356 !! html/parsoid
16357 <div style="background:
16358 #00FF00">-</div>
16359 !! end
16360
16361 !! test
16362 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16363 !! wikitext
16364 <div style="background: &#10;#00FF00">-</div>
16365 !! html
16366 <div style="background: &#10;#00FF00">-</div>
16367
16368 !! end
16369
16370 !! test
16371 evil <math>-wiki-tags without Extension:Math enabled
16372 !! wikitext
16373 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16374 !! html+tidy
16375 <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>
16376 !! end
16377
16378 ###
16379 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16380 ###
16381 !! test
16382 Parser hook: empty input
16383 !! wikitext
16384 <tag></tag>
16385 !! html/php
16386 <pre>
16387 ''
16388 array (
16389 )
16390 </pre>
16391
16392 !! html/parsoid
16393 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16394 !! end
16395
16396 ## Don't expect parsoid to rt this form.
16397 !! test
16398 Parser hook: empty input using terminated empty elements
16399 !! options
16400 parsoid=wt2html,html2html
16401 !! wikitext
16402 <tag/>
16403 !! html/php
16404 <pre>
16405 NULL
16406 array (
16407 )
16408 </pre>
16409
16410 !! html/parsoid
16411 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16412 !! end
16413
16414 !! test
16415 Parser hook: empty input using terminated empty elements (space before)
16416 !! wikitext
16417 <tag />
16418 !! html/php
16419 <pre>
16420 NULL
16421 array (
16422 )
16423 </pre>
16424
16425 !! html/parsoid
16426 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16427 !! end
16428
16429 !! test
16430 Parser hook: basic input
16431 !! wikitext
16432 <tag>input</tag>
16433 !! html/php
16434 <pre>
16435 'input'
16436 array (
16437 )
16438 </pre>
16439
16440 !! html/parsoid
16441 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16442 !! end
16443
16444 ## Don't expect parsoid to rt this form.
16445 !! test
16446 Parser hook: case insensitive
16447 !! options
16448 parsoid=wt2html,html2html
16449 !! wikitext
16450 <TAG>input</TAG>
16451 !! html/php
16452 <pre>
16453 'input'
16454 array (
16455 )
16456 </pre>
16457
16458 !! html/parsoid
16459 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16460 !! end
16461
16462 ## Don't expect parsoid to rt this form.
16463 !! test
16464 Parser hook: case insensitive, redux
16465 !! options
16466 parsoid=wt2html,html2html
16467 !! wikitext
16468 <TaG>input</TAg>
16469 !! html/php
16470 <pre>
16471 'input'
16472 array (
16473 )
16474 </pre>
16475
16476 !! html/parsoid
16477 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16478 !! end
16479
16480 !! test
16481 Parser hook: nested tags
16482 !! wikitext
16483 <tag><tag></tag></tag>
16484 !! html/php
16485 <pre>
16486 '<tag>'
16487 array (
16488 )
16489 </pre>&lt;/tag&gt;
16490
16491 !! html/parsoid
16492 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16493 !! end
16494
16495 !! test
16496 Parser hook: basic arguments
16497 !! wikitext
16498 <tag width="200" height="100" depth="50" square=""></tag>
16499 !! html/php
16500 <pre>
16501 ''
16502 array (
16503 'width' => '200',
16504 'height' => '100',
16505 'depth' => '50',
16506 'square' => '',
16507 )
16508 </pre>
16509
16510 !! html/parsoid
16511 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16512 !! end
16513
16514 ## Don't expect parsoid to rt this form.
16515 !! test
16516 Parser hook: basic arguments, variations
16517 !! options
16518 parsoid=wt2html,html2html
16519 !! wikitext
16520 <tag width=200 height = "100" depth = '50' square></tag>
16521 !! html/php
16522 <pre>
16523 ''
16524 array (
16525 'width' => '200',
16526 'height' => '100',
16527 'depth' => '50',
16528 'square' => '',
16529 )
16530 </pre>
16531
16532 !! html/parsoid
16533 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16534 !! end
16535
16536 !! test
16537 Parser hook: argument containing a forward slash (bug 5344)
16538 !! wikitext
16539 <tag filename="/tmp/bla"></tag>
16540 !! html/php
16541 <pre>
16542 ''
16543 array (
16544 'filename' => '/tmp/bla',
16545 )
16546 </pre>
16547
16548 !! html/parsoid
16549 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16550 !! end
16551
16552 ## Don't expect parsoid to rt this form.
16553 !! test
16554 Parser hook: empty input using terminated empty elements (bug 2374)
16555 !! options
16556 parsoid=wt2html,html2html
16557 !! wikitext
16558 <tag foo=bar/>text
16559 !! html/php
16560 <pre>
16561 NULL
16562 array (
16563 'foo' => 'bar',
16564 )
16565 </pre>text
16566
16567 !! html/parsoid
16568 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16569 !! end
16570
16571 ## </tag> should be output literally since there is no matching tag that begins it
16572 ## Don't expect parsoid to rt this form.
16573 !! test
16574 Parser hook: basic arguments using terminated empty elements (bug 2374)
16575 !! options
16576 parsoid=wt2html
16577 !! wikitext
16578 <tag width=200 height = "100" depth = '50' square/>
16579 other stuff
16580 </tag>
16581 !! html/php
16582 <pre>
16583 NULL
16584 array (
16585 'width' => '200',
16586 'height' => '100',
16587 'depth' => '50',
16588 'square' => '',
16589 )
16590 </pre>
16591 <p>other stuff
16592 &lt;/tag&gt;
16593 </p>
16594 !! html/parsoid
16595 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
16596 &lt;/tag></p>
16597 !! end
16598
16599 ## Don't expect parsoid to rt this form.
16600 !! test
16601 Parser hook: Don't allow unclosed extension tags
16602 !! options
16603 parsoid=wt2html
16604 !! wikitext
16605 test <tag>123
16606
16607 this is a '''test'''
16608 !! html/php
16609 <p>test &lt;tag&gt;123
16610 </p><p>this is a <b>test</b>
16611 </p>
16612 !! html/parsoid
16613 <p>test &lt;tag>123</p>
16614
16615 <p>this is a <b>test</b></p>
16616 !! end
16617
16618 ###
16619 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16620 ###
16621
16622 !! test
16623 Parser hook: static parser hook not inside a comment
16624 !! wikitext
16625 <statictag>hello, world</statictag>
16626
16627 <statictag action="flush" />
16628 !! html/php
16629 <p><br />
16630 hello, world
16631 </p>
16632 !! html/parsoid
16633 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16634 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16635 !! end
16636
16637 !! test
16638 Parser hook: static parser hook inside a comment
16639 !! wikitext
16640 <!-- <statictag>hello, world</statictag> -->
16641 <statictag action="flush" />
16642 !! html/php
16643 <p><br />
16644 </p>
16645 !! html/parsoid
16646 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16647 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16648 !! end
16649
16650 # Nested template calls; this case was broken by Parser.php rev 1.506,
16651 # since reverted.
16652
16653 !! article
16654 Template:One-parameter
16655 !! text
16656 (My parameter is: {{{1}}})
16657 !! endarticle
16658
16659 !! article
16660 Template:Map-one-parameter
16661 !! text
16662 {{{{{1}}}|{{{2}}}}}
16663 !! endarticle
16664
16665 !! test
16666 Nested template calls
16667 !! wikitext
16668 {{Map-one-parameter|One-parameter|param}}
16669 !! html
16670 <p>(My parameter is: param)
16671 </p>
16672 !! end
16673
16674
16675 ###
16676 ### Sanitizer
16677 ###
16678
16679 # HTML+Tidy effectively strips out the empty tags completely
16680 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16681 # which Tidy would have done for the PHP parser had there been content inside it.
16682 !! test
16683 Sanitizer: Closing of open tags
16684 !! wikitext
16685 <s></s><table></table>
16686 !! html
16687 <s></s><table></table>
16688
16689 !! html/parsoid
16690 <p><s></s></p><table></table>
16691 !! end
16692
16693 !! test
16694 Sanitizer: Closing of open but not closed tags
16695 !! wikitext
16696 <s>foo
16697 !! html
16698 <p><s>foo</s>
16699 </p>
16700 !! end
16701
16702 !! test
16703 Sanitizer: Closing of closed but not open tags
16704 !! options
16705 parsoid=wt2html
16706 !! wikitext
16707 </s>
16708 !! html/php+tidy
16709 !! html/parsoid
16710 !! end
16711
16712 !! test
16713 Sanitizer: Closing of closed but not open table tags
16714 !! options
16715 parsoid=wt2html
16716 !! wikitext
16717 Table not started</td></tr></table>
16718 !! html/php+tidy
16719 <p>Table not started</p>
16720 !! html/parsoid
16721 <p>Table not started</p>
16722 !! end
16723
16724 !! test
16725 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16726 !! wikitext
16727 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16728 !! html
16729 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16730 </p>
16731 !! end
16732
16733 # In HTML5, the restrictions are that id must contain at least one character,
16734 # and must not contain any space characters.
16735 !! test
16736 Sanitizer: Validating the contents of the id attribute (bug 4515)
16737 !! options
16738 disabled
16739 !! wikitext
16740 <br id="" /><br id="a space" />
16741 !! html
16742 Something ...
16743 !! end
16744
16745 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16746 !! test
16747 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16748 !! options
16749 disabled
16750 !! wikitext
16751 <br id="foo" /><br id="foo" />
16752 !! html
16753 Something need to be done. foo-2 ?
16754 !! end
16755
16756 !! test
16757 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16758 !! wikitext
16759 <div itemscope>
16760 <meta itemprop="hello" content="world">
16761 <meta http-equiv="refresh" content="5">
16762 <meta itemprop="hello" http-equiv="refresh" content="5">
16763 <link itemprop="hello" href="{{SERVER}}">
16764 <link rel="stylesheet" href="{{SERVER}}">
16765 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16766 </div>
16767 !! html
16768 <div itemscope="">
16769 <p> <meta itemprop="hello" content="world" />
16770 &lt;meta http-equiv="refresh" content="5"&gt;
16771 <meta itemprop="hello" content="5" />
16772 </p>
16773 <link itemprop="hello" href="http&#58;//example.org" />
16774 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16775 <link itemprop="hello" href="http&#58;//example.org" />
16776 </div>
16777
16778 !! end
16779
16780 !! test
16781 Language converter: output gets cut off unexpectedly (bug 5757)
16782 !! options
16783 language=zh
16784 !! wikitext
16785 this bit is safe: }-
16786
16787 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16788
16789 then we get cut off here: }-
16790
16791 all additional text is vanished
16792 !! html
16793 <p>this bit is safe: }-
16794 </p><p>but if we add a conversion instance: xxx
16795 </p><p>then we get cut off here: }-
16796 </p><p>all additional text is vanished
16797 </p>
16798 !! end
16799
16800 !! test
16801 Self closed html pairs (bug 5487)
16802 !! options
16803 !! wikitext
16804 <center><font id="bug" />Centered text</center>
16805 <div><font id="bug2" />In div text</div>
16806 !! html
16807 <center>&lt;font id="bug" /&gt;Centered text</center>
16808 <div>&lt;font id="bug2" /&gt;In div text</div>
16809
16810 !! end
16811
16812 #
16813 #
16814 #
16815
16816 !! test
16817 Punctuation: nbsp before exclamation
16818 !! wikitext
16819 C'est grave !
16820 !! html
16821 <p>C'est grave&#160;!
16822 </p>
16823 !! end
16824
16825 !! test
16826 Punctuation: CSS !important (bug 11874)
16827 !! wikitext
16828 <div style="width:50% !important">important</div>
16829 !! html
16830 <div style="width:50% !important">important</div>
16831
16832 !!end
16833
16834 !! test
16835 Punctuation: CSS ! important (bug 11874; with space after)
16836 !! wikitext
16837 <div style="width:50% ! important">important</div>
16838 !! html
16839 <div style="width:50% ! important">important</div>
16840
16841 !!end
16842
16843 !! test
16844 HTML bullet list, closed tags (bug 5497)
16845 !! wikitext
16846 <ul>
16847 <li>One</li>
16848 <li>Two</li>
16849 </ul>
16850 !! html/php
16851 <ul>
16852 <li>One</li>
16853 <li>Two</li>
16854 </ul>
16855
16856 !! html/parsoid
16857 <ul data-parsoid='{"stx":"html"}'>
16858 <li data-parsoid='{"stx":"html"}'>One</li>
16859 <li data-parsoid='{"stx":"html"}'>Two</li>
16860 </ul>
16861
16862 !! end
16863
16864 !! test
16865 HTML bullet list, unclosed tags (bug 5497)
16866 !! wikitext
16867 <ul>
16868 <li>One
16869 <li>Two
16870 </ul>
16871 !! html/php+tidy
16872 <ul>
16873 <li>One</li>
16874 <li>Two</li>
16875 </ul>
16876 !! html/parsoid
16877 <ul data-parsoid='{"stx":"html"}'>
16878 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16879 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16880 </ul>
16881
16882 !! end
16883
16884 !! test
16885 HTML ordered list, closed tags (bug 5497)
16886 !! wikitext
16887 <ol>
16888 <li>One</li>
16889 <li>Two</li>
16890 </ol>
16891 !! html/php
16892 <ol>
16893 <li>One</li>
16894 <li>Two</li>
16895 </ol>
16896
16897 !! html/parsoid
16898 <ol data-parsoid='{"stx":"html"}'>
16899 <li data-parsoid='{"stx":"html"}'>One</li>
16900 <li data-parsoid='{"stx":"html"}'>Two</li>
16901 </ol>
16902
16903 !! end
16904
16905 !! test
16906 HTML ordered list, unclosed tags (bug 5497)
16907 !! options
16908 !! wikitext
16909 <ol>
16910 <li>One
16911 <li>Two
16912 </ol>
16913 !! html/php+tidy
16914 <ol>
16915 <li>One</li>
16916 <li>Two</li>
16917 </ol>
16918 !! html/parsoid
16919 <ol data-parsoid='{"stx":"html"}'>
16920 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16921 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16922 </ol>
16923
16924 !! end
16925
16926 !! test
16927 HTML nested bullet list, closed tags (bug 5497)
16928 !! wikitext
16929 <ul>
16930 <li>One</li>
16931 <li>Two:
16932 <ul>
16933 <li>Sub-one</li>
16934 <li>Sub-two</li>
16935 </ul>
16936 </li>
16937 </ul>
16938 !! html/php
16939 <ul>
16940 <li>One</li>
16941 <li>Two:
16942 <ul>
16943 <li>Sub-one</li>
16944 <li>Sub-two</li>
16945 </ul>
16946 </li>
16947 </ul>
16948
16949 !! html/parsoid
16950 <ul data-parsoid='{"stx":"html"}'>
16951 <li data-parsoid='{"stx":"html"}'>One</li>
16952 <li data-parsoid='{"stx":"html"}'>Two:
16953 <ul data-parsoid='{"stx":"html"}'>
16954 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
16955 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
16956 </ul>
16957 </li>
16958 </ul>
16959 !! end
16960
16961 !! test
16962 HTML nested bullet list, open tags (bug 5497)
16963 !! wikitext
16964 <ul>
16965 <li>One
16966 <li>Two:
16967 <ul>
16968 <li>Sub-one
16969 <li>Sub-two
16970 </ul>
16971 </ul>
16972 !! html/php+tidy
16973 <ul>
16974 <li>One</li>
16975 <li>Two:
16976 <ul>
16977 <li>Sub-one</li>
16978 <li>Sub-two</li>
16979 </ul>
16980 </li>
16981 </ul>
16982 !! html/parsoid
16983 <ul>
16984 <li>One
16985 </li>
16986 <li>Two:
16987 <ul>
16988 <li>Sub-one
16989 </li>
16990 <li>Sub-two
16991 </li>
16992 </ul>
16993 </li>
16994 </ul>
16995
16996 !! end
16997
16998 !! test
16999 HTML nested ordered list, closed tags (bug 5497)
17000 !! wikitext
17001 <ol>
17002 <li>One</li>
17003 <li>Two:
17004 <ol>
17005 <li>Sub-one</li>
17006 <li>Sub-two</li>
17007 </ol>
17008 </li>
17009 </ol>
17010 !! html
17011 <ol>
17012 <li>One</li>
17013 <li>Two:
17014 <ol>
17015 <li>Sub-one</li>
17016 <li>Sub-two</li>
17017 </ol>
17018 </li>
17019 </ol>
17020
17021 !! end
17022
17023 !! test
17024 HTML nested ordered list, open tags (bug 5497)
17025 !! wikitext
17026 <ol>
17027 <li>One
17028 <li>Two:
17029 <ol>
17030 <li>Sub-one
17031 <li>Sub-two
17032 </ol>
17033 </ol>
17034 !! html/php
17035 <ol>
17036 <li>One
17037 <li>Two:
17038 <ol>
17039 <li>Sub-one
17040 <li>Sub-two
17041 </ol>
17042 </ol>
17043
17044 !! html/parsoid
17045 <ol>
17046 <li>One
17047 </li>
17048 <li>Two:
17049 <ol>
17050 <li>Sub-one
17051 </li>
17052 <li>Sub-two
17053 </li>
17054 </ol>
17055 </li>
17056 </ol>
17057
17058 !! end
17059
17060 !! test
17061 HTML ordered list item with parameters oddity
17062 !! wikitext
17063 <ol><li id="fragment">One</li>
17064 </ol>
17065 !! html
17066 <ol><li id="fragment">One</li>
17067 </ol>
17068
17069 !! end
17070
17071 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17072 !!test
17073 bug 5918: autonumbering
17074 !! wikitext
17075 [http://first/] [http://second] [ftp://ftp]
17076
17077 ftp://inlineftp
17078
17079 [mailto:enclosed@mail.tld With target]
17080
17081 [mailto:enclosed@mail.tld]
17082
17083 mailto:inline@mail.tld
17084 !! html/php
17085 <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>
17086 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17087 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17088 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17089 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17090 </p>
17091 !! html/parsoid
17092 <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>
17093 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17094 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17095 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17096 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17097 !! end
17098
17099
17100 #
17101 # Security and HTML correctness
17102 # From Nick Jenkins' fuzz testing
17103 #
17104
17105 !! test
17106 Fuzz testing: Parser13
17107 !! wikitext
17108 {|
17109 | http://a|
17110 !! html
17111 <table>
17112 <tr>
17113 <td>
17114 </td>
17115 </tr>
17116 </table>
17117
17118 !! end
17119
17120 !! test
17121 Fuzz testing: Parser14
17122 !! wikitext
17123 == onmouseover= ==
17124 http://__TOC__
17125 !! html
17126 <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>
17127 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17128 <ul>
17129 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17130 </ul>
17131 </div>
17132
17133
17134 !! html+tidy
17135 <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>
17136 <p>http://</p>
17137 <div id="toc" class="toc">
17138 <div id="toctitle">
17139 <h2>Contents</h2>
17140 </div>
17141 <ul>
17142 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17143 </ul>
17144 </div>
17145 <p></p>
17146 !! end
17147
17148 !! test
17149 Fuzz testing: Parser14-table
17150 !! options
17151 parsoid=wt2html,html2html
17152 !! wikitext
17153 ==a==
17154 {| STYLE=__TOC__
17155 !! html
17156 <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>
17157 <table style="&#95;_TOC&#95;_">
17158 <tr><td></td></tr>
17159 </table>
17160
17161 !! html+tidy
17162 <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>
17163 <table style="__TOC__">
17164 <tr>
17165 <td></td>
17166 </tr>
17167 </table>
17168 !! html/parsoid
17169 <h2>a</h2>
17170 <table style="__TOC__"></table>
17171 !! end
17172
17173 # Known to produce bogus xml (extra </td>)
17174 !! test
17175 Fuzz testing: Parser16
17176 !! wikitext
17177 {|
17178 !https://||||||
17179 !! html
17180 <table>
17181 <tr>
17182 <th>https://</th>
17183 <th></th>
17184 <th></th>
17185 <th>
17186 </td>
17187 </tr>
17188 </table>
17189
17190 !! html+tidy
17191 <table>
17192 <tr>
17193 <th>https://</th>
17194 <th></th>
17195 <th></th>
17196 <th></th>
17197 </tr>
17198 </table>
17199 !! end
17200
17201 !! test
17202 Fuzz testing: Parser21
17203 !! wikitext
17204 {|
17205 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17206 |
17207 !! html
17208 <table>
17209 <tr>
17210 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17211 </th>
17212 <td>
17213 </td>
17214 </tr>
17215 </table>
17216
17217 !! end
17218
17219 !! test
17220 Fuzz testing: Parser22
17221 !! wikitext
17222 http://===r:::https://b
17223
17224 {|
17225 !! html
17226 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17227 </p>
17228 <table>
17229 <tr><td></td></tr>
17230 </table>
17231
17232 !! end
17233
17234 # Known to produce bad XML for now
17235 !! test
17236 Fuzz testing: Parser24
17237 !! wikitext
17238 {|
17239 {{{|
17240 <u CLASS=
17241 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17242 <br style="onmouseover='alert(document.cookie);' " />
17243
17244 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17245 |
17246 !! html
17247 <table>
17248 {{{|
17249 <u class="&#124;">}}}} &gt;
17250 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17251
17252 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17253 <tr>
17254 <td></u>
17255 </td>
17256 </tr>
17257 </table>
17258
17259 !! end
17260
17261 # Note: the current result listed for this is not what the original one was,
17262 # but the original bug was JavaScript injection, which is fixed in any case.
17263 # It's not clear that the original result listed was any more correct than the
17264 # current one. Original result:
17265 # <p>{{{|
17266 # </p>
17267 # <li class="&#124;&#124;">
17268 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17269 !!test
17270 Fuzz testing: Parser25 (bug 6055)
17271 !! wikitext
17272 {{{
17273 |
17274 <LI CLASS=||
17275 >
17276 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17277 !! html
17278 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17279 </p>
17280 !! end
17281
17282 !!test
17283 Fuzz testing: URL adjacent extension (with space, clean)
17284 !! wikitext
17285 http://example.com <nowiki>junk</nowiki>
17286 !! html/php
17287 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17288 </p>
17289 !! html/parsoid
17290 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17291 !! end
17292
17293 !!test
17294 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17295 !! wikitext
17296 http://example.com<nowiki>junk</nowiki>
17297 !! html/php
17298 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17299 </p>
17300 !! html/parsoid
17301 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17302 !! end
17303
17304 !!test
17305 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17306 !! wikitext
17307 http://example.com<pre>junk</pre>
17308 !! html/php
17309 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17310
17311 !! html/php+tidy
17312 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17313 <pre>
17314 junk
17315 </pre>
17316 !! html/parsoid
17317 <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>
17318 !!end
17319
17320 !!test
17321 Fuzz testing: image with bogus manual thumbnail
17322 !! wikitext
17323 [[Image:foobar.jpg|thumbnail= ]]
17324 !! html/php
17325 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17326
17327 !! html/parsoid
17328 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' 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":{}}'><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>
17329 !!end
17330
17331 !! test
17332 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17333 !! wikitext
17334 <pre dir="&#10;"></pre>
17335 !! html
17336 <pre dir="&#10;"></pre>
17337
17338 !! end
17339
17340 !! test
17341 Parsing optional HTML elements (Bug 6171)
17342 !! options
17343 !! wikitext
17344 <table>
17345 <tr>
17346 <td> Some tabular data</td>
17347 <td> More tabular data ...
17348 <td> And yet som tabular data</td>
17349 </tr>
17350 </table>
17351 !! html
17352 <table>
17353 <tr>
17354 <td> Some tabular data</td>
17355 <td> More tabular data ...
17356 </td><td> And yet som tabular data</td>
17357 </tr>
17358 </table>
17359
17360 !! end
17361
17362 !! test
17363 Correct handling of <td>, <tr> (Bug 6171)
17364 !! options
17365 !! wikitext
17366 <table>
17367 <tr>
17368 <td> Some tabular data</td>
17369 <td> More tabular data ...</td>
17370 <td> And yet som tabular data</td>
17371 </tr>
17372 </table>
17373 !! html
17374 <table>
17375 <tr>
17376 <td> Some tabular data</td>
17377 <td> More tabular data ...</td>
17378 <td> And yet som tabular data</td>
17379 </tr>
17380 </table>
17381
17382 !! end
17383
17384
17385 !! test
17386 Parsing crashing regression (fr:JavaScript)
17387 !! wikitext
17388 </body></x>
17389 !! html
17390 <p>&lt;/body&gt;&lt;/x&gt;
17391 </p>
17392 !! end
17393
17394 !! test
17395 Inline wiki vs wiki block nesting
17396 !! wikitext
17397 '''Bold paragraph
17398
17399 New wiki paragraph
17400 !! html
17401 <p><b>Bold paragraph</b>
17402 </p><p>New wiki paragraph
17403 </p>
17404 !! end
17405
17406 # FIXME: The current php output is documented
17407 # and desired output is the parsoid target.
17408 !! test
17409 Inline HTML vs wiki block nesting
17410 !! wikitext
17411 <b>Bold paragraph
17412
17413 New wiki paragraph
17414 !! html/php
17415 <p><b>Bold paragraph
17416 </p><p>New wiki paragraph</b>
17417 </p>
17418 !! html/parsoid
17419 <p><b>Bold paragraph</b>
17420 </p><p>New wiki paragraph
17421 </p>
17422 !! end
17423
17424 # Original result was this:
17425 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17426 # </p>
17427 # While that might be marginally more intuitive, maybe, the six-apostrophe
17428 # construct is clearly pathological and the result stated here (which is what
17429 # the parser actually does) is about as reasonable as anything.
17430 !!test
17431 Mixing markup for italics and bold
17432 !! options
17433 !! wikitext
17434 '''bold''''''bold''bolditalics'''''
17435 !! html
17436 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17437 </p>
17438 !! end
17439
17440
17441 !! article
17442 Xyzzyx
17443 !! text
17444 Article for special page transclusion test
17445 !! endarticle
17446
17447 !! test
17448 Special page transclusion
17449 !! options
17450 !! wikitext
17451 {{Special:Prefixindex/Xyzzyx}}
17452 !! html
17453 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17454 </ul>
17455
17456 !! end
17457
17458 !! test
17459 Special page transclusion twice (bug 5021)
17460 !! options
17461 !! wikitext
17462 {{Special:Prefixindex/Xyzzyx}}
17463 {{Special:Prefixindex/Xyzzyx}}
17464 !! html
17465 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17466 </ul>
17467 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17468 </ul>
17469
17470 !! end
17471
17472 !! test
17473 Transclusion of default MediaWiki message
17474 !! wikitext
17475 {{MediaWiki:Mainpage}}
17476 !! html
17477 <p>Main Page
17478 </p>
17479 !! end
17480
17481 !! test
17482 Transclusion of nonexistent MediaWiki message
17483 !! wikitext
17484 {{MediaWiki:Mainpagexxx}}
17485 !! html
17486 <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>
17487 </p>
17488 !! end
17489
17490 !! test
17491 Transclusion of MediaWiki message with underscore
17492 !! wikitext
17493 {{MediaWiki:history_short}}
17494 !! html
17495 <p>History
17496 </p>
17497 !! end
17498
17499 !! test
17500 Transclusion of MediaWiki message with space
17501 !! wikitext
17502 {{MediaWiki:history short}}
17503 !! html
17504 <p>History
17505 </p>
17506 !! end
17507
17508 !! test
17509 Invalid header with following text
17510 !! wikitext
17511 = x = y
17512 !! html
17513 <p>= x = y
17514 </p>
17515 !! end
17516
17517
17518 !! test
17519 Section extraction test (section 0)
17520 !! options
17521 section=0
17522 !! wikitext
17523 start
17524 ==a==
17525 ===aa===
17526 ====aaa====
17527 ==b==
17528 ===ba===
17529 ===bb===
17530 ====bba====
17531 ===bc===
17532 ==c==
17533 ===ca===
17534 !! html/php
17535 start
17536 !! end
17537
17538 !! test
17539 Section extraction test (section 1)
17540 !! options
17541 section=1
17542 !! wikitext
17543 start
17544 ==a==
17545 ===aa===
17546 ====aaa====
17547 ==b==
17548 ===ba===
17549 ===bb===
17550 ====bba====
17551 ===bc===
17552 ==c==
17553 ===ca===
17554 !! html/php
17555 ==a==
17556 ===aa===
17557 ====aaa====
17558 !! end
17559
17560 !! test
17561 Section extraction test (section 2)
17562 !! options
17563 section=2
17564 !! wikitext
17565 start
17566 ==a==
17567 ===aa===
17568 ====aaa====
17569 ==b==
17570 ===ba===
17571 ===bb===
17572 ====bba====
17573 ===bc===
17574 ==c==
17575 ===ca===
17576 !! html/php
17577 ===aa===
17578 ====aaa====
17579 !! end
17580
17581 !! test
17582 Section extraction test (section 3)
17583 !! options
17584 section=3
17585 !! wikitext
17586 start
17587 ==a==
17588 ===aa===
17589 ====aaa====
17590 ==b==
17591 ===ba===
17592 ===bb===
17593 ====bba====
17594 ===bc===
17595 ==c==
17596 ===ca===
17597 !! html/php
17598 ====aaa====
17599 !! end
17600
17601 !! test
17602 Section extraction test (section 4)
17603 !! options
17604 section=4
17605 !! wikitext
17606 start
17607 ==a==
17608 ===aa===
17609 ====aaa====
17610 ==b==
17611 ===ba===
17612 ===bb===
17613 ====bba====
17614 ===bc===
17615 ==c==
17616 ===ca===
17617 !! html/php
17618 ==b==
17619 ===ba===
17620 ===bb===
17621 ====bba====
17622 ===bc===
17623 !! end
17624
17625 !! test
17626 Section extraction test (section 5)
17627 !! options
17628 section=5
17629 !! wikitext
17630 start
17631 ==a==
17632 ===aa===
17633 ====aaa====
17634 ==b==
17635 ===ba===
17636 ===bb===
17637 ====bba====
17638 ===bc===
17639 ==c==
17640 ===ca===
17641 !! html/php
17642 ===ba===
17643 !! end
17644
17645 !! test
17646 Section extraction test (section 6)
17647 !! options
17648 section=6
17649 !! wikitext
17650 start
17651 ==a==
17652 ===aa===
17653 ====aaa====
17654 ==b==
17655 ===ba===
17656 ===bb===
17657 ====bba====
17658 ===bc===
17659 ==c==
17660 ===ca===
17661 !! html/php
17662 ===bb===
17663 ====bba====
17664 !! end
17665
17666 !! test
17667 Section extraction test (section 7)
17668 !! options
17669 section=7
17670 !! wikitext
17671 start
17672 ==a==
17673 ===aa===
17674 ====aaa====
17675 ==b==
17676 ===ba===
17677 ===bb===
17678 ====bba====
17679 ===bc===
17680 ==c==
17681 ===ca===
17682 !! html/php
17683 ====bba====
17684 !! end
17685
17686 !! test
17687 Section extraction test (section 8)
17688 !! options
17689 section=8
17690 !! wikitext
17691 start
17692 ==a==
17693 ===aa===
17694 ====aaa====
17695 ==b==
17696 ===ba===
17697 ===bb===
17698 ====bba====
17699 ===bc===
17700 ==c==
17701 ===ca===
17702 !! html/php
17703 ===bc===
17704 !! end
17705
17706 !! test
17707 Section extraction test (section 9)
17708 !! options
17709 section=9
17710 !! wikitext
17711 start
17712 ==a==
17713 ===aa===
17714 ====aaa====
17715 ==b==
17716 ===ba===
17717 ===bb===
17718 ====bba====
17719 ===bc===
17720 ==c==
17721 ===ca===
17722 !! html/php
17723 ==c==
17724 ===ca===
17725 !! end
17726
17727 !! test
17728 Section extraction test (section 10)
17729 !! options
17730 section=10
17731 !! wikitext
17732 start
17733 ==a==
17734 ===aa===
17735 ====aaa====
17736 ==b==
17737 ===ba===
17738 ===bb===
17739 ====bba====
17740 ===bc===
17741 ==c==
17742 ===ca===
17743 !! html/php
17744 ===ca===
17745 !! end
17746
17747 !! test
17748 Section extraction test (nonexistent section 11)
17749 !! options
17750 section=11
17751 !! wikitext
17752 start
17753 ==a==
17754 ===aa===
17755 ====aaa====
17756 ==b==
17757 ===ba===
17758 ===bb===
17759 ====bba====
17760 ===bc===
17761 ==c==
17762 ===ca===
17763 !! html/php
17764 !! end
17765
17766 !! test
17767 Section extraction test with bogus heading (section 1)
17768 !! options
17769 section=1
17770 !! wikitext
17771 ==a==
17772 ==bogus== not a legal section
17773 ==b==
17774 !! html/php
17775 ==a==
17776 ==bogus== not a legal section
17777 !! end
17778
17779 !! test
17780 Section extraction test with bogus heading (section 2)
17781 !! options
17782 section=2
17783 !! wikitext
17784 ==a==
17785 ==bogus== not a legal section
17786 ==b==
17787 !! html/php
17788 ==b==
17789 !! end
17790
17791 !! test
17792 Section extraction test with comment after heading (section 1)
17793 !! options
17794 section=1
17795 !! wikitext
17796 ==a==
17797 ==b== <!-- -->
17798 ==c==
17799 !! html/php
17800 ==a==
17801 !! end
17802
17803 !! test
17804 Section extraction test with comment after heading (section 2)
17805 !! options
17806 section=2
17807 !! wikitext
17808 ==a==
17809 ==b== <!-- -->
17810 ==c==
17811 !! html/php
17812 ==b== <!-- -->
17813 !! end
17814
17815 !! test
17816 Section extraction test with bogus <nowiki> heading (section 1)
17817 !! options
17818 section=1
17819 !! wikitext
17820 ==a==
17821 ==bogus== <nowiki>not a legal section</nowiki>
17822 ==b==
17823 !! html/php
17824 ==a==
17825 ==bogus== <nowiki>not a legal section</nowiki>
17826 !! end
17827
17828 !! test
17829 Section extraction test with bogus <nowiki> heading (section 2)
17830 !! options
17831 section=2
17832 !! wikitext
17833 ==a==
17834 ==bogus== <nowiki>not a legal section</nowiki>
17835 ==b==
17836 !! html/php
17837 ==b==
17838 !! end
17839
17840 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17841 # instead of respecting commented sections
17842 !! test
17843 Section extraction prefixed by comment (section 1)
17844 !! options
17845 section=1
17846 !! wikitext
17847 <!-- -->==sec1==
17848 ==sec2==
17849 !! html/php
17850 ==sec2==
17851 !!end
17852
17853 !! test
17854 Section extraction prefixed by comment (section 2)
17855 !! options
17856 section=2
17857 !! wikitext
17858 <!-- -->==sec1==
17859 ==sec2==
17860 !! html/php
17861
17862 !!end
17863
17864 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17865 # instead of respecting HTML-style headings
17866 !! test
17867 Section extraction, mixed wiki and html (section 1)
17868 !! options
17869 section=1
17870 !! wikitext
17871 <h2>unmarked</h2>
17872 unmarked
17873 ==1==
17874 one
17875 ==2==
17876 two
17877 !! html/php
17878 ==1==
17879 one
17880 !! end
17881
17882 !! test
17883 Section extraction, mixed wiki and html (section 2)
17884 !! options
17885 section=2
17886 !! wikitext
17887 <h2>unmarked</h2>
17888 unmarked
17889 ==1==
17890 one
17891 ==2==
17892 two
17893 !! html/php
17894 ==2==
17895 two
17896 !! end
17897
17898
17899 # Formerly testing for bug 3342
17900 !! test
17901 Section extraction, heading surrounded by <noinclude>
17902 !! options
17903 section=1
17904 !! wikitext
17905 <noinclude>==unmarked==</noinclude>
17906 ==marked==
17907 !! html/php
17908 ==marked==
17909 !!end
17910
17911 # Test behavior of bug 19910
17912 !! test
17913 Sectiion with all-equals
17914 !! options
17915 section=2
17916 !! wikitext
17917 ===
17918 The line above must have a trailing space
17919 === <!--
17920 --> <!-- -->
17921 But just in case it doesn't...
17922 !! html/php
17923 === <!--
17924 --> <!-- -->
17925 But just in case it doesn't...
17926 !! end
17927
17928 !! test
17929 Section replacement test (section 0)
17930 !! options
17931 replace=0,"xxx"
17932 !! wikitext
17933 start
17934 ==a==
17935 ===aa===
17936 ====aaa====
17937 ==b==
17938 ===ba===
17939 ===bb===
17940 ====bba====
17941 ===bc===
17942 ==c==
17943 ===ca===
17944 !! html/php
17945 xxx
17946
17947 ==a==
17948 ===aa===
17949 ====aaa====
17950 ==b==
17951 ===ba===
17952 ===bb===
17953 ====bba====
17954 ===bc===
17955 ==c==
17956 ===ca===
17957 !! end
17958
17959 !! test
17960 Section replacement test (section 1)
17961 !! options
17962 replace=1,"xxx"
17963 !! wikitext
17964 start
17965 ==a==
17966 ===aa===
17967 ====aaa====
17968 ==b==
17969 ===ba===
17970 ===bb===
17971 ====bba====
17972 ===bc===
17973 ==c==
17974 ===ca===
17975 !! html/php
17976 start
17977 xxx
17978
17979 ==b==
17980 ===ba===
17981 ===bb===
17982 ====bba====
17983 ===bc===
17984 ==c==
17985 ===ca===
17986 !! end
17987
17988 !! test
17989 Section replacement test (section 2)
17990 !! options
17991 replace=2,"xxx"
17992 !! wikitext
17993 start
17994 ==a==
17995 ===aa===
17996 ====aaa====
17997 ==b==
17998 ===ba===
17999 ===bb===
18000 ====bba====
18001 ===bc===
18002 ==c==
18003 ===ca===
18004 !! html/php
18005 start
18006 ==a==
18007 xxx
18008
18009 ==b==
18010 ===ba===
18011 ===bb===
18012 ====bba====
18013 ===bc===
18014 ==c==
18015 ===ca===
18016 !! end
18017
18018 !! test
18019 Section replacement test (section 3)
18020 !! options
18021 replace=3,"xxx"
18022 !! wikitext
18023 start
18024 ==a==
18025 ===aa===
18026 ====aaa====
18027 ==b==
18028 ===ba===
18029 ===bb===
18030 ====bba====
18031 ===bc===
18032 ==c==
18033 ===ca===
18034 !! html/php
18035 start
18036 ==a==
18037 ===aa===
18038 xxx
18039
18040 ==b==
18041 ===ba===
18042 ===bb===
18043 ====bba====
18044 ===bc===
18045 ==c==
18046 ===ca===
18047 !! end
18048
18049 !! test
18050 Section replacement test (section 4)
18051 !! options
18052 replace=4,"xxx"
18053 !! wikitext
18054 start
18055 ==a==
18056 ===aa===
18057 ====aaa====
18058 ==b==
18059 ===ba===
18060 ===bb===
18061 ====bba====
18062 ===bc===
18063 ==c==
18064 ===ca===
18065 !! html/php
18066 start
18067 ==a==
18068 ===aa===
18069 ====aaa====
18070 xxx
18071
18072 ==c==
18073 ===ca===
18074 !! end
18075
18076 !! test
18077 Section replacement test (section 5)
18078 !! options
18079 replace=5,"xxx"
18080 !! wikitext
18081 start
18082 ==a==
18083 ===aa===
18084 ====aaa====
18085 ==b==
18086 ===ba===
18087 ===bb===
18088 ====bba====
18089 ===bc===
18090 ==c==
18091 ===ca===
18092 !! html/php
18093 start
18094 ==a==
18095 ===aa===
18096 ====aaa====
18097 ==b==
18098 xxx
18099
18100 ===bb===
18101 ====bba====
18102 ===bc===
18103 ==c==
18104 ===ca===
18105 !! end
18106
18107 !! test
18108 Section replacement test (section 6)
18109 !! options
18110 replace=6,"xxx"
18111 !! wikitext
18112 start
18113 ==a==
18114 ===aa===
18115 ====aaa====
18116 ==b==
18117 ===ba===
18118 ===bb===
18119 ====bba====
18120 ===bc===
18121 ==c==
18122 ===ca===
18123 !! html/php
18124 start
18125 ==a==
18126 ===aa===
18127 ====aaa====
18128 ==b==
18129 ===ba===
18130 xxx
18131
18132 ===bc===
18133 ==c==
18134 ===ca===
18135 !! end
18136
18137 !! test
18138 Section replacement test (section 7)
18139 !! options
18140 replace=7,"xxx"
18141 !! wikitext
18142 start
18143 ==a==
18144 ===aa===
18145 ====aaa====
18146 ==b==
18147 ===ba===
18148 ===bb===
18149 ====bba====
18150 ===bc===
18151 ==c==
18152 ===ca===
18153 !! html/php
18154 start
18155 ==a==
18156 ===aa===
18157 ====aaa====
18158 ==b==
18159 ===ba===
18160 ===bb===
18161 xxx
18162
18163 ===bc===
18164 ==c==
18165 ===ca===
18166 !! end
18167
18168 !! test
18169 Section replacement test (section 8)
18170 !! options
18171 replace=8,"xxx"
18172 !! wikitext
18173 start
18174 ==a==
18175 ===aa===
18176 ====aaa====
18177 ==b==
18178 ===ba===
18179 ===bb===
18180 ====bba====
18181 ===bc===
18182 ==c==
18183 ===ca===
18184 !! html/php
18185 start
18186 ==a==
18187 ===aa===
18188 ====aaa====
18189 ==b==
18190 ===ba===
18191 ===bb===
18192 ====bba====
18193 xxx
18194
18195 ==c==
18196 ===ca===
18197 !!end
18198
18199 !! test
18200 Section replacement test (section 9)
18201 !! options
18202 replace=9,"xxx"
18203 !! wikitext
18204 start
18205 ==a==
18206 ===aa===
18207 ====aaa====
18208 ==b==
18209 ===ba===
18210 ===bb===
18211 ====bba====
18212 ===bc===
18213 ==c==
18214 ===ca===
18215 !! html/php
18216 start
18217 ==a==
18218 ===aa===
18219 ====aaa====
18220 ==b==
18221 ===ba===
18222 ===bb===
18223 ====bba====
18224 ===bc===
18225 xxx
18226 !! end
18227
18228 !! test
18229 Section replacement test (section 10)
18230 !! options
18231 replace=10,"xxx"
18232 !! wikitext
18233 start
18234 ==a==
18235 ===aa===
18236 ====aaa====
18237 ==b==
18238 ===ba===
18239 ===bb===
18240 ====bba====
18241 ===bc===
18242 ==c==
18243 ===ca===
18244 !! html/php
18245 start
18246 ==a==
18247 ===aa===
18248 ====aaa====
18249 ==b==
18250 ===ba===
18251 ===bb===
18252 ====bba====
18253 ===bc===
18254 ==c==
18255 xxx
18256 !! end
18257
18258 !! test
18259 Section replacement test with initial whitespace (bug 13728)
18260 !! options
18261 replace=2,"xxx"
18262 !! wikitext
18263 Preformatted initial line
18264 ==a==
18265 ===a===
18266 !! html/php
18267 Preformatted initial line
18268 ==a==
18269 xxx
18270 !! end
18271
18272
18273 !! test
18274 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18275 !! options
18276 section=1
18277 !! wikitext
18278 ==a==
18279 a
18280 !! html/php
18281 ==a==
18282 a
18283 !! end
18284
18285 !! test
18286 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18287 !! options
18288 section=1
18289 !! wikitext
18290 ==a==
18291 a
18292 !! html/php
18293 ==a==
18294 a
18295 !! end
18296
18297
18298 !! test
18299 Section extraction, <pre> around bogus header (bug 10309)
18300 !! options
18301 section=2
18302 !! wikitext
18303 == Section One ==
18304 <pre>
18305 =======
18306 </pre>
18307
18308 == Section Two ==
18309 stuff
18310 !! html/php
18311 == Section Two ==
18312 stuff
18313 !! end
18314
18315 !! test
18316 Section replacement, <pre> around bogus header (bug 10309)
18317 !! options
18318 replace=2,"xxx"
18319 !! wikitext
18320 == Section One ==
18321 <pre>
18322 =======
18323 </pre>
18324
18325 == Section Two ==
18326 stuff
18327 !! html/php
18328 == Section One ==
18329 <pre>
18330 =======
18331 </pre>
18332
18333 xxx
18334 !! end
18335
18336
18337 !! test
18338 Handling of &#x0A; in URLs
18339 !! wikitext
18340 ** irc://&#x0A;a
18341 !! html/php
18342 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18343
18344 !! html/parsoid
18345 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18346 a">irc://
18347 a</a></li></ul></li></ul>
18348 !! end
18349
18350 !! test
18351 Handling of %0A in URLs
18352 !! wikitext
18353 ** irc://%0Aa
18354 !! html/php
18355 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18356
18357 !! html/parsoid
18358 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18359 !! end
18360
18361
18362 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18363 !! test
18364 5 quotes, code coverage +1 line
18365 !! options
18366 parsoid=wt2html
18367 !! wikitext
18368 '''''
18369 !! html/php
18370 !! html/parsoid
18371 <p><b><i></i></b></p>
18372 !! end
18373
18374 # same html as previous, but wikitext adjusted to match parsoid html2wt
18375 # note that wt2html and html2html will put the <i> before the <b>
18376 !! test
18377 5 quotes, code coverage +1 line w/ nowiki (1)
18378 !! options
18379 parsoid=wt2wt,html2wt
18380 !! wikitext
18381 '''''<nowiki/>'''''
18382 !! html/php
18383 <p><i></i>
18384 </p>
18385 !! html/parsoid
18386 <p><b><i></i></b></p>
18387 !! end
18388
18389 # same as previous, just swapping the <i> and <b>
18390 !! test
18391 5 quotes, code coverage +1 line w/ nowiki (2)
18392 !! wikitext
18393 '''''<nowiki/>'''''
18394 !! html/php
18395 <p><i></i>
18396 </p>
18397 !! html/parsoid
18398 <p><i><b></b></i></p>
18399 !! end
18400
18401 !! test
18402 Special:Search page linking.
18403 !! wikitext
18404 {{Special:search}}
18405 !! html
18406 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18407 </p>
18408 !! end
18409
18410 !! test
18411 {{!}} is a magic word
18412 !! wikitext
18413 {{!}} is a magic word there and {{!}} is still a magic word here
18414 | is not a magic word here but {{!}} is still a magic word here
18415 !! html/php
18416 <p>| is a magic word there and | is still a magic word here
18417 | is not a magic word here but | is still a magic word here
18418 </p>
18419 !! html/parsoid
18420 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18421 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18422
18423 !! end
18424
18425 !! test
18426 Say the magic word
18427 !! options
18428 title=[[Parser test]]
18429 !! wikitext
18430 * {{PAGENAME}}
18431 * {{PAGENAMEE}}
18432 * {{FULLPAGENAME}}
18433 * {{FULLPAGENAMEE}}
18434 * {{BASEPAGENAME}}
18435 * {{BASEPAGENAMEE}}
18436 * {{SUBPAGENAME}}
18437 * {{SUBPAGENAMEE}}
18438 * {{ROOTPAGENAME}}
18439 * {{ROOTPAGENAMEE}}
18440 * {{TALKPAGENAME}}
18441 * {{TALKPAGENAMEE}}
18442 * {{SUBJECTPAGENAME}}
18443 * {{SUBJECTPAGENAMEE}}
18444 * {{NAMESPACEE}}
18445 * {{NAMESPACE}}
18446 * {{NAMESPACENUMBER}}
18447 * {{TALKSPACE}}
18448 * {{TALKSPACEE}}
18449 * {{SUBJECTSPACE}}
18450 * {{SUBJECTSPACEE}}
18451 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18452 !! html
18453 <ul><li> Parser test</li>
18454 <li> Parser_test</li>
18455 <li> Parser test</li>
18456 <li> Parser_test</li>
18457 <li> Parser test</li>
18458 <li> Parser_test</li>
18459 <li> Parser test</li>
18460 <li> Parser_test</li>
18461 <li> Parser test</li>
18462 <li> Parser_test</li>
18463 <li> Talk:Parser test</li>
18464 <li> Talk:Parser_test</li>
18465 <li> Parser test</li>
18466 <li> Parser_test</li>
18467 <li> </li>
18468 <li> </li>
18469 <li> 0</li>
18470 <li> Talk</li>
18471 <li> Talk</li>
18472 <li> </li>
18473 <li> </li>
18474 <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>
18475
18476 !! end
18477 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18478
18479 !! test
18480 Gallery
18481 !! wikitext
18482 <gallery>
18483 image1.png |
18484 image2.gif|||||
18485
18486 image3|
18487 image4 |300px| centre
18488 image5.svg| http://///////
18489 [[x|xx]]]]
18490 * image6
18491 </gallery>
18492 !! html
18493 <ul class="gallery mw-gallery-traditional">
18494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18495 <div class="thumb" style="height: 150px;">Image1.png</div>
18496 <div class="gallerytext">
18497 </div>
18498 </div></li>
18499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18500 <div class="thumb" style="height: 150px;">Image2.gif</div>
18501 <div class="gallerytext">
18502 </div>
18503 </div></li>
18504 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18505 <div class="thumb" style="height: 150px;">Image3</div>
18506 <div class="gallerytext">
18507 </div>
18508 </div></li>
18509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18510 <div class="thumb" style="height: 150px;">Image4</div>
18511 <div class="gallerytext">
18512 <pre>centre
18513 </pre>
18514 </div>
18515 </div></li>
18516 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18517 <div class="thumb" style="height: 150px;">Image5.svg</div>
18518 <div class="gallerytext">
18519 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18520 </p>
18521 </div>
18522 </div></li>
18523 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18524 <div class="thumb" style="height: 150px;">* image6</div>
18525 <div class="gallerytext">
18526 </div>
18527 </div></li>
18528 </ul>
18529
18530 !! end
18531
18532 !! test
18533 Gallery (with options)
18534 !! wikitext
18535 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18536 File:Nonexistent.jpg|caption
18537 File:Nonexistent.jpg
18538 image:foobar.jpg|some '''caption''' [[Main Page]]
18539 image:foobar.jpg
18540 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18541 </gallery>
18542 !! html
18543 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18544 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18545 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18546 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18547 <div class="gallerytext">
18548 <p>caption
18549 </p>
18550 </div>
18551 </div></li>
18552 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18553 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18554 <div class="gallerytext">
18555 </div>
18556 </div></li>
18557 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18558 <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>
18559 <div class="gallerytext">
18560 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18561 </p>
18562 </div>
18563 </div></li>
18564 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18565 <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>
18566 <div class="gallerytext">
18567 </div>
18568 </div></li>
18569 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18570 <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>
18571 <div class="gallerytext">
18572 <p>blabla.
18573 </p>
18574 </div>
18575 </div></li>
18576 </ul>
18577
18578 !! end
18579
18580 !! test
18581 Gallery with link that has fragment
18582 !! wikitext
18583 <gallery>
18584 image:foobar.jpg|link=Main_Page
18585 image:foobar.jpg|link=Main_Page#section
18586 image:foobar.jpg|link=Main Page#section|caption
18587 </gallery>
18588 !! html
18589 <ul class="gallery mw-gallery-traditional">
18590 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18591 <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>
18592 <div class="gallerytext">
18593 </div>
18594 </div></li>
18595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18596 <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>
18597 <div class="gallerytext">
18598 </div>
18599 </div></li>
18600 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18601 <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>
18602 <div class="gallerytext">
18603 <p>caption
18604 </p>
18605 </div>
18606 </div></li>
18607 </ul>
18608
18609 !! end
18610
18611 !! test
18612 Gallery with wikitext inside caption
18613 !! wikitext
18614 <gallery>
18615 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18616 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18617 </gallery>
18618 !! html
18619 <ul class="gallery mw-gallery-traditional">
18620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18621 <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>
18622 <div class="gallerytext">
18623 <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>
18624 </p>
18625 </div>
18626 </div></li>
18627 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18628 <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>
18629 <div class="gallerytext">
18630 <p>This is a test template
18631 </p>
18632 </div>
18633 </div></li>
18634 </ul>
18635
18636 !! end
18637
18638 !! test
18639 gallery (with showfilename option)
18640 !! wikitext
18641 <gallery showfilename>
18642 File:Nonexistent.jpg|caption
18643 File:Nonexistent.jpg
18644 image:foobar.jpg|some '''caption''' [[Main Page]]
18645 File:Foobar.jpg
18646 </gallery>
18647 !! html
18648 <ul class="gallery mw-gallery-traditional">
18649 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18650 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18651 <div class="gallerytext">
18652 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18653 caption
18654 </p>
18655 </div>
18656 </div></li>
18657 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18658 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18659 <div class="gallerytext">
18660 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18661 </p>
18662 </div>
18663 </div></li>
18664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18665 <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>
18666 <div class="gallerytext">
18667 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18668 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18669 </p>
18670 </div>
18671 </div></li>
18672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18673 <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>
18674 <div class="gallerytext">
18675 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18676 </p>
18677 </div>
18678 </div></li>
18679 </ul>
18680
18681 !! end
18682
18683 !! test
18684 Gallery (with namespace-less filenames)
18685 !! wikitext
18686 <gallery>
18687 File:Nonexistent.jpg
18688 Nonexistent.jpg
18689 image:foobar.jpg
18690 foobar.jpg
18691 </gallery>
18692 !! html
18693 <ul class="gallery mw-gallery-traditional">
18694 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18695 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18696 <div class="gallerytext">
18697 </div>
18698 </div></li>
18699 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18700 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18701 <div class="gallerytext">
18702 </div>
18703 </div></li>
18704 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18705 <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>
18706 <div class="gallerytext">
18707 </div>
18708 </div></li>
18709 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18710 <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>
18711 <div class="gallerytext">
18712 </div>
18713 </div></li>
18714 </ul>
18715
18716 !! end
18717
18718 !! test
18719 HTML Hex character encoding (spells the word "JavaScript")
18720 !! options
18721 parsoid=wt2html,wt2wt,html2html
18722 !! wikitext
18723 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18724 !! html/php
18725 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18726 </p>
18727 !! html/php+tidy
18728 <p>JavaScript</p>
18729 !! html/parsoid
18730 <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>
18731 !! end
18732
18733 !! test
18734 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18735 !! wikitext
18736 &#xsee;&#XSEE;
18737 !! html/php
18738 <p>&amp;#xsee;&amp;#XSEE;
18739 </p>
18740 !! html/parsoid
18741 <p>&amp;#xsee;&amp;#XSEE;</p>
18742 !! end
18743
18744 !! test
18745 HTML Hex character encoding mixed case
18746 !! options
18747 parsoid=wt2html,wt2wt,html2html
18748 !! wikitext
18749 &#xEE;&#Xee;
18750 !! html/php
18751 <p>&#xee;&#xee;
18752 </p>
18753 !! html/php+tidy
18754 <p>îî</p>
18755 !! html/parsoid
18756 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18757 !! end
18758
18759 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18760 # Note that U+000C (form feed) is not a valid XML character, so
18761 # it is banned even though allowed in HTML5.
18762 !! test
18763 Illegal character references (T106578)
18764 !! wikitext
18765 ; Null: &#00;
18766 ; FF: &#xC;
18767 ; CR: &#xD;
18768 ; Control (low): &#8;
18769 ; Control (high): &#x7F; &#x9F;
18770 ; Surrogate: &#xD83D;&#xDCA9;
18771 ; This is an okay astral character: &#x1F4A9;
18772 !! html+tidy
18773 <dl>
18774 <dt>Null</dt>
18775 <dd>&amp;#00;</dd>
18776 <dt>FF</dt>
18777 <dd>&amp;#xC;</dd>
18778 <dt>CR</dt>
18779 <dd>&amp;#xD;</dd>
18780 <dt>Control (low)</dt>
18781 <dd>&amp;#8;</dd>
18782 <dt>Control (high)</dt>
18783 <dd>&amp;#x7F; &amp;#x9F;</dd>
18784 <dt>Surrogate</dt>
18785 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18786 <dt>This is an okay astral character</dt>
18787 <dd>💩</dd>
18788 </dl>
18789 !! end
18790
18791 !! test
18792 __FORCETOC__ override
18793 !! wikitext
18794 __NEWSECTIONLINK__
18795 __FORCETOC__
18796 !! html/php
18797 <p><br />
18798 </p>
18799 !! end
18800
18801 !! test
18802 ISBN code coverage
18803 !! wikitext
18804 ISBN 978-0-1234-56&#x20;789
18805 !! html
18806 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18807 </p>
18808 !! html+tidy
18809 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18810 !! html/parsoid
18811 <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>
18812 !! end
18813
18814 !! test
18815 ISBN followed by 5 spaces
18816 !! wikitext
18817 ISBN
18818 !! html
18819 <p>ISBN
18820 </p>
18821 !! end
18822
18823 !! test
18824 Double ISBN
18825 !! wikitext
18826 ISBN ISBN 1234567890
18827 !! html/php
18828 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18829 </p>
18830 !! html/parsoid
18831 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18832 !! end
18833
18834 # Uppercase X and lowercase x as well
18835 !! test
18836 ISBN with an X
18837 !! wikitext
18838 ISBN 3-462-04561-X
18839 ISBN 3-462-04561-x
18840 ISBN 080442957X
18841 ISBN 080442957x
18842 ISBN 978080442957X
18843 ISBN 978080442957x
18844 !! html/php
18845 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18846 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18847 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18848 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18849 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18850 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18851 </p>
18852 !! html/parsoid
18853 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18854 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18855 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18856 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18857 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18858 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18859 !! end
18860
18861 !! test
18862 ISBN with empty prefix (parsoid test)
18863 !! wikitext
18864 ISBN 1234567890
18865 !! html/php
18866 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18867 </p>
18868 !! html/parsoid
18869 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18870 !! end
18871
18872 !! test
18873 Bug 22905: <abbr> followed by ISBN followed by </a>
18874 !! wikitext
18875 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18876 !! html/php
18877 <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>
18878 </p>
18879 !! html/parsoid
18880 <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>
18881 !! end
18882
18883 !! test
18884 Double RFC
18885 !! wikitext
18886 RFC RFC 1234
18887 !! html
18888 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18889 </p>
18890 !! end
18891
18892 !! test
18893 Double RFC with a wiki link
18894 !! wikitext
18895 RFC [[RFC 1234]]
18896 !! html
18897 <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>
18898 </p>
18899 !! end
18900
18901 !! test
18902 RFC code coverage
18903 !! wikitext
18904 RFC 983&#x20;987
18905 !! html
18906 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18907 </p>
18908 !! html+tidy
18909 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18910 !! end
18911
18912 !! test
18913 Centre-aligned image
18914 !! wikitext
18915 [[Image:foobar.jpg|centre]]
18916 !! html
18917 <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>
18918
18919 !!end
18920
18921 !! test
18922 None-aligned image
18923 !! wikitext
18924 [[Image:foobar.jpg|none]]
18925 !! html
18926 <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>
18927
18928 !!end
18929
18930 !! test
18931 Width + Height sized image (using px) (height is ignored)
18932 !! wikitext
18933 [[Image:foobar.jpg|640x480px]]
18934 !! html
18935 <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>
18936 </p>
18937 !!end
18938
18939 !! test
18940 Width-sized image (using px, no following whitespace)
18941 !! wikitext
18942 [[Image:foobar.jpg|640px]]
18943 !! html
18944 <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>
18945 </p>
18946 !!end
18947
18948 !! test
18949 Width-sized image (using px, with following whitespace - test regression from r39467)
18950 !! wikitext
18951 [[Image:foobar.jpg|640px ]]
18952 !! html
18953 <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>
18954 </p>
18955 !!end
18956
18957 !! test
18958 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18959 !! wikitext
18960 [[Image:foobar.jpg| 640px]]
18961 !! html
18962 <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>
18963 </p>
18964 !!end
18965
18966 !! test
18967 Image with page parameter
18968 !! options
18969 djvu
18970 !! wikitext
18971 [[File:LoremIpsum.djvu|page=2]]
18972 !! html/php
18973 <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>
18974 </p>
18975 !! html/parsoid
18976 <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>
18977 !! end
18978
18979 !! test
18980 Another italics / bold test
18981 !! wikitext
18982 ''' ''x'
18983 !! html
18984 <pre>'<i> </i>x'
18985 </pre>
18986 !!end
18987
18988 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18989 !! test
18990 dt/dd/dl test
18991 !! wikitext
18992 :;;;::
18993 !! html/php
18994 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18995
18996 !! html/parsoid
18997 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18998
18999 !!end
19000
19001
19002 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19003 !! test
19004 Images with the "|" character in the comment
19005 !! wikitext
19006 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19007 !! html/php
19008 <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>
19009
19010 !! html/parsoid
19011 <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>
19012 !! end
19013
19014 !! test
19015 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19016 !! wikitext
19017 <html><script>alert(1);</script></html>
19018 !! html
19019 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19020 </p>
19021 !! end
19022
19023 !! test
19024 HTML with raw HTML ($wgRawHtml==true)
19025 !! options
19026 wgRawHtml=1
19027 !! wikitext
19028 <html><script>alert(1);</script></html>
19029 !! html
19030 <p><script>alert(1);</script>
19031 </p>
19032 !! end
19033
19034 !! test
19035 Parents of subpages, one level up
19036 !! options
19037 subpage title=[[Subpage test/L1/L2/L3]]
19038 !! wikitext
19039 [[../|L2]]
19040 !! html
19041 <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>
19042 </p>
19043 !! end
19044
19045
19046 !! test
19047 Parents of subpages, one level up, not named
19048 !! options
19049 subpage title=[[Subpage test/L1/L2/L3]]
19050 !! wikitext
19051 [[../]]
19052 !! html
19053 <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>
19054 </p>
19055 !! end
19056
19057
19058
19059 !! test
19060 Parents of subpages, two levels up
19061 !! options
19062 subpage title=[[Subpage test/L1/L2/L3]]
19063 !! wikitext
19064 [[../../|L1]]2
19065
19066 [[../../|L1]]l
19067 !! html
19068 <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
19069 </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>
19070 </p>
19071 !! end
19072
19073 !! test
19074 Parents of subpages, two levels up, without trailing slash or name.
19075 !! options
19076 subpage title=[[Subpage test/L1/L2/L3]]
19077 !! wikitext
19078 [[../..]]
19079 !! html
19080 <p>[[../..]]
19081 </p>
19082 !! end
19083
19084 !! test
19085 Parents of subpages, two levels up, with lots of extra trailing slashes.
19086 !! options
19087 subpage title=[[Subpage test/L1/L2/L3]]
19088 !! wikitext
19089 [[../../////]]
19090 !! html
19091 <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>
19092 </p>
19093 !! end
19094
19095 !! article
19096 Subpage test/L1/L2/L3Sibling
19097 !! text
19098 Sibling article
19099 !! endarticle
19100
19101 !! test
19102 Transclusion of a sibling page (one level up)
19103 !! options
19104 subpage title=[[Subpage test/L1/L2/L3]]
19105 !! wikitext
19106 {{../L3Sibling}}
19107 !! html
19108 <p>Sibling article
19109 </p>
19110 !! end
19111
19112 !! test
19113 Transclusion of a child page
19114 !! options
19115 subpage title=[[Subpage test/L1/L2]]
19116 !! wikitext
19117 {{/L3Sibling}}
19118 !! html
19119 <p>Sibling article
19120 </p>
19121 !! end
19122
19123 !! test
19124 Non-transclusion because of too many up levels
19125 !! options
19126 subpage title=[[Subpage test/L1/L2/L3]]
19127 !! wikitext
19128 {{../../../../More than parent}}
19129 !! html
19130 <p>{{../../../../More than parent}}
19131 </p>
19132 !! end
19133
19134 !! test
19135 Definition list code coverage
19136 !! wikitext
19137 ; title : def
19138 ; title : def
19139 ;title: def
19140 !! html/php
19141 <dl><dt> title &#160;</dt>
19142 <dd> def</dd>
19143 <dt> title&#160;</dt>
19144 <dd> def</dd>
19145 <dt>title</dt>
19146 <dd> def</dd></dl>
19147
19148 !! html/parsoid
19149 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19150 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19151 <dt>title</dt><dd> def</dd></dl>
19152 !! end
19153
19154 !! test
19155 Don't fall for the self-closing div
19156 !! wikitext
19157 <div>hello world</div/>
19158 !! html
19159 <div>hello world</div>
19160
19161 !! end
19162
19163 !! test
19164 MSGNW magic word
19165 !! wikitext
19166 {{MSGNW:msg}}
19167 !! html/php
19168 <p>&#91;&#91;:Template:Msg&#93;&#93;
19169 </p>
19170 !! end
19171
19172 !! test
19173 RAW magic word
19174 !! wikitext
19175 {{RAW:QUERTY}}
19176 !! html
19177 <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>
19178 </p>
19179 !! end
19180
19181 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19182 !! test
19183 Always escape literal '>' in output, not just after '<'
19184 !! wikitext
19185 ><>
19186 !! html
19187 <p>&gt;&lt;&gt;
19188 </p>
19189 !! end
19190
19191 !! test
19192 Template caching
19193 !! wikitext
19194 {{Test}}
19195 {{Test}}
19196 !! html
19197 <p>This is a test template
19198 This is a test template
19199 </p>
19200 !! end
19201
19202
19203 !! article
19204 MediaWiki:Fake
19205 !! text
19206 ==header==
19207 !! endarticle
19208
19209 !! test
19210 Inclusion of !userCanEdit() content
19211 !! wikitext
19212 {{MediaWiki:Fake}}
19213 !! html
19214 <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>
19215
19216 !! end
19217
19218
19219 !! test
19220 Out-of-order TOC heading levels
19221 !! wikitext
19222 ==2==
19223 ======6======
19224 ===3===
19225 =1=
19226 =====5=====
19227 ==2==
19228 !! html
19229 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19230 <ul>
19231 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19232 <ul>
19233 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19234 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19235 </ul>
19236 </li>
19237 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19238 <ul>
19239 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19240 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19241 </ul>
19242 </li>
19243 </ul>
19244 </div>
19245
19246 <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>
19247 <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>
19248 <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>
19249 <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>
19250 <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>
19251 <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>
19252
19253 !! end
19254
19255
19256 !! test
19257 ISBN with a dummy number
19258 !! wikitext
19259 ISBN ---
19260 !! html
19261 <p>ISBN ---
19262 </p>
19263 !! end
19264
19265
19266 !! test
19267 ISBN with space-delimited number
19268 !! wikitext
19269 ISBN 92 9017 032 8
19270 !! html
19271 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19272 </p>
19273 !! end
19274
19275
19276 !! test
19277 ISBN with multiple spaces, no number
19278 !! wikitext
19279 ISBN foo
19280 !! html
19281 <p>ISBN foo
19282 </p>
19283 !! end
19284
19285
19286 !! test
19287 ISBN length
19288 !! wikitext
19289 ISBN 123456789
19290
19291 ISBN 1234567890
19292
19293 ISBN 12345678901
19294 !! html
19295 <p>ISBN 123456789
19296 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19297 </p><p>ISBN 12345678901
19298 </p>
19299 !! end
19300
19301
19302 !! test
19303 ISBN with trailing year (bug 8110)
19304 !! wikitext
19305 ISBN 1-234-56789-0 - 2006
19306
19307 ISBN 1 234 56789 0 - 2006
19308 !! html
19309 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19310 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19311 </p>
19312 !! end
19313
19314
19315 !! test
19316 anchorencode
19317 !! wikitext
19318 {{anchorencode:foo bar©#%n}}
19319 !! html
19320 <p>foo_bar.C2.A9.23.25n
19321 </p>
19322 !! end
19323
19324 !! test
19325 anchorencode trims spaces
19326 !! wikitext
19327 {{anchorencode: __pretty__please__}}
19328 !! html
19329 <p>pretty_please
19330 </p>
19331 !! end
19332
19333 !! test
19334 anchorencode deals with links
19335 !! wikitext
19336 {{anchorencode: [[hello|world]] [[hi]]}}
19337 !! html
19338 <p>world_hi
19339 </p>
19340 !! end
19341
19342 !! test
19343 anchorencode deals with templates
19344 !! wikitext
19345 {{anchorencode: {{Foo}} }}
19346 !! html
19347 <p>FOO
19348 </p>
19349 !! end
19350
19351 !! test
19352 anchorencode encodes like the TOC generator: (bug 18431)
19353 !! wikitext
19354 === _ +:.3A%3A&&amp;]] ===
19355 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19356 __NOEDITSECTION__
19357 !! html
19358 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19359 <p>.2B:.3A.253A.26.26.5D.5D
19360 </p>
19361 !! end
19362
19363 !! test
19364 Bug 6200: blockquotes and paragraph formatting
19365 !! wikitext
19366 <blockquote>
19367 foo
19368 </blockquote>
19369
19370 bar
19371
19372 baz
19373 !! html
19374 <blockquote>
19375 <p>foo
19376 </p>
19377 </blockquote>
19378 <p>bar
19379 </p>
19380 <pre>baz
19381 </pre>
19382 !! end
19383
19384 !! test
19385 Bug 8293: Use of center tag ruins paragraph formatting
19386 !! wikitext
19387 <center>
19388 foo
19389 </center>
19390
19391 bar
19392
19393 baz
19394 !! html
19395 <center>
19396 <p>foo
19397 </p>
19398 </center>
19399 <p>bar
19400 </p>
19401 <pre>baz
19402 </pre>
19403 !! end
19404
19405 !!test
19406 Parsing of overlapping (improperly nested) inline html tags
19407 !! wikitext
19408 <span><s>x</span></s>
19409 !! html/php
19410 <p><span><s>x&lt;/span&gt;</s></span>
19411 </p>
19412 !! html/parsoid
19413 <p><span><s>x</s></span>
19414 </p>
19415 !!end
19416
19417 ###
19418 ### Language variants related tests
19419 ###
19420 !! test
19421 Self-link in language variants
19422 !! options
19423 title=[[Dunav]] language=sr
19424 !! wikitext
19425 Both [[Dunav]] and [[Дунав]] are names for this river.
19426 !! html
19427 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19428 </p>
19429 !!end
19430
19431 !! article
19432 Дуна
19433 !! text
19434 content
19435 !! endarticle
19436
19437 !! test
19438 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19439 !! options
19440 title=[[Duna]] language=sr
19441 !! wikitext
19442 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19443 !! html
19444 <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.
19445 </p>
19446 !! end
19447
19448 !! test
19449 Link to a section of a variant of this title shouldn't be parsed as self-link
19450 !! options
19451 title=[[Duna]] language=sr
19452 !! wikitext
19453 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19454 !! html
19455 <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.
19456 </p>
19457 !! end
19458
19459 !! test
19460 Link to pages in language variants
19461 !! options
19462 language=sr
19463 !! wikitext
19464 Main Page can be written as [[Маин Паге]]
19465 !! html
19466 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19467 </p>
19468 !!end
19469
19470
19471 !! test
19472 Multiple links to pages in language variants
19473 !! options
19474 language=sr
19475 !! wikitext
19476 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19477 !! html
19478 <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>.
19479 </p>
19480 !!end
19481
19482
19483 !! test
19484 Simple template in language variants
19485 !! options
19486 language=sr
19487 !! wikitext
19488 {{тест}}
19489 !! html
19490 <p>This is a test template
19491 </p>
19492 !! end
19493
19494
19495 !! test
19496 Template with explicit namespace in language variants
19497 !! options
19498 language=sr
19499 !! wikitext
19500 {{Template:тест}}
19501 !! html
19502 <p>This is a test template
19503 </p>
19504 !! end
19505
19506
19507 !! test
19508 Basic test for template parameter in language variants
19509 !! options
19510 language=sr
19511 !! wikitext
19512 {{парамтест|param=foo}}
19513 !! html
19514 <p>This is a test template with parameter foo
19515 </p>
19516 !! end
19517
19518
19519 !! test
19520 Simple category in language variants
19521 !! options
19522 language=sr cat
19523 !! wikitext
19524 [[Category:МедиаWики Усер'с Гуиде]]
19525 !! html
19526 <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>
19527 !! end
19528
19529
19530 !! article
19531 Category:分类
19532 !! text
19533 blah
19534 !! endarticle
19535
19536 !! article
19537 Category:分類
19538 !! text
19539 blah
19540 !! endarticle
19541
19542 ## We used to, but no longer wt2wt this test since the default serializer
19543 ## will normalize all categories to serialize on their own line.
19544 ## This wikitext usage is going to be fairly uncommon in production and
19545 ## selser will take care of preserving formatting in those scenarios.
19546 !! test
19547 Don't convert blue categorylinks to another variant (bug 33210)
19548 !! options
19549 cat
19550 language=zh
19551 parsoid=wt2html
19552 !! wikitext
19553 [[A]][[Category:分类]]
19554 !! html/php
19555 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19556 !! html/parsoid
19557 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19558 <link rel="mw:PageProp/Category" href="Category:分类"/>
19559 !! end
19560
19561 !! test
19562 Stripping -{}- tags (language variants)
19563 !! options
19564 language=sr
19565 !! wikitext
19566 Latin proverb: -{Ne nuntium necare}-
19567 !! html
19568 <p>Latin proverb: Ne nuntium necare
19569 </p>
19570 !! end
19571
19572
19573 !! test
19574 Prevent conversion with -{}- tags (language variants)
19575 !! options
19576 language=sr variant=sr-ec
19577 !! wikitext
19578 Latinski: -{Ne nuntium necare}-
19579 !! html
19580 <p>Латински: Ne nuntium necare
19581 </p>
19582 !! end
19583
19584
19585 !! test
19586 Prevent conversion of text with -{}- tags (language variants)
19587 !! options
19588 language=sr variant=sr-ec
19589 !! wikitext
19590 Latinski: -{Ne nuntium necare}-
19591 !! html
19592 <p>Латински: Ne nuntium necare
19593 </p>
19594 !! end
19595
19596
19597 !! test
19598 Prevent conversion of links with -{}- tags (language variants)
19599 !! options
19600 language=sr variant=sr-ec
19601 !! wikitext
19602 -{[[Main Page]]}-
19603 !! html
19604 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19605 </p>
19606 !! end
19607
19608
19609 !! test
19610 -{}- tags within headlines (within html for parserConvert())
19611 !! options
19612 language=sr variant=sr-ec
19613 !! wikitext
19614 == -{Naslov}- ==
19615 !! html
19616 <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>
19617
19618 !! end
19619
19620
19621 !! test
19622 Explicit definition of language variant alternatives
19623 !! options
19624 language=zh variant=zh-tw
19625 !! wikitext
19626 -{zh:China;zh-tw:Taiwan}-, not China
19627 !! html
19628 <p>Taiwan, not China
19629 </p>
19630 !! end
19631
19632
19633 !! test
19634 Conversion around HTML tags
19635 !! options
19636 language=sr variant=sr-ec
19637 !! wikitext
19638 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19639 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19640 !! html
19641 <p>
19642 <span title="ЛаCтин">ски</span>
19643 </p>
19644 !! end
19645
19646
19647 !! test
19648 Explicit session-wise language variant mapping (A flag and - flag)
19649 !! options
19650 language=zh variant=zh-tw
19651 !! wikitext
19652 Taiwan is not China.
19653 But -{A|zh:China;zh-tw:Taiwan}- is China,
19654 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19655 and -{China}- is China.
19656 !! html
19657 <p>Taiwan is not China.
19658 But Taiwan is Taiwan,
19659 (This should be stripped!)
19660 and China is China.
19661 </p>
19662 !! end
19663
19664 !! test
19665 Explicit session-wise language variant mapping (H flag for hide)
19666 !! options
19667 language=zh variant=zh-tw
19668 !! wikitext
19669 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19670 Taiwan is China.
19671 !! html
19672 <p>(This should be stripped!)
19673 Taiwan is Taiwan.
19674 </p>
19675 !! end
19676
19677 !! test
19678 Adding explicit conversion rule for title (T flag)
19679 !! options
19680 language=zh variant=zh-tw showtitle
19681 !! wikitext
19682 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19683 !! html
19684 Taiwan
19685 <p>Should be stripped!
19686 </p>
19687 !! end
19688
19689 !! test
19690 Testing that changing the language variant here in the tests actually works
19691 !! options
19692 language=zh variant=zh showtitle
19693 !! wikitext
19694 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19695 !! html
19696 China
19697 <p>Should be stripped!
19698 </p>
19699 !! end
19700
19701 !! test
19702 Recursive conversion of alt and title attrs shouldn't clear converter state
19703 !! options
19704 language=zh variant=zh-cn showtitle
19705 !! wikitext
19706 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19707 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19708 !! html
19709 China
19710 <p>
19711 Should be stripped<span title="Exclamation">!</span>
19712 </p>
19713 !! end
19714
19715 !! test
19716 Bug 24072: more test on conversion rule for title
19717 !! options
19718 language=zh variant=zh-tw showtitle
19719 !! wikitext
19720 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19721 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19722 !! html
19723 Taiwan
19724 <p>This should be stripped!
19725 This won't take interferes with the title rule.
19726 </p>
19727 !! end
19728
19729 !! test
19730 Partly disable title conversion if variant == main language code
19731 !! options
19732 language=zh variant=zh title=[[ZH]] showtitle
19733 !! wikitext
19734 -{T|zh-cn:CN;zh-tw:TW}-
19735 !! html
19736 ZH
19737 <p>
19738 </p>
19739 !! end
19740
19741 !! test
19742 Partly disable title conversion if variant == main language code, more
19743 !! options
19744 language=zh variant=zh title=[[ZH]] showtitle
19745 !! wikitext
19746 -{T|TW}-
19747 !! html
19748 ZH
19749 <p>
19750 </p>
19751 !! end
19752
19753 !! test
19754 Raw output of variant escape tags (R flag)
19755 !! options
19756 language=zh variant=zh-tw
19757 !! wikitext
19758 Raw: -{R|zh:China;zh-tw:Taiwan}-
19759 !! html
19760 <p>Raw: zh:China;zh-tw:Taiwan
19761 </p>
19762 !! end
19763
19764 !! test
19765 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19766 !! options
19767 language=zh variant=zh-cn
19768 !! input
19769 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19770 !! result
19771 <p>0
19772 </p>
19773 !! end
19774
19775 !! test
19776 Conversion rules from [numeric-only string] to [something else] (T48634)
19777 !! options
19778 language=zh variant=zh-cn
19779 !! input
19780 -{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
19781 !! result
19782 <p>D12345EE12345
19783 </p>
19784 !! end
19785
19786 !! test
19787 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19788 !! options
19789 language=zh variant=zh-cn
19790 !! input
19791 -{H|zh-cn:foo;zh-tw:;}-foobar
19792 !! result
19793 <p>foobar
19794 </p>
19795 !! end
19796
19797 !! test
19798 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19799 !! options
19800 language=zh variant=zh-cn
19801 !! input
19802 -{H|=>zh-cn:foo;}-foobar
19803 !! result
19804 <p>foobar
19805 </p>
19806 !! end
19807
19808 !! test
19809 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19810 !! options
19811 language=zh variant=zh-cn
19812 !! input
19813 -{H|}-foobar
19814 !! result
19815 <p>foobar
19816 </p>
19817 !! end
19818
19819 !! test
19820 Nested using of manual convert syntax
19821 !! options
19822 language=zh variant=zh-hk
19823 !! wikitext
19824 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19825 !! html
19826 <p>Nested: Hello Hong Kong!
19827 </p>
19828 !! end
19829
19830 !! test
19831 Proper conversion of text in external links
19832 !! options
19833 language=sr variant=sr-ec
19834 !! wikitext
19835 http://www.google.com
19836 gopher://www.google.com
19837 [http://www.google.com http://www.google.com]
19838 [gopher://www.google.com gopher://www.google.com]
19839 [https://www.google.com irc://www.google.com]
19840 [ftp://www.google.com www.google.com/ftp://dir]
19841 [//www.google.com www.google.com]
19842 !! html
19843 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19844 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19845 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19846 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19847 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19848 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19849 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19850 </p>
19851 !! end
19852
19853 !! test
19854 Do not convert roman numbers to language variants
19855 !! options
19856 language=sr variant=sr-ec
19857 !! wikitext
19858 Fridrih IV je car.
19859 !! html
19860 <p>Фридрих IV је цар.
19861 </p>
19862 !! end
19863
19864 !! test
19865 Unclosed language converter markup "-{"
19866 !! options
19867 language=sr
19868 !! wikitext
19869 -{T|hello
19870 !! html
19871 <p>-{T|hello
19872 </p>
19873 !! end
19874
19875 !! test
19876 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19877 !! options
19878 language=sr
19879 !! wikitext
19880 -{R|=&gt;}-
19881 !! html
19882 <p>=&gt;
19883 </p>
19884 !!end
19885
19886 !! test
19887 Don't break link parsing if language converter markup is in the caption.
19888 !! options
19889 language=sr variant=sr-ec
19890 !! wikitext
19891 [[Main Page|-{R|main page}-]]
19892 !! html
19893 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19894 </p>
19895 !! end
19896
19897 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19898 !! test
19899 Don't break image parsing if language converter markup is in the caption.
19900 !! options
19901 language=sr
19902 !! wikitext
19903 [[File:Foobar.jpg|-{R|caption}-]]
19904 !! html/parsoid
19905 <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>
19906 </p>
19907 !! end
19908
19909 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19910 !! test
19911 Don't break list handling if language converter markup is in the item.
19912 !! options
19913 language=zh variant=zh-cn
19914 !! wikitext
19915 ;-{zh-cn:AAA;zh-tw:BBB}-
19916 !! html/php
19917 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19918
19919 !! html/parsoid
19920 <dl><dt>AAA
19921 </dt></dl>
19922 !! end
19923
19924 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19925 !! test
19926 Don't break table handling if language converter markup is in the cell.
19927 !! options
19928 language=sr variant=sr-ec
19929 !! wikitext
19930 {|
19931 |-
19932 | -{R|B}-
19933 |}
19934 !! html/php
19935 <table>
19936
19937 <tr>
19938 <td>Б}-
19939 </td></tr></table>
19940
19941 !! html/parsoid
19942 <table>
19943
19944 <tr>
19945 <td> B
19946 </td></tr></table>
19947
19948 !! end
19949
19950 !! test
19951 Bug 529: Uncovered bullet
19952 !! wikitext
19953 * Foo {{bullet}}
19954 !! html
19955 <ul><li> Foo </li>
19956 <li> Bar</li></ul>
19957
19958 !! end
19959
19960 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19961 # Templates in Wikipedia rely on this behavior, as tidy has always been
19962 # enabled there. These tests are normally run *without* tidy, so specify the
19963 # full output here.
19964 # To test realistic parsing behavior, apply a tidy-like transformation to both
19965 # the expected output and your parser's output.
19966 !! test
19967 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19968 !! wikitext
19969 ******* Foo {{bullet}}
19970 !! html
19971 <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>
19972 <li> Bar</li></ul>
19973
19974 !! end
19975
19976 !! test
19977 Bug 529: Uncovered table already at line-start
19978 !! wikitext
19979 x
19980
19981 {{table}}
19982 y
19983 !! html
19984 <p>x
19985 </p>
19986 <table>
19987 <tr>
19988 <td> 1 </td>
19989 <td> 2
19990 </td></tr>
19991 <tr>
19992 <td> 3 </td>
19993 <td> 4
19994 </td></tr></table>
19995 <p>y
19996 </p>
19997 !! end
19998
19999 !! test
20000 Bug 529: Uncovered bullet in parser function result
20001 !! wikitext
20002 * Foo {{lc:{{bullet}} }}
20003 !! html
20004 <ul><li> Foo </li>
20005 <li> bar</li></ul>
20006
20007 !! end
20008
20009 !! test
20010 Bug 5678: Double-parsed template argument
20011 !! wikitext
20012 {{lc:{{{1}}}|hello}}
20013 !! html
20014 <p>{{{1}}}
20015 </p>
20016 !! end
20017
20018 !! test
20019 Bug 5678: Double-parsed template invocation
20020 !! wikitext
20021 {{lc:{{paramtest {{!}} param = hello }} }}
20022 !! html
20023 <p>{{paramtest | param = hello }}
20024 </p>
20025 !! end
20026
20027 !! test
20028 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20029 !! options
20030 language=cs
20031 title=[[Main Page]]
20032 !! wikitext
20033 {{PRVNÍVELKÉ:ěščř}}
20034 {{prvnívelké:ěščř}}
20035 {{PRVNÍMALÉ:ěščř}}
20036 {{prvnímalé:ěščř}}
20037 {{MALÁ:ěščř}}
20038 {{malá:ěščř}}
20039 {{VELKÁ:ěščř}}
20040 {{velká:ěščř}}
20041 !! html
20042 <p>Ěščř
20043 Ěščř
20044 ěščř
20045 ěščř
20046 ěščř
20047 ěščř
20048 ĚŠČŘ
20049 ĚŠČŘ
20050 </p>
20051 !! end
20052
20053 !! test
20054 Morwen/13: Unclosed link followed by heading
20055 !! wikitext
20056 [[link
20057 ==heading==
20058 !! html
20059 <p>[[link
20060 </p>
20061 <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>
20062
20063 !! end
20064
20065 !! test
20066 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20067 !! wikitext
20068 {{foo|
20069 =heading=
20070 !! html
20071 <p>{{foo|
20072 </p>
20073 <h1><span class="mw-headline" id="heading">heading</span></h1>
20074
20075 !! end
20076
20077 !! test
20078 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20079 !! wikitext
20080 {{foo|
20081 ==heading==
20082 !! html
20083 <p>{{foo|
20084 </p>
20085 <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>
20086
20087 !! end
20088
20089 !! test
20090 Tildes in comments
20091 !! options
20092 pst
20093 !! wikitext
20094 <!-- ~~~~ -->
20095 !! html/php
20096 <!-- ~~~~ -->
20097 !! end
20098
20099 !! test
20100 Paragraphs inside divs (no extra line breaks)
20101 !! wikitext
20102 <div>Line one
20103
20104 Line two</div>
20105 !! html
20106 <div>Line one
20107 Line two</div>
20108
20109 !! end
20110
20111 !! test
20112 Paragraphs inside divs (extra line break on open)
20113 !! wikitext
20114 <div>
20115 Line one
20116
20117 Line two</div>
20118 !! html
20119 <div>
20120 <p>Line one
20121 </p>
20122 Line two</div>
20123
20124 !! end
20125
20126 !! test
20127 Paragraphs inside divs (extra line break on close)
20128 !! wikitext
20129 <div>Line one
20130
20131 Line two
20132 </div>
20133 !! html
20134 <div>Line one
20135 <p>Line two
20136 </p>
20137 </div>
20138
20139 !! end
20140
20141 !! test
20142 Paragraphs inside divs (extra line break on open and close)
20143 !! wikitext
20144 <div>
20145 Line one
20146
20147 Line two
20148 </div>
20149 !! html
20150 <div>
20151 <p>Line one
20152 </p><p>Line two
20153 </p>
20154 </div>
20155
20156 !! end
20157
20158 !! test
20159 Nesting tags, paragraphs on lines which begin with <div>
20160 !! wikitext
20161 <div></div><strong>A
20162 B</strong>
20163 !! html/php+tidy
20164 <p><strong>A</strong></p>
20165 <p><strong>B</strong></p>
20166 !! html/parsoid
20167 <div></div>
20168 <p><strong>A
20169 B</strong>
20170 </p>
20171 !! end
20172
20173 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20174 !! test
20175 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20176 !! wikitext
20177 <blockquote>Line one
20178
20179 Line two</blockquote>
20180 !! html
20181 <blockquote>Line one
20182 Line two</blockquote>
20183
20184 !! html+tidy
20185 <blockquote>
20186 <p>Line one Line two</p>
20187 </blockquote>
20188 !! end
20189
20190 !! test
20191 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20192 !! wikitext
20193 <blockquote>
20194 Line one
20195
20196 Line two</blockquote>
20197 !! html
20198 <blockquote>
20199 <p>Line one
20200 </p>
20201 Line two</blockquote>
20202
20203 !! html+tidy
20204 <blockquote>
20205 <p>Line one</p>
20206 Line two</blockquote>
20207 !! end
20208
20209 !! test
20210 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20211 !! wikitext
20212 <blockquote>Line one
20213
20214 Line two
20215 </blockquote>
20216 !! html
20217 <blockquote>Line one
20218 <p>Line two
20219 </p>
20220 </blockquote>
20221
20222 !! html+tidy
20223 <blockquote>
20224 <p>Line one</p>
20225 <p>Line two</p>
20226 </blockquote>
20227 !! end
20228
20229 !! test
20230 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20231 !! wikitext
20232 <blockquote>
20233 Line one
20234
20235 Line two
20236 </blockquote>
20237 !! html
20238 <blockquote>
20239 <p>Line one
20240 </p><p>Line two
20241 </p>
20242 </blockquote>
20243
20244 !! html+tidy
20245 <blockquote>
20246 <p>Line one</p>
20247 <p>Line two</p>
20248 </blockquote>
20249 !! end
20250
20251 !! test
20252 Paragraphs inside blockquotes/divs (no extra line breaks)
20253 !! wikitext
20254 <blockquote><div>Line one
20255
20256 Line two</div></blockquote>
20257 !! html
20258 <blockquote><div>Line one
20259 Line two</div></blockquote>
20260
20261 !! end
20262
20263 !! test
20264 Paragraphs inside blockquotes/divs (extra line break on open)
20265 !! wikitext
20266 <blockquote><div>
20267 Line one
20268
20269 Line two</div></blockquote>
20270 !! html
20271 <blockquote><div>
20272 <p>Line one
20273 </p>
20274 Line two</div></blockquote>
20275
20276 !! end
20277
20278 !! test
20279 Paragraphs inside blockquotes/divs (extra line break on close)
20280 !! wikitext
20281 <blockquote><div>Line one
20282
20283 Line two
20284 </div></blockquote>
20285 !! html
20286 <blockquote><div>Line one
20287 <p>Line two
20288 </p>
20289 </div></blockquote>
20290
20291 !! end
20292
20293 !! test
20294 Paragraphs inside blockquotes/divs (extra line break on open and close)
20295 !! wikitext
20296 <blockquote><div>
20297 Line one
20298
20299 Line two
20300 </div></blockquote>
20301 !! html
20302 <blockquote><div>
20303 <p>Line one
20304 </p><p>Line two
20305 </p>
20306 </div></blockquote>
20307
20308 !! end
20309
20310 !! test
20311 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20312 !! options
20313 wgLinkHolderBatchSize=0
20314 !! wikitext
20315 [[meatball:1]]
20316 [[meatball:2]]
20317 [[meatball:3]]
20318 !! html
20319 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20320 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20321 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20322 </p>
20323 !! end
20324
20325 !! test
20326 Free external link invading image caption
20327 !! wikitext
20328 [[Image:Foobar.jpg|thumb|http://x|hello]]
20329 !! html
20330 <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>
20331
20332 !! end
20333
20334 !! test
20335 Bug 15196: localised external link numbers
20336 !! options
20337 language=fa
20338 !! wikitext
20339 [http://en.wikipedia.org/]
20340 !! html/php
20341 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20342 </p>
20343 !! html/parsoid
20344 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20345 !! end
20346
20347 !! test
20348 Multibyte character in padleft
20349 !! wikitext
20350 {{padleft:-Hello|7|Æ}}
20351 !! html
20352 <p>Æ-Hello
20353 </p>
20354 !! end
20355
20356 !! test
20357 Multibyte character in padright
20358 !! wikitext
20359 {{padright:Hello-|7|Æ}}
20360 !! html
20361 <p>Hello-Æ
20362 </p>
20363 !! end
20364
20365 !!test
20366 formatdate parser function
20367 !! wikitext
20368 {{#formatdate:2009-03-24}}
20369 !! html
20370 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20371 </p>
20372 !! end
20373
20374 !!test
20375 formatdate parser function, with default format
20376 !! wikitext
20377 {{#formatdate:2009-03-24|mdy}}
20378 !! html
20379 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20380 </p>
20381 !! end
20382
20383 !! test
20384 Spacing of numbers in formatted dates
20385 !! wikitext
20386 {{#formatdate:January 15}}
20387 !! html
20388 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20389 </p>
20390 !! end
20391
20392 !! test
20393 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
20394 !! options
20395 language=nl title=[[MediaWiki:Common.css]]
20396 !! wikitext
20397 {{#formatdate:2009-03-24|dmy}}
20398 !! html
20399 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20400 </p>
20401 !! end
20402
20403 #
20404 #
20405 #
20406
20407 #
20408 # Edit comments
20409 #
20410
20411 !! test
20412 Edit comment with link
20413 !! options
20414 comment
20415 !! wikitext
20416 I like the [[Main Page]] a lot
20417 !! html/php
20418 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20419 !!end
20420
20421 !! test
20422 Edit comment with link and link text
20423 !! options
20424 comment
20425 !! wikitext
20426 I like the [[Main Page|best pages]] a lot
20427 !! html/php
20428 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20429 !!end
20430
20431 !! test
20432 Edit comment with link and link text with suffix
20433 !! options
20434 comment
20435 !! wikitext
20436 I like the [[Main Page|best page]]s a lot
20437 !! html/php
20438 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20439 !!end
20440
20441 !! test
20442 Edit comment with section link (non-local, eg in history list)
20443 !! options
20444 comment title=[[Main Page]]
20445 !! wikitext
20446 /* External links */ removed bogus entries
20447 !! html/php
20448 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20449 !!end
20450
20451 !! test
20452 Edit comment with section link and text before it (non-local, eg in history list)
20453 !! options
20454 comment title=[[Main Page]]
20455 !! wikitext
20456 pre-comment text /* External links */ removed bogus entries
20457 !! html/php
20458 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>
20459 !!end
20460
20461 !! test
20462 Edit comment with section link (local, eg in diff view)
20463 !! options
20464 comment local title=[[Main Page]]
20465 !! wikitext
20466 /* External links */ removed bogus entries
20467 !! html/php
20468 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20469 !!end
20470
20471 !! test
20472 Edit comment with subpage link (bug 14080)
20473 !! options
20474 comment
20475 subpage
20476 title=[[Subpage test]]
20477 !! wikitext
20478 Poked at a [[/subpage]] here...
20479 !! html/php
20480 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20481 !!end
20482
20483 !! test
20484 Edit comment with subpage link and link text (bug 14080)
20485 !! options
20486 comment
20487 subpage
20488 title=[[Subpage test]]
20489 !! wikitext
20490 Poked at a [[/subpage|neat little page]] here...
20491 !! html/php
20492 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20493 !!end
20494
20495 !! test
20496 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20497 !! options
20498 comment
20499 title=[[Subpage test]]
20500 !! wikitext
20501 Poked at a [[/subpage]] here...
20502 !! html/php
20503 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...
20504 !!end
20505
20506 !! test
20507 Edit comment with bare anchor link (local, as on diff)
20508 !! options
20509 comment
20510 local
20511 title=[[Main Page]]
20512 !! wikitext
20513 [[#section]]
20514 !! html/php
20515 <a href="#section">#section</a>
20516 !! end
20517
20518 !! test
20519 Edit comment with bare anchor link (non-local, as on history)
20520 !! options
20521 comment
20522 title=[[Main Page]]
20523 !! wikitext
20524 [[#section]]
20525 !! html/php
20526 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20527 !! end
20528
20529 !! test
20530 Anchor starting with underscore
20531 !! options
20532 title=[[Foo]]
20533 !! wikitext
20534 [[#_ref|One]]
20535 !! html/php
20536 <p><a href="#_ref">One</a>
20537 </p>
20538 !! html/parsoid
20539 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20540 !! end
20541
20542 !! test
20543 Id starting with underscore
20544 !! wikitext
20545 <div id="_ref"></div>
20546 !! html/*
20547 <div id="_ref"></div>
20548
20549 !! end
20550
20551 !! test
20552 Space normalisation on autocomment (bug 22784)
20553 !! options
20554 comment
20555 title=[[Main Page]]
20556 !! wikitext
20557 /* __hello__world__ */
20558 !! html/php
20559 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20560 !! end
20561
20562 !! test
20563 percent-encoding and + signs in comments (Bug 26410)
20564 !! options
20565 comment
20566 !! wikitext
20567 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20568 !! html/php
20569 <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>
20570 !! end
20571
20572 # Parsoid doesn't support this yet: see bug 73581
20573 # but it *should* omit the 'src' attribute if the image is bad.
20574 # PHP side of tests was disabled in
20575 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20576 # because of issues in the PHP parserTests infrastructure
20577 # (but the output below is indeed what the PHP side emits)
20578 !! test
20579 Bad images - basic functionality
20580 !! wikitext
20581 [[File:Bad.jpg]]
20582 !! DISABLED/html/php
20583 !! html/parsoid
20584 <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>
20585 !! end
20586
20587 !! test
20588 Bad images - bug 16039: text after bad image disappears
20589 !! wikitext
20590 Foo bar
20591 [[File:Bad.jpg]]
20592 Bar foo
20593 !! DISABLED/html/php
20594 <p>Foo bar
20595 </p><p>Bar foo
20596 </p>
20597 !! html/parsoid
20598 <p>Foo bar
20599 <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>
20600 Bar foo</p>
20601 !! end
20602
20603 !! test
20604 Verify that displaytitle works (bug #22501) no displaytitle
20605 !! options
20606 showtitle
20607 !! config
20608 wgAllowDisplayTitle=true
20609 wgRestrictDisplayTitle=false
20610 !! wikitext
20611 this is not the the title
20612 !! html/php
20613 Parser test
20614 <p>this is not the the title
20615 </p>
20616 !! end
20617
20618 !! test
20619 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20620 !! options
20621 showtitle
20622 title=[[Screen]]
20623 !! config
20624 wgAllowDisplayTitle=true
20625 wgRestrictDisplayTitle=false
20626 !! wikitext
20627 this is not the the title
20628 {{DISPLAYTITLE:whatever}}
20629 !! html/php
20630 whatever
20631 <p>this is not the the title
20632 </p>
20633 !! end
20634
20635 !! test
20636 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20637 !! options
20638 showtitle
20639 title=[[Screen]]
20640 !! config
20641 wgAllowDisplayTitle=true
20642 wgRestrictDisplayTitle=true
20643 !! wikitext
20644 this is not the the title
20645 {{DISPLAYTITLE:whatever}}
20646 !! html/php
20647 Screen
20648 <p>this is not the the title
20649 <span class="error"><strong>Warning:</strong> Display title "whatever" was ignored since it is not equivalent to the page's actual title.</span>
20650 </p>
20651 !! end
20652
20653 !! test
20654 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20655 !! options
20656 showtitle
20657 title=[[Screen]]
20658 !! config
20659 wgAllowDisplayTitle=true
20660 wgRestrictDisplayTitle=true
20661 !! wikitext
20662 this is not the the title
20663 {{DISPLAYTITLE:screen}}
20664 !! html/php
20665 screen
20666 <p>this is not the the title
20667 </p>
20668 !! end
20669
20670 !! test
20671 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20672 !! options
20673 showtitle
20674 title=[[Screen]]
20675 !! config
20676 wgAllowDisplayTitle=false
20677 !! wikitext
20678 this is not the the title
20679 {{DISPLAYTITLE:screen}}
20680 !! html/php
20681 Screen
20682 <p>this is not the the title
20683 <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>
20684 </p>
20685 !! end
20686
20687 !! test
20688 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20689 !! options
20690 showtitle
20691 title=[[Screen]]
20692 !! config
20693 wgAllowDisplayTitle=false
20694 !! wikitext
20695 this is not the the title
20696 !! html/php
20697 Screen
20698 <p>this is not the the title
20699 </p>
20700 !! end
20701
20702 !! test
20703 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20704 !! options
20705 showtitle
20706 title=[[Screen]]
20707 !! config
20708 wgAllowDisplayTitle=true
20709 wgRestrictDisplayTitle=true
20710 !! wikitext
20711 this is not the the title
20712 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20713 !! html/php
20714 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20715 <p>this is not the the title
20716 </p>
20717 !! end
20718
20719 !! test
20720 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20721 !! options
20722 showtitle
20723 title=[[Screen]]
20724 !! config
20725 wgAllowDisplayTitle=true
20726 wgRestrictDisplayTitle=true
20727 !! wikitext
20728 this is not the the title
20729 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20730 !! html/php
20731 <span style="color: red;">s</span>creen
20732 <p>this is not the the title
20733 </p>
20734 !! end
20735
20736 !! test
20737 Page status indicators: Empty name is invalid
20738 !! options
20739 showindicators
20740 !! wikitext
20741 <indicator name=" "></indicator>
20742 <indicator></indicator>
20743 !! html
20744 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20745 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20746 </p>
20747 !! end
20748
20749 !! test
20750 Page status indicators: Weird syntaxes that are okay
20751 !! options
20752 showindicators
20753 !! wikitext
20754 <indicator name="empty" />
20755 <indicator name="name"></indicator>
20756 !! html
20757 empty=
20758 name=
20759 <p><br />
20760 </p>
20761 !! end
20762
20763 !! test
20764 Page status indicators: Torture test
20765 !! options
20766 showindicators
20767 !! wikitext
20768 <indicator name="01">hello world</indicator>
20769 <indicator name="02">[[Main Page]]</indicator>
20770 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20771 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20772 <indicator name="05">* foo
20773 * bar</indicator>
20774 <indicator name="06"><nowiki>foo</nowiki></indicator>
20775 <indicator name="07"> Preformatted</indicator>
20776 <indicator name="08"><div>Broken tag</indicator>
20777 <indicator name="09">{| class=wikitable
20778 | cell
20779 |}</indicator>
20780 <indicator name="10">Two
20781
20782 paragraphs</indicator>
20783 !! html
20784 01=hello world
20785 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20786 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" />
20787 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>
20788 05=<ul><li> foo</li>
20789 <li> bar</li></ul>
20790
20791 06=foo
20792 07=<pre>Preformatted
20793 </pre>
20794 08=<div>Broken tag</div>
20795
20796 09=<table class="wikitable">
20797 <tr>
20798 <td> cell
20799 </td></tr></table>
20800
20801 10=<p>Two
20802 </p><p>paragraphs
20803 </p>
20804 <p><br />
20805 </p><p><br />
20806 </p><p><br />
20807 </p><p><br />
20808 </p><p><br />
20809 </p>
20810 !! end
20811
20812 !! test
20813 preload: check <noinclude> and <includeonly>
20814 !! options
20815 preload
20816 !! wikitext
20817 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20818 !! html/php
20819 Hello kind world.
20820 !! end
20821
20822 !! test
20823 preload: check <onlyinclude>
20824 !! options
20825 preload
20826 !! wikitext
20827 Goodbye <onlyinclude>Hello world</onlyinclude>
20828 !! html/php
20829 Hello world
20830 !! end
20831
20832 !! test
20833 preload: can pass tags through if we want to
20834 !! options
20835 preload
20836 !! wikitext
20837 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20838 !! html/php
20839 <includeonly>Hello world</includeonly>
20840 !! end
20841
20842 !! test
20843 preload: check that it doesn't try to do tricks
20844 !! options
20845 preload
20846 !! wikitext
20847 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20848 !! html/php
20849 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20850 !! end
20851
20852 !! test
20853 Play a bit with r67090 and bug 3158
20854 !! wikitext
20855 <div style="width:50% !important">&nbsp;</div>
20856 <div style="width:50%&nbsp;!important">&nbsp;</div>
20857 <div style="width:50%&#160;!important">&nbsp;</div>
20858 <div style="border : solid;">&nbsp;</div>
20859 !! html/php
20860 <div style="width:50% !important">&#160;</div>
20861 <div style="width:50% !important">&#160;</div>
20862 <div style="width:50% !important">&#160;</div>
20863 <div style="border&#160;: solid;">&#160;</div>
20864
20865 !! html/parsoid
20866 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20867 <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>
20868 <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>
20869 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20870
20871 !! end
20872
20873 !! test
20874 HTML5 data attributes
20875 !! wikitext
20876 <span data-foo="bar">Baz</span>
20877 <p data-abc-def_hij="">Quuz</p>
20878 !! html/php
20879 <p><span data-foo="bar">Baz</span>
20880 </p>
20881 <p data-abc-def_hij="">Quuz</p>
20882
20883 !! html/parsoid
20884 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20885 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20886 !! end
20887
20888 !! test
20889 Strip reserved data attributes
20890 !! wikitext
20891 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20892 !! html/php
20893 <div data-ok="fred">d</div>
20894
20895 !! html/parsoid
20896 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
20897 !! end
20898
20899 !! test
20900 percent-encoding and + signs in internal links (Bug 26410)
20901 !! wikitext
20902 [[User:+%]] [[Page+title%]]
20903 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20904 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20905 [[%33%45]] [[%33%45+]]
20906 !! html/php
20907 <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>
20908 <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>
20909 <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>
20910 <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>
20911 </p>
20912 !! html/parsoid
20913 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
20914 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
20915 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><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>
20916 <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>
20917 !! end
20918
20919 !! test
20920 Special characters in embedded file links (bug 27679)
20921 !! wikitext
20922 [[File:Contains & ampersand.jpg]]
20923 [[File:Does not exist.jpg|Title with & ampersand]]
20924 !! html/php
20925 <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>
20926 <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>
20927 </p>
20928 !! html/parsoid
20929 <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>
20930 <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>
20931 !! end
20932
20933 !! test
20934 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20935 !! wikitext
20936 Text&apos;s been normalized?
20937 !! html
20938 <p>Text&#39;s been normalized?
20939 </p>
20940 !! end
20941
20942 !! test
20943 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20944 !! wikitext
20945 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20946 !! html
20947 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20948 </p>
20949 !! end
20950
20951 !! test
20952 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20953 !! wikitext
20954 [http://www.example.org/ ideograms]
20955 !! html
20956 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20957 </p>
20958 !! end
20959
20960 !! test
20961 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20962 !! wikitext
20963 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20964 !! html
20965 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20966 </p>
20967 !! end
20968
20969 !! article
20970 Mediawiki:loop1
20971 !! text
20972 {{Identical|A}}
20973 !! endarticle
20974
20975 !! article
20976 Mediawiki:loop2
20977 !! text
20978 {{Identical|B}}
20979 !! endarticle
20980
20981 !! article
20982 Template:Identical
20983 !! text
20984 {{int:loop1}}
20985 {{int:loop2}}
20986 !! endarticle
20987
20988 !! test
20989 Bug 31098 Template which includes system messages which includes the template
20990 !! wikitext
20991 {{Identical}}
20992 !! html
20993 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20994 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20995 </p>
20996 !! end
20997
20998 !! test
20999 Bug31490 Turkish: ucfirst 'blah'
21000 !! options
21001 language=tr
21002 !! wikitext
21003 {{ucfirst:blah}}
21004 !! html
21005 <p>Blah
21006 </p>
21007 !! end
21008
21009 !! test
21010 Bug31490 Turkish: ucfirst 'ix'
21011 !! options
21012 language=tr
21013 !! wikitext
21014 {{ucfirst:ix}}
21015 !! html
21016 <p>İx
21017 </p>
21018 !! end
21019
21020 !! test
21021 Bug31490 Turkish: lcfirst 'BLAH'
21022 !! options
21023 language=tr
21024 !! wikitext
21025 {{lcfirst:BLAH}}
21026 !! html
21027 <p>bLAH
21028 </p>
21029 !! end
21030
21031 !! test
21032 Bug31490 Turkish: ucfırst (with a dotless i)
21033 !! options
21034 language=tr
21035 !! wikitext
21036 {{ucfırst:blah}}
21037 !! html
21038 <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>
21039 </p>
21040 !! end
21041
21042 !! test
21043 Bug31490 ucfırst (with a dotless i) with English language
21044 !! options
21045 language=en
21046 !! wikitext
21047 {{ucfırst:blah}}
21048 !! html
21049 <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>
21050 </p>
21051 !! end
21052
21053 !! test
21054 Bug 26375: TOC with italics
21055 !! options
21056 title=[[Main Page]]
21057 !! wikitext
21058 __TOC__
21059 == ''Lost'' episodes ==
21060 !! html
21061 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21062 <ul>
21063 <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>
21064 </ul>
21065 </div>
21066
21067 <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>
21068
21069 !! end
21070
21071 !! test
21072 Bug 26375: TOC with bold
21073 !! options
21074 title=[[Main Page]]
21075 !! wikitext
21076 __TOC__
21077 == '''should be bold''' then normal text ==
21078 !! html
21079 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21080 <ul>
21081 <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>
21082 </ul>
21083 </div>
21084
21085 <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>
21086
21087 !! end
21088
21089 !! test
21090 Bug 33845: Headings become cursive in TOC when they contain an image
21091 !! options
21092 title=[[Main Page]]
21093 !! wikitext
21094 __TOC__
21095 == Image [[Image:foobar.jpg]] ==
21096 !! html
21097 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21098 <ul>
21099 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21100 </ul>
21101 </div>
21102
21103 <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>
21104
21105 !! end
21106
21107 !! test
21108 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21109 !! options
21110 title=[[Main Page]]
21111 !! wikitext
21112 __TOC__
21113 == <blockquote>Quote</blockquote> ==
21114 !! html
21115 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21116 <ul>
21117 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21118 </ul>
21119 </div>
21120
21121 <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>
21122
21123 !! html+tidy
21124 <p></p>
21125 <div id="toc" class="toc">
21126 <div id="toctitle">
21127 <h2>Contents</h2>
21128 </div>
21129 <ul>
21130 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21131 </ul>
21132 </div>
21133 <p></p>
21134 <h2><span class="mw-headline" id="Quote"></span></h2>
21135 <blockquote>
21136 <p><span class="mw-headline" id="Quote">Quote</span></p>
21137 </blockquote>
21138 <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>
21139 !! end
21140
21141 !! test
21142 Unclosed tags in TOC
21143 !! options
21144 title=[[Main Page]]
21145 !! wikitext
21146 __TOC__
21147 == Proof: 2 < 3 ==
21148 <small>Hanc marginis exiguitas non caperet.</small>
21149 QED
21150 !! html
21151 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21152 <ul>
21153 <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>
21154 </ul>
21155 </div>
21156
21157 <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>
21158 <p><small>Hanc marginis exiguitas non caperet.</small>
21159 QED
21160 </p>
21161 !! end
21162
21163 !! test
21164 Multiple tags in TOC
21165 !! wikitext
21166 __TOC__
21167 == <i>Foo</i> <b>Bar</b> ==
21168
21169 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21170 !! html
21171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21172 <ul>
21173 <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>
21174 <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>
21175 </ul>
21176 </div>
21177
21178 <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>
21179 <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>
21180
21181 !! html+tidy
21182 <p></p>
21183 <div id="toc" class="toc">
21184 <div id="toctitle">
21185 <h2>Contents</h2>
21186 </div>
21187 <ul>
21188 <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>
21189 <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>
21190 </ul>
21191 </div>
21192 <p></p>
21193 <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>
21194 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21195 <blockquote>
21196 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21197 </blockquote>
21198 <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>
21199 !! end
21200
21201 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21202 # html5 tag parsing.
21203 !! test
21204 Tags with parameters in TOC
21205 !! options
21206 parsoid=wt2html
21207 !! wikitext
21208 __TOC__
21209 == <sup class="in-h2">Hello</sup> ==
21210
21211 == <sup class="a > b">Evilbye</sup> ==
21212 !! html/php
21213 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21214 <ul>
21215 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21216 <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>
21217 </ul>
21218 </div>
21219
21220 <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>
21221 <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>
21222
21223 !! html/parsoid
21224 <meta property="mw:PageProp/toc" />
21225 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21226
21227 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21228 !! end
21229
21230 !! test
21231 span tags with directionality in TOC
21232 !! wikitext
21233 __TOC__
21234 == <span dir="ltr">C++</span> ==
21235
21236 == <span dir="rtl">זבנג!</span> ==
21237
21238 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21239
21240 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21241
21242 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21243 !! html
21244 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21245 <ul>
21246 <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>
21247 <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>
21248 <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>
21249 <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>
21250 <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>
21251 </ul>
21252 </div>
21253
21254 <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>
21255 <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>
21256 <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>
21257 <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>
21258 <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>
21259
21260 !! end
21261
21262 !! test
21263 Bug 72884: bdi element in ToC
21264 !! wikitext
21265 __TOC__
21266 == <bdi>test</bdi> ==
21267 !! html
21268 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21269 <ul>
21270 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21271 </ul>
21272 </div>
21273
21274 <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>
21275
21276 !! end
21277
21278 # Note that the html output does not have the <p></p>, but the
21279 # html+tidy output *does*. This is because the empty <p></p> is
21280 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21281 !! test
21282 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21283 !! wikitext
21284 __TOC__
21285 == x ==
21286 !! html
21287 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21288 <ul>
21289 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21290 </ul>
21291 </div>
21292
21293 <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>
21294
21295 !! html+tidy
21296 <p></p>
21297 <div id="toc" class="toc">
21298 <div id="toctitle">
21299 <h2>Contents</h2>
21300 </div>
21301 <ul>
21302 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21303 </ul>
21304 </div>
21305 <p></p>
21306 <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>
21307 !! end
21308
21309 !! article
21310 MediaWiki:Bug32057
21311 !! text
21312 == {{int:headline_sample}} ==
21313 !! endarticle
21314
21315 !! test
21316 Bug 32057: Title needed when expanding <h> nodes.
21317 !! options
21318 title=[[Main Page]]
21319 !! wikitext
21320 {{int:Bug32057}}
21321 !! html
21322 <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>
21323
21324 !! end
21325
21326 !! test
21327 Strip marker in urlencode
21328 !! wikitext
21329 {{urlencode:x<nowiki/>y}}
21330 {{urlencode:x<nowiki/>y|wiki}}
21331 {{urlencode:x<nowiki/>y|path}}
21332 {{urlencode:x<pre id="one">two</pre>y}}
21333 !! html
21334 <p>xy
21335 xy
21336 xy
21337 xy
21338 </p>
21339 !! end
21340
21341 !! test
21342 Strip marker in lc
21343 !! wikitext
21344 {{lc:x<nowiki/>y}}
21345 !! html
21346 <p>xy
21347 </p>
21348 !! end
21349
21350 !! test
21351 Strip marker in uc
21352 !! wikitext
21353 {{uc:x<nowiki/>y}}
21354 !! html
21355 <p>XY
21356 </p>
21357 !! end
21358
21359 !! test
21360 Strip marker in formatNum
21361 !! wikitext
21362 {{formatnum:1<nowiki/>2}}
21363 {{formatnum:1<nowiki/>2|R}}
21364 !! html
21365 <p>12
21366 12
21367 </p>
21368 !! end
21369
21370 !! test
21371 Check noCommafy in formatNum
21372 !! options
21373 language=be-tarask
21374 !! wikitext
21375 {{formatnum:123456.78}}
21376 {{formatnum:123456.78|NOSEP}}
21377 !! html
21378 <p>123 456,78
21379 123456.78
21380 </p>
21381 !! end
21382
21383 !! test
21384 Wrong option for formatNum (bug 56199)
21385 !! wikitext
21386 {{formatnum:1,234.56|Random}}
21387 {{formatnum:1,234.56|EVERYTHING}}
21388 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21389 !! html
21390 <p>1,234.56
21391 1,234.56
21392 1,234.56
21393 </p>
21394 !! end
21395
21396 !! test
21397 Strip marker in grammar
21398 !! options
21399 language=fi
21400 !! wikitext
21401 {{grammar:elative|foo<nowiki/>bar}}
21402 !! html
21403 <p>foobarista
21404 </p>
21405 !! end
21406
21407 !! test
21408 Strip marker in padleft
21409 !! wikitext
21410 {{padleft:|2|x<nowiki/>y}}
21411 !! html
21412 <p>xy
21413 </p>
21414 !! end
21415
21416 !! test
21417 Strip marker in padright
21418 !! wikitext
21419 {{padright:|2|x<nowiki/>y}}
21420 !! html
21421 <p>xy
21422 </p>
21423 !! end
21424
21425 !! test
21426 Strip marker in anchorencode
21427 !! wikitext
21428 {{anchorencode:x<nowiki/>y}}
21429 !! html
21430 <p>xy
21431 </p>
21432 !! end
21433
21434 !! test
21435 nowiki inside link inside heading (bug 18295)
21436 !! wikitext
21437 ==[[foo|x<nowiki>y</nowiki>z]]==
21438 !! html
21439 <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>
21440
21441 !! end
21442
21443 !! test
21444 new support for bdi element (bug 31817)
21445 !! wikitext
21446 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21447 !! html
21448 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21449
21450 !!end
21451
21452 !! test
21453 Ignore pipe between table row attributes
21454 !! wikitext
21455 {|
21456 | quux
21457 |- id=foo | style='color: red'
21458 | bar
21459 |}
21460 !! html
21461 <table>
21462 <tr>
21463 <td> quux
21464 </td></tr>
21465 <tr id="foo" style="color: red">
21466 <td> bar
21467 </td></tr></table>
21468
21469 !! end
21470
21471 !!test
21472 Gallery override link with WikiLink (bug 34852)
21473 !! wikitext
21474 <gallery>
21475 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21476 </gallery>
21477 !! html
21478 <ul class="gallery mw-gallery-traditional">
21479 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21480 <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>
21481 <div class="gallerytext">
21482 <p>caption
21483 </p>
21484 </div>
21485 </div></li>
21486 </ul>
21487
21488 !! end
21489
21490 !!test
21491 Gallery override link with absolute external link (bug 34852)
21492 !! wikitext
21493 <gallery>
21494 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21495 </gallery>
21496 !! html
21497 <ul class="gallery mw-gallery-traditional">
21498 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21499 <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>
21500 <div class="gallerytext">
21501 <p>caption
21502 </p>
21503 </div>
21504 </div></li>
21505 </ul>
21506
21507 !! end
21508
21509 !!test
21510 Gallery override link with malicious javascript (bug 34852)
21511 !! wikitext
21512 <gallery>
21513 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21514 </gallery>
21515 !! html
21516 <ul class="gallery mw-gallery-traditional">
21517 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21518 <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>
21519 <div class="gallerytext">
21520 <p>caption
21521 </p>
21522 </div>
21523 </div></li>
21524 </ul>
21525
21526 !! end
21527
21528 !!test
21529 Gallery with invalid title as link (bug 43964)
21530 !! wikitext
21531 <gallery>
21532 File:foobar.jpg|link=<
21533 </gallery>
21534 !! html
21535 <ul class="gallery mw-gallery-traditional">
21536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21537 <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>
21538 <div class="gallerytext">
21539 </div>
21540 </div></li>
21541 </ul>
21542
21543 !! end
21544
21545 !!test
21546 Language parser function
21547 !! wikitext
21548 {{#language:ar}}
21549 !! html
21550 <p>العربية
21551 </p>
21552 !! end
21553
21554 !!test
21555 Padleft and padright as substr
21556 !! wikitext
21557 {{padleft:|3|abcde}}
21558 {{padright:|3|abcde}}
21559 !! html
21560 <p>abc
21561 abc
21562 </p>
21563 !! end
21564
21565 !!test
21566 Special parser function
21567 !! wikitext
21568 {{#special:RandomPage}}
21569 {{#special:BaDtItLe}}
21570 {{#special:Foobar}}
21571 !! html
21572 <p>Special:Random
21573 Special:Badtitle
21574 Special:Foobar
21575 </p>
21576 !! end
21577
21578 !!test
21579 Bug 34939 - Case insensitive link parsing ([HttP://])
21580 !! wikitext
21581 [HttP://MediaWiki.Org/]
21582 !! html/php
21583 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21584 </p>
21585 !! html/parsoid
21586 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21587 !! end
21588
21589 !!test
21590 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21591 !! wikitext
21592 [HttP://MediaWiki.Org/ MediaWiki]
21593 !! html
21594 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21595 </p>
21596 !! end
21597
21598 !!test
21599 Bug 34939 - Case insensitive link parsing (HttP://)
21600 !! wikitext
21601 HttP://MediaWiki.Org/
21602 !! html/php
21603 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21604 </p>
21605 !! html/parsoid
21606 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21607 !! end
21608
21609 !!test
21610 Disable TOC
21611 !! options
21612 notoc
21613 !! wikitext
21614 Lead
21615 == Section 1 ==
21616 == Section 2 ==
21617 == Section 3 ==
21618 == Section 4 ==
21619 == Section 5 ==
21620 !! html
21621 <p>Lead
21622 </p>
21623
21624 <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>
21625 <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>
21626 <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>
21627 <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>
21628 <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>
21629
21630 !! end
21631
21632
21633 ###
21634 ### Parsoid-specific tests
21635 ### Parsoid-PHP parser incompatibilities
21636 ###
21637 !!test
21638 1. SOL-sensitive wikitext tokens as template-args
21639 !!options
21640 parsoid=wt2html,wt2wt
21641 !! wikitext
21642 {{echo|*a}}
21643 {{echo|#a}}
21644 {{echo|:a}}
21645 !! html
21646 <span about="#mwt1" typeof="mw:Transclusion">
21647 </span><ul about="#mwt1"><li>a</li>
21648 </ul>
21649 <span about="#mwt2" typeof="mw:Transclusion">
21650 </span><ol about="#mwt2"><li>a</li>
21651 </ol>
21652 <span about="#mwt3" typeof="mw:Transclusion">
21653 </span><dl about="#mwt3"><dd>a</dd>
21654 </dl>
21655 !!end
21656
21657 #### -----------------------------------------------------------------
21658 #### Parsoid-specific functionality tests
21659 #### -----------------------------------------------------------------
21660
21661 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21662 # We know wt2wt will fail, but we expect selser to pass.
21663 # Due to the nature of our testing, wt2wt and selser tests will enter the
21664 # blacklist and we'll catch selser regressions based on changes to the
21665 # blacklist entries for selser tests.
21666 !! test
21667 1. Bad treebuilder fixup of formatting elt is cleaned up
21668 !! options
21669 parsoid=wt2html,wt2wt
21670 !! wikitext
21671 {|
21672 |
21673 <small>
21674 [[Image:Foobar.jpg|right|Test]]
21675 </small>
21676 |}
21677 !! html/parsoid
21678 <table>
21679 <tbody><tr><td>
21680 <small>
21681 <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>
21682 </small>
21683 </td></tr>
21684 </tbody></table>
21685 !! end
21686
21687 !! test
21688 2. Bad treebuilder fixup of formatting elt is cleaned up
21689 !! options
21690 parsoid=wt2html,wt2wt
21691 !! wikitext
21692 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21693
21694 <small>[[Image:Foobar.jpg|right|300px]]</small>
21695 !! html/parsoid
21696
21697 <p><b>foo</b></p>
21698 <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>
21699 <p><b>bar</b></p>
21700 <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>
21701 !! end
21702
21703 !! test
21704 3. Bad treebuilder fixup of formatting elt is cleaned up
21705 !! options
21706 parsoid=wt2html,wt2wt
21707 !! wikitext
21708 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21709 !! html/parsoid
21710 <p><small><b>foo</b></small></p>
21711 <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>
21712 <p><small><b>bar</b></small></p>
21713 !! end
21714
21715 !! test
21716 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21717 !! options
21718 parsoid=wt2html,wt2wt
21719 !! wikitext
21720 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21721 !! html/parsoid
21722 <p><b><small></small></b></p>
21723 <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>
21724 <p></p>
21725 !! end
21726
21727 #### ----------------------------------------------------------------
21728 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21729 #### tags. Parsoid's output for these tags differs from that of the
21730 #### PHP parser.
21731 #### ----------------------------------------------------------------
21732
21733 !!test
21734 Ref: 1. ref-location should be replaced with an index span
21735 !! wikitext
21736 A <ref>foo</ref>
21737 B <ref name="x">foo</ref>
21738 C <ref name="y" />
21739 <references />
21740 !! html/parsoid
21741 <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>
21742 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>
21743 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>
21744 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21745 <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>
21746 <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>
21747 <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>
21748 </ol>
21749 !!end
21750
21751 !!test
21752 Ref: 2. ref-tags with identical names should all get the same index
21753 !! wikitext
21754 A <ref name="x">foo</ref>
21755 B <ref name="x" />
21756 <references />
21757 !! html/parsoid
21758 <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>
21759 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>
21760 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21761 <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>
21762 </ol>
21763 !!end
21764
21765 !!test
21766 Ref: 3. spaces in ref-names should be ignored
21767 !! wikitext
21768 A <ref name="x">foo</ref>
21769 B <ref name=" x " />
21770 C <ref name= x />
21771 <references />
21772 !! html/parsoid
21773 <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>
21774 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>
21775 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>
21776 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21777 <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>
21778 </ol>
21779 !!end
21780
21781 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21782 !!test
21783 Ref: 4. 'constructor' should be accepted as a valid ref-name
21784 !! wikitext
21785 A <ref name="constructor">foo</ref>
21786 <references />
21787 !! html/parsoid
21788 <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>
21789 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21790 <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>
21791 </ol>
21792 !!end
21793
21794 !!test
21795 Ref: 5. body should accept generic wikitext
21796 !! wikitext
21797 A <ref>
21798 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21799 </ref>
21800
21801 <references />
21802 !! html/parsoid
21803 <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>
21804
21805 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21806 <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>
21807 </span></li>
21808 </ol>
21809 !!end
21810
21811 !!test
21812 Ref: 6. indent-pres should not be output in ref-body
21813 !! wikitext
21814 A <ref>
21815 foo
21816 bar
21817 baz
21818 </ref>
21819
21820 <references />
21821 !! html/parsoid
21822 <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>
21823
21824 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21825 <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
21826 bar
21827 baz
21828 </span></li>
21829 </ol>
21830 !!end
21831
21832 !!test
21833 Ref: 7. No p-wrapping in ref-body
21834 !! wikitext
21835 A <ref>
21836 foo
21837
21838 bar
21839
21840
21841 baz
21842
21843
21844
21845 booz
21846 </ref>
21847
21848 <references />
21849 !! html/parsoid
21850 <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>
21851
21852 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21853 <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
21854
21855 bar
21856
21857
21858 baz
21859
21860
21861
21862 booz
21863 </span></li>
21864 </ol>
21865 !!end
21866
21867 !!test
21868 Ref: 8. transclusion wikitext has lower precedence
21869 !! wikitext
21870 A <ref> foo {{echo|</ref> B C}}
21871
21872 <references />
21873 !! html/parsoid
21874 <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>
21875 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21876 <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 {{echo|</span></li>
21877 </ol>
21878 !!end
21879
21880 !!test
21881 Ref: 9. unclosed comments should not leak out of ref-body
21882 !! wikitext
21883 A <ref> foo <!--</ref> B C
21884 <references />
21885 !! html/parsoid
21886 <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>
21887 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21888 <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>
21889 </ol>
21890 !!end
21891
21892 !!test
21893 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21894 !! wikitext
21895 A <ref> <b> foo </ref> B C
21896
21897 <references />
21898 !! html/parsoid
21899 <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>
21900
21901
21902 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21903 <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>
21904 </ol>
21905 !!end
21906
21907 !!test
21908 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21909 !! wikitext
21910 A <ref>foo</ref> B
21911 C <ref>bar</ref> D
21912 <references />
21913 !! html/parsoid
21914 <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
21915 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>
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21917 <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>
21918 <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>
21919 </ol>
21920 !!end
21921
21922 !!test
21923 Ref: 12. ref-tags act as trailing newline migration barrier
21924 !! wikitext
21925 <!--the newline at the end of this line moves out of the p tag-->a
21926
21927 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21928 <ref />
21929
21930 c
21931 <references />
21932 !! html/parsoid
21933 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21934
21935
21936 <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>
21937 <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>
21938
21939 <p>c</p>
21940 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21941 <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>
21942 <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>
21943 !!end
21944
21945 !!test
21946 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21947 !! wikitext
21948 <ref>foo</ref> A
21949 <ref>bar
21950 </ref> B
21951 <references />
21952 !! html/parsoid
21953 <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
21954 <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>
21955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21956 <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>
21957 <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
21958 </span></li>
21959 </ol>
21960 !!end
21961
21962 !!test
21963 Ref: 14. A nested ref-tag should be emitted as plain text
21964 !! wikitext
21965 <ref>foo <ref>bar</ref> baz</ref>
21966
21967 <references />
21968 !! html/parsoid
21969 <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>
21970 </p>
21971 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21972 <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>
21973 </ol>
21974 !!end
21975
21976 !!test
21977 Ref: 15. ref-tags with identical names should get identical indexes
21978 !! wikitext
21979 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21980 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21981
21982 <references />
21983 !! html/parsoid
21984 <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>
21985 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>
21986
21987 <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>
21988 </ol>
21989 !!end
21990
21991 ## We don't bother wt2wt-ing non-standard whitespace
21992 !!test
21993 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21994 !!options
21995 parsoid=wt2html
21996 !! wikitext
21997 A <ref >foo</ref >
21998
21999 <references />
22000 !! html/parsoid
22001 <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>
22002 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22003 <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>
22004 !!end
22005
22006 !!test
22007 Ref: 17. Generate valid HTML5 id/about attributes
22008 !!wikitext
22009 <ref name="a b">foo</ref>
22010
22011 <references />
22012 !!html/parsoid
22013 <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>
22014 </p>
22015
22016 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22017 <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>
22018 </ol>
22019 !!end
22020
22021 !!test
22022 Ref: 18. T58916: Extension attributes should be parsed as plain text
22023 !!wikitext
22024 <ref name="{{echo|a}}">foo</ref>
22025
22026 <references />
22027 !!html/parsoid
22028 <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>
22029 </p>
22030
22031 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22032 <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>
22033 </ol>
22034 !!end
22035
22036 !!test
22037 Ref: 19. ref-tags with identical name encodings should get identical indexes
22038 !! wikitext
22039 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22040
22041 <references />
22042 !! html/parsoid
22043 <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>
22044 </p>
22045 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22046 <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>
22047 </ol>
22048 !!end
22049
22050 !!test
22051 Ref: 20. ref-tags with identical names but different content should keep it
22052 !! wikitext
22053 A <ref name="foo">Foo one</ref>
22054 B <ref name="foo">Foo two</ref>
22055 C <ref name="foo" />
22056
22057 <references />
22058 !! html/parsoid
22059 <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>
22060 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>
22061 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>
22062
22063 <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>
22064 </ol>
22065 !!end
22066
22067 !!test
22068 References: 1. references tag without any refs should be handled properly
22069 !! wikitext
22070 <references />
22071 !! html/parsoid
22072 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22073 !!end
22074
22075 !!test
22076 References: 2. references tag with group only outputs references from that group
22077 !! wikitext
22078 A <ref group="a">foo</ref>
22079 B <ref group="b">bar</ref>
22080 C <ref>baz</ref>
22081
22082 <references group="a" />
22083 <references />
22084 <references group="b" />
22085 !! html/parsoid
22086 <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>
22087 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>
22088 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>
22089
22090 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22091 <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>
22092 </ol>
22093 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22094 <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>
22095 </ol>
22096 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22097 <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>
22098 </ol>
22099 !!end
22100
22101 !!test
22102 References: 3. ref list should be cleared after processing references
22103 !! wikitext
22104 A <ref>foo</ref>
22105
22106 <references />
22107
22108 B <ref>bar</ref>
22109
22110 <references />
22111 !! html/parsoid
22112 <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>
22113
22114 <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>
22115 </ol>
22116
22117 <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>
22118
22119 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22120 <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>
22121 </ol>
22122 !!end
22123
22124 !!test
22125 References: 4. only referenced group should be cleared after processing references
22126 !! wikitext
22127 A <ref group="a">afoo</ref>
22128 B <ref>bfoo</ref>
22129
22130 <references group="a" />
22131
22132 C <ref>cfoo</ref>
22133
22134 <references />
22135 !! html/parsoid
22136 <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>
22137 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>
22138
22139 <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>
22140 </ol>
22141
22142 <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>
22143
22144 <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>
22145 </ol>
22146 !!end
22147
22148 ## Don't expect this to rt since we're dropping content
22149 !! test
22150 References: 5. ref tags in references should be processed while ignoring all other content
22151 !! options
22152 parsoid=wt2html,html2html
22153 !! wikitext
22154 A <ref name="a" />
22155 B <ref name="b">bar</ref>
22156
22157 <references>
22158 <ref name="a">foo</ref>
22159 This should just get lost.
22160 </references>
22161 !! html/parsoid
22162 <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>
22163 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>
22164
22165
22166 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"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;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><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>
22167 </ol>
22168 !! end
22169
22170 !! test
22171 References: 6. <references /> from a transclusion
22172 !! wikitext
22173 <ref>Foo</ref> {{echo|<references />}}
22174 !! html/parsoid
22175 <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>
22176 </ol>
22177 !! end
22178
22179 !! test
22180 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22181 !! wikitext
22182 A <ref>foo bar for a</ref>
22183 B <ref group="X" name="b" />
22184
22185 <references />
22186
22187 <references group="X">
22188 <ref name="b">foo</ref>
22189 </references>
22190 !! html/parsoid
22191 <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>
22192 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>
22193 </p>
22194
22195 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22196 <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>
22197 </ol>
22198
22199 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"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\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22200 <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>
22201 </ol>
22202 !! end
22203
22204 !! test
22205 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22206 !! wikitext
22207 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22208 <references />
22209 !! html/parsoid
22210 <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>
22211 <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>
22212 </ol>
22213 !!end
22214
22215 # This test only works in wt2html now as the <references /> are always generated
22216 # unless selser is active. Once T72722 is fixed, we should add a changes test
22217 # here to ensure that unrelated changes don't add the new <references />
22218 # when selser is active.
22219 !! test
22220 References: 9. Generate missing references list at the end
22221 !! wikitext
22222 A <ref>foo</ref>
22223 B <ref group="inexistent">bar</ref>
22224 !! html/parsoid
22225 <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>
22226 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22227 <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>
22228 </ol>
22229 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22230 <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>
22231 </ol>
22232 !! end
22233
22234 !! test
22235 References: 10. New <references/> shouldn't be added for unrelated edits.
22236 !! options
22237 parsoid={
22238 "modes": ["selser"],
22239 "changes": [["#x", "remove"]],
22240 "selser": "noauto"
22241 }
22242 !! wikitext
22243 Unrelated text<span id="x"> that's going to disappear</span>.
22244 A <ref>foo</ref>
22245 !! wikitext/edited
22246 Unrelated text.
22247 A <ref>foo</ref>
22248 !!end
22249
22250 !! test
22251 Entities in ref name
22252 !! wikitext
22253 <ref name="test &amp; me">hi</ref>
22254 <references />
22255 !! html/parsoid
22256 <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>
22257 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22258 <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>
22259 </ol>
22260 !! end
22261
22262 ## The output here may look funny, but it's what the php parser will do. The
22263 ## unclosed references tag becomes escaped text, and then a new references
22264 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22265 ## nowiki tags, and the auto-generated references tag is only dropped in
22266 ## rtTestMode.
22267 !! test
22268 Generate references for unclosed references tag
22269 !! options
22270 parsoid=wt2html
22271 !! wikitext
22272 a<ref>foo</ref>
22273
22274 <references>
22275 !! html/parsoid
22276 <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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22277
22278 <p>&lt;references></p>
22279 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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>
22280 !! end
22281
22282 !! test
22283 New reference serializes on its own line
22284 !! options
22285 parsoid=wt2wt,html2wt
22286 !! wikitext
22287 foo
22288 <references />
22289 !! html/parsoid
22290 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22291 !! end
22292
22293 #### ----------------------------------------------------------------
22294 #### Parsoid-only testing of Parsoid's impl of LST
22295 #### Not implemented yet, see
22296 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22297 #### ----------------------------------------------------------------
22298
22299 !! test
22300 LST Sections: 1. Simple section start and end
22301 !! options
22302 parsoid={ "suppressErrors": true }
22303 !! wikitext
22304 <section begin="2011-05-16" />
22305 <section end="2014-04-10 (MW 1.23wmf22)" />
22306 !! html/parsoid
22307 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22308 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22309 !! end
22310
22311 #--------- Test stripping of empty nodes in template content ----------
22312 !!test
22313 Empty LI and TR nodes should be stripped from template content
22314 !!wikitext
22315 {{EmptyLITest}}
22316 {{EmptyTRTest}}
22317 !!html/parsoid
22318 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22319 <li>a</li>
22320 <li>b</li>
22321 </ul>
22322 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22323 <tbody>
22324 <tr>
22325 <td>foo</td>
22326 </tr>
22327 <tr>
22328 <td>bar</td>
22329 </tr>
22330 </tbody>
22331 </table>
22332 !!end
22333
22334 !!test
22335 Empty LI and TR nodes should not be stripped from top-level content
22336 !!wikitext
22337 * a
22338 *
22339 * b
22340 {|
22341 |-
22342 |-
22343 |foo
22344 |}
22345 !!html/parsoid
22346 <ul>
22347 <li> a</li>
22348 <li></li>
22349 <li> b</li>
22350 </ul>
22351 <table>
22352 <tbody>
22353 <tr></tr>
22354 <tr>
22355 <td>foo</td>
22356 </tr>
22357 </tbody>
22358 </table>
22359 !!end
22360
22361 !!test
22362 Empty TR nodes should not be stripped if they have any attributes set
22363 !!wikitext
22364 {{EmptyTRWithHTMLAttrTest}}
22365 !!html/parsoid
22366 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22367 <tr align="center"></tr>
22368 <tr><td>foo</td></tr>
22369 <tr align="center"></tr>
22370 <tr><td>bar</td></tr>
22371 </table>
22372 !!end
22373
22374 #### ----------------------------------------------------------------
22375 #### The following section of tests are primarily to test
22376 #### wikitext escaping capabilities of Parsoid. Given that
22377 #### escaping can be done any number of ways, the wikitext (input)
22378 #### is always adjusted to reflect how Parsoid adds nowiki
22379 #### escape tags.
22380 ####
22381 #### We are marking several tests as parsoid-only since the
22382 #### HTML in the result section is different from what the
22383 #### PHP parser generates for it.
22384 #### ----------------------------------------------------------------
22385
22386
22387 #### --------------- Headings ---------------
22388 #### 0. Unnested
22389 #### 1. Nested inside html <h1>=foo=</h1>
22390 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22391 #### 3. Nested inside html with wikitext split by html tags
22392 #### 4. No escape needed
22393 #### 5. Empty headings <h1></h1>
22394 #### 6. Heading chars in SOL context
22395 #### ----------------------------------------
22396 !! test
22397 Headings: 0. Unnested
22398 !! options
22399 parsoid=html2wt
22400 !! html/parsoid
22401 <p>=foo=</p>
22402
22403 <p> =foo=
22404 <!--cmt-->
22405 =foo=</p>
22406
22407 <p>=foo<i>a</i>=</p>
22408 !! wikitext
22409 <nowiki>=foo=</nowiki>
22410
22411 <nowiki> </nowiki>=foo=
22412 <!--cmt-->
22413 <nowiki>=foo=</nowiki>
22414
22415 =foo''a''<nowiki>=</nowiki>
22416 !!end
22417
22418 # New headings and existing headings are handled differently
22419 !! test
22420 Headings: 1. Nested inside html
22421 !! options
22422 parsoid=html2wt
22423 !! html/parsoid
22424 <h1>=foo=</h1>
22425 <h2>=foo=</h2>
22426 <h3>=foo=</h3>
22427
22428 <h1 data-parsoid=''>=foo=</h1>
22429 <h2 data-parsoid=''>=foo=</h2>
22430 <h3 data-parsoid=''>=foo=</h3>
22431 <h4 data-parsoid=''>=foo=</h4>
22432 <h5 data-parsoid=''>=foo=</h5>
22433 <h6 data-parsoid=''>=foo=</h6>
22434 !! wikitext
22435 = =foo= =
22436
22437 == =foo= ==
22438
22439 === =foo= ===
22440
22441 =<nowiki>=foo=</nowiki>=
22442 ==<nowiki>=foo=</nowiki>==
22443 ===<nowiki>=foo=</nowiki>===
22444 ====<nowiki>=foo=</nowiki>====
22445 =====<nowiki>=foo=</nowiki>=====
22446 ======<nowiki>=foo=</nowiki>======
22447
22448 !!end
22449
22450 !! test
22451 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22452 !! options
22453 parsoid=html2wt
22454 !! html/parsoid
22455 <h1>foo</h1>*bar
22456 <h1>foo</h1>=bar
22457 <h1>foo</h1>=bar=
22458 !! wikitext
22459 = foo =
22460 <nowiki>*</nowiki>bar
22461
22462 = foo =
22463 =bar
22464
22465 = foo =
22466 <nowiki>=bar=</nowiki>
22467 !!end
22468
22469 !! test
22470 Headings: 3. Nested inside html with wikitext split by html tags
22471 !! options
22472 parsoid=html2wt
22473 !! html/parsoid
22474 <h1>=<b>bold</b>foo=</h1>
22475 !! wikitext
22476 = ='''bold'''foo= =
22477 !!end
22478
22479 !! test
22480 Headings: 4a. No escaping needed (testing just h1 and h2)
22481 !! options
22482 parsoid=html2wt
22483 !! html/parsoid
22484 <h1>=foo</h1>
22485 <h1>foo=</h1>
22486 <h1> =foo= </h1>
22487 <h1>=foo= bar</h1>
22488 <h2>=foo</h2>
22489 <h2>foo=</h2>
22490 <h1>=</h1>
22491 <h1><i>=</i>foo=</h1>
22492 !! wikitext
22493 = =foo =
22494
22495 = foo= =
22496
22497 = =foo= =
22498
22499 = =foo= bar =
22500
22501 == =foo ==
22502
22503 == foo= ==
22504
22505 = = =
22506
22507 = ''=''foo= =
22508 !!end
22509
22510 !! test
22511 Headings: 4b. No escaping needed (inside p-tags)
22512 !! options
22513 parsoid=html2wt
22514 !! html/parsoid
22515 <p>===
22516 =foo= x
22517 =foo= <s></s>
22518 </p>
22519 !! wikitext
22520 ===
22521 =foo= x
22522 =foo= <s></s>
22523 !!end
22524
22525 !! test
22526 Headings: 5. Empty headings
22527 !! options
22528 parsoid=html2wt
22529 !! html/parsoid
22530 <h1 data-parsoid='{}'></h1>
22531
22532 <h2 data-parsoid='{}'></h2>
22533
22534 <h3 data-parsoid='{}'></h3>
22535
22536 <h4 data-parsoid='{}'></h4>
22537
22538 <h5 data-parsoid='{}'></h5>
22539
22540 <h6 data-parsoid='{}'></h6>
22541 !! wikitext
22542 =<nowiki/>=
22543
22544 ==<nowiki/>==
22545
22546 ===<nowiki/>===
22547
22548 ====<nowiki/>====
22549
22550 =====<nowiki/>=====
22551
22552 ======<nowiki/>======
22553 !!end
22554
22555 !! test
22556 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22557 !! options
22558 parsoid=html2wt
22559 !! html/parsoid
22560 <p>=a=</p>
22561
22562 <p>=a=</p>
22563
22564 <p>=a=</p>
22565 !! wikitext
22566 <nowiki>=a=</nowiki>
22567
22568 <nowiki>=a=</nowiki>
22569
22570 <nowiki>=a=</nowiki>
22571 !!end
22572
22573 !! test
22574 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22575 !! options
22576 parsoid=html2wt
22577 !! html/parsoid
22578 <p>=a=
22579 b</p>
22580
22581 <p>=a=
22582 b</p>
22583
22584 <p>=a=
22585 b</p>
22586 !! wikitext
22587 <nowiki>=a=</nowiki>
22588 b
22589
22590 <nowiki>=a=</nowiki>
22591 b
22592
22593 <nowiki>=a=</nowiki>
22594 b
22595 !!end
22596
22597 !! test
22598 Headings: 6c. Heading chars in SOL context (leading newline break)
22599 !! options
22600 parsoid=html2wt
22601 !! html/parsoid
22602 <p>a
22603 =b=</p>
22604 !! wikitext
22605 a
22606 <nowiki>=b=</nowiki>
22607 !!end
22608
22609 !! test
22610 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22611 !! options
22612 parsoid=html2wt
22613 !! html/parsoid
22614 <!--c0--><p>=a=</p>
22615
22616 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22617 !! wikitext
22618 <!--c0--><nowiki>=a=</nowiki>
22619
22620 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22621 !!end
22622
22623 !! test
22624 Headings: 6d. Heading chars in SOL context (No escaping needed)
22625 !! options
22626 parsoid=html2wt
22627 !! html/parsoid
22628 =a=<div>b</div>
22629 !! wikitext
22630 =a=<div>b</div>
22631 !!end
22632
22633 !! test
22634 Headings: 7. Insert a newline between new content and headings
22635 !! options
22636 parsoid=html2wt
22637 !! html/parsoid
22638 <h2>NEW</h2>
22639 <p>new</p>
22640 <h2 data-parsoid='{}'>A</h2>
22641 <p data-parsoid='{}'>a</p>
22642 !! wikitext
22643 == NEW ==
22644 new
22645
22646 ==A==
22647 a
22648
22649 !! end
22650
22651 #### --------------- Lists ---------------
22652 #### 0. Outside nests (*foo, etc.)
22653 #### 1. Nested inside html <ul><li>*foo</li></ul>
22654 #### 2. Inside definition lists
22655 #### 3. Only bullets at start should be escaped
22656 #### 4. No escapes needed
22657 #### 5. No unnecessary escapes
22658 #### 6. Escape bullets in SOL position
22659 #### 7. Escape bullets in a multi-line context
22660 #### ----------------------------------------
22661
22662 !! test
22663 Lists: 0. Outside nests
22664 !! options
22665 parsoid=html2wt
22666 !! html/parsoid
22667 <p>*foo</p>
22668
22669 <p>#foo</p>
22670
22671 <p>;Foo:bar</p>
22672 !! wikitext
22673 <nowiki>*</nowiki>foo
22674
22675 <nowiki>#</nowiki>foo
22676
22677 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22678 !!end
22679
22680 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22681 ## to test wikitext escaping, and insignificant whitespace diffs
22682 ## cause PHP parser tests to barf
22683 !! test
22684 Lists: 1. Nested inside html (No unnecessary escapes)
22685 !! options
22686 parsoid=html2wt
22687 !! html/parsoid
22688 <ul>
22689 <li>*foo</li>
22690 <li>#foo</li>
22691 <li>:foo</li>
22692 <li>;foo</li>
22693 <li data-parsoid='{}'>*foo</li>
22694 <li data-parsoid='{}'>#foo</li>
22695 <li data-parsoid='{}'>:foo</li>
22696 <li data-parsoid='{}'>;foo</li>
22697 </ul>
22698
22699 <ol>
22700 <li>*foo</li>
22701 <li>#foo</li>
22702 <li>:foo</li>
22703 <li>;foo</li>
22704 <li data-parsoid='{}'>*foo</li>
22705 <li data-parsoid='{}'>#foo</li>
22706 <li data-parsoid='{}'>:foo</li>
22707 <li data-parsoid='{}'>;foo</li>
22708 </ol>
22709 !! wikitext
22710 * *foo
22711 * #foo
22712 * :foo
22713 * ;foo
22714 *<nowiki>*foo</nowiki>
22715 *<nowiki>#foo</nowiki>
22716 *<nowiki>:foo</nowiki>
22717 *<nowiki>;foo</nowiki>
22718
22719 # *foo
22720 # #foo
22721 # :foo
22722 # ;foo
22723 #<nowiki>*foo</nowiki>
22724 #<nowiki>#foo</nowiki>
22725 #<nowiki>:foo</nowiki>
22726 #<nowiki>;foo</nowiki>
22727 !!end
22728
22729 !! test
22730 Lists: 2. Inside definition lists
22731 !! options
22732 parsoid=html2wt
22733 !! html/parsoid
22734 <dl><dt>;foo</dt></dl>
22735 <dl><dt>:foo</dt></dl>
22736 <dl><dt>:foo</dt>
22737 <dd>bar</dd></dl>
22738 <dl><dd>:foo</dd></dl>
22739 !! wikitext
22740 ; ;foo
22741
22742 ; <nowiki>:foo</nowiki>
22743
22744 ; <nowiki>:foo</nowiki>
22745 : bar
22746
22747 : :foo
22748 !!end
22749
22750 !! test
22751 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22752 !! options
22753 parsoid=html2wt
22754 !! html/parsoid
22755 <ul>
22756 <li>*foo*bar</li>
22757 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22758 </ul>
22759 !! wikitext
22760 * *foo*bar
22761 *<nowiki>*foo</nowiki>''it''*bar
22762 !!end
22763
22764 !! test
22765 Lists: 4. No escapes needed
22766 !! options
22767 parsoid=html2wt
22768 !! html/parsoid
22769 <ul>
22770 <li>foo*bar
22771 </li>
22772 </ul>
22773 <ul>
22774 <li><i>foo</i>*bar
22775 </li>
22776 </ul>
22777 <ul>
22778 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22779 </li>
22780 </ul>
22781 <ul>
22782 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22783 </li>
22784 </ul>
22785 !! wikitext
22786 *foo*bar
22787
22788 *''foo''*bar
22789
22790 *[[Foo]]: bar
22791
22792 *[[Foo]]*bar
22793 !!end
22794
22795 !! test
22796 Lists: 5. No unnecessary escapes
22797 !! options
22798 parsoid=html2wt
22799 !! html/parsoid
22800 <ul><li> bar <span>[[foo]]</span></li></ul>
22801 <ul><li> =bar <span>[[foo]]</span></li></ul>
22802 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22803 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22804 <ul><li> =bar <span>foo]]</span>=</li></ul>
22805 <ul><li> <s></s>: a</li></ul>
22806 <ul><li> <i>* foo</i></li></ul>
22807
22808 !! wikitext
22809 * bar <span><nowiki>[[foo]]</nowiki></span>
22810
22811 * =bar <span><nowiki>[[foo]]</nowiki></span>
22812
22813 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22814
22815 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22816
22817 * =bar <span>foo]]</span>=
22818
22819 * <s></s>: a
22820
22821 * ''* foo''
22822 !!end
22823
22824 !! test
22825 Lists: 6. Escape bullets in SOL position
22826 !! options
22827 parsoid=html2wt
22828 !! html/parsoid
22829 <p><!--cmt-->*foo</p>
22830 !! wikitext
22831 <!--cmt--><nowiki>*</nowiki>foo
22832 !!end
22833
22834 !! test
22835 Lists: 7. Escape bullets in a multi-line context
22836 !! options
22837 parsoid=html2wt
22838 !! html/parsoid
22839 <p>a
22840 *b
22841 </p>
22842 !! wikitext
22843 a
22844 <nowiki>*</nowiki>b
22845 !!end
22846
22847 !! test
22848 Lists: 8. Escape colons only if not present in tags
22849 !! options
22850 parsoid=html2wt
22851 !! html/parsoid
22852 <dl><dt>a:b<i>c:d</i></dt></dl>
22853 !! wikitext
22854 ; <nowiki>a:b</nowiki>''c:d''
22855 !! end
22856
22857 #### --------------- HRs ---------------
22858 #### 1. Single line
22859 #### -----------------------------------
22860
22861 !! test
22862 HRs: 1. Single line
22863 !! options
22864 parsoid=html2wt
22865 !! html/parsoid
22866 <hr />----
22867 <hr />=foo=
22868 <hr />*foo
22869 !! wikitext
22870 ----<nowiki>----</nowiki>
22871 ----=foo=
22872 ----*foo
22873 !! end
22874
22875 #### --------------- Tables ---------------
22876 #### 1a. Simple example
22877 #### 1b. No escaping needed (!foo)
22878 #### 1c. No escaping needed (|foo)
22879 #### 1d. No escaping needed (|}foo)
22880 ####
22881 #### 2a. Nested in td (<td>foo|bar</td>)
22882 #### 2b. Nested in td (<td>foo||bar</td>)
22883 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22884 ####
22885 #### 3a. Nested in th (<th>foo!bar</th>)
22886 #### 3b. Nested in th (<th>foo!!bar</th>)
22887 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22888 ####
22889 #### 4a. Escape -
22890 #### 4b. Escape +
22891 #### 4c. No escaping needed
22892 #### --------------------------------------
22893
22894 !! test
22895 Tables: 1a. Simple example
22896 !! options
22897 parsoid=html2wt
22898 !! html/parsoid
22899 <p>{|
22900 |}
22901 </p>
22902 !! wikitext
22903 <nowiki>{|</nowiki>
22904 |}
22905 !! end
22906
22907 !! test
22908 Tables: 1b. No escaping needed
22909 !! options
22910 parsoid=html2wt
22911 !! html/parsoid
22912 <p>!foo
22913 </p>
22914 !! wikitext
22915 !foo
22916 !! end
22917
22918 !! test
22919 Tables: 1c. No escaping needed
22920 !! options
22921 parsoid=html2wt
22922 !! html/parsoid
22923 <p>|foo
22924 </p>
22925 !! wikitext
22926 |foo
22927 !! end
22928
22929 !! test
22930 Tables: 1d. No escaping needed
22931 !! options
22932 parsoid=html2wt
22933 !! html/parsoid
22934 <p>|}foo
22935 </p>
22936 !! wikitext
22937 |}foo
22938 !! end
22939
22940 !! test
22941 Tables: 2a. Nested in td
22942 !! options
22943 parsoid=html2wt
22944 !! html/parsoid
22945 <table><tbody><tr>
22946 <td>foo|bar</td></tr>
22947 <tr><td>x<div>a|b</div></td>
22948 </tbody></table>
22949 !! wikitext
22950 {|
22951 |<nowiki>foo|bar</nowiki>
22952 |-
22953 |x<div><nowiki>a|b</nowiki></div>
22954 |}
22955 !! html/php+tidy
22956 <table>
22957 <tr>
22958 <td>foo|bar</td>
22959 </tr>
22960 <tr>
22961 <td>x
22962 <div>a|b</div>
22963 </td>
22964 </tr>
22965 </table>
22966 !! end
22967
22968 !! test
22969 Tables: 2b. Nested in td
22970 !! options
22971 parsoid=html2wt
22972 !! html/parsoid
22973 <table><tbody><tr>
22974 <td>foo||bar</td>
22975 <td>a<i>b||c</i></td>
22976 <td>a<i><div>b||c</div></i></td>
22977 </tr></tbody></table>
22978 !! wikitext
22979 {|
22980 |<nowiki>foo||bar</nowiki>
22981 |a''<nowiki>b||c</nowiki>''
22982 |a''<div><nowiki>b||c</nowiki></div>''
22983 |}
22984 !! html/php
22985 <table>
22986 <tr>
22987 <td>foo||bar
22988 </td>
22989 <td>a<i>b||c</i>
22990 </td>
22991 <td>a<i><div>b||c</div></i>
22992 </td></tr></table>
22993
22994 !! end
22995
22996 !! test
22997 Tables: 2c. Nested in td -- no escaping needed
22998 !! options
22999 parsoid=html2wt
23000 !! html/*
23001 <table>
23002
23003 <tr>
23004 <td>foo!!bar
23005 </td></tr></table>
23006
23007 !! wikitext
23008 {|
23009
23010 |foo!!bar
23011 |}
23012 !! end
23013
23014 !! test
23015 Tables: 3a. Nested in th
23016 !! options
23017 parsoid=html2wt
23018 !! html/*
23019 <table>
23020
23021 <tr>
23022 <th>foo!bar
23023 </th></tr></table>
23024
23025 !! wikitext
23026 {|
23027
23028 !foo!bar
23029 |}
23030 !! end
23031
23032 !! test
23033 Tables: 3b. Nested in th
23034 !! options
23035 parsoid=html2wt
23036 !! html/parsoid
23037 <table><tbody>
23038 <tr><th>foo!!bar</th>
23039 <th><i>foo|bar</i></th>
23040 <th><i>foo!!bar</i></th>
23041 <th><i><span>foo!!bar</span></i></th>
23042 </tr></tbody></table>
23043 !! wikitext
23044 {|
23045 !<nowiki>foo!!bar</nowiki>
23046 !''<nowiki>foo|bar</nowiki>''
23047 !''<nowiki>foo!!bar</nowiki>''
23048 !''<span><nowiki>foo!!bar</nowiki></span>''
23049 |}
23050 !! html/php
23051 <table>
23052 <tr>
23053 <th>foo!!bar
23054 </th>
23055 <th><i>foo|bar</i>
23056 </th>
23057 <th><i>foo!!bar</i>
23058 </th>
23059 <th><i><span>foo!!bar</span></i>
23060 </th></tr></table>
23061
23062 !! end
23063
23064 !! test
23065 Tables: 3c. Nested in th
23066 !! options
23067 parsoid=html2wt
23068 !! html/parsoid
23069 <table><tbody>
23070 <tr><th>foo||bar</th>
23071 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23072 </tr></tbody></table>
23073 !! wikitext
23074 {|
23075 !<nowiki>foo||bar</nowiki>
23076 !<nowiki>foo||bar</nowiki>
23077 |}
23078 !! html/php
23079 <table>
23080 <tr>
23081 <th>foo||bar
23082 </th>
23083 <th>foo||bar
23084 </th></tr></table>
23085
23086 !! end
23087
23088 !! test
23089 Tables: 4a. Escape -
23090 !! options
23091 parsoid=html2wt
23092 !! html/*
23093 <table>
23094
23095 <tr>
23096 <th>-bar
23097 </th></tr>
23098 <tr>
23099 <td>-bar
23100 </td></tr></table>
23101
23102 !! wikitext
23103 {|
23104
23105 !-bar
23106
23107 |-
23108 |<nowiki>-bar</nowiki>
23109 |}
23110 !! end
23111
23112 !! test
23113 Tables: 4b. Escape +
23114 !! options
23115 parsoid=html2wt
23116 !! html/*
23117 <table>
23118
23119 <tr>
23120 <th>+bar
23121 </th></tr>
23122 <tr>
23123 <td>+bar
23124 </td></tr></table>
23125
23126 !! wikitext
23127 {|
23128
23129 !+bar
23130
23131 |-
23132 |<nowiki>+bar</nowiki>
23133 |}
23134 !! end
23135
23136 !! test
23137 Tables: 4c. No escaping needed
23138 !! options
23139 parsoid=html2wt
23140 !! html/parsoid
23141 <table><tbody>
23142 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23143 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23144 <tr><td>foo
23145 <p>bar|baz
23146 +bar
23147 -bar</p></td></tr>
23148 <tr><td>x
23149 <div>a|b</div></td>
23150 </tbody></table>
23151 !! wikitext
23152 {|
23153 |foo-bar
23154 |foo+bar
23155 |-
23156 |''foo''-bar
23157 |''foo''+bar
23158 |-
23159 |foo
23160 bar|baz
23161 +bar
23162 -bar
23163 |-
23164 |x
23165 <div>a|b</div>
23166 |}
23167 !! html/php
23168 <table>
23169 <tr>
23170 <td>foo-bar
23171 </td>
23172 <td>foo+bar
23173 </td></tr>
23174 <tr>
23175 <td><i>foo</i>-bar
23176 </td>
23177 <td><i>foo</i>+bar
23178 </td></tr>
23179 <tr>
23180 <td>foo
23181 <p>bar|baz
23182 +bar
23183 -bar
23184 </p>
23185 </td></tr>
23186 <tr>
23187 <td>x
23188 <div>a|b</div>
23189 </td></tr></table>
23190
23191 !! end
23192
23193 !! test
23194 Tables: 4d. No escaping needed
23195 !! options
23196 parsoid=html2wt
23197 !! html/parsoid
23198 <table>
23199 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23200 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23201 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23202 </tbody></table>
23203 !! wikitext
23204 {|
23205 |[[Foo]]-bar
23206 ||+1
23207 ||-2
23208 |}
23209 !! html/php
23210 <table>
23211 <tr>
23212 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23213 </td>
23214 <td>+1
23215 </td>
23216 <td>-2
23217 </td></tr></table>
23218
23219 !! end
23220
23221 !! test
23222 T97430: Don't emit empty nowiki pairs around marker meta tags
23223 !! options
23224 parsoid=html2wt
23225 !! html/parsoid
23226 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23227 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23228 !! wikitext
23229 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23230 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23231 !! end
23232
23233 !! test
23234 Unclosed xmlish element in table line shouldn't eat end delimiters
23235 !! options
23236 parsoid=html2wt
23237 !! html/parsoid
23238 <table>
23239 <tbody><tr><td> &lt;foo</td>
23240 <td> bar></td></tr>
23241 </tbody></table>
23242 !! wikitext
23243 {|
23244 | <foo
23245 | bar>
23246 |}
23247 !! html/php
23248 <table>
23249 <tr>
23250 <td> &lt;foo
23251 </td>
23252 <td> bar&gt;
23253 </td></tr></table>
23254
23255 !! end
23256
23257 #### --------------- Links ----------------
23258 #### 1. Quote marks in link text
23259 #### 2. Wikilinks: Escapes needed
23260 #### 3. Wikilinks: No escapes needed
23261 #### 4. Extlinks: Escapes needed
23262 #### 5. Extlinks: No escapes needed
23263 #### --------------------------------------
23264 !! test
23265 Links 1. WikiLinks: No escapes needed
23266 !! options
23267 parsoid=html2wt
23268 !! html/parsoid
23269 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23270 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23271 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23272 !! wikitext
23273 [[Foo|Foo''boo'']]
23274 [[Foo|[Foobar]]]
23275 [[Foo|x [Foobar] x]]
23276 !! html/php
23277 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23278 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23279 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23280 </p>
23281 !! end
23282
23283 !! test
23284 Links 2. WikiLinks: Escapes needed
23285 !! options
23286 parsoid=html2wt
23287 !! html/parsoid
23288 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23289 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23290 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23291 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23292 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23293 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23294 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23295 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23296 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23297 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23298 !! wikitext
23299 [[Foo|<nowiki>Foobar]</nowiki>]]
23300 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23301 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23302 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23303 [[Foo|<nowiki>|Bar</nowiki>]]
23304 [[Foo|<nowiki>]]bar</nowiki>]]
23305 [[Foo|<nowiki>[[bar</nowiki>]]
23306 [[Foo|<nowiki>x [[ y</nowiki>]]
23307 [[Foo|<nowiki>x ]] y</nowiki>]]
23308 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23309 !! html/php
23310 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23311 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23312 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23313 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23314 <a href="/wiki/Foo" title="Foo">|Bar</a>
23315 <a href="/wiki/Foo" title="Foo">]]bar</a>
23316 <a href="/wiki/Foo" title="Foo">[[bar</a>
23317 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23318 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23319 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23320 </p>
23321 !! end
23322
23323 !! test
23324 Links 3. WikiLinks: No escapes needed
23325 !! options
23326 parsoid=html2wt
23327 !! html/parsoid
23328 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23329 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23330 !! wikitext
23331 [[Foo|[Foobar]]
23332 [[Foo|foo|bar]]
23333 !! html/php
23334 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23335 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23336 </p>
23337 !! end
23338
23339 !! test
23340 Links 4. ExtLinks: Escapes needed
23341 !! options
23342 parsoid=html2wt
23343 !! html/parsoid
23344 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23345 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23346 <p>[http://google.com]</p>
23347 <p>[http://google.com google]</p>
23348 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23349 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
23350 !! wikitext
23351 [http://google.com <nowiki>[google]</nowiki>]
23352 [http://google.com <nowiki>google]</nowiki>]
23353
23354 <nowiki>[http://google.com]</nowiki>
23355
23356 <nowiki>[http://google.com google]</nowiki>
23357
23358 [http://google.com<nowiki>]</nowiki>
23359
23360 [{{echo|http://google.com}}<nowiki>]</nowiki>
23361 !! html/php
23362 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23363 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23364 </p><p>[http://google.com]
23365 </p><p>[http://google.com google]
23366 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23367 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23368 </p>
23369 !! end
23370
23371 !! test
23372 Links 5. ExtLinks: No escapes needed
23373 !! options
23374 parsoid=html2wt
23375 !! html/parsoid
23376 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23377 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23378 !! wikitext
23379 [http://google.com [google]
23380
23381 [[http://google.com]]
23382 !! html/php
23383 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23384 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23385 </p>
23386 !! end
23387
23388 !! test
23389 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23390 !! options
23391 parsoid=html2wt
23392 !! html/parsoid
23393 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23394 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23395 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23396 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23397 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23398 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23399 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23400 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23401 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23402 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23403 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23404 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23405 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23406 </p>
23407 !! wikitext
23408 x<nowiki/>http://example.com<nowiki/>y
23409 http://example.com<nowiki/>?x
23410 http://example.com<nowiki/>&x
23411 http://example.com<nowiki/>'x
23412 http://example.com<nowiki/>,x
23413 http://example.com<nowiki/>.x
23414 http://example.com<nowiki/>;x
23415 http://example.com<nowiki/>:x
23416 http://example.com<nowiki/>;x
23417 http://example.com<nowiki/>!x
23418 http://example.com<nowiki/>=x
23419 http://example.com<nowiki/>(x)
23420 http://example.com(x<nowiki/>)
23421 !! end
23422
23423 !! test
23424 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <p>x
23429 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23430 y
23431 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23432 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23433 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23434 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23435 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23436 </p>
23437 !! wikitext
23438 x
23439 http://example.com
23440 y
23441 "http://example.com"
23442 (http://example.com)
23443 (http://example.com) foo
23444 http://example.com,
23445 http://example.com, foo
23446 !! html/php
23447 <p>x
23448 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23449 y
23450 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23451 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23452 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23453 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23454 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23455 </p>
23456 !! end
23457
23458 !! test
23459 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23460 !! options
23461 parsoid=html2wt
23462 !! html/parsoid
23463 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23464 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23465 !! wikitext
23466 http://example.com.,;:!?\
23467 -http://example.com:
23468 !! html/php
23469 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23470 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23471 </p>
23472 !! end
23473
23474 !! test
23475 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23476 !! options
23477 parsoid=html2wt
23478 !! html/parsoid
23479 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23480 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23481 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23482 !! wikitext
23483 RFC 123<nowiki/>4
23484 RFC 123<nowiki/>y
23485 X<nowiki/>RFC 123<nowiki/>y
23486 !! end
23487
23488 !! test
23489 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23490 !! options
23491 parsoid=html2wt
23492 !! html/parsoid
23493 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23494 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23495 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23496 </p>
23497 !! wikitext
23498 RFC 123?foo
23499 RFC 123&foo
23500 -RFC 123-
23501 !! html/php
23502 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23503 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23504 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23505 </p>
23506 !! end
23507
23508 !! test
23509 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23510 !! options
23511 parsoid=html2wt
23512 !! html/parsoid
23513 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23514 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23515 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23516 !! wikitext
23517 PMID 123<nowiki/>4
23518 PMID 123<nowiki/>y
23519 X<nowiki/>PMID 123<nowiki/>y
23520 !! end
23521
23522 !! test
23523 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23524 !! options
23525 parsoid=html2wt
23526 !! html/parsoid
23527 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23528 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23529 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23530 </p>
23531 !! wikitext
23532 PMID 123?foo
23533 PMID 123&foo
23534 -PMID 123-
23535 !! html/php
23536 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23537 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23538 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23539 </p>
23540 !! end
23541
23542 !! test
23543 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23544 !! options
23545 parsoid=html2wt
23546 !! html/parsoid
23547 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23548 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23549 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23550 </p>
23551 !! wikitext
23552 ISBN 1234567890<nowiki/>1
23553 ISBN 1234567890<nowiki/>x
23554 a<nowiki/>ISBN 1234567890<nowiki/>b
23555 !! end
23556
23557 !! test
23558 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23559 !! options
23560 parsoid=html2wt
23561 !! html/parsoid
23562 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23563 !! wikitext
23564 -ISBN 1234567890's
23565 !! html/php
23566 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23567 </p>
23568 !! end
23569
23570 !! test
23571 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23572 !! options
23573 parsoid=html2wt
23574 !! html/*
23575 <p>this is not a link: http://example.com
23576 </p>
23577 !! wikitext
23578 this is not a link: <nowiki>http://example.com</nowiki>
23579 !! end
23580
23581 !! test
23582 Links 15. Link trails can't become link prefixes.
23583 !! options
23584 language=is
23585 parsoid=html2wt
23586 !! html/parsoid
23587 <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>
23588 !! wikitext
23589 [[Söfnuður]]-[[00]]
23590 !! html/php
23591 <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>
23592 </p>
23593 !! end
23594
23595 #### --------------- Quotes ---------------
23596 #### 1. Quotes inside <b> and <i>
23597 #### 2. Link fragments separated by <i> and <b> tags
23598 #### 3. Link fragments inside <i> and <b>
23599 #### 4. No escaping needed
23600 #### --------------------------------------
23601 !! test
23602 1a. Quotes inside <b> and <i>
23603 !! options
23604 parsoid=html2wt
23605 !! html/*
23606 <p><i>'foo'</i>
23607 <i>''foo''</i>
23608 <i>'''foo'''</i>
23609 <i>foo</i>'s
23610 <b>'foo'</b>
23611 <b>''foo''</b>
23612 <b>'''foo'''</b>
23613 <b>foo'<i>bar'</i>baz</b>
23614 <b>foo</b>'s
23615 '<i>foo</i>
23616 <i>foo</i>'
23617 <i>foo'</i>'
23618 '<i>foo</i>'
23619 '<b>foo</b>
23620 <b>foo</b>'
23621 '<b>foo</b>'
23622 <i>fools'<span> errand</span></i>
23623 <i><span>fool</span>'s errand</i>
23624 '<i>foo</i> bar '<i>baz</i>
23625 a|!*#-:;+-~[]{}b'<i>x</i>
23626 </p>
23627 !! wikitext
23628 ''<nowiki/>'foo'''
23629 ''<nowiki>''foo''</nowiki>''
23630 ''<nowiki>'''foo'''</nowiki>''
23631 ''foo''<nowiki/>'s
23632 '''<nowiki/>'foo''''
23633 '''<nowiki>''foo''</nowiki>'''
23634 '''<nowiki>'''foo'''</nowiki>'''
23635 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23636 '''foo'''<nowiki/>'s
23637 '''foo''
23638 ''foo''<nowiki/>'
23639 ''foo'''<nowiki/>'
23640 '''foo''<nowiki/>'
23641 ''''foo'''
23642 '''foo'''<nowiki/>'
23643 ''''foo'''<nowiki/>'
23644 ''fools'<span> errand</span>''
23645 ''<span>fool</span>'s errand''
23646 '<nowiki/>''foo'' bar '''baz''
23647 a|!*#-:;+-~[]{}b'''x''
23648 !! end
23649
23650 !! test
23651 1b. Quotes inside <b> and <i> with other tags on same line
23652 !! options
23653 parsoid=html2wt
23654 !! html/parsoid
23655 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23656 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23657 <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>
23658 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23659 '<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>
23660 '<i>foo</i> <div title="name">test</div>
23661 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23662 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23663 <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>
23664 </ol>
23665 !! wikitext
23666 '''a'' foo ''[[bar]]''
23667 ''a''' foo ''[[bar]]''
23668 ''a''' foo '''{{echo|[[bar]]}}'''
23669 [[foo]] x'''[[bar]]''
23670 '''foo'' <ref>test</ref>
23671 '''foo'' <div title="name">test</div>
23672 '''foo'' and <br> bar
23673 <references />
23674 !! end
23675
23676 !! test
23677 2. Link fragments separated by <i> and <b> tags
23678 !! options
23679 parsoid=html2wt
23680 !! html/parsoid
23681 <p>[[<i>foo</i>hello]]</p>
23682 <p>[[<b>foo</b>hello]]</p>
23683 !! wikitext
23684 [[''foo''<nowiki>hello]]</nowiki>
23685
23686 [['''foo'''<nowiki>hello]]</nowiki>
23687 !! end
23688
23689 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23690 # this is one of the shortcomings of this format
23691 !! test
23692 3. Link fragments inside <i> and <b>
23693 !! options
23694 parsoid=html2wt
23695 !! html/parsoid
23696 <p><i>[[foo</i>]]</p>
23697 <p><b>[[foo</b>]]</p>
23698 !! wikitext
23699 ''[[foo''<nowiki>]]</nowiki>
23700
23701 '''[[foo'''<nowiki>]]</nowiki>
23702 !! end
23703
23704 !! test
23705 4. No escaping needed
23706 !! options
23707 options=html2wt
23708 !! html/parsoid
23709 <p>'<span><i>bar</i></span>'
23710 '<span><b>bar</b></span>'
23711 'a:b'foo
23712 </p>
23713 !! wikitext
23714 '<span>''bar''</span>'
23715 '<span>'''bar'''</span>'
23716 'a:b'foo
23717 !! end
23718
23719 #### ----------- Paragraphs ---------------
23720 #### 1. No unnecessary escapes
23721 #### --------------------------------------
23722
23723 !! test
23724 1. No unnecessary escapes
23725 !! options
23726 parsoid=html2wt
23727 !! html/parsoid
23728 <p>bar <span>[[foo]]</span>
23729 </p><p>=bar <span>[[foo]]</span>
23730 </p><p>[[bar <span>[[foo]]</span>
23731 </p><p>]]bar <span>[[foo]]</span>
23732 </p><p>=bar <span>foo]]</span>=
23733 </p>
23734 !! wikitext
23735 bar <span><nowiki>[[foo]]</nowiki></span>
23736
23737 =bar <span><nowiki>[[foo]]</nowiki></span>
23738
23739 [[bar <span><nowiki>[[foo]]</nowiki></span>
23740
23741 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23742
23743 =bar <span>foo]]</span><nowiki>=</nowiki>
23744 !!end
23745
23746 #### ----------------------- PRE --------------------------
23747 #### 1. Leading whitespace in SOL context should be escaped
23748 #### ------------------------------------------------------
23749 !! test
23750 1. Leading whitespace in SOL context should be escaped
23751 !! options
23752 parsoid=html2wt
23753 !! html/parsoid
23754 <p> a</p>
23755
23756 <p> a</p>
23757
23758 <p> a(tab)</p>
23759
23760 <p> a
23761 <!--cmt-->
23762 a</p>
23763
23764 <p>a
23765 b</p>
23766
23767 <p>a
23768 b</p>
23769
23770 <p>a
23771 b</p>
23772 !! wikitext
23773 <nowiki> </nowiki>a
23774
23775 <nowiki> </nowiki> a
23776
23777 a(tab)
23778
23779 <nowiki> </nowiki> a
23780 <!--cmt-->
23781 <nowiki> </nowiki>a
23782
23783 a
23784 <nowiki> </nowiki>b
23785
23786 a
23787 b
23788
23789 a
23790 b
23791 !! html/php
23792 <p> a
23793 </p><p> a
23794 </p><p> a(tab)
23795 </p><p> a
23796 a
23797 </p><p>a
23798 b
23799 </p><p>a
23800 b
23801 </p><p>a
23802 b
23803 </p>
23804 !! end
23805
23806 !! test
23807 2. Leading whitespace in non-indent-pre contexts should not be escaped
23808 !! options
23809 parsoid=html2wt
23810 !! html/parsoid
23811 <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>
23812 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23813 <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>a</i>
23814 b</span></li>
23815 </ol>
23816 !! wikitext
23817 foo <ref>''a''
23818 b</ref>
23819 <references />
23820 !! end
23821
23822 !! test
23823 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23824 !! options
23825 parsoid=html2wt
23826 !! html/parsoid
23827 <blockquote>
23828 <p>
23829 a
23830 <span>b</span>
23831 c</p>
23832 </blockquote>
23833 !! wikitext
23834 <blockquote>
23835 a
23836 <span>b</span>
23837 c
23838 </blockquote>
23839 !! end
23840
23841 !! test
23842 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23843 !! options
23844 options=html2wt
23845 !! html/parsoid
23846 <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>
23847 !! wikitext
23848 [[File:Foobar.jpg|thumb|caption]]
23849 !! end
23850
23851 !! test
23852 5. Nowiki escaping should account for indent-pres
23853 !! options
23854 parsoid=html2wt
23855 !! html/parsoid
23856 <pre>==foo==</pre>
23857 !! wikitext
23858 ==foo==
23859 !! end
23860
23861 !!test
23862 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23863 !! options
23864 parsoid=html2wt
23865 !! html/parsoid
23866 <pre>
23867 * foo
23868 * bar
23869 </pre>
23870 !! wikitext
23871 * foo
23872 * bar
23873 !! end
23874
23875 #### --------------- Behavior Switches --------------------
23876
23877 !! test
23878 1. Valid behavior switches should be escaped
23879 !! options
23880 parsoid=html2wt
23881 !! html/parsoid
23882 __TOC__
23883 <i>__TOC__</i>
23884 !! wikitext
23885 <nowiki>__TOC__</nowiki>
23886 ''<nowiki>__TOC__</nowiki>''
23887 !! end
23888
23889 !! test
23890 2. Invalid behavior switches should not be escaped
23891 !! options
23892 parsoid=html2wt
23893 !! html/parsoid
23894 __TOO__
23895 __|__
23896 !! wikitext
23897 __TOO__
23898 __|__
23899 !! end
23900
23901 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23902 !! test
23903 Behavior switches should be SOL-transparent
23904 !! options
23905 parsoid=html2wt
23906 !! html/parsoid
23907 <meta property="mw:PageProp/toc" />
23908
23909 <!-- this one's bogus -->
23910 <pre>__TOO__</pre>
23911
23912 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23913
23914 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23915 !! wikitext
23916 __TOC__
23917
23918 <!-- this one's bogus -->
23919 __TOO__
23920
23921 __TOC__ foo
23922
23923 __TOC__
23924 bar
23925 !! end
23926
23927 #### --------------- HTML tags ---------------
23928 #### 1. a tags
23929 #### 2. other tags
23930 #### 3. multi-line html tag
23931 #### 4. extension tags
23932 #### -----------------------------------------
23933 !! test
23934 1. a tags
23935 !! options
23936 parsoid=html2wt
23937 !! html/parsoid
23938 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23939 !! wikitext
23940 <a href="http://google.com">google</a>
23941 !! end
23942
23943 !! test
23944 2. other tags
23945 !! options
23946 parsoid=html2wt
23947 !! html/parsoid
23948 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23949 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23950 <li> &lt;td&gt;</li></ul>
23951
23952 !! wikitext
23953 * <nowiki><div>foo</div></nowiki>
23954 * <nowiki><div style="color:red">foo</div></nowiki>
23955 * <nowiki><td></nowiki>
23956 !! end
23957
23958 !! test
23959 3. multi-line html tag
23960 !! options
23961 parsoid=html2wt
23962 !! html/parsoid
23963 <p>&lt;div
23964 &gt;foo&lt;/div
23965 &gt;
23966 </p>
23967 !! wikitext
23968 <nowiki><div
23969 >foo</div
23970 ></nowiki>
23971 !! end
23972
23973 !! test
23974 4. extension tags
23975 !! options
23976 parsoid=html2wt
23977 !! html/parsoid
23978 <p>&lt;ref&gt;foo&lt;/ref&gt;
23979 </p><p>&lt;ref&gt;bar
23980 </p><p>baz&lt;/ref&gt;
23981 </p>
23982 !! wikitext
23983 <nowiki><ref>foo</ref></nowiki>
23984
23985 <nowiki><ref>bar</nowiki>
23986
23987 baz<nowiki></ref></nowiki>
23988 !! end
23989
23990 #### --------------- Others ---------------
23991 !! test
23992 Escaping nowikis
23993 !! options
23994 parsoid=html2wt
23995 !! html/parsoid
23996 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23997 </p>
23998 !! wikitext
23999 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24000 !! end
24001
24002 ## The quote-char in the input is necessary for triggering the bug
24003 !! test
24004 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24005 !! options
24006 parsoid=html2wt
24007 !! html/parsoid
24008 <p>foo's bar :</p>
24009 !! wikitext
24010 foo's bar :
24011 !! end
24012
24013 #----------- End of wikitext escaping tests --------------
24014
24015 !! test
24016
24017 Tag-like HTML structures are passed through as text
24018 !! wikitext
24019 <x y>
24020
24021 <x.y>
24022
24023 <x-y>
24024
24025 1>2
24026
24027 x<y
24028
24029 a>b
24030
24031 1<d e>f
24032 !! html
24033 <p>&lt;x y&gt;
24034 </p><p>&lt;x.y&gt;
24035 </p><p>&lt;x-y&gt;
24036 </p><p>1&gt;2
24037 </p><p>x&lt;y
24038 </p><p>a&gt;b
24039 </p><p>1&lt;d e&gt;f
24040 </p>
24041 !! end
24042
24043 !! test
24044 HTML tag with necessary entities in attributes
24045 !! wikitext
24046 <span title="&amp;amp;">foo</span>
24047 !! html
24048 <p><span title="&amp;amp;">foo</span>
24049 </p>
24050 !! end
24051
24052 !! test
24053 HTML tag with 'unnecessary' entity encoding in attributes
24054 !! wikitext
24055 <span title="&amp;">foo</span>
24056 !! html
24057 <p><span title="&amp;">foo</span>
24058 </p>
24059 !! end
24060
24061 !! test
24062 HTML tag with broken attribute value quoting
24063 !! options
24064 parsoid=wt2html,html2html
24065 !! wikitext
24066 <span title="Hello world>Foo</span>
24067 !! html/php
24068 <p><span title="Hello world">Foo</span>
24069 </p>
24070 !! html/parsoid
24071 <p><span title="Hello world">Foo</span></p>
24072 !! end
24073
24074 !! test
24075 Self-closed tag with broken attribute value quoting
24076 !! options
24077 parsoid=wt2html,html2html
24078 !! wikitext
24079 <div title="Hello world />Foo
24080 !! html/php+tidy
24081 <div title="Hello world"></div>
24082 <p>Foo</p>
24083 !! html/parsoid
24084 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24085 !! end
24086
24087 !! test
24088 Table with broken attribute value quoting
24089 !! options
24090 parsoid=wt2html,html2html
24091 !! wikitext
24092 {|
24093 | title="Hello world|Foo
24094 |}
24095 !! html/php
24096 <table>
24097 <tr>
24098 <td title="Hello world">Foo
24099 </td></tr></table>
24100
24101 !! html/parsoid
24102 <table>
24103 <tr>
24104 <td title="Hello world">Foo
24105 </td></tr></table>
24106
24107 !! end
24108
24109 !! test
24110 Table with broken attribute value quoting on consecutive lines
24111 !! options
24112 parsoid=wt2html,html2html
24113 !! wikitext
24114 {|
24115 | title="Hello world|Foo
24116 | style="color:red|Bar
24117 |}
24118 !! html/php
24119 <table>
24120 <tr>
24121 <td title="Hello world">Foo
24122 </td>
24123 <td style="color:red">Bar
24124 </td></tr></table>
24125
24126 !! html/parsoid
24127 <table><tbody>
24128 <tr>
24129 <td title="Hello world">Foo
24130 </td><td style="color: red">Bar
24131 </td></tr></tbody></table>
24132
24133 !! end
24134
24135 !!test
24136 Accept empty td cell attribute
24137 !! wikitext
24138 {|
24139 | align="center" | foo || |
24140 |}
24141 !! html
24142 <table>
24143 <tr>
24144 <td align="center"> foo </td>
24145 <td>
24146 </td></tr></table>
24147
24148 !!end
24149
24150 !!test
24151 Non-empty attributes in th-cells
24152 !! wikitext
24153 {|
24154 ! Foo !! style="color: red" | Bar
24155 |}
24156 !! html
24157 <table>
24158 <tr>
24159 <th> Foo </th>
24160 <th style="color: red"> Bar
24161 </th></tr></table>
24162
24163 !!end
24164
24165 !!test
24166 Accept empty attributes in th-cells
24167 !! wikitext
24168 {|
24169 !| foo !!| bar
24170 |}
24171 !! html
24172 <table>
24173 <tr>
24174 <th> foo </th>
24175 <th> bar
24176 </th></tr></table>
24177
24178 !!end
24179
24180 !!test
24181 Empty table rows go away
24182 !! wikitext
24183 {|
24184 | Hello
24185 | there
24186 |- class="foo"
24187 |-
24188 |}
24189 !! html
24190 <table>
24191 <tr>
24192 <td> Hello
24193 </td>
24194 <td> there
24195 </td></tr>
24196
24197 </table>
24198
24199 !! end
24200
24201 ###
24202 ### Parsoid-centric tests for testing RTing of inter-element separators
24203 ### Edge cases not tested by existing parser tests and specific to
24204 ### Parsoid-specific serialization strategies.
24205 ###
24206
24207 !!test
24208 RT-ed inter-element separators should be valid separators
24209 !! wikitext
24210 {|
24211 |- [[foo]]
24212 |}
24213 !! html/php
24214 <table>
24215
24216 </table>
24217
24218 !! html/parsoid
24219 <table>
24220 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24221 </tbody></table>
24222 !!end
24223
24224 # Parsoid-only since PHP parser relies on Tidy for correct output
24225 !!test
24226 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24227 !!options
24228 parsoid
24229 !! wikitext
24230 {|
24231 |<small>foo
24232 bar
24233 |}
24234
24235 {|
24236 |<small>foo<small>
24237 |}
24238 !! html
24239 <table>
24240 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24241 <p>bar</p></small></td></tr>
24242 </tbody></table>
24243
24244 <table>
24245 <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>
24246 </tbody></table>
24247 !!end
24248
24249 # Note that the "style" attribute is really a template parameter here.
24250 # The = would have to be {{=}} if you wanted the literal.
24251 !!test
24252 Empty TD followed by TD with tpl-generated attribute
24253 !! wikitext
24254 {|
24255 |-
24256 |
24257 |{{echo|style='color:red'}}|foo
24258 |}
24259 !! html
24260 <table>
24261
24262 <tr>
24263 <td>
24264 </td>
24265 <td>foo
24266 </td></tr></table>
24267
24268 !!end
24269
24270 !!test
24271 Indented table with an empty td
24272 !! wikitext
24273 {|
24274 |-
24275 |
24276 |foo
24277 |}
24278 !! html
24279 <table>
24280
24281 <tr>
24282 <td>
24283 </td>
24284 <td>foo
24285 </td></tr></table>
24286
24287 !!end
24288
24289 ## We have some newline diffs RT-ing this edge case
24290 ## and it is not important enough -- we seem to be emitting
24291 ## at most 2 newlines after a </tr> and this is unrelated to
24292 ## the issue from T85627 that this is testing.
24293 !!test
24294 Indented table with blank lines in between (T85627)
24295 !! options
24296 parsoid=wt2html
24297 !! wikitext
24298 {|
24299 |foo
24300
24301
24302 |}
24303 !! html
24304 <table>
24305
24306 <tr>
24307 <td>foo
24308 </td></tr></table>
24309
24310 !!end
24311
24312 !!test
24313 Indented block & table
24314 !! wikitext
24315 <div>foo</div>
24316 {|
24317 |foo
24318 |}
24319 !! html/php
24320 <div>foo</div>
24321 <table>
24322 <tr>
24323 <td>foo
24324 </td></tr></table>
24325
24326 !! html/parsoid
24327 <div data-parsoid='{"stx":"html"}'>foo</div>
24328 <table><tbody>
24329 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24330 </tbody></table>
24331 !!end
24332
24333 !! test
24334 Indent and comment before table row
24335 !! wikitext
24336 {|
24337 <!--hi-->|-
24338 | there
24339 |}
24340 !! html/php
24341 <table>
24342
24343 <tr>
24344 <td> there
24345 </td></tr></table>
24346
24347 !! html/parsoid
24348 <table>
24349 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24350 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24351 </tbody></table>
24352 !! end
24353
24354 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24355 !!test
24356 Empty TR followed by a template-generated TR
24357 !!options
24358 parsoid
24359 !! wikitext
24360 {|
24361 |-
24362 {{echo|<tr><td>foo</td></tr>}}
24363 |}
24364 !! html
24365 <table>
24366 <tbody>
24367 <tr></tr>
24368 <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}}]}'>
24369 <td>foo</td></tr>
24370 </tbody></table>
24371 !!end
24372
24373 ## PHP and parsoid output differ for this, and since this is primarily
24374 ## for testing Parsoid's serializer, marking this Parsoid only
24375 !!test
24376 Empty TR followed by mixed-ws-comment line should RT correctly
24377 !!options
24378 parsoid
24379 !! wikitext
24380 {|
24381 |-
24382 <!--c-->
24383 |-
24384 <!--c--> <!--d-->
24385 |}
24386 !! html
24387 <table>
24388 <tbody>
24389 <tr></tr>
24390 <!--c-->
24391 <tr>
24392 <!--c--> </tr><!--d-->
24393 </tbody></table>
24394
24395 !!end
24396
24397 !!test
24398 Multi-line image caption generated by templates with/without trailing newlines
24399 !! wikitext
24400 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24401 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24402 !! html/parsoid
24403 <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>
24404 <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>
24405 !!end
24406
24407 !! test
24408 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24409 !! options
24410 parsoid=html2wt
24411 !! html/parsoid
24412 <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>
24413
24414 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24415 !! wikitext
24416 <includeonly>foo</includeonly>
24417 new para
24418
24419 [[Category:Foo]]
24420
24421 = new heading =
24422 !! end
24423
24424 ## PHP emits broken html for this, and since this is primarily
24425 ## a Parsoid serializer test, marking this Parsoid only
24426 !!test
24427 Improperly nested inline or quotes tags with whitespace in between
24428 !! wikitext
24429 <span> <s>x</span> </s>
24430 ''' ''x''' ''
24431 !! html/parsoid
24432 <p><span> <s>x</s></span><s> </s>
24433 <b> <i>x</i></b><i> </i>
24434 </p>
24435 !!end
24436
24437 !!test
24438 Encapsulate protected attributes from wt
24439 !! wikitext
24440 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24441 !! html/parsoid
24442 <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>
24443 </body>
24444 !!end
24445
24446 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24447 ## Having nested or stray pre tags results in the attempt to add duplicates,
24448 ## causing an assertion fail. This test tries to prevent that situation.
24449 !!test
24450 Ensure ParagraphWrapper can deal with stray closing pre tags
24451 !!options
24452 parsoid=wt2html
24453 !! wikitext
24454 plain text</pre>
24455 !! html/parsoid
24456 plain text
24457 !!end
24458
24459 !!test
24460 1. Ensure fostered text content is wrapped in element nodes
24461 !!options
24462 parsoid=wt2html
24463 !! wikitext
24464 <table>hi</table><table>ho</table>
24465 !! html/parsoid
24466 <p>hi</p>
24467 <table></table>
24468 <p>ho</p>
24469 <table></table>
24470 !!end
24471
24472 !!test
24473 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24474 !!options
24475 parsoid=wt2html,wt2wt
24476 !! wikitext
24477 <table>
24478 <tr> || ||
24479 <td> a
24480 </table>
24481 !! html/parsoid
24482 <p> || ||
24483 </p><table>
24484 <tbody><tr><td> a</td></tr>
24485 </tbody></table>
24486 !!end
24487
24488 !!test
24489 Encapsulation properly handles null DSR information from foster box
24490 !!options
24491 parsoid=wt2html,wt2wt
24492 !! wikitext
24493 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24494 !! html/parsoid
24495 <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>
24496 !!end
24497
24498 !!test
24499 1. Encapsulate foster-parented transclusion content
24500 !!options
24501 parsoid=wt2wt,wt2html
24502 !! wikitext
24503 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24504 !! html/parsoid
24505 <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>
24506 <tbody>
24507 <tr>
24508 <td>bar</td>
24509 </tr>
24510 </tbody>
24511 </table>
24512 !!end
24513
24514 !!test
24515 2. Encapsulate foster-parented transclusion content
24516 !!options
24517 parsoid=wt2wt,wt2html
24518 !! wikitext
24519 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24520 !! html/parsoid
24521 <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>
24522 <table>
24523 <tbody>
24524 <tr>
24525 <td>bar</td>
24526 </tr>
24527 </tbody>
24528 </table>
24529 !!end
24530
24531 !!test
24532 3. Encapsulate foster-parented transclusion content
24533 !!options
24534 parsoid=wt2wt,wt2html
24535 !! wikitext
24536 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24537 !! html/parsoid
24538 <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;]}">
24539 <p>foo</p>
24540 </div>
24541 <table>
24542 <tbody>
24543 <tr>
24544 <td>bar</td>
24545 </tr>
24546 </tbody>
24547 </table>
24548 !!end
24549
24550 !!test
24551 4. Encapsulate foster-parented transclusion content
24552 !!options
24553 parsoid=wt2wt,wt2html
24554 !! wikitext
24555 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24556 !! html/parsoid
24557 <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;]}">
24558 <p>foo</p>
24559 </div>
24560 <table>
24561 <tbody>
24562 <tr>
24563 <td>bar</td>
24564 </tr>
24565 </tbody>
24566 </table>
24567 !!end
24568
24569 !!test
24570 5. Encapsulate foster-parented transclusion content
24571 !!options
24572 parsoid=wt2wt,wt2html
24573 !! wikitext
24574 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24575 !! html/parsoid
24576 <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>
24577 <table>
24578 <tbody>
24579 <tr>
24580 <td>
24581 <div>
24582 <p>foo</p>
24583 </div>
24584 </td>
24585 </tr>
24586 </tbody>
24587 </table>
24588 !!end
24589
24590 !!test
24591 6. Encapsulate foster-parented transclusion content
24592 !!options
24593 parsoid=wt2wt,wt2html
24594 !! wikitext
24595 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24596 !! html/parsoid
24597 <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>
24598 <table>
24599 <tbody>
24600 <tr>
24601 <td>
24602 <div>
24603 <p>foo</p>
24604 </div>
24605 </td>
24606 </tr>
24607 </tbody>
24608 </table>
24609 <p>ok</p>
24610 !!end
24611
24612 !!test
24613 7. Encapsulate foster-parented transclusion content
24614 !!options
24615 parsoid=wt2wt,wt2html
24616 !! wikitext
24617 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24618 !! html/parsoid
24619 <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>
24620 <table>
24621 <tbody>
24622 <tr>
24623 <td>bar</td>
24624 </tr>
24625 </tbody>
24626 </table>
24627 !!end
24628
24629 # Note that the wt is broken on purpose: the = should be {{=}} if you
24630 # don't want it to be a template parameter key.
24631 !!test
24632 8. Encapsulate foster-parented transclusion content
24633 !!options
24634 parsoid=wt2wt,wt2html
24635 !! wikitext
24636 {{echo|a
24637 }}{|{{echo|style='color:red'}}
24638 |-
24639 |b
24640 |}
24641 !! html/parsoid
24642 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24643 <span> </span>
24644 <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>
24645 <table>
24646 <tbody>
24647 <tr>
24648 <td>b</td>
24649 </tr>
24650 </tbody>
24651 </table>
24652 !!end
24653
24654 !!test
24655 9. Encapsulate foster-parented transclusion content
24656 !!options
24657 parsoid=wt2wt,wt2html
24658 !! wikitext
24659 <table>{{echo|hi</table>hello}}
24660 !! html/parsoid
24661 <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"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
24662 !!end
24663
24664 !!test
24665 Table in fosterable position
24666 !!options
24667 parsoid=wt2html
24668 !! wikitext
24669 {{OpenTable}}
24670 <div>
24671 {|
24672 |}
24673 </div>
24674 |}
24675 !! html/parsoid
24676 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
24677 </span>
24678 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24679
24680 <table>
24681 </table>
24682 !!end
24683
24684 # Parsoid only for bug 64747
24685 !! test
24686 Properly encapsulate empty-content transclusions in fosterable positions
24687 !! wikitext
24688 <table>
24689 {{#if:|
24690 <td>foo</td>
24691 }}
24692 </table>
24693 !! html/parsoid
24694 <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"}]]}'>
24695
24696 </table>
24697 !! end
24698
24699 !! test
24700 Always encapsulate foster box when template range is expanded to table
24701 !! options
24702 parsoid=wt2wt
24703 !! wikitext
24704 {|
24705 hello
24706 {{OpenTable}}
24707 |}
24708 !! html/parsoid
24709
24710 !! end
24711
24712 !! test
24713 T115289: Unclosed table
24714 !! wikitext
24715 {{echo|<table>}}<!--c-->[[Category:Two]]
24716 !! html/parsoid
24717 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
24718 !! end
24719
24720 !! test
24721 T115289: Don't migrate newlines out of tables with fostered content
24722 !! wikitext
24723 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24724 !! html/parsoid
24725 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24726 !! end
24727
24728 !! test
24729 T73074: More fostering fun
24730 !! wikitext
24731 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24732 !! html/parsoid
24733 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
24734 !! end
24735
24736 !!test
24737 Support <object> element with .data attribute
24738 !!options
24739 parsoid=html2wt
24740 !! html/parsoid
24741 <object data="test.swf"></object>
24742 !! wikitext
24743 <object data="test.swf"></object>
24744 !!end
24745
24746 !! test
24747 Don't block XML namespace declaration
24748 !! wikitext
24749 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24750 !! html/php
24751 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24752 </p>
24753 !! html/parsoid
24754 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24755 !! end
24756
24757 # -----------------------------------------------------------------
24758 # The following section of tests are primarily to spec requirements
24759 # around serialization of new/edited content.
24760 #
24761 # All these tests are marked Parsoid html2wt and html2html only
24762 # ----------------------------------------------------------------
24763
24764 # 'mi' is a localinterwiki prefix as well as a language
24765 !! test
24766 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24767 !! options
24768 parsoid=html2wt
24769 !! html/parsoid
24770 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24771 !! wikitext
24772 [[Foo]]
24773 !! end
24774
24775 # See T93839
24776 !! test
24777 New wikilinks should be serialized properly
24778 !! options
24779 parsoid=html2wt
24780 !! html/parsoid
24781 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24782 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24783 !! wikitext
24784 [[Foo]]
24785 [[Foo]]
24786 !! end
24787
24788 !! test
24789 New wiki links (href variations)
24790 !! options
24791 parsoid=html2wt
24792 !! html/parsoid
24793 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24794 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24795 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24796 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24797 !! wikitext
24798 [[Foo_bar]]
24799 [[Foo_bar]]
24800 [[Foo_bar]]
24801 [[Toxine bactérienne]]
24802 !! end
24803
24804 !! test
24805 New wiki links (content string variations)
24806 !! options
24807 parsoid=html2wt
24808 !! html/parsoid
24809 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24810 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24811 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24812 !! wikitext
24813 [[Foo_bar]]
24814 [[Foo bar]]
24815 [[Foo_bar|./Foo_bar]]
24816 !! end
24817
24818 !! test
24819 New category links (href variations)
24820 !! options
24821 parsoid=html2wt
24822 !! html/parsoid
24823 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24824 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24825 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24826 !! wikitext
24827 [[Category:Toxine bactérienne]]
24828 [[Category:Toxine bactérienne]]
24829 [[Category:Toxine bactérienne]]
24830 !! end
24831
24832 !! test
24833 New sol transparent links don't need indent-pre nowiki protection
24834 !! options
24835 parsoid=html2wt
24836 language=de
24837 !! html/parsoid
24838 <link rel="mw:PageProp/redirect" href="./Main_Page">
24839 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24840 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24841 !! wikitext
24842 #WEITERLEITUNG [[Main Page]]
24843 <!-- this is good --> [[Category:Good]]
24844 <!-- this is great --> [[Kategorie:Great]]
24845 !! end
24846
24847 !! test
24848 New interlanguage links (href variations)
24849 !! options
24850 parsoid=html2wt
24851 !! html/parsoid
24852 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24853 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24854 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24855 !! wikitext
24856 [[es:Toxine bactérienne]]
24857 [[es:Toxine_bactérienne]]
24858 [[es:Toxine_bactérienne]]
24859 !! end
24860
24861 !! test
24862 Image: Modifying size of an image (1)
24863 !! options
24864 parsoid={
24865 "modes": ["wt2wt"],
24866 "changes": [
24867 ["img[height]", "attr", "height", "22"],
24868 ["img[width]", "attr", "width", "200"]
24869 ]
24870 }
24871 !! wikitext
24872 [[Image:Foobar.jpg|230x230px]]
24873 !! wikitext/edited
24874 [[Image:Foobar.jpg|200x200px]]
24875 !!end
24876
24877 !! test
24878 Image: Modifying size of an image (2)
24879 !! options
24880 parsoid={
24881 "modes": ["wt2wt"],
24882 "changes": [
24883 ["img[height]", "attr", "height", "100"],
24884 ["img[width]", "attr", "width", "500"]
24885 ]
24886 }
24887 !! wikitext
24888 [[Image:Foobar.jpg|230x230px]]
24889 !! wikitext/edited
24890 [[Image:Foobar.jpg|500x500px]]
24891 !!end
24892
24893 # Change in size is ignored so long as class='mw-default-size'
24894 !! test
24895 Image: Modifying size of an image (3)
24896 !! options
24897 parsoid={
24898 "modes": ["wt2wt"],
24899 "changes": [
24900 ["figure[class]", "removeClass", "mw-default-size"],
24901 ["figure img", "attr", "height", "19"],
24902 ["figure img", "attr", "width", "170"]
24903 ]
24904 }
24905 !! wikitext
24906 [[Image:Foobar.jpg|thumb]]
24907 !! wikitext/edited
24908 [[Image:Foobar.jpg|thumb|170x170px]]
24909 !!end
24910
24911 !! test
24912 Image: Modifying alignment of an image (bug 48665)
24913 !! options
24914 parsoid={
24915 "modes": ["wt2wt"],
24916 "changes": [
24917 ["figure[class]", "removeClass", "mw-halign-right"],
24918 ["figure[class]", "addClass", "mw-halign-left"]
24919 ]
24920 }
24921 !! wikitext
24922 [[Image:Foobar.jpg|thumb|caption|right]]
24923 !! wikitext/edited
24924 [[Image:Foobar.jpg|thumb|caption|left]]
24925 !! end
24926
24927 !! test
24928 Image: Modifying mw-default-size of an frameless image (bug 62805)
24929 !! options
24930 parsoid={
24931 "modes": ["wt2wt"],
24932 "changes": [
24933 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24934 ]
24935 }
24936 !! wikitext
24937 [[Image:Foobar.jpg|frameless|right]]
24938 !! wikitext/edited
24939 [[Image:Foobar.jpg|frameless|right|220x220px]]
24940 !! end
24941
24942 !! test
24943 Image: Modifying valign of an image (bug 49221)
24944 !! options
24945 parsoid={
24946 "modes": ["wt2wt"],
24947 "changes": [
24948 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24949 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24950 ]
24951 }
24952 !! wikitext
24953 [[File:Foobar.jpg|20px|middle]]
24954 !! wikitext/edited
24955 [[File:Foobar.jpg|20px|text-top]]
24956 !! end
24957
24958 !! test
24959 Image: Modifying alt attribute of an image (bug 56400)
24960 !! options
24961 parsoid={
24962 "modes": ["wt2wt"],
24963 "changes": [
24964 ["img[alt]", "attr", "alt", "some alternate edited text"]
24965 ]
24966 }
24967 !! wikitext
24968 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24969 !! wikitext/edited
24970 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24971 !!end
24972
24973 !! test
24974 Image: Modifying caption of an image
24975 !! options
24976 parsoid={
24977 "modes": ["wt2wt"],
24978 "changes": [
24979 ["figcaption", "text", "new caption"]
24980 ]
24981 }
24982 !! wikitext
24983 [[Image:Foobar.jpg|thumb|original caption]]
24984 !! wikitext/edited
24985 [[Image:Foobar.jpg|thumb|new caption]]
24986 !!end
24987
24988 !! test
24989 Image: empty alt attribute (bug 48924)
24990 !! options
24991 parsoid
24992 !! wikitext
24993 [[File:Foobar.jpg|thumb|alt=|bar]]
24994 !! html
24995 <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>
24996 !! end
24997
24998 !! test
24999 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25000 !! options
25001 parsoid=html2wt
25002 language=ar
25003 disabled
25004 !! html/parsoid
25005 <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>
25006 !! wikitext
25007 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25008 !! end
25009
25010 !! test
25011 Image: Block level image should have \n before and after
25012 !! wikitext
25013 123
25014 [[File:Foobar.jpg|right|thumb|150x150px]]
25015 456
25016 !! html/parsoid
25017 <p>123</p>
25018 <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>
25019 <p>456</p>
25020 !!end
25021
25022 !! test
25023 Image: New block level image should have \n before and after (existing content)
25024 !! wikitext
25025 123
25026 [[File:Foobar.jpg|right|thumb|150x150px]]
25027 456
25028 !! html/parsoid
25029 <p>123</p>
25030 <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>
25031 <p>456</p>
25032 !!end
25033
25034 !! test
25035 Image: upright option (parsoid)
25036 !! wikitext
25037 [[File:Foobar.jpg|thumb|upright|caption]]
25038 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25039 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25040 !! html/parsoid
25041 <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>
25042 <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>
25043 <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>
25044 !!end
25045
25046 !! test
25047 Image: upright option is ignored on inline and frame images (parsoid)
25048 !! wikitext
25049 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25050 !! html/parsoid
25051 <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>
25052 !!end
25053
25054 !! test
25055 Image: from basic HTML (1)
25056 !! options
25057 parsoid=html2wt
25058 !! html/parsoid
25059 <span typeof="mw:Image">
25060 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25061 </span>
25062 !! wikitext
25063 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25064 !! end
25065
25066 !! test
25067 Image: from basic HTML (2)
25068 !! options
25069 parsoid=html2wt
25070 !! html/parsoid
25071 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25072 !! wikitext
25073 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25074 !! end
25075
25076 !! test
25077 Image: from basic HTML (3)
25078 !! options
25079 parsoid=html2wt
25080 !! html/parsoid
25081 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25082 !! wikitext
25083 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25084 !! end
25085
25086 !! test
25087 Image: from basic HTML (4)
25088 !! options
25089 parsoid=html2wt
25090 !! html/parsoid
25091 <img src="./File:Foobar.jpg">
25092 !! wikitext
25093 [[File:Foobar.jpg|link=]]
25094 !! end
25095
25096 !! test
25097 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25098 !! options
25099 parsoid=html2wt
25100 !! html/parsoid
25101 <ul>
25102 <li><p>foo</p></li>
25103 </ul>
25104 !! wikitext
25105 * foo
25106 !! end
25107
25108 !! test
25109 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25110 !! options
25111 parsoid=html2wt
25112 !! html/parsoid
25113 <ul> <li>foo</li></ul>
25114 !! wikitext
25115 * foo
25116 !! end
25117
25118 !! test
25119 Don't strip leading whitespace when handling indent-pre suppressing tags
25120 !! options
25121 parsoid=html2wt
25122 !! html/parsoid
25123 <table>
25124 <tr><td> indented row</td></tr>
25125 </table>
25126 <blockquote><p>
25127 <b>This is very bold of you!</b>
25128 </p>
25129 <table><tr><td>
25130 indented cell (no pre-wrapping!)
25131 </td></tr></table>
25132 </blockquote>
25133 <p>foo</p>
25134 <div>bar</div>
25135 !! wikitext
25136 {|
25137 | indented row
25138 |}
25139 <blockquote>
25140 '''This is very bold of you!'''
25141
25142 {|
25143 |
25144 indented cell (no pre-wrapping!)
25145 |}
25146 </blockquote>
25147 foo
25148 <div>bar</div>
25149 !! end
25150
25151 !! test
25152 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25153 !! options
25154 parsoid=html2wt
25155 !! html/parsoid
25156 <p>foo</p>
25157 <span>bar</span>
25158
25159 <span>foo2
25160 </span>bar2
25161
25162 <div>foo</div>
25163 <span>bar</span>
25164
25165 <div>
25166 <span>foo</span>
25167 </div>
25168 !! wikitext
25169 foo
25170
25171 <span>bar</span>
25172
25173 <span>foo2
25174 <nowiki> </nowiki></span>bar2
25175
25176 <div>foo</div>
25177 <nowiki> </nowiki><span>bar</span>
25178
25179 <div>
25180 <nowiki> </nowiki><span>foo</span>
25181 </div>
25182 !! end
25183
25184 !! test
25185 Lists: Dont insert newlines in a serialized list item.
25186 !! options
25187 parsoid=html2wt
25188 !! html/parsoid
25189 <ul><li>a<br>b</li><li>c</li></ul>
25190 !! wikitext
25191 * a<br>b
25192 * c
25193 !! end
25194
25195 !! test
25196 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25197 !! options
25198 parsoid={
25199 "modes": ["html2wt"],
25200 "scrubWikitext": false
25201 }
25202 !! html/parsoid
25203 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25204 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25205
25206 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25207 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25208
25209 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25210
25211 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25212 !! wikitext
25213 == hello there [[Category:A1]] ==
25214
25215 == [[Category:A2]] hi pal ==
25216
25217 == <!--foo--> [[Category:A3]] how goes it ==
25218
25219 == it goes well [[Category:A4]] <!--bar--> ==
25220
25221 ==howdy [[Category:A5]]==
25222
25223 == __TOC__ ok ==
25224 !! end
25225
25226 !! test
25227 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25228 !! options
25229 parsoid={
25230 "modes": ["html2wt"],
25231 "scrubWikitext": true
25232 }
25233 !! html/parsoid
25234 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25235 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25236
25237 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25238 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25239
25240 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25241 !! wikitext
25242 == hello there ==
25243 [[Category:A1]]
25244 [[Category:A2]]
25245
25246 == hi pal ==
25247
25248 <!--foo--> [[Category:A3]]
25249
25250 == how goes it ==
25251
25252 == it goes well ==
25253 [[Category:A4]] <!--bar-->
25254
25255 __TOC__
25256
25257 == ok ==
25258 !! end
25259
25260 !! test
25261 Headings: Don't hoist metas that come from templates
25262 !! options
25263 parsoid={
25264 "modes": ["html2wt"],
25265 "scrubWikitext": true
25266 }
25267 !! html/parsoid
25268 <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>
25269 !! wikitext
25270 == {{echo|foo [[Category:Foo]]}} ==
25271 !! end
25272
25273 !! test
25274 Headings: Category in ref isn't hoisted
25275 !! options
25276 parsoid={
25277 "modes": ["html2wt"],
25278 "scrubWikitext": true
25279 }
25280 !! html/parsoid
25281 <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>
25282
25283 <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>
25284 !! wikitext
25285 == foo <ref>bar
25286 [[Category:Baz]] </ref> ==
25287
25288 <references />
25289 !! end
25290
25291 !! test
25292 Parsoid: Serialize positional parameters with = in them as named parameter
25293 !! options
25294 parsoid=html2wt
25295 !! html/parsoid
25296 <p about="#mwt1" typeof="mw:Transclusion"
25297 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25298
25299 <p about="#mwt1" typeof="mw:Transclusion"
25300 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25301
25302 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25303 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25304 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' 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>
25305 !! wikitext
25306 {{echo|1=f=oo}}
25307
25308 {{echo|1=f=oo|2=bar}}
25309
25310 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25311 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25312 {{echo|<nowiki>f=oo</nowiki>|bar}}
25313 !! end
25314
25315 !! test
25316 Parsoid: Serialize positional parameters with = in extlink as named parameter
25317 !! options
25318 parsoid=html2wt
25319 !! html/parsoid
25320 <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>
25321 !! wikitext
25322 {{echo|1=http://stuff?is=ok}}
25323 !! end
25324
25325 !! test
25326 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25327 !! options
25328 parsoid=html2wt
25329 !! html/parsoid
25330 <div>a<p>b</p></div>
25331 <div>a
25332 <p>b</p></div>
25333 <div>
25334 a
25335 <p>b</p></div>
25336 !! wikitext
25337 <div>a
25338 b
25339 </div>
25340 <div>a
25341 b
25342 </div>
25343 <div>
25344 a
25345
25346 b
25347 </div>
25348 !! end
25349
25350 !! test
25351 Substrings resembling wikitext in hrefs should not get nowiki escapes
25352 !! options
25353 parsoid=html2wt
25354 !! html/parsoid
25355 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25356 !! wikitext
25357 [[Foo''bar''baz]]
25358 !! end
25359
25360 !! test
25361 Enforce single-line context in the serializer
25362 !! options
25363 parsoid=html2wt
25364 !! html/parsoid
25365 <h2>testing
25366 123</h2>
25367
25368 <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">
25369 </span><span about="#mwt1">you</span> </h2>
25370
25371 <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>
25372
25373 <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
25374 there</span></li></ol>
25375
25376 <ul><li>asd
25377 sdf</li></ul>
25378
25379 <ul><li>foo
25380 bar
25381 baz</li>
25382 <li>foo <b>bar</b>
25383 baz</li></ul>
25384
25385 <dl><dt>hi
25386 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25387 ho</dd></dl>
25388
25389 <dl><dd> <table>
25390 <tbody><tr><td> ha
25391 ha
25392 ha</td></tr>
25393 </tbody></table></dd></dl>
25394 !! wikitext
25395 == testing 123 ==
25396
25397 == hi {{bogus|there
25398 you}} ==
25399
25400 == foo <ref>hello
25401 there</ref> ==
25402
25403 <references />
25404
25405 * asd sdf
25406
25407 * foo bar baz
25408 * foo '''bar''' baz
25409
25410 ; hi ho : hi ho
25411
25412 : {|
25413 | ha
25414 ha
25415 ha
25416 |}
25417 !! end
25418
25419 !! test
25420 Serialize new placeholder space without spans
25421 !! options
25422 parsoid=html2wt
25423 !! html/parsoid
25424 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25425
25426 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25427
25428 <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>
25429 !! wikitext
25430 foo : bar
25431
25432 foo : bar
25433
25434 <ref>foo : bar</ref>ok
25435 !! end
25436
25437
25438 #-----------------------
25439 # Tag minimization tests
25440 #-----------------------
25441
25442 !! test
25443 1. I/B quote minimization: wikitext-only tags should be combined
25444 !! options
25445 parsoid=html2wt
25446 !! html/parsoid
25447 <p><i>A</i><i>B</i></p>
25448 <p><b>A</b><b>B</b></p>
25449 <p><i>A</i><b><i>B</i></b></p>
25450 <p><b>A</b><i><b>B</b></i></p>
25451 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25452 <p><i><b>A</b></i><i><b>B</b></i></p>
25453 <p><i><b>A</b></i><b><i>B</i></b></p>
25454 <p><b><i>A</i></b><i><b>B</b></i></p>
25455 !! wikitext
25456 ''AB''
25457
25458 '''AB'''
25459
25460 ''A'''B'''''
25461
25462 '''A''B'''''
25463
25464 '''A''BC''D'''
25465
25466 '''''AB'''''
25467
25468 '''''AB'''''
25469
25470 '''''AB'''''
25471 !! end
25472
25473 !! test
25474 2. I/B quote minimization: wikitext and html tags should not be combined
25475 !! options
25476 parsoid=html2wt
25477 !! html/parsoid
25478 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25479 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25480 !! wikitext
25481 ''A''<i>B</i>
25482
25483 ''A''<nowiki/>'''<i>B</i>'''
25484 !! end
25485
25486 !! test
25487 3. I/B quote minimization: templated content stops minimization
25488 !! options
25489 parsoid=html2wt
25490 !! html/parsoid
25491 <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>
25492 <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>
25493 !! wikitext
25494 ''A''{{echo|''B''}}
25495
25496 ''A''{{echo|'''''B'''''}}
25497 !! end
25498
25499 !! test
25500 4. I/B quote minimization: new content should be mimimized with adjacent old content
25501 !! options
25502 parsoid=html2wt
25503 !! html/parsoid
25504 <p><i>A</i><i>B</i></p>
25505 <p><b>A</b><b>B</b></p>
25506 <p><i>A</i><b><i>B</i></b></p>
25507 !! wikitext
25508 ''AB''
25509
25510 '''AB'''
25511
25512 ''A'''B'''''
25513 !! end
25514
25515 !! test
25516 5a. Merge adjacent quote nodes if they've been edited
25517 !! options
25518 parsoid={
25519 "modes": ["wt2wt", "selser"],
25520 "changes": [
25521 ["p", "contents", "remove", ":contains('b')"]
25522 ]
25523 }
25524 !! wikitext
25525 ''a''b''c''
25526 !! wikitext/edited
25527 ''ac''
25528 !! end
25529
25530 !! test
25531 5b. Merge adjacent quote nodes if they've been edited
25532 !! options
25533 parsoid={
25534 "modes": ["wt2wt", "selser"],
25535 "changes": [
25536 ["#x", "remove"]
25537 ]
25538 }
25539 !! wikitext
25540 ''a''<span id="x">b</span>''c''
25541 !! wikitext/edited
25542 ''ac''
25543 !! end
25544
25545 !! test
25546 1. Merge adjacent link nodes as long as at least one element is new
25547 !! options
25548 parsoid={
25549 "modes": ["html2wt"],
25550 "scrubWikitext": true
25551 }
25552 !! html/parsoid
25553 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25554 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25555 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25556 !! wikitext
25557 [[Football]]
25558 [[Football]]
25559 [[Football|Foot]][[Football|ball]]
25560 !! end
25561
25562 !! test
25563 2. Merge adjacent link nodes and enable additional normalizations
25564 !! options
25565 parsoid={
25566 "modes": ["html2wt"],
25567 "scrubWikitext": true
25568 }
25569 !! html/parsoid
25570 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25571 !! wikitext
25572 [[Football|''Football'']]
25573 !! end
25574
25575 !! test
25576 3. Don't merge adjacent link nodes if scrubWikitext is false
25577 !! options
25578 parsoid={
25579 "modes": ["html2wt"],
25580 "scrubWikitext": false
25581 }
25582 !! html/parsoid
25583 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25584 !! wikitext
25585 [[Football|Foot]][[Football|ball]]
25586 !! end
25587
25588 #------------------------------
25589 # End of tag minimization tests
25590 #------------------------------
25591
25592 !!test
25593 Bug 54262: New entities
25594 !! options
25595 parsoid=html2wt
25596 !! html/parsoid
25597 <span typeof="mw:Entity">&nbsp;</span>
25598 !! wikitext
25599 &nbsp;
25600 !! end
25601
25602 ## Note that there is no wikitext output for 'unknownproperty' ##
25603 ## Unknown magic words are silently dropped ##
25604
25605 !! test
25606 Magic words
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <meta property='mw:PageProp/toc' />
25611 <meta property='mw:PageProp/notoc' />
25612 <meta property='mw:PageProp/forcetoc' />
25613 <meta property='mw:PageProp/index' />
25614 <meta property='mw:PageProp/noindex' />
25615 <meta property='mw:PageProp/nogallery' />
25616 <meta property='mw:PageProp/noeditsection' />
25617 <meta property='mw:PageProp/notitleconvert' />
25618 <meta property='mw:PageProp/nocontentconvert' />
25619 <meta property='mw:PageProp/unknownproperty' />
25620 !! wikitext
25621 __TOC__
25622 __NOTOC__
25623 __FORCETOC__
25624 __INDEX__
25625 __NOINDEX__
25626 __NOGALLERY__
25627 __NOEDITSECTION__
25628 __NOTITLECONVERT__
25629 __NOCONTENTCONVERT__
25630 !! end
25631
25632 !! test
25633 Consecutive <pre>s should not get merged
25634 !! options
25635 parsoid=html2wt,html2html
25636 !! html/parsoid
25637 <pre>a</pre><pre>b</pre>
25638
25639 <pre>c
25640 </pre><pre>
25641 d</pre>
25642
25643 <pre>e
25644
25645 </pre><pre>
25646
25647 f</pre>
25648 !! wikitext
25649 a
25650
25651 b
25652
25653 c
25654
25655 d
25656
25657 e
25658
25659
25660
25661 f
25662 !! end
25663
25664 !! test
25665 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25666 !! options
25667 parsoid=html2wt
25668 !! html/parsoid
25669 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25670 !! wikitext
25671 [[Special:BookSources/1234567890|ISBN 1234567895]]
25672 !! end
25673
25674 !! test
25675 Edited RFC links not serializable as RFC links should serialize as extlinks
25676 !! options
25677 parsoid=html2wt
25678 !! html/parsoid
25679 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25680 !! wikitext
25681 [//tools.ietf.org/html/rfc123 New RFC]
25682 !! end
25683
25684 !! test
25685 Edited PMID links not serializable as PMID links should serialize as extlinks
25686 !! options
25687 parsoid=html2wt
25688 !! html/parsoid
25689 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25690 !! wikitext
25691 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25692 !! end
25693
25694 !! test
25695 WTS of autolinks with trailing/surrounding context
25696 !! options
25697 parsoid=html2wt
25698 !! html/parsoid
25699 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25700 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25701 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25702 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25703 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25704 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25705 !! wikitext
25706 http://cscott.net'''foo'''
25707
25708 http://cscott.net<b>foo</b>
25709
25710 '''http://cscott.net'''
25711
25712 '''http://cscott.net '''
25713
25714 '''http://cscott.net<nowiki/>x'''
25715
25716 http://cscott.net<nowiki/>x
25717 !! end
25718
25719 !! test
25720 WTS of autolinks with nowikis (round-trip)
25721 !! wikitext
25722 x<nowiki/>http://cscott.net<nowiki/>x
25723 !! html/parsoid
25724 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25725 !! end
25726
25727 # this is the "easy" test because it leaves in place all the
25728 # data-parsoid information indicating this is an autolink
25729 !! test
25730 WTS of autolinks with escapes (editing)
25731 !! options
25732 parsoid={
25733 "modes": ["wt2wt"],
25734 "changes": [
25735 [ "meta", "remove" ]
25736 ]
25737 }
25738 !! wikitext
25739 x<nowiki/>http://cscott.net<nowiki/>x
25740 !! wikitext/edited
25741 x<nowiki/>http://cscott.net<nowiki/>x
25742 !! end
25743
25744 !! test
25745 WTS of edited autolink-like text (T103364)
25746 !! options
25747 parsoid={
25748 "modes": ["wt2wt"],
25749 "changes": [
25750 [ "span[typeof]", "removeAttr", "typeof" ]
25751 ]
25752 }
25753 !! wikitext
25754 Not a link: <nowiki>http://example.com</nowiki>.
25755 !! wikitext/edited
25756 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25757 !! end
25758
25759 !! test
25760 WTS of newly-authored autolink-like text (T103364)
25761 !! options
25762 parsoid=html2wt
25763 !! html/parsoid
25764 <p>http://example.com is not a link.</p>
25765 !! wikitext
25766 <nowiki>http://example.com</nowiki> is not a link.
25767 !! end
25768
25769 !! test
25770 WTS of autolink-like text after an autolink (T108563)
25771 !! options
25772 parsoid=html2wt
25773 !! html/parsoid
25774 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25775 !! wikitext
25776 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25777 !! end
25778
25779 !! test
25780 Magic links inside links (not autolinked)
25781 !! wikitext
25782 [[Foo|http://example.com]]
25783 [[Foo|RFC 1234]]
25784 [[Foo|PMID 1234]]
25785 [[Foo|ISBN 123456789x]]
25786
25787 [http://foo.com http://example.com]
25788 [http://foo.com RFC 1234]
25789 [http://foo.com PMID 1234]
25790 [http://foo.com ISBN 123456789x]
25791 !! html+tidy
25792 <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>
25793 <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>
25794 !! html/parsoid
25795 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25796 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25797 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25798 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25799
25800 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25801 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25802 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25803 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25804 !! end
25805
25806 !! test
25807 Magic links inside image captions (autolinked)
25808 !! wikitext
25809 [[File:Foobar.jpg|thumb|http://example.com]]
25810 [[File:Foobar.jpg|thumb|RFC 1234]]
25811 [[File:Foobar.jpg|thumb|PMID 1234]]
25812 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25813 !! html+tidy
25814 <div class="thumb tright">
25815 <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>
25816 <div class="thumbcaption">
25817 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25818 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25819 </div>
25820 </div>
25821 <div class="thumb tright">
25822 <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>
25823 <div class="thumbcaption">
25824 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25825 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25826 </div>
25827 </div>
25828 <div class="thumb tright">
25829 <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>
25830 <div class="thumbcaption">
25831 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25832 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25833 </div>
25834 </div>
25835 <div class="thumb tright">
25836 <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>
25837 <div class="thumbcaption">
25838 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25839 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25840 </div>
25841 </div>
25842 !! html/parsoid
25843 <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>
25844 <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>
25845 <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>
25846 <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>
25847 !! end
25848
25849 !! test
25850 WTS of magic word text (T109371)
25851 !! options
25852 parsoid=html2wt
25853 !! html/parsoid
25854 <p>RFC 1234</p>
25855 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25856 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25857 !! wikitext
25858 <nowiki>RFC 1234</nowiki>
25859
25860 [http://foo.com RFC 1234]
25861
25862 [[Foo|RFC 1234]]
25863 !! end
25864
25865 !! test
25866 Edited Redirect link should emit a non-piped wikitext link
25867 !! options
25868 parsoid=html2wt
25869 !! html/parsoid
25870 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25871 !! wikitext
25872 #REDIRECT [[Bar]]
25873 !! end
25874
25875 !! test
25876 T75121: Infer extension name from typeOf if data-mw is not present
25877 !! options
25878 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25879 !! html/parsoid
25880 <div typeOf="mw:Extension/foo"></div>
25881 !! wikitext
25882 <foo />
25883 !! end
25884
25885 # Note that the <p> wrapping isn't present in PHP parser output
25886 # The important thing for this test is that P-wrapping doesn't
25887 # interfere with the <nowiki> protection for leading - in <td>
25888 # (which isn't necessary for <th>).
25889 !! test
25890 T88318: p-wrapped dash in table.
25891 !! options
25892 parsoid=html2wt,wt2wt
25893 !! html/parsoid
25894 <table><tbody>
25895 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25896 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25897 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25898 </tbody></table>
25899 !! wikitext
25900 {|
25901 !-
25902 !-
25903 |-
25904 |<nowiki>-</nowiki>
25905 |<nowiki>- </nowiki>
25906 |-
25907 |<small>-</small>
25908 |<br>
25909 -
25910 |<br>
25911 -
25912 |}
25913 !! html/php+tidy
25914 <table>
25915 <tr>
25916 <th>-</th>
25917 <th>-</th>
25918 </tr>
25919 <tr>
25920 <td>-</td>
25921 <td>-</td>
25922 </tr>
25923 <tr>
25924 <td><small>-</small></td>
25925 <td><br />
25926 <p>-</p>
25927 </td>
25928 <td><br />
25929 <p>-</p>
25930 </td>
25931 </tr>
25932 </table>
25933 !! end
25934
25935 !! test
25936 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25937 !! options
25938 parsoid=html2wt
25939 !! html/parsoid
25940 <table id='mwAb'>
25941 <td id='mwAc'>foo</td>
25942 <td id='serialize-this'>bar</td>
25943 </table>
25944 !! wikitext
25945 {|
25946 |foo
25947 | id="serialize-this" |bar
25948 |}
25949 !! end
25950
25951 !! test
25952 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25953 !! options
25954 parsoid=html2wt
25955 !! html/parsoid
25956 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25957 !! wikitext
25958 <div id="hello">ok</div>
25959 !! end
25960
25961 !! test
25962 WTS change modes
25963 !! options
25964 parsoid={
25965 "modes": ["wt2wt"],
25966 "changes": [
25967 [ "#xyz", "before", "<b>before</b> stuff " ],
25968 [ "#xyz", "after", " stuff <i>after</i>" ],
25969 [ "#xyz", "html", "x <b>y</b> z" ]
25970 ]
25971 }
25972 !! wikitext
25973 <span id="xyz">hello</span>
25974 !! wikitext/edited
25975 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25976 !! end
25977
25978 !! test
25979 Never serialize a-tag as html, regardless of what data-parsoid has to say
25980 !! options
25981 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25982 !! html/parsoid
25983 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25984 !! wikitext
25985 [[Foo]]
25986 !! end
25987
25988 ## SSS FIXME: This is broken output nevertheless.
25989 ## What might be a reasonable non-broken output for this?
25990 ## This is an edge case unlikely to be seen in production
25991 ## that I am not wasting more time on this right now.
25992 !! test
25993 Never serialize a-tag as html, no matter what attributes it has
25994 !! options
25995 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25996 !! html/parsoid
25997 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25998 !! wikitext
25999 [http://boo.org http://boohoo.org]
26000 !! end
26001
26002 # Misnested is an indication that selser can reuse the source but these have
26003 # shown to sneak through on occasion. See T101768.
26004 # The original wikitext here is: [http://test.com [[one]] two three]
26005 !! test
26006 Strip span tags added to mark misnested links
26007 !! options
26008 parsoid=html2wt
26009 !! html/parsoid
26010 <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>
26011 !! wikitext
26012 [http://test.com][[one]] two three
26013 !! end
26014
26015 !! test
26016 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
26021 <tbody><tr><td>d
26022 </td></tr>
26023 </tbody></table>
26024 !! wikitext
26025 {{echo|a}}
26026 {|{{echo|c
26027 {{!}}d
26028 }}
26029 |}
26030 !! end
26031
26032 ## This test verifies the presence and computation of this attribute indirectly
26033 ## by making an edit and ensuring that the serialization is correct (which it would be
26034 ## only if firstWikitextNode is properly set).
26035 !! test
26036 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26037 !! options
26038 parsoid= {
26039 "modes": ["wt2wt"],
26040 "changes": [
26041 [ "div#x", "remove" ],
26042 [ "div", "before", "<div>new</div>" ]
26043 ]
26044 }
26045 !! wikitext
26046 <div id="x">foo</div>
26047 {|
26048 {{echo|<div>boo</div>
26049 {{!}}b}}
26050 |c
26051 |}
26052 !! wikitext/edited
26053
26054 <div>new</div>
26055 {|
26056 {{echo|<div>boo</div>
26057 {{!}}b}}
26058 |c
26059 |}
26060 !! end
26061
26062 # --------------------------------------------
26063 # Tests spec'ing wikitext serialization norms |
26064 # --------------------------------------------
26065
26066 !! test
26067 1. Categories should always be serialized on their own line
26068 !! options
26069 parsoid=html2wt
26070 !! html/parsoid
26071 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26072 !! wikitext
26073 foo
26074 [[Category:Foo]]
26075 bar
26076 !! end
26077
26078 !! test
26079 2. Categories that are part of templates should not introduce a line break
26080 !! wikitext
26081 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26082 !! html/parsoid
26083 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
26084 !! end
26085
26086 # Careful while editing these next 2 tests. There are \u200f characters
26087 # before and after the <link> tags in the HTML and following some
26088 # of the categories in wikitext
26089 # Do not remove these characters in edits.
26090 #
26091 # As part of the serialization, these bidi characters will get stripped.
26092 !! test
26093 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26094 !! options
26095 parsoid={
26096 "modes": ["html2wt"],
26097 "scrubWikitext": true
26098 }
26099 !! html/parsoid
26100 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26101 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26102 !! wikitext
26103 [[קטגוריה:טקסים]]
26104 [[קטגוריה: שיטות משפט]]
26105 !! end
26106
26107 !! test
26108 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26109 !! options
26110 parsoid={
26111 "modes": ["html2wt"],
26112 "scrubWikitext": true
26113 }
26114 !! html/parsoid
26115 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26116 !! wikitext
26117 [[קטגוריה:טקסים]]
26118 ‏y
26119 !! end
26120
26121 !! test
26122 Lists: Add space after bullets
26123 !! options
26124 parsoid=html2wt
26125 !! html/parsoid
26126 <ul>
26127 <li>foo</li>
26128 <li> bar</li>
26129 <li><span> baz</span></li>
26130 </ul>
26131 !! wikitext
26132 * foo
26133 * bar
26134 * <span> baz</span>
26135 !! end
26136
26137 !! test
26138 1. Headings: Add space before/after == (T53744)
26139 !! options
26140 parsoid=html2wt
26141 !! html/parsoid
26142 <h2>foo</h2>
26143 <h2> bar</h2>
26144 <h2>baz </h2>
26145 <h2><span> baz</span></h2>
26146 !! wikitext
26147 == foo ==
26148
26149 == bar ==
26150
26151 == baz ==
26152
26153 == <span> baz</span> ==
26154 !! end
26155
26156 !! test
26157 2. Headings: Add space before/after == even after hoisted content
26158 !! options
26159 parsoid={
26160 "modes": ["html2wt"],
26161 "scrubWikitext": true
26162 }
26163 !! html/parsoid
26164 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26165 !! wikitext
26166 [[Category:A2]]
26167
26168 == ok ==
26169 !! end
26170
26171 !! test
26172 1. Headings: suppress newly created empty headings
26173 !! options
26174 parsoid={
26175 "modes": ["html2wt"],
26176 "scrubWikitext": true
26177 }
26178 !! html/parsoid
26179 <h2></h2>
26180 !! wikitext
26181 !! end
26182
26183 !! test
26184 2. Headings: don't suppress empty headings if scrubWikitext is false
26185 !! options
26186 parsoid=html2wt
26187 !! html/parsoid
26188 <h2></h2>
26189 !! wikitext
26190 ==<nowiki/>==
26191 !! end
26192
26193 !! test
26194 3. Headings: suppress empty headings on edits
26195 !! options
26196 parsoid={
26197 "modes": ["selser"],
26198 "scrubWikitext": true,
26199 "changes": [
26200 [ "#x", "remove"]
26201 ]
26202 }
26203 !! wikitext
26204 ==<span id="x">foo</span>==
26205 !! wikitext/edited
26206 !! end
26207
26208 !! test
26209 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26210 !! options
26211 parsoid={
26212 "modes": ["html2wt"],
26213 "scrubWikitext": true
26214 }
26215 !! html/parsoid
26216 <h2>foo<br/>bar</h2>
26217 <h2>foo <span><br/>bar</span> baz</h2>
26218 !! wikitext
26219 == foo bar ==
26220
26221 == foo <span> bar</span> baz ==
26222 !! end
26223
26224 !! test
26225 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26226 !! options
26227 parsoid={
26228 "modes": ["html2wt"],
26229 "scrubWikitext": false
26230 }
26231 !! html/parsoid
26232 <h2>foo<br/>bar</h2>
26233 !! wikitext
26234 == foo<br> bar ==
26235 !! end
26236
26237 !! test
26238 1. WT Quote Tags: suppress newly created empty style tags
26239 !! options
26240 parsoid={
26241 "modes": ["html2wt"],
26242 "scrubWikitext": true
26243 }
26244 !! html/parsoid
26245 <i></i><b></b>
26246 !! wikitext
26247 !! end
26248
26249 !! test
26250 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26251 !! options
26252 parsoid=html2wt
26253 !! html/parsoid
26254 <i></i><b></b>
26255 !! wikitext
26256 ''<nowiki/>'''''<nowiki/>'''
26257 !! end
26258
26259 !! test
26260 3. WT Quote Tags: suppress empty style tags on edits
26261 !! options
26262 parsoid={
26263 "modes": ["selser"],
26264 "scrubWikitext": true,
26265 "changes": [
26266 [ "#x", "remove"]
26267 ]
26268 }
26269 !! wikitext
26270 '''<span id="x">foo</span>'''
26271 !! wikitext/edited
26272 !! end
26273
26274 !! test
26275 1. Anchors: suppress newly created empty anchors
26276 !! options
26277 parsoid={
26278 "modes": ["html2wt"],
26279 "scrubWikitext": true
26280 }
26281 !! html/parsoid
26282 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26283 !! wikitext
26284 !! end
26285
26286 !! test
26287 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26288 !! options
26289 parsoid={
26290 "modes": ["html2wt"],
26291 "scrubWikitext": false
26292 }
26293 !! html/parsoid
26294 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26295 !! wikitext
26296 [[Test|<nowiki/>]]
26297 !! end
26298
26299 !! test
26300 3. Anchors: suppress empty anchors on edits
26301 !! options
26302 parsoid={
26303 "modes": ["selser"],
26304 "scrubWikitext": true,
26305 "changes": [
26306 [ "#x", "remove"]
26307 ]
26308 }
26309 !! wikitext
26310 [[Test|<span id="x">foo</span>]]
26311 !! wikitext/edited
26312 !! end
26313
26314 !! test
26315 3a. Anchors: do not suppress numbered extlinks
26316 !! options
26317 parsoid={
26318 "modes": ["wt2wt"],
26319 "scrubWikitext": true
26320 }
26321 !! wikitext
26322 [http://foo.com]
26323 !! html/parsoid
26324 <a rel="mw:ExtLink" href="http://foo.com"></a>
26325 !! end
26326
26327 !! test
26328 3b. Anchors: do not suppress numbered extlinks
26329 !! options
26330 parsoid={
26331 "modes": ["wt2wt"],
26332 "scrubWikitext": true,
26333 "changes": [
26334 [ "#x", "remove"]
26335 ]
26336 }
26337 !! wikitext
26338 [http://foo.com <span id="x">foo</span>]
26339 !! wikitext/edited
26340 [http://foo.com]
26341 !! end
26342
26343 !!test
26344 Normalizations should be restricted to edited content
26345 !!options
26346 parsoid={
26347 "modes": ["selser"],
26348 "scrubWikitext": true,
26349 "changes": [
26350 [ "h1", "before", "<i></i>"]
26351 ]
26352 }
26353 !!wikitext
26354 a
26355 = =
26356 b
26357 !!wikitext/edited
26358 a
26359 = =
26360 b
26361 !!end
26362
26363 !! test
26364 1. Multiple normalizations (html2wt)
26365 !! options
26366 parsoid={
26367 "modes": ["html2wt"],
26368 "scrubWikitext": true
26369 }
26370 !! html
26371 <h2><i></i></h2>
26372 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26373 </a><b><i></i></b>x</p>
26374 !! wikitext
26375
26376 [[foo]]
26377 x
26378
26379 !! end
26380
26381 !! test
26382 2. Multiple normalizations (selser)
26383 !! options
26384 parsoid={
26385 "modes": ["selser"],
26386 "scrubWikitext": true,
26387 "changes": [
26388 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26389 ]
26390 }
26391 !! wikitext
26392 <span id="x">foo</span>
26393 !! wikitext/edited
26394 <span id="x">foo</span>
26395
26396 x
26397 !! end
26398
26399 !! test
26400 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26401 !! options
26402 parsoid={
26403 "modes": ["html2wt"],
26404 "scrubWikitext": true
26405 }
26406 !! html/parsoid
26407 <p> hi</p>
26408 <p> hello</p>
26409 !! wikitext
26410 hi
26411
26412 hello
26413 !! end
26414
26415 !! test
26416 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26417 !! options
26418 parsoid=html2wt
26419 !! html/parsoid
26420 <p> hi</p>
26421 <p> hello</p>
26422 !! wikitext
26423 <nowiki> </nowiki>hi
26424
26425 <nowiki> </nowiki> hello
26426 !! end
26427
26428 !! test
26429 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26430 !! options
26431 parsoid={
26432 "modes": ["html2wt"],
26433 "scrubWikitext": true
26434 }
26435 !! html/parsoid
26436 <p>Foo
26437 bar
26438 baz</p>
26439
26440 <table><tr><td>Foo
26441 bar
26442 baz bang</td></tr></table>
26443
26444 <p><!--boo--> foo
26445 bar</p>
26446
26447 <p> foo
26448 bar<span>boo</span></p>
26449 !! wikitext
26450 Foo
26451 bar
26452 baz
26453
26454 {|
26455 |Foo
26456 bar
26457 baz bang
26458 |}
26459
26460 <!--boo-->foo
26461 bar
26462
26463 foo
26464 bar<span>boo</span>
26465 !! end
26466
26467 !! test
26468 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26469 !! options
26470 parsoid={
26471 "modes": ["selser"],
26472 "scrubWikitext": true,
26473 "changes": [
26474 [ "p", "html", " a\n b" ]
26475 ]
26476 }
26477 !! wikitext
26478 xyz
26479 !! wikitext/edited
26480 a
26481 b
26482 !! end
26483
26484 !! test
26485 1. New links that end in spaces
26486 !! options
26487 parsoid={
26488 "modes": ["html2wt"],
26489 "scrubWikitext": false
26490 }
26491 !! html/parsoid
26492 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26493 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26494 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26495 !! wikitext
26496 [[Berlin ]]<nowiki/>is the capital of Germany.
26497
26498 [[Foo ]]'''bar'''
26499
26500 [[Boston ]] is a city.
26501 !! end
26502
26503 !! test
26504 2. New links that end in spaces
26505 !! options
26506 parsoid={
26507 "modes": ["html2wt"],
26508 "scrubWikitext": true
26509 }
26510 !! html/parsoid
26511 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26512 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26513 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26514 !! wikitext
26515 [[Berlin]] is the capital of Germany.
26516
26517 [[Foo]] '''bar'''
26518
26519 [[Boston]] is a city.
26520 !! end
26521
26522 !! test
26523 1. Table cells with escapable prefixes
26524 !! options
26525 parsoid={
26526 "modes": ["html2wt"],
26527 "scrubWikitext": false
26528 }
26529 !! html
26530 <table>
26531 <tr><td>a</td></tr>
26532 <tr><td>-</td></tr>
26533 <tr><td>+</td></tr>
26534 </table>
26535 !! wikitext
26536 {|
26537 |a
26538 |-
26539 |<nowiki>-</nowiki>
26540 |-
26541 |<nowiki>+</nowiki>
26542 |}
26543 !! end
26544
26545 !! test
26546 2. Table cells with escapable prefixes
26547 !! options
26548 parsoid={
26549 "modes": ["html2wt"],
26550 "scrubWikitext": true
26551 }
26552 !! html
26553 <table>
26554 <tr><td>a</td></tr>
26555 <tr><td>-</td></tr>
26556 <tr><td>+</td></tr>
26557 </table>
26558 !! wikitext
26559 {|
26560 |a
26561 |-
26562 | -
26563 |-
26564 | +
26565 |}
26566 !! end
26567
26568 !! test
26569 3a. Table cells with escapable prefixes after edits
26570 !! options
26571 parsoid={
26572 "modes": ["selser"],
26573 "scrubWikitext": true,
26574 "changes": [
26575 [ "table tbody tr:first-child td:first-child", "remove"]
26576 ]
26577 }
26578 !! wikitext
26579 {|
26580 |a||-
26581 |}
26582 !! wikitext/edited
26583 {|
26584 | -
26585 |}
26586 !! end
26587
26588 !! test
26589 3b. Table cells with escapable prefixes after edits
26590 !! options
26591 parsoid={
26592 "modes": ["selser"],
26593 "scrubWikitext": true,
26594 "changes": [
26595 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26596 [ "#x", "remove" ]
26597 ]
26598 }
26599 !! wikitext
26600 {|
26601 |pqr
26602 |<span id="x">foo</span>+
26603 |}
26604 !! wikitext/edited
26605 {|
26606 | -
26607 | +
26608 |}
26609 !! end
26610
26611 # FIXME: This test will fail because
26612 # normalization doesn't realize that the id attribute
26613 # will eliminate the escapable scenario
26614 !! test
26615 4a. Table cells without escapable prefixes after edits
26616 !! options
26617 parsoid={
26618 "modes": ["selser"],
26619 "scrubWikitext": true,
26620 "changes": [
26621 [ "#x", "html", "-" ]
26622 ]
26623 }
26624 !! wikitext
26625 {|
26626 | id="x" |abcd
26627 |}
26628 !! wikitext/edited
26629 {|
26630 | id="x" |-
26631 |}
26632 !! end
26633
26634 ## This tests normalizer's ability to discriminate between
26635 ## cells having identical content.
26636 !! test
26637 4b. Table cells without escapable prefixes after edits
26638 !! options
26639 parsoid={
26640 "modes": ["selser"],
26641 "scrubWikitext": true,
26642 "changes": [
26643 [ "td", "html", "-" ]
26644 ]
26645 }
26646 !! wikitext
26647 {|
26648 |a||b
26649 |}
26650 !! wikitext/edited
26651 {|
26652 | -||-
26653 |}
26654 !! end
26655
26656 ## This tests normalizer's ability to not be tripped by
26657 ## comments (and whitespace)
26658 !! test
26659 4c. Table cells without escapable prefixes after edits
26660 !! options
26661 parsoid={
26662 "modes": ["selser"],
26663 "scrubWikitext": true,
26664 "changes": [
26665 [ "table tbody tr td:first-child", "remove" ]
26666 ]
26667 }
26668 !! wikitext
26669 {|
26670 |-
26671 <!--foo--> |a||-
26672 |}
26673 !! wikitext/edited
26674 {|
26675 |-
26676 <!--foo--> | -
26677 |}
26678 !! end
26679
26680 ## This tests normalizer's ability to handle HTML cells
26681 !! test
26682 4d. Table cells without escapable prefixes after edits
26683 !! options
26684 parsoid={
26685 "modes": ["selser"],
26686 "scrubWikitext": true,
26687 "changes": [
26688 [ "td", "html", "-" ]
26689 ]
26690 }
26691 !! wikitext
26692 <table>
26693 <tr><td>a</td></tr>
26694 </table>
26695 !! wikitext/edited
26696 <table>
26697 <tr><td>-</td></tr>
26698 </table>
26699 !! end
26700
26701 ## T111151 Remove font elements without attributes
26702 !! test
26703 5a. font tags without attributes should be dropped in scrubWikitext mode
26704 !! options
26705 parsoid={
26706 "modes": ["html2wt"],
26707 "scrubWikitext": true
26708 }
26709 !! html
26710 <font>foo</font>
26711 <font><font>bar</font></font>
26712 <font class="x">boo</font>
26713 !! wikitext
26714 foo
26715 bar
26716 <font class="x">boo</font>
26717 !! end
26718
26719 !! test
26720 5b. font tags should not be dropped without scrubWikitext being enabled
26721 !! options
26722 parsoid={
26723 "modes": ["html2wt"],
26724 "scrubWikitext": false
26725 }
26726 !! html
26727 <font>foo</font>
26728 !! wikitext
26729 <font>foo</font>
26730 !! end
26731
26732 !! test
26733 Escape nowiki DOM elements
26734 !! options
26735 parsoid=html2wt
26736 !! html/parsoid
26737 <nowiki><i>foo</i></nowiki>
26738 !! wikitext
26739 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26740 !! end
26741
26742 # This is meant to be an interim fix while we go about figuring out
26743 # how to not introduce these trailing <nowiki/>s in the first place.
26744 !! test
26745 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26746 !! options
26747 parsoid=html2wt
26748 !! html/parsoid
26749 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26750 y</p>
26751 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26752 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26753 !! wikitext
26754 x
26755 y
26756
26757 {{echo|
26758 1 = <nowiki/>}}
26759
26760 {{echo|
26761 1 = <nowiki/>
26762 }}
26763 !! end
26764
26765 # ---------------------------------------------------
26766 # End of tests spec'ing wikitext serialization norms |
26767 # ---------------------------------------------------
26768
26769 # T104032
26770 !! test
26771 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26772 !! options
26773 parsoid=html2wt
26774 !! html/parsoid
26775 a<p>b</p>
26776 <b>c</b><p>d</p>
26777 <table><tr>
26778 <td>a<p>b</p></td>
26779 <td><b>c</b><p>d</p></td>
26780 </tr></table>
26781 !! wikitext
26782 a
26783
26784 b
26785
26786 '''c'''
26787
26788 d
26789 {|
26790 |a
26791 b
26792 |'''c'''
26793 d
26794 |}
26795 !! end
26796
26797 # -----------------------------------------------------------------
26798 # End of section for Parsoid-only html2wt tests for serialization
26799 # of new content
26800 # -----------------------------------------------------------------
26801
26802 # -----------------------------------------------------------------
26803 # The following section of tests are primarily to spec behavior of
26804 # the selective serializer. All these tests have manual selser
26805 # changes. The automated selser changes for all tests handle the
26806 # wide variation of changes, but these tests here capture specs
26807 # deterministically.
26808 # ----------------------------------------------------------------
26809
26810 ## T90517
26811 !! test
26812 Selser: New comments should not be lost
26813 !! options
26814 parsoid={
26815 "modes": ["selser"],
26816 "changes": [
26817 [ "#a", "after", "<!--c1-->" ],
26818 [ "#b", "before", "<!--c2-->" ]
26819 ]
26820 }
26821 !! wikitext
26822 <span id="a">a</span>
26823
26824 <span id="b">b</span>
26825 !! wikitext/edited
26826 <span id="a">a</span><!--c1-->
26827
26828 <!--c2--><span id="b">b</span>
26829 !! end
26830
26831 ## T89383
26832 !! test
26833 Selser: Check for validity of DSR before using it
26834 !! options
26835 parsoid={
26836 "modes": ["selser"],
26837 "changes": [
26838 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26839 ]
26840 }
26841 !! wikitext
26842 <span id="a">a</span>
26843 !! wikitext/edited
26844 {{DISPLAYTITLE:foo}}
26845 <span id="a">a</span>
26846 !! end
26847
26848 !! test
26849 1. DOMDiff: Changes to <ref> content should be looked up using id
26850 !! options
26851 parsoid={
26852 "modes": ["selser"],
26853 "changes": [
26854 ["#X", "after", "bar"],
26855 ["#Y", "after", "baz"]
26856 ]
26857 }
26858 !! wikitext
26859 X <ref><span id="X">foo</span></ref>
26860 Y <ref name="a" />
26861 <references>
26862 <ref name="a"><span id="Y">foo</span></ref>
26863 </references>
26864 !! wikitext/edited
26865 X <ref><span id="X">foo</span>bar</ref>
26866 Y <ref name="a" />
26867 <references>
26868 <ref name="a"><span id="Y">foo</span>baz</ref>
26869 </references>
26870 !! end
26871
26872 !! test
26873 2. DOMDiff: Changes to <ref> content should be looked up using id
26874 !! options
26875 parsoid={
26876 "modes": ["selser"],
26877 "changes": [
26878 ["#Z", "after", "bar"]
26879 ]
26880 }
26881 !! wikitext
26882 A <ref>foo bar for a</ref>
26883 B <ref group="X" name="b" />
26884
26885 <references />
26886
26887 <references group="X">
26888 <ref name="b"><span id="Z">foo</span></ref>
26889 </references>
26890 !! wikitext/edited
26891 A <ref>foo bar for a</ref>
26892 B <ref group="X" name="b" />
26893
26894 <references />
26895
26896 <references group="X">
26897 <ref name="b"><span id="Z">foo</span>bar</ref>
26898 </references>
26899 !! end
26900
26901 !! test
26902 Empty LI (T49673)
26903 !! wikitext
26904 * a
26905 *
26906 *
26907 * b
26908 !! html/php+tidy
26909 <ul>
26910 <li>a</li>
26911 <li class="mw-empty-li"></li>
26912 <li class="mw-empty-li"></li>
26913 <li>b</li>
26914 </ul>
26915 !! end