parserTest: Remove mention of non-existent 'noxml' option
[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|a <nowiki>}}</nowiki> b}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|a {{!}} <nowiki>{{ ]]</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 ## PHP parser discards the "<pre " string
2523 !! test
2524 Handle broken pre-like tags (bug 64025)
2525 !! options
2526 parsoid=wt2html
2527 !! wikitext
2528 {{echo|<pre <pre>x</pre>}}
2529
2530 <table><pre </table>
2531 !! html/php
2532 <pre>x</pre>
2533 <table><pre></pre></table>
2534
2535 !! html/parsoid
2536 <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>
2537
2538
2539 <p>&lt;pre </p>
2540
2541 <table></table>
2542 !! end
2543
2544 !! test
2545 Parsoid: handle pre with space after attribute
2546 !! options
2547 parsoid=wt2html
2548 !! wikitext
2549 <pre style="width:50%;" >{{echo|foo}}</pre>
2550 !! html/php
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552
2553 !! html/parsoid
2554 <pre style="width:50%;">{{echo|foo}}</pre>
2555 !! end
2556
2557 # TODO / maybe: fix wt2wt for this
2558 !! test
2559 Parsoid: Don't paragraph-wrap fosterable content
2560 !! options
2561 parsoid=wt2html
2562 !! wikitext
2563 {|
2564 <td></td>
2565 <td></td>
2566
2567
2568
2569 |}
2570 !! html
2571 <table>
2572
2573 <tbody>
2574 <tr>
2575 <td></td>
2576
2577 <td></td></tr>
2578
2579
2580
2581 </tbody></table>
2582 !! end
2583
2584 !! test
2585 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2586 !! options
2587 parsoid=wt2html
2588 !! wikitext
2589 {|
2590 <td>
2591 <td>
2592 </td>
2593
2594
2595
2596 |}
2597 !! html
2598 <table>
2599
2600 <tbody>
2601 <tr>
2602 <td></td>
2603
2604 <td>
2605 </td></tr>
2606
2607
2608
2609 </tbody></table>
2610 !! end
2611
2612
2613 #--------------------------------------------------------------------
2614 # Transclusion parameter whitespace stripping tests
2615 # Behavior is different for positional and named parameters
2616 #--------------------------------------------------------------------
2617 !! test
2618 Templates: Strip leading and trailing whitespace from named-param values
2619 !! wikitext
2620 {{echo|1= a }}
2621
2622 {{echo|1= {{echo|b}} }}
2623
2624 {{echo| 1 =
2625 c }}
2626
2627 {{echo| 1 =
2628 * d
2629 }}
2630 !! html
2631 <p>a
2632 </p><p>b
2633 </p><p>c
2634 </p>
2635 <ul><li> d</li></ul>
2636
2637 !! end
2638
2639 !! test
2640 Templates: Don't strip whitespace from positional-param values
2641 !! wikitext
2642 {{echo|a }}
2643
2644 {{echo|{{echo|b}} }}
2645
2646 {{echo| c
2647 }}
2648
2649 {{echo| {{echo|d}}
2650 }}
2651
2652 {{echo|
2653 e}}
2654
2655 {{echo|
2656 * f}}
2657
2658 {{echo|
2659 }}g
2660 !! html
2661 <p>a
2662 </p><p>b
2663 </p>
2664 <pre>c
2665 </pre>
2666 <p><br />
2667 </p>
2668 <pre>d
2669 </pre>
2670 <p><br />
2671 </p>
2672 <pre>e
2673 </pre>
2674 <p><br />
2675 </p>
2676 <ul><li> f</li></ul>
2677 <p><br />
2678 </p>
2679 <pre>g
2680 </pre>
2681 !! end
2682
2683 !! test
2684 Templates: Handle empty comment-and-ws-only lines correctly
2685 !! wikitext
2686 {{echo|foo
2687 <!--should be ignored-->
2688 <!--should be ignored as well-->
2689 bar}}
2690 !! html
2691 <p>foo
2692 bar
2693 </p>
2694 !! end
2695
2696 !! test
2697 Templates: Handle comments in the target
2698 !! wikitext
2699 {{echo
2700 <!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->
2704 |foo}}
2705
2706 {{echo<!-- should be ignored -->|foo}}
2707
2708 {{<!-- should be ignored -->echo|foo}}
2709 !!html/parsoid
2710 <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>
2711
2712 <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>
2713
2714 <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>
2715
2716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2717 !!end
2718
2719 !! test
2720 Templates: Handle comments in parameter names (bug 67657)
2721 !! wikitext
2722 {{echo|1
2723 <!-- should be ignored -->
2724 =foo}}
2725
2726 {{echo|
2727 <!-- should be ignored -->
2728 1 = foo}}
2729
2730 {{echo|1<!-- should be ignored -->=foo}}
2731
2732 {{echo|<!-- should be ignored -->1=foo}}
2733 !!html/parsoid
2734 <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>
2735
2736 <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>
2737
2738 <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>
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 -->1"}}},"i":0}}]}'>foo</p>
2741 !!end
2742
2743 !! test
2744 Templates: Other wikitext in parameter names (bug 67657)
2745 !! wikitext
2746 {{echo|''1''=foo}}
2747 !!html/parsoid
2748 <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>
2749 !!html/php
2750 <p>{{{1}}}
2751 </p>
2752 !!end
2753
2754 #--------------------------------------------------------------------
2755 # Transclusion parameter escaping tests
2756 #--------------------------------------------------------------------
2757 !! test
2758 Templates: Parsoid parameter escaping test 1
2759 !! wikitext
2760 {{echo|[foo]|{{echo|[bar]}}}}
2761 !! html/php+tidy
2762 <p>[foo]</p>
2763 !! html/parsoid
2764 <p about="#mwt1" typeof="mw:Transclusion"
2765 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2766 !! end
2767
2768 !! test
2769 Parsoid: Pipes in external links in template parameter
2770 !! wikitext
2771 {{echo|[{{echo|http://example.com}} link]}}
2772 !! html/php+tidy
2773 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2774 !! html/parsoid
2775 <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>
2776 !! end
2777
2778 !! test
2779 Parsoid: pipe in transclusion parameter
2780 !! wikitext
2781 {{echo|http://foo.com/a&#124;b}}
2782 !! html/php+tidy
2783 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2784 !! html/parsoid
2785 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2786 typeof="mw:Transclusion"
2787 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>
2788 !! end
2789
2790 !! test
2791 Parsoid: Pipe in external link target and content in template parameter
2792 !! options
2793 parsoid=html2wt,wt2wt
2794 !! wikitext
2795 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2796 !! html/php+tidy
2797 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2798 !! html/parsoid
2799 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2800 typeof="mw:Transclusion"
2801 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2802 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2803 !! end
2804
2805 !! test
2806 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2807 !! options
2808 parsoid
2809 !! wikitext
2810 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2811 !! html
2812 <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>
2813 !! end
2814
2815 !! test
2816 Templates: Don't escape already nowiki-escaped text in template parameters
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|foo<nowiki>|</nowiki>bar}}
2821 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2822 {{echo|<nowiki></nowiki>}}
2823 !! html/php+tidy
2824 <p>foo|bar &lt;div&gt;</p>
2825 !! html/parsoid
2826 <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>
2827 <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>
2828 <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>
2829 </p>
2830 !! end
2831
2832 ## Bug 52824
2833 !! test
2834 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2835 !! options
2836 parsoid=html2wt,wt2wt
2837 !! wikitext
2838 {{echo|{{echo|1=bar}}}}
2839 !! html/php+tidy
2840 <p>bar</p>
2841 !! html/parsoid
2842 <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>
2843 !! end
2844
2845 ## Bug 56733
2846 !! test
2847 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2848 !! wikitext
2849 {{echo|a : b}}
2850 !! html/php+tidy
2851 <p>a&#160;: b</p>
2852 !! html/parsoid
2853 <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>
2854 !! end
2855
2856 ## Bug T73412
2857 !! test
2858 Templates: Preserve blank parameter names
2859 !! wikitext
2860 {{echo|=foo}}
2861 !! html/php+tidy
2862 <p>{{{1}}}</p>
2863 !! html/parsoid
2864 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2865 !! end
2866
2867 !! test
2868 Templates: Preserve blank parameter names in other positions
2869 !! wikitext
2870 {{blank_param|bar|=foo}}
2871 !! html/php+tidy
2872 <p>bar foo</p>
2873 !! html/parsoid
2874 <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
2875 foo</p>
2876 !! end
2877
2878 ###
2879 ### Parsoid-centric tests for testing RT edge cases for pre
2880 ###
2881
2882 !!test
2883 1a. Indent-Pre and Comments
2884 !! wikitext
2885 a
2886 <!--a-->
2887 c
2888 !! html
2889 <pre>a
2890 </pre>
2891 <p>c
2892 </p>
2893 !!end
2894
2895 !!test
2896 1b. Indent-Pre and Comments
2897 !! wikitext
2898 a
2899 <!--a-->
2900 c
2901 !! html
2902 <pre>a
2903 </pre>
2904 <p>c
2905 </p>
2906 !!end
2907
2908 !!test
2909 1c. Indent-Pre and Comments
2910 !! wikitext
2911 <!--a--> a
2912
2913 <!--a--> a
2914 !! html
2915 <pre> a
2916 </pre>
2917 <pre> a
2918 </pre>
2919 !!end
2920
2921 !!test
2922 1d. Indent-Pre and Comments
2923 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2924 !! wikitext
2925 <!--a--> a
2926
2927 <!--b-->b
2928 !! html
2929 <pre>a
2930 </pre>
2931 <pre>b
2932 </pre>
2933 !!end
2934
2935 !!test
2936 2a. Indent-Pre and tables
2937 !! wikitext
2938 {|
2939 |-
2940 !h1!!h2
2941 |foo||bar
2942 |}
2943 !! html
2944 <table>
2945
2946 <tr>
2947 <th>h1</th>
2948 <th>h2
2949 </th>
2950 <td>foo</td>
2951 <td>bar
2952 </td></tr></table>
2953
2954 !!end
2955
2956 !!test
2957 2b. Indent-Pre and tables
2958 !! wikitext
2959 {|
2960 |-
2961 |foo
2962 |}
2963 !! html
2964 <table>
2965
2966 <tr>
2967 <td>foo
2968 </td></tr></table>
2969
2970 !!end
2971
2972 !!test
2973 2c. Indent-Pre and tables (bug 42252)
2974 !! wikitext
2975 {|
2976 |+ foo
2977 ! | bar
2978 |}
2979 !! html
2980 <table>
2981 <caption> foo
2982 </caption>
2983 <tr>
2984 <th> bar
2985 </th></tr></table>
2986
2987 !!end
2988
2989 !!test
2990 2d. Indent-Pre and tables
2991 !! wikitext
2992 a
2993 {|
2994 | b
2995 |}
2996 !! html/php
2997 <pre>a
2998 </pre>
2999 <table>
3000 <tr>
3001 <td> b
3002 </td></tr></table>
3003
3004 !! html/parsoid
3005 <pre>a</pre>
3006 <table>
3007 <tbody><tr><td> b</td></tr>
3008 </tbody></table>
3009 !!end
3010
3011 !!test
3012 2e. Indent-Pre and table-line syntax
3013 !! wikitext
3014 a
3015 | b
3016 | c
3017 !! html/php
3018 <pre>a
3019 | b
3020 | c
3021 </pre>
3022 !!end
3023
3024 !!test
3025 2f. Indent-pre started by table-line syntax
3026 !! wikitext
3027 a
3028 | b
3029 | c
3030 !! html/php
3031 <p>a
3032 </p>
3033 <pre>| b
3034 | c
3035 </pre>
3036 !! html/parsoid
3037 <p>a</p>
3038 <pre>
3039 | b
3040 | c</pre>
3041 !!end
3042
3043 !!test
3044 3a. Indent-Pre and block tags (single-line html)
3045 !! wikitext
3046 a <p> foo </p>
3047 b <div> foo </div>
3048 c <blockquote> foo </blockquote>
3049 <span> foo </span>
3050 !! html
3051 a <p> foo </p>
3052 b <div> foo </div>
3053 c <blockquote> foo </blockquote>
3054 <pre><span> foo </span>
3055 </pre>
3056 !! html/parsoid
3057 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3058 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3059 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3060 <pre><span> foo </span>
3061 </pre>
3062 !! html+tidy
3063 <p>a</p>
3064 <p>foo</p>
3065 <p>b</p>
3066 <div>foo</div>
3067 <p>c</p>
3068 <blockquote>
3069 <p>foo</p>
3070 </blockquote>
3071 <pre>
3072 <span> foo </span>
3073 </pre>
3074 !! end
3075
3076 !!test
3077 3b. Indent-Pre and block tags (multi-line html)
3078 !! wikitext
3079 a <span>foo</span>
3080 b <div> foo </div>
3081 !! html
3082 <pre>a <span>foo</span>
3083 </pre>
3084 b <div> foo </div>
3085
3086 !! html/parsoid
3087 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3088 b <div data-parsoid='{"stx":"html"}'> foo </div>
3089 !! html+tidy
3090 <pre>
3091 a <span>foo</span>
3092 </pre>
3093 <p>b</p>
3094 <div>foo</div>
3095 !!end
3096
3097 !!test
3098 3c. Indent-Pre and block tags (pre-content on separate line)
3099 !! wikitext
3100 <p>
3101 foo
3102 </p>
3103
3104 <div>
3105 foo
3106 </div>
3107
3108 <center>
3109 foo
3110 </center>
3111
3112 <blockquote>
3113 foo
3114 </blockquote>
3115
3116 <blockquote>
3117 <pre>
3118 foo
3119 </pre>
3120 </blockquote>
3121
3122 <table><tr><td>
3123 foo
3124 </td></tr></table>
3125
3126 <ul><li>
3127 foo
3128 </li></ul>
3129
3130 !! html
3131 <p>
3132 foo
3133 </p>
3134 <div>
3135 <pre>foo
3136 </pre>
3137 </div>
3138 <center>
3139 <pre>foo
3140 </pre>
3141 </center>
3142 <blockquote>
3143 <p> foo
3144 </p>
3145 </blockquote>
3146 <blockquote>
3147 <pre>
3148 foo
3149 </pre>
3150 </blockquote>
3151 <table><tr><td>
3152 <pre>foo
3153 </pre>
3154 </td></tr></table>
3155 <ul><li>
3156 foo
3157 </li></ul>
3158
3159 !!end
3160
3161 !!test
3162 4. Indent-Pre and extension tags
3163 !! wikitext
3164 a <gallery>
3165 File:foobar.jpg
3166 </gallery>
3167 !! html
3168 a <ul class="gallery mw-gallery-traditional">
3169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3170 <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>
3171 <div class="gallerytext">
3172 </div>
3173 </div></li>
3174 </ul>
3175
3176 !! html+tidy
3177 <p>a</p>
3178 <ul class="gallery mw-gallery-traditional">
3179 <li class="gallerybox" style="width: 155px">
3180 <div style="width: 155px">
3181 <div class="thumb" style="width: 150px;">
3182 <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>
3183 </div>
3184 <div class="gallerytext"></div>
3185 </div>
3186 </li>
3187 </ul>
3188 !!end
3189
3190 !! test
3191 Table wikitext syntax outside wiki-tables
3192 !! wikitext
3193 a
3194 ! not a table heading
3195 |- not a table row
3196 | not a table cell
3197 | class="foo bar" | baz
3198 b
3199 |}
3200 |-
3201 c
3202 !! html
3203 <p>a
3204 ! not a table heading
3205 |- not a table row
3206 | not a table cell
3207 | class="foo bar" | baz
3208 b
3209 |}
3210 |-
3211 c
3212 </p>
3213 !! end
3214
3215 !!test
3216 Render paragraphs when indent-pre is suppressed in blocklevels
3217 !! wikitext
3218 <blockquote>
3219 foo
3220
3221 bar
3222 </blockquote>
3223 !! html
3224 <blockquote>
3225 <p> foo
3226 </p><p> bar
3227 </p>
3228 </blockquote>
3229
3230 !!end
3231
3232 !!test
3233 4. Multiple spaces at start-of-line
3234 !! wikitext
3235 <p> foo </p>
3236 foo
3237 {|
3238 |foo
3239 |}
3240 !! html
3241 <p> foo </p>
3242 <pre> foo
3243 </pre>
3244 <table>
3245 <tr>
3246 <td>foo
3247 </td></tr></table>
3248
3249 !!end
3250
3251 ## NOTE: the leading white-space chars on empty line are significant
3252 !! test
3253 5a. White-space in indent-pre
3254 !! wikitext
3255 a<br />
3256
3257 b
3258 !! html
3259 <pre>a<br />
3260
3261 b
3262 </pre>
3263 !! end
3264
3265 ## NOTE: the leading white-space chars on empty line are significant
3266 !! test
3267 5b. White-space in indent-pre
3268 !! wikitext
3269 a
3270
3271 b
3272
3273
3274 c
3275 !! html
3276 <pre>a
3277
3278 b
3279
3280
3281 c
3282 </pre>
3283 !! end
3284
3285 !! test
3286 5c. White-space in indent-pre
3287 !! wikitext
3288 ''a''
3289 ''b''
3290 ''c''
3291 !! html
3292 <pre><i>a</i>
3293 <i>b</i>
3294 <i>c</i>
3295 </pre>
3296 !! end
3297
3298 !! test
3299 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3300 !! wikitext
3301 a
3302
3303 <!-- continue -->
3304 b
3305
3306 c
3307
3308 d
3309 !! html
3310 <pre>a
3311
3312 b
3313 </pre>
3314 <pre>c
3315
3316 </pre>
3317 <p>d
3318 </p>
3319 !! end
3320
3321 !! test
3322 7a. Indent-pre and category links
3323 !! options
3324 parsoid=wt2html,wt2wt
3325 !! wikitext
3326 [[Category:foo]] <!-- No pre-wrapping -->
3327 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3328 !! html/php+tidy
3329 !! html/parsoid
3330 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3331 <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 -->
3332 !! end
3333
3334 ## We used to, but no longer wt2wt this test since the default serializer
3335 ## will normalize all categories to serialize on their own line.
3336 ## This wikitext usage is going to be fairly uncommon in production and
3337 ## selser will take care of preserving formatting in those scenarios.
3338 !! test
3339 7b. Indent-pre and category links
3340 !! options
3341 parsoid=wt2html
3342 !! wikitext
3343 [[Category:foo]] a
3344 [[Category:foo]] {{echo|b}}
3345 !! html/parsoid
3346 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3347 <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>
3348 !! end
3349
3350 !! test
3351 Indent-Pre: Newlines in comments shouldn't affect sol state
3352 !! wikitext
3353 a <!--
3354 foo
3355 --> b
3356 !! html/php+tidy
3357 <p>a b</p>
3358 !! html/parsoid
3359 <p>a <!--
3360 foo
3361 --> b</p>
3362 !! end
3363
3364 ###
3365 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3366 ###
3367
3368 !!test
3369 HTML-pre: 1. embedded newlines
3370 !! wikitext
3371 <pre>foo</pre>
3372
3373 <pre>
3374 foo
3375 </pre>
3376
3377 <pre>
3378
3379 foo
3380 </pre>
3381
3382 <pre>
3383
3384
3385 foo
3386 </pre>
3387 !! html/php+tidy
3388 <pre>
3389 foo
3390 </pre>
3391 <pre>
3392 foo
3393 </pre>
3394 <pre>
3395
3396 foo
3397 </pre>
3398 <pre>
3399
3400
3401 foo
3402 </pre>
3403 !! html/parsoid
3404 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3405
3406 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3407 foo
3408 </pre>
3409
3410 <pre data-parsoid='{"stx":"html"}'>
3411
3412 foo
3413 </pre>
3414
3415 <pre data-parsoid='{"stx":"html"}'>
3416
3417
3418 foo
3419 </pre>
3420 !!end
3421
3422 !! test
3423 HTML-pre: big spaces
3424 !! wikitext
3425 <pre>
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 haha
3436
3437
3438
3439
3440 </pre>
3441 !! html/php+tidy
3442 <pre>
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 haha
3453
3454
3455
3456
3457 </pre>
3458 !! html/parsoid
3459 <pre data-parsoid='{"stx":"html"}'>
3460
3461
3462
3463
3464 haha
3465
3466
3467
3468
3469 haha
3470
3471
3472
3473
3474 </pre>
3475 !! end
3476
3477 !!test
3478 HTML-pre: 2: indented text
3479 !! wikitext
3480 <pre>
3481 foo
3482 </pre>
3483 !! html
3484 <pre>
3485 foo
3486 </pre>
3487
3488 !!end
3489
3490 !!test
3491 HTML-pre: 3: other wikitext
3492 !! wikitext
3493 <pre>
3494 * foo
3495 # bar
3496 = no-h =
3497 '' no-italic ''
3498 [[ NoLink ]]
3499 </pre>
3500 !! html/php
3501 <pre>
3502 * foo
3503 # bar
3504 = no-h =
3505 '' no-italic ''
3506 [[ NoLink ]]
3507 </pre>
3508
3509 !! html/parsoid
3510 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3511 # bar
3512 = no-h =
3513 '' no-italic ''
3514 [[ NoLink ]]
3515 </pre>
3516 !!end
3517
3518 ###
3519 ### Definition lists
3520 ###
3521 !! test
3522 Simple definition
3523 !! wikitext
3524 ; name : Definition
3525 !! html
3526 <dl><dt> name&#160;</dt>
3527 <dd> Definition</dd></dl>
3528
3529 !! end
3530
3531 !! test
3532 Definition list for indentation only
3533 !! wikitext
3534 : Indented text
3535 !! html
3536 <dl><dd> Indented text</dd></dl>
3537
3538 !! end
3539
3540 !! test
3541 Definition list with no space
3542 !! wikitext
3543 ;name:Definition
3544 !! html
3545 <dl><dt>name</dt>
3546 <dd>Definition</dd></dl>
3547
3548 !!end
3549
3550 !! test
3551 Definition list with URL link
3552 !! wikitext
3553 ; http://example.com/ : definition
3554 !! html
3555 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3556 <dd> definition</dd></dl>
3557
3558 !! end
3559
3560 !! test
3561 Definition list with bracketed URL link
3562 !! wikitext
3563 ;[http://www.example.com/ Example]:Something about it
3564 !! html
3565 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3566 <dd>Something about it</dd></dl>
3567
3568 !! end
3569
3570 !! test
3571 Definition list with wikilink containing colon
3572 !! wikitext
3573 ; [[Help:FAQ]]: The least-read page on Wikipedia
3574 !! html
3575 <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>
3576 <dd> The least-read page on Wikipedia</dd></dl>
3577
3578 !! end
3579
3580 # At Brion's and JeLuF's insistence... :)
3581 !! test
3582 Definition list with news link containing colon
3583 !! wikitext
3584 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3585 !! html/php
3586 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3587 <dd> This isn't even a real newsgroup!</dd></dl>
3588
3589 !! html/parsoid
3590 <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>
3591 !! end
3592
3593 !! test
3594 Malformed definition list with colon
3595 !! wikitext
3596 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3597 !! html
3598 <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>
3599
3600 !! end
3601
3602 !! test
3603 Definition lists: colon in external link text
3604 !! wikitext
3605 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3606 !! html
3607 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3608 <dd> OK, I made that up</dd></dl>
3609
3610 !! end
3611
3612 !! test
3613 Definition lists: colon in HTML attribute
3614 !! wikitext
3615 ;<b style="display: inline">bold</b>
3616 !! html
3617 <dl><dt><b style="display: inline">bold</b></dt></dl>
3618
3619 !! end
3620
3621 !! test
3622 Definition lists: self-closed tag
3623 !! wikitext
3624 ;one<br/>two : two-line fun
3625 !! html
3626 <dl><dt>one<br />two&#160;</dt>
3627 <dd> two-line fun</dd></dl>
3628
3629 !! end
3630
3631 !! test
3632 Bug 11748: Literal closing tags
3633 !! wikitext
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640 !! html
3641 <dl>
3642 <dt>test 1</dt>
3643 <dd>test test test test test</dd>
3644 <dt>test 2</dt>
3645 <dd>test test test test test</dd>
3646 </dl>
3647
3648 !! end
3649
3650 !! test
3651 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3652 !! wikitext
3653 <ul><li>
3654 ; term : description
3655 * unordered
3656 </li></ul>
3657 !! html
3658 <ul><li>
3659 <dl><dt> term&#160;</dt>
3660 <dd> description</dd></dl>
3661 <ul><li> unordered</li></ul>
3662 </li></ul>
3663
3664 !! end
3665
3666 !! test
3667
3668 Definition list with empty definition and following paragraph
3669 !! wikitext
3670 ; term:
3671 Paragraph text
3672 !! html
3673 <dl><dt> term</dt>
3674 <dd></dd></dl>
3675 <p>Paragraph text
3676 </p>
3677 !! end
3678
3679 !! test
3680 Nested definition lists using html syntax
3681 !! wikitext
3682 <dl><dt>x</dt>
3683 <dd>a</dd>
3684 <dd>b</dd></dl>
3685
3686 !! end
3687
3688 !! test
3689 Definition Lists: No nesting: Multiple dd's
3690 !! wikitext
3691 ;x
3692 :a
3693 :b
3694 !! html
3695 <dl><dt>x</dt>
3696 <dd>a</dd>
3697 <dd>b</dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition Lists: Indentation: Regular
3703 !! wikitext
3704 :i1
3705 ::i2
3706 :::i3
3707 !! html
3708 <dl><dd>i1
3709 <dl><dd>i2
3710 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3711
3712 !! end
3713
3714 !! test
3715 Definition Lists: Indentation: Missing 1st level
3716 !! wikitext
3717 ::i2
3718 :::i3
3719 !! html
3720 <dl><dd><dl><dd>i2
3721 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3722
3723 !! end
3724
3725 !! test
3726 Definition Lists: Indentation: Multi-level indent
3727 !! wikitext
3728 :::i3
3729 !! html
3730 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3731
3732 !! end
3733
3734 !! test
3735 Definition Lists: Hacky use to indent tables
3736 !! wikitext
3737 ::{|
3738 |foo
3739 |bar
3740 |}
3741 this text
3742 should be left alone
3743 !! html
3744 <dl><dd><dl><dd><table>
3745 <tr>
3746 <td>foo
3747 </td>
3748 <td>bar
3749 </td></tr></table></dd></dl></dd></dl>
3750 <p>this text
3751 should be left alone
3752 </p>
3753 !! end
3754
3755 !! test
3756 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3757 !! wikitext
3758 <!-- foo -->
3759 ::{|
3760 |foo
3761 |bar
3762 |}<!-- bar -->
3763 this text
3764 should be left alone
3765 !! html/parsoid
3766 <!-- foo -->
3767 <dl><dd><dl><dd><table><tr>
3768 <td>foo</td>
3769 <td>bar</td>
3770 </tr></table><!-- bar --></dd></dl></dd></dl>
3771 <p>this text
3772 should be left alone</p>
3773 !! end
3774
3775 !! test
3776 Definition Lists: Hacky use to indent tables, with comment before table
3777 !! wikitext
3778 ::<!-- foo -->{|
3779 |foo
3780 |}
3781 !! html/parsoid
3782 <dl><dd><dl><dd><!-- foo --><table><tr>
3783 <td>foo</td>
3784 </tr></table></dd></dl></dd></dl>
3785 !! end
3786
3787 # The trailing whitespace in this test is to catch a regression in
3788 # Parsoid after T54473.
3789 !! test
3790 Definition Lists: Hacky use to indent tables (WS-insensitive)
3791 !! wikitext
3792 : {|
3793 |a
3794 |}
3795 !! html/php
3796 <dl><dd><table>
3797 <tr>
3798 <td>a
3799 </td></tr></table></dd></dl>
3800
3801 !! html/parsoid
3802 <dl><dd> <table>
3803 <tbody><tr><td>a</td></tr>
3804 </tbody></table> </dd></dl>
3805 !! end
3806
3807 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3808 ## as an empty dt item. It also ignores all but the last ";" when followed
3809 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3810 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3811 ## ";"s.
3812 ##
3813 ## Ex: ";;t2 ::d2" is transformed into:
3814 ##
3815 ## <dl>
3816 ## <dt>t2 </dt>
3817 ## <dd>
3818 ## <dl>
3819 ## <dt></dt>
3820 ## <dd>d2</dd>
3821 ## </dl>
3822 ## </dd>
3823 ## </dl>
3824 ##
3825 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3826 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3827 ##
3828 ## <dl>
3829 ## <dt>
3830 ## <dl>
3831 ## <dt>t2 </dt>
3832 ## <dd>:d2</dd>
3833 ## </dl>
3834 ## </dt>
3835 ## </dl>
3836 ##
3837 ## All Parsoid only definition list tests have this difference.
3838 ##
3839 ## See also: https://phabricator.wikimedia.org/T8569
3840 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3841
3842 !! test
3843 Table / list interaction: indented table with lists in table contents
3844 !! wikitext
3845 :{|
3846 |-
3847 | a
3848 * b
3849 |-
3850 | c
3851 * d
3852 |}
3853 !! html
3854 <dl><dd><table>
3855
3856 <tr>
3857 <td> a
3858 <ul><li> b</li></ul>
3859 </td></tr>
3860 <tr>
3861 <td> c
3862 <ul><li> d</li></ul>
3863 </td></tr></table></dd></dl>
3864
3865 !! end
3866
3867 !!test
3868 Table / list interaction: lists nested in tables nested in indented lists
3869 !! wikitext
3870 :{|
3871 |
3872 :a
3873 :b
3874 |
3875 *c
3876 *d
3877 |}
3878
3879 *e
3880 *f
3881 !! html
3882 <dl><dd><table>
3883 <tr>
3884 <td>
3885 <dl><dd>a</dd>
3886 <dd>b</dd></dl>
3887 </td>
3888 <td>
3889 <ul><li>c</li>
3890 <li>d</li></ul>
3891 </td></tr></table></dd></dl>
3892 <ul><li>e</li>
3893 <li>f</li></ul>
3894
3895 !!end
3896
3897 !! test
3898 Definition Lists: Nesting: Multi-level (Parsoid only)
3899 !! options
3900 parsoid
3901 !! wikitext
3902 ;t1 :d1
3903 ;;t2 ::d2
3904 ;;;t3 :::d3
3905 !! html
3906 <dl>
3907 <dt>t1 </dt>
3908 <dd>d1</dd>
3909 <dt>
3910 <dl>
3911 <dt>t2 </dt>
3912 <dd>:d2</dd>
3913 <dt>
3914 <dl>
3915 <dt>t3 </dt>
3916 <dd>::d3</dd>
3917 </dl>
3918 </dt>
3919 </dl>
3920 </dt>
3921 </dl>
3922
3923
3924 !! end
3925
3926
3927 !! test
3928 Definition Lists: Nesting: Test 2 (Parsoid only)
3929 !! wikitext
3930 ;t1
3931 ::d2
3932 !! html/php+tidy
3933 <dl>
3934 <dt>t1</dt>
3935 <dd>
3936 <dl>
3937 <dd>d2</dd>
3938 </dl>
3939 </dd>
3940 </dl>
3941 !! html/parsoid
3942 <dl>
3943 <dt>t1</dt>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950
3951 !! end
3952
3953
3954 !! test
3955 Definition Lists: Nesting: Test 3 (Parsoid only)
3956 !! wikitext
3957 :;t1
3958 ::::d2
3959 !! html/php+tidy
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dt>t1</dt>
3964 <dd>
3965 <dl>
3966 <dd>
3967 <dl>
3968 <dd>d2</dd>
3969 </dl>
3970 </dd>
3971 </dl>
3972 </dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976 !! html/parsoid
3977 <dl>
3978 <dd>
3979 <dl>
3980 <dt>t1</dt>
3981 <dd>
3982 <dl>
3983 <dd>
3984 <dl>
3985 <dd>d2</dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 </dd>
3992 </dl>
3993
3994 !! end
3995
3996
3997 !! test
3998 Definition Lists: Nesting: Test 4
3999 !! wikitext
4000 ::;t3
4001 :::d3
4002 !! html
4003 <dl><dd><dl><dd><dl><dt>t3</dt>
4004 <dd>d3</dd></dl></dd></dl></dd></dl>
4005
4006 !! end
4007
4008
4009 ## The Parsoid team believes the following three test exposes a
4010 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4011 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4012 ## It also exposes a "misfeature" in tidy, which doesn't like
4013 ## <dl> tags with a single <dt> child; it converts the <dt> into
4014 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4015 !! test
4016 Definition Lists: Mixed Lists: Test 1
4017 !! wikitext
4018 :;* foo
4019 ::* bar
4020 :; baz
4021 !! html/php
4022 <dl><dd><dl><dt><ul><li> foo</li>
4023 <li> bar</li></ul></dt></dl>
4024 <dl><dt> baz</dt></dl></dd></dl>
4025
4026 !! html/php+tidy
4027 <dl>
4028 <dd>
4029 <dl>
4030 <dd>
4031 <ul>
4032 <li>foo</li>
4033 <li>bar</li>
4034 </ul>
4035 </dd>
4036 </dl>
4037 <dl>
4038 <dt>baz</dt>
4039 </dl>
4040 </dd>
4041 </dl>
4042 !! html/parsoid
4043 <dl>
4044 <dd><dl>
4045 <dt><ul>
4046 <li> foo
4047 </li>
4048 </ul></dt>
4049 <dd><ul>
4050 <li> bar
4051 </li>
4052 </ul></dd>
4053 <dt> baz</dt>
4054 </dl></dd>
4055 </dl>
4056 !! end
4057
4058 !! test
4059 Definition Lists: Mixed Lists: Test 2
4060 !! wikitext
4061 *: d1
4062 *: d2
4063 !! html
4064 <ul><li><dl><dd> d1</dd>
4065 <dd> d2</dd></dl></li></ul>
4066
4067 !! end
4068
4069
4070 !! test
4071 Definition Lists: Mixed Lists: Test 3
4072 !! wikitext
4073 *::: d1
4074 *::: d2
4075 !! html
4076 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4077 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4078
4079 !! end
4080
4081
4082 !! test
4083 Definition Lists: Mixed Lists: Test 4
4084 !! wikitext
4085 *;d1 :d2
4086 *;d3 :d4
4087 !! html
4088 <ul><li><dl><dt>d1&#160;</dt>
4089 <dd>d2</dd>
4090 <dt>d3&#160;</dt>
4091 <dd>d4</dd></dl></li></ul>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Mixed Lists: Test 5
4098 !! wikitext
4099 *:d1
4100 *:: d2
4101 !! html
4102 <ul><li><dl><dd>d1
4103 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4104
4105 !! end
4106
4107
4108 !! test
4109 Definition Lists: Mixed Lists: Test 6
4110 !! wikitext
4111 #*:d1
4112 #*::: d3
4113 !! html
4114 <ol><li><ul><li><dl><dd>d1
4115 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4116
4117 !! end
4118
4119
4120 !! test
4121 Definition Lists: Mixed Lists: Test 7
4122 !! wikitext
4123 :* d1
4124 :* d2
4125 !! html
4126 <dl><dd><ul><li> d1</li>
4127 <li> d2</li></ul></dd></dl>
4128
4129 !! end
4130
4131
4132 !! test
4133 Definition Lists: Mixed Lists: Test 8
4134 !! wikitext
4135 :* d1
4136 ::* d2
4137 !! html
4138 <dl><dd><ul><li> d1</li></ul>
4139 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4140
4141 !! end
4142
4143
4144 !! test
4145 Definition Lists: Mixed Lists: Test 9
4146 !! wikitext
4147 *;foo :bar
4148 !! html
4149 <ul><li><dl><dt>foo&#160;</dt>
4150 <dd>bar</dd></dl></li></ul>
4151
4152 !! end
4153
4154
4155 !! test
4156 Definition Lists: Mixed Lists: Test 10
4157 !! wikitext
4158 *#;foo :bar
4159 !! html
4160 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4161 <dd>bar</dd></dl></li></ol></li></ul>
4162
4163 !! end
4164
4165 # The Parsoid team disagrees with the PHP parser's seemingly-random
4166 # rules regarding dd/dt on the next two tests. Parsoid is more
4167 # consistent, and recognizes the shared nesting and keeps the
4168 # still-open tags around until the nesting is complete.
4169 # (And tidy again converts <dt> to <dd> before 'bar'.)
4170
4171 !! test
4172 Definition Lists: Mixed Lists: Test 11
4173 !! wikitext
4174 *#*#;*;;foo :bar
4175 *#*#;boo :baz
4176 !! html/php
4177 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4178 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4179 <dl><dt>boo&#160;</dt>
4180 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4181
4182 !! html/php+tidy
4183 <ul>
4184 <li>
4185 <ol>
4186 <li>
4187 <ul>
4188 <li>
4189 <ol>
4190 <li>
4191 <dl>
4192 <dt>foo&#160;</dt>
4193 <dd>
4194 <ul>
4195 <li>
4196 <dl>
4197 <dd>
4198 <dl>
4199 <dt>bar</dt>
4200 </dl>
4201 </dd>
4202 </dl>
4203 </li>
4204 </ul>
4205 </dd>
4206 </dl>
4207 <dl>
4208 <dt>boo&#160;</dt>
4209 <dd>baz</dd>
4210 </dl>
4211 </li>
4212 </ol>
4213 </li>
4214 </ul>
4215 </li>
4216 </ol>
4217 </li>
4218 </ul>
4219 !! html/parsoid
4220 <ul>
4221 <li>
4222 <ol>
4223 <li>
4224 <ul>
4225 <li>
4226 <ol>
4227 <li>
4228 <dl>
4229 <dt>
4230 <ul>
4231 <li>
4232 <dl>
4233 <dt>
4234 <dl>
4235 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4236 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4237 </dl></dt>
4238 </dl></li>
4239 </ul></dt>
4240 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4241 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4242 </dl></li>
4243 </ol></li>
4244 </ul></li>
4245 </ol></li>
4246 </ul>
4247 !! end
4248
4249
4250 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4251 # From whitelist:
4252 # * The test is wrong, there are two colons where there should be :;
4253 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4254 !! test
4255 Definition Lists: Weird Ones: Test 1
4256 !! wikitext
4257 *#;*::;; foo : bar (who uses this?)
4258 !! html/php
4259 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4260 <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>
4261
4262 !! html/php+tidy
4263 <ul>
4264 <li>
4265 <ol>
4266 <li>
4267 <dl>
4268 <dt>foo&#160;</dt>
4269 <dd>
4270 <ul>
4271 <li>
4272 <dl>
4273 <dd>
4274 <dl>
4275 <dd>
4276 <dl>
4277 <dd>
4278 <dl>
4279 <dt>bar (who uses this?)</dt>
4280 </dl>
4281 </dd>
4282 </dl>
4283 </dd>
4284 </dl>
4285 </dd>
4286 </dl>
4287 </li>
4288 </ul>
4289 </dd>
4290 </dl>
4291 </li>
4292 </ol>
4293 </li>
4294 </ul>
4295 !! html/parsoid
4296 <ul>
4297 <li>
4298 <ol>
4299 <li>
4300 <dl>
4301 <dt>
4302 <ul>
4303 <li>
4304 <dl>
4305 <dd>
4306 <dl>
4307 <dd>
4308 <dl>
4309 <dt>
4310 <dl>
4311 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4312 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4313 </dl></dt>
4314 </dl></dd>
4315 </dl></dd>
4316 </dl></li>
4317 </ul></dt>
4318 </dl></li>
4319 </ol></li>
4320 </ul>
4321 !! end
4322
4323 !! test
4324 Definition Lists: colons occurring in tags
4325 !! wikitext
4326 ;a:b
4327 ;'''a:b'''
4328 ;<i>a:b</i>
4329 ;<span>a:b</span>
4330 ;<div>a:b</div>
4331 ;<div>a
4332 :b</div>
4333 ;{{echo|a:b}}
4334 ;{{echo|''a:b''}}
4335 ;;;''a:b''
4336 !! html+tidy
4337 <dl>
4338 <dt>a</dt>
4339 <dd>b</dd>
4340 <dt><b>a:b</b></dt>
4341 <dt><i>a:b</i></dt>
4342 <dt><span>a:b</span></dt>
4343 <dd>
4344 <div>a:b</div>
4345 </dd>
4346 <dd>
4347 <div>a
4348 <dl>
4349 <dd>b</dd>
4350 </dl>
4351 </div>
4352 </dd>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 <dl>
4358 <dd>
4359 <dl>
4360 <dd>
4361 <dl>
4362 <dt><i>a:b</i></dt>
4363 </dl>
4364 </dd>
4365 </dl>
4366 </dd>
4367 </dl>
4368 !! html/parsoid
4369 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4370 <dt><b>a:b</b></dt>
4371 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4372 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4373 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4374 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4375 <dd>b</dd>
4376 <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>
4377 <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>
4378 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4379 !! end
4380
4381 !! test
4382 Definition Lists: colons and tables 1
4383 !! wikitext
4384 :{|
4385 | x
4386 |}
4387 :{|
4388 | y
4389 |}
4390 !! html
4391 <dl><dd><table>
4392 <tr>
4393 <td> x
4394 </td></tr></table></dd></dl>
4395 <dl><dd><table>
4396 <tr>
4397 <td> y
4398 </td></tr></table></dd></dl>
4399
4400 !! end
4401
4402 # Parsoid's output (as documented below) differs from php's in this case.
4403 # This is probably a bug. If we fixup parsoid to match php's output, the
4404 # above test should pass and the below test case can be removed. It is
4405 # unclear which output is more desirable.
4406
4407 !! test
4408 Definition Lists: colons and tables 2
4409 !! wikitext
4410 :{|
4411 | x
4412 |}
4413 :{|
4414 | y
4415 |}
4416 !! html/parsoid
4417 <dl><dd><table>
4418 <tr>
4419 <td> x
4420 </td></tr></table></dd>
4421 <dd><table>
4422 <tr>
4423 <td> y
4424 </td></tr></table></dd></dl>
4425 !! end
4426
4427 !! test
4428 Definition Lists: template interaction
4429 !! wikitext
4430 ::{{definition_list}}
4431
4432 :one
4433 ::{{definition_list}}
4434 :::two
4435 :::three
4436 ::four
4437 !! html/parsoid
4438 <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">
4439 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4440
4441 <dl><dd data-parsoid='{}'>one
4442 <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">
4443 </span><dd about="#mwt2">two
4444 <dl><dd>two</dd>
4445 <dd>three</dd></dl></dd>
4446 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4447 !! end
4448
4449
4450 ###
4451 ### External links
4452 ###
4453 !! test
4454 External links: non-bracketed
4455 !! wikitext
4456 Non-bracketed: http://example.com
4457 !! html
4458 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4459 </p>
4460 !! end
4461
4462 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4463 !! test
4464 External links: numbered
4465 !! wikitext
4466 Numbered: [http://example.com]
4467 Numbered: [http://example.net]
4468 Numbered: [http://example.com]
4469 !! html/php
4470 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4471 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4472 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4473 </p>
4474 !! html/parsoid
4475 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4476 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4477 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4478 !!end
4479
4480 !! test
4481 External links: specified text
4482 !! wikitext
4483 Specified text: [http://example.com link]
4484 !! html
4485 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4486 </p>
4487 !!end
4488
4489 !! test
4490 External links: trail
4491 !! wikitext
4492 Linktrails should not work for external links: [http://example.com link]s
4493 !! html
4494 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4495 </p>
4496 !! end
4497
4498 !! test
4499 External links: dollar sign in URL
4500 !! wikitext
4501 http://example.com/1$2345
4502 !! html
4503 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4504 </p>
4505 !! end
4506
4507 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4508 !! test
4509 External links: dollar sign in URL (autonumber)
4510 !! wikitext
4511 [http://example.com/1$2345]
4512 !! html/php
4513 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4514 </p>
4515 !! html/parsoid
4516 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4517 !!end
4518
4519 !! test
4520 External links: open square bracket forbidden in URL (bug 4377)
4521 !! options
4522 parsoid=wt2html,wt2wt,html2html
4523 !! wikitext
4524 http://example.com/1[2345
4525 !! html/php
4526 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4530 !! end
4531
4532 !! test
4533 External links: open square bracket forbidden in URL (named) (bug 4377)
4534 !! options
4535 parsoid=wt2html,html2html
4536 !! wikitext
4537 [http://example.com/1[2345]
4538 !! html/php
4539 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4540 </p>
4541 !! html/parsoid
4542 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4543 !!end
4544
4545 # parsoid adds a space before the link name
4546 !! test
4547 External links: open square bracket forbidden in URL (named) (bug 4377)
4548 Parsoid variant.
4549 !! wikitext
4550 [http://example.com/1 [2345]
4551 !! html
4552 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4553 </p>
4554 !!end
4555
4556 !! test
4557 External links: nowiki in URL link text (bug 6230)
4558 !! wikitext
4559 [http://example.com/ <nowiki>''example site''</nowiki>]
4560 !! html
4561 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4562 </p>
4563 !! end
4564
4565 !! test
4566 External links: newline forbidden in text (bug 6230 regression check)
4567 !! wikitext
4568 [http://example.com/ first
4569 second]
4570 !! html
4571 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4572 second]
4573 </p>
4574 !!end
4575
4576 !! test
4577 External links: Pipe char between url and text
4578 !! wikitext
4579 [http://example.com | link]
4580 !! html
4581 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4582 </p>
4583 !!end
4584
4585 !! test
4586 External links: protocol-relative URL in brackets
4587 !! wikitext
4588 [//example.com/ Test]
4589 !! html
4590 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4591 </p>
4592 !! end
4593
4594 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4595 !! test
4596 External links: protocol-relative URL in brackets without text
4597 !! wikitext
4598 [//example.com]
4599 !! html/php
4600 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4601 </p>
4602 !! html/parsoid
4603 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4604 !! end
4605
4606 !! test
4607 External links: protocol-relative URL in free text is left alone
4608 !! wikitext
4609 //example.com/Foo
4610 !! html
4611 <p>//example.com/Foo
4612 </p>
4613 !!end
4614
4615 !! test
4616 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4617 !! wikitext
4618 foo//example.com/Foo
4619 !! html
4620 <p>foo//example.com/Foo
4621 </p>
4622 !! end
4623
4624 !! test
4625 External links: with no contents
4626 !! wikitext
4627 [http://en.wikipedia.org/wiki/Foo]
4628
4629 [[wikipedia:Foo|Bar]]
4630
4631 [[wikipedia:Foo|<span>Bar</span>]]
4632 !! html/php
4633 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4634 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4635 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4636 </p>
4637 !! html/parsoid
4638 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4641 !! end
4642
4643 !! test
4644 External links: Free with trailing punctuation
4645 !! wikitext
4646 http://example.com,
4647 http://example.com;
4648 http://example.com\
4649 http://example.com.
4650 http://example.com:
4651 http://example.com!
4652 http://example.com?
4653 http://example.com)
4654 http://example.com/url_with_(brackets)
4655 (http://example.com/url_without_brackets)
4656 http://example.com/url_with_entity&amp;
4657 http://example.com/url_with_entity&#x26;
4658 http://example.com/url_with_entity&#038;
4659 http://example.com/url_with_entity&nbsp;
4660 http://example.com/url_with_entity&#xA0;
4661 http://example.com/url_with_entity&#160;
4662 http://example.com/url_with_entity&lt;
4663 http://example.com/url_with_entity&#x3C;
4664 http://example.com/url_with_entity&#60;
4665 !! html/php
4666 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4667 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4670 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4675 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4685 </p>
4686 !! html/parsoid
4687 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4688 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4691 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4696 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4697 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4700 <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>
4701 <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>
4702 <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>
4703 <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>
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;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4706 !! end
4707
4708 !! test
4709 External links: tricky Parsoid html2html case
4710 !! options
4711 parsoid=wt2html,wt2wt,html2html
4712 !! wikitext
4713 http://example.com/url_with_entity&amp;amp;
4714 !! html/php
4715 <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>;
4716 </p>
4717 !! html/parsoid
4718 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4719 !! end
4720
4721 !! test
4722 External links: Free with trailing quotes (T113666)
4723 !! wikitext
4724 '''News:''' Stuff here
4725
4726 news:'a'b''c''d e
4727 !! html/php
4728 <p><b>News:</b> Stuff here
4729 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4730 </p>
4731 !! html/parsoid
4732 <p><b>News:</b> Stuff here</p>
4733 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4734 !! end
4735
4736 !! test
4737 External links: Lone protocols are never linked (T105697)
4738 !! wikitext
4739 http://
4740 http://;
4741 (http://)
4742 bitcoin:
4743 bitcoin:;
4744 (bitcoin:)
4745 !! html
4746 <p>http://
4747 http://;
4748 (http://)
4749 bitcoin:
4750 bitcoin:;
4751 (bitcoin:)
4752 </p>
4753 !! end
4754
4755 !! test
4756 External links: No preceding word characters allowed (bug 65278)
4757 !! wikitext
4758 NOPEhttp://example.com
4759 N0http://example.com
4760 ok:http://example.com
4761 ok-http://example.com
4762 !! html
4763 <p>NOPEhttp://example.com
4764 N0http://example.com
4765 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4766 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4767 </p>
4768 !! end
4769
4770 !! test
4771 External image
4772 !! wikitext
4773 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4774 !! html
4775 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4776 </p>
4777 !! end
4778
4779 !! test
4780 External image from https
4781 !! wikitext
4782 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4783 !! html
4784 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4785 </p>
4786 !! end
4787
4788 !! test
4789 External image (when not allowed)
4790 !! options
4791 wgAllowExternalImages=0
4792 !! wikitext
4793 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4794 !! html
4795 <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>
4796 </p>
4797 !! end
4798
4799 !! test
4800 Link to non-http image, no img tag
4801 !! wikitext
4802 Link to non-http image, no img tag: ftp://example.com/test.jpg
4803 !! html
4804 <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>
4805 </p>
4806 !! end
4807
4808 !! test
4809 External links: terminating separator
4810 !! wikitext
4811 Terminating separator: http://example.com/thing,
4812 !! html
4813 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4814 </p>
4815 !! end
4816
4817 !! test
4818 External links: intervening separator
4819 !! wikitext
4820 Intervening separator: http://example.com/1,2,3
4821 !! html
4822 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4823 </p>
4824 !! end
4825
4826 !! test
4827 External links: old bug with URL in query
4828 !! wikitext
4829 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4830 !! html
4831 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: old URL-in-URL bug, mixed protocols
4837 !! wikitext
4838 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4839 !! html
4840 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4841 </p>
4842 !!end
4843
4844 !! test
4845 External links: URL in text
4846 !! wikitext
4847 URL in text: [http://example.com http://example.com]
4848 !! html
4849 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4850 </p>
4851 !! end
4852
4853 !! test
4854 External links: Clickable images
4855 !! wikitext
4856 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4857 !! html/php
4858 <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>
4859 </p>
4860 !! html/parsoid
4861 <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>
4862 !! end
4863
4864 !! test
4865 External links: raw ampersand
4866 !! wikitext
4867 Old &amp; use: http://x&y
4868 !! html
4869 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4870 </p>
4871 !! end
4872
4873 !! test
4874 External links: encoded ampersand
4875 !! wikitext
4876 Old &amp; use: http://x&amp;y
4877 !! html/php
4878 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4879 </p>
4880 !! html/parsoid
4881 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4882 !! end
4883
4884 !! test
4885 External links: encoded equals (bug 6102)
4886 !! wikitext
4887 http://example.com/?foo&#61;bar
4888 !! html/php
4889 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4890 </p>
4891 !! html/parsoid
4892 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4893 !! end
4894
4895 ##
4896 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4897 ## does it number them. As discussed in bug 53505, we can identify
4898 ## autonumbered links via CSS.
4899 ##
4900
4901 !! test
4902 External links: [raw ampersand]
4903 !! wikitext
4904 Old &amp; use: [http://x&y]
4905 !! html/php
4906 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4907 </p>
4908 !! html/parsoid
4909 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4910 !! end
4911
4912 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4913 # mode will return the [raw ampersand] wikitext
4914 !! test
4915 External links: [encoded ampersand]
4916 !! options
4917 parsoid=wt2html,wt2wt,html2html
4918 !! wikitext
4919 Old &amp; use: [http://x&amp;y]
4920 !! html/php
4921 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4922 </p>
4923 !! html/parsoid
4924 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4925 !! end
4926
4927 !! test
4928 External links: [raw equals]
4929 !! wikitext
4930 [http://example.com/?foo=bar]
4931 !! html/php
4932 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4933 </p>
4934 !! html/parsoid
4935 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4936 !! end
4937
4938 # note that parsoid html is identical to [raw equals] case; so html2wt
4939 # mode will return the [raw equals] wikitext
4940 !! test
4941 External links: [encoded equals] (bug 6102)
4942 !! options
4943 parsoid=wt2html,wt2wt,html2html
4944 !! wikitext
4945 [http://example.com/?foo&#61;bar]
4946 !! html/php
4947 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4948 </p>
4949 !! html/parsoid
4950 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4951 !! end
4952
4953 # xxx parsoid strips the IDN character, so the round-trip tests will
4954 # obviously fail and are disabled. --cscott
4955 !! test
4956 External links: [IDN ignored character reference in hostname; strip it right off]
4957 !! options
4958 parsoid=wt2html,wt2wt,html2html
4959 !! wikitext
4960 [http://e&zwnj;xample.com/]
4961 !! html/php
4962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4966 !! end
4967
4968 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4969 # Where an external link could easily circumvent the sanitization of the text of
4970 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4971 # test demands a higher standard. That's a bit strange.
4972 #
4973 # Example:
4974 #
4975 # http://e‌xample.com -> [http://example.com|http://example.com]
4976 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4977 #
4978 # The first example is sanitized, but the second is not. Any security benefits
4979 # from this production are trivial to circumvent. Either remove this test and
4980 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4981 # the test accordingly.
4982 #
4983 # All our love,
4984 # The Parsoid team.
4985 # xxx parsoid strips the IDN character, so the round-trip tests will
4986 # obviously fail and are disabled. --cscott
4987 !! test
4988 External links: IDN ignored character reference in hostname; strip it right off
4989 !! options
4990 parsoid=wt2html,html2html
4991 !! wikitext
4992 http://e&zwnj;xample.com/
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4998 !! end
4999
5000 !! test
5001 External links: www.jpeg.org (bug 554)
5002 !! wikitext
5003 http://www.jpeg.org
5004 !! html
5005 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5006 </p>
5007 !! end
5008
5009 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5010 !! test
5011 External links: URL within URL (original bug 2)
5012 !! wikitext
5013 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5014 !! html/php
5015 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5016 </p>
5017 !! html/parsoid
5018 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5019 !! end
5020
5021 !! test
5022 BUG 361: URL inside bracketed URL
5023 !! wikitext
5024 [http://www.example.com/foo http://www.example.com/bar]
5025 !! html
5026 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5027 </p>
5028 !! end
5029
5030 !! test
5031 BUG 361: URL within URL, not bracketed
5032 !! wikitext
5033 http://www.example.com/foo?=http://www.example.com/bar
5034 !! html
5035 <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>
5036 </p>
5037 !! end
5038
5039 !! test
5040 BUG 289: ">"-token in URL-tail
5041 !! wikitext
5042 http://www.example.com/<hello>
5043 !! html
5044 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5045 </p>
5046 !!end
5047
5048 !! test
5049 BUG 289: literal ">"-token in URL-tail
5050 !! wikitext
5051 http://www.example.com/<b>html</b>
5052 !! html/php
5053 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5054 </p>
5055 !! html/parsoid
5056 <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>
5057 !! end
5058
5059 !! test
5060 BUG 289: ">"-token in bracketed URL
5061 !! wikitext
5062 [http://www.example.com/<hello> stuff]
5063 !! html
5064 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5065 </p>
5066 !!end
5067
5068 !! test
5069 BUG 289: literal ">"-token in bracketed URL
5070 !! wikitext
5071 [http://www.example.com/<b>html</b> stuff]
5072 !! html
5073 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5074 </p>
5075 !!end
5076
5077 !! test
5078 BUG 289: literal double quote at end of URL
5079 !! wikitext
5080 http://www.example.com/"hello"
5081 !! html
5082 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5083 </p>
5084 !!end
5085
5086 !! test
5087 BUG 289: literal double quote in bracketed URL
5088 !! wikitext
5089 [http://www.example.com/"hello" stuff]
5090 !! html
5091 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5092 </p>
5093 !!end
5094
5095 !! test
5096 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5097 !! wikitext
5098 [http://www.example.com test]
5099 !! html
5100 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5101 </p>
5102 !! end
5103
5104 !! test
5105 External links: link text with spaces
5106 !! wikitext
5107 [http://www.example.com a b c]
5108 [http://www.example.com ''a'' ''b'']
5109 !! html
5110 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5111 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5112 </p>
5113 !! end
5114
5115 !! test
5116 External links: wiki links within external link (Bug 3695)
5117 !! options
5118 parsoid=wt2html,html2html
5119 !! wikitext
5120 [http://example.com [[wikilink]] embedded in ext link]
5121 !! html/php
5122 <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>
5123 </p>
5124 !! html/parsoid
5125 <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>
5126 !! end
5127
5128 !! test
5129 BUG 787: Links with one slash after the url protocol are invalid
5130 !! wikitext
5131 http:/example.com
5132
5133 [http:/example.com title]
5134 !! html
5135 <p>http:/example.com
5136 </p><p>[http:/example.com title]
5137 </p>
5138 !! end
5139
5140 !! test
5141 Bracketed external links with template-generated invalid target
5142 !! wikitext
5143 [{{echo|http:/example.com}} title]
5144 !! html
5145 <p>[http:/example.com title]
5146 </p>
5147 !! end
5148
5149 !! test
5150 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5151 !! wikitext
5152 ''[http://example.com text'']
5153 [http://example.com '''text]'''
5154 ''Something [http://example.com in italic'']
5155 ''Something [http://example.com mixed''''', even bold]'''
5156 '''''Now [http://example.com both''''']
5157 !! html
5158 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5159 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5160 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5161 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5162 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5163 </p>
5164 !! end
5165
5166
5167 !! test
5168 Bug 4781: %26 in URL
5169 !! wikitext
5170 http://www.example.com/?title=AT%26T
5171 !! html/php
5172 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5173 </p>
5174 !! html/parsoid
5175 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5176 !! end
5177
5178 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5179 # % is actually legal in HTML5. Any change in output would need testing though.
5180 !! test
5181 Bug 4781, 5267: %25 in URL
5182 !! wikitext
5183 http://www.example.com/?title=100%25_Bran
5184 !! html/php
5185 <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>
5186 </p>
5187 !! html/parsoid
5188 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5189 !! end
5190
5191 !! test
5192 Bug 4781, 5267: %28, %29 in URL
5193 !! wikitext
5194 http://www.example.com/?title=Ben-Hur_%281959_film%29
5195 !! html/php
5196 <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>
5197 </p>
5198 !! html/parsoid
5199 <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>
5200 !! end
5201
5202
5203 !! test
5204 Bug 4781: %26 in autonumber URL
5205 !! wikitext
5206 [http://www.example.com/?title=AT%26T]
5207 !! html/php
5208 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5209 </p>
5210 !! html/parsoid
5211 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5212 !! end
5213
5214 !! test
5215 Bug 4781, 5267: %26 in autonumber URL
5216 !! wikitext
5217 [http://www.example.com/?title=100%25_Bran]
5218 !! html/php
5219 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5220 </p>
5221 !! html/parsoid
5222 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5223 !! end
5224
5225 !! test
5226 Bug 4781, 5267: %28, %29 in autonumber URL
5227 !! wikitext
5228 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5229 !! html/php
5230 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5234 !! end
5235
5236
5237 !! test
5238 Bug 4781: %26 in bracketed URL
5239 !! wikitext
5240 [http://www.example.com/?title=AT%26T link]
5241 !! html/php
5242 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5243 </p>
5244 !! html/parsoid
5245 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5246 !! end
5247
5248 !! test
5249 Bug 4781, 5267: %25 in bracketed URL
5250 !! wikitext
5251 [http://www.example.com/?title=100%25_Bran link]
5252 !! html
5253 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5254 </p>
5255 !! end
5256
5257 !! test
5258 Bug 4781, 5267: %28, %29 in bracketed URL
5259 !! wikitext
5260 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5261 !! html/php
5262 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5263 </p>
5264 !! html/parsoid
5265 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5266 !! end
5267
5268 !! test
5269 External link containing a period in the anchor. (bug 63947)
5270 !! wikitext
5271 [//foo.org/bar#baz. bang]
5272
5273 [//foo.org/bar. bang]
5274 !! html/php
5275 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5276 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5277 </p>
5278 !! html/parsoid
5279 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5280 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5281 !! end
5282
5283 !! test
5284 External link containing a single quote. (bug 63947)
5285 !! wikitext
5286 [//foo.org/bar'baz]
5287
5288 [//foo.org/bar'baz bang]
5289 !! html/php
5290 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5291 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5292 </p>
5293 !! html/parsoid
5294 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5296 !! end
5297
5298 !! test
5299 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5300 !! wikitext
5301 Some [http://example.com/ pretty ''italics'' and stuff]!
5302 !! html
5303 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5304 </p>
5305 !! end
5306
5307 !! test
5308 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5309 !! wikitext
5310 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5311 !! html
5312 <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>
5313 </p>
5314 !! end
5315
5316 !! test
5317 External link containing double-single-quotes with no space separating the url from text in italics
5318 !! wikitext
5319 [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]].]
5320 !! html/php
5321 <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>
5322 </p>
5323 !! html/php+tidy
5324 <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>
5325 !! html/parsoid
5326 <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>
5327 !! end
5328
5329 !! test
5330 External link with comments in link text
5331 !! wikitext
5332 [http://www.google.com Google <!-- comment -->]
5333 !! html/php
5334 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5335 </p>
5336 !! html/parsoid
5337 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5338 !! end
5339
5340 !! test
5341 External link to bare IPv4 address
5342 !! wikitext
5343 [http://192.168.0.1 Link]
5344 !! html/php
5345 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5346 </p>
5347 !! html/parsoid
5348 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5349 !! end
5350
5351 !! test
5352 URL-encoding in URL functions (single parameter)
5353 !! wikitext
5354 {{localurl:Some page|amp=&}}
5355 !! html
5356 <p>/index.php?title=Some_page&amp;amp=&amp;
5357 </p>
5358 !! end
5359
5360 !! test
5361 URL-encoding in URL functions (multiple parameters)
5362 !! wikitext
5363 {{localurl:Some page|q=?&amp=&}}
5364 !! html
5365 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5366 </p>
5367 !! end
5368
5369 !! test
5370 Brackets in urls
5371 !! wikitext
5372 http://example.com/index.php?foozoid%5B%5D=bar
5373
5374 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5375 !! html/php
5376 <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>
5377 </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>
5378 </p>
5379 !! html/parsoid
5380 <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>
5381
5382 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5383 !! end
5384
5385 !! test
5386 IPv6 urls, autolink format (T23261)
5387 !! wikitext
5388 http://[2404:130:0:1000::187:2]/index.php
5389
5390 Examples from RFC 2373, section 2.2:
5391 * http://[1080::8:800:200C:417A]/unicast
5392 * http://[FF01::101]/multicast
5393 * http://[::1]/loopback
5394 * http://[::]/unspecified
5395 * http://[::13.1.68.3]/ipv4compat
5396 * http://[::FFFF:129.144.52.38]/ipv4compat
5397
5398 Examples from RFC 2732, section 2:
5399 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5400 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5401 * http://[3ffe:2a00:100:7031::1]
5402 * http://[1080::8:800:200C:417A]/foo
5403 * http://[::192.9.5.5]/ipng
5404 * http://[::FFFF:129.144.52.38]:80/index.html
5405 * http://[2010:836B:4179::836B:4179]
5406
5407 !! html/php
5408 <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>
5409 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5410 </p>
5411 <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>
5412 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5413 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5416 <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>
5417 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5418 </p>
5419 <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>
5420 <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>
5421 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5422 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5423 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5424 <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>
5425 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5426
5427 !! html/parsoid
5428 <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>
5429
5430 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5431 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5432 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5437
5438 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5439 <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>
5440 <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>
5441 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5442 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5443 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5444 <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>
5445 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5446 !! end
5447
5448 !! test
5449 IPv6 urls, bracketed format (T23261)
5450 !! wikitext
5451 [http://[2404:130:0:1000::187:2]/index.php test]
5452
5453 Examples from RFC 2373, section 2.2:
5454 * [http://[1080::8:800:200C:417A] unicast]
5455 * [http://[FF01::101] multicast]
5456 * [http://[::1]/ loopback]
5457 * [http://[::] unspecified]
5458 * [http://[::13.1.68.3] ipv4compat]
5459 * [http://[::FFFF:129.144.52.38] ipv4compat]
5460
5461 Examples from RFC 2732, section 2:
5462 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5463 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5464 * [http://[3ffe:2a00:100:7031::1] 3]
5465 * [http://[1080::8:800:200C:417A]/foo 4]
5466 * [http://[::192.9.5.5]/ipng 5]
5467 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5468 * [http://[2010:836B:4179::836B:4179] 7]
5469
5470 !! html/php
5471 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5472 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5473 </p>
5474 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5475 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5480 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5481 </p>
5482 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5489
5490 !! html/parsoid
5491 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5492
5493 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5494 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5495 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5500
5501 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5502 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5509 !! end
5510
5511 !! test
5512 Non-extlinks in brackets
5513 !! wikitext
5514 [foo]
5515 [foo bar]
5516 [foo ''bar'']
5517 [fool's] errand
5518 [fool's errand]
5519 [{{echo|foo}}]
5520 [{{echo|foo}} bar]
5521 [{{echo|foo}} ''bar'']
5522 [{{echo|foo}}l's] errand
5523 [{{echo|foo}}l's errand]
5524 [url={{echo|foo}}]
5525 [url=http://example.com]
5526 [http:// bare protocols don't count]
5527 !! html/php
5528 <p>[foo]
5529 [foo bar]
5530 [foo <i>bar</i>]
5531 [fool's] errand
5532 [fool's errand]
5533 [foo]
5534 [foo bar]
5535 [foo <i>bar</i>]
5536 [fool's] errand
5537 [fool's errand]
5538 [url=foo]
5539 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5540 [http:// bare protocols don't count]
5541 </p>
5542 !! html/parsoid
5543 <p>[foo]
5544 [foo bar]
5545 [foo <i>bar</i>]
5546 [fool's] errand
5547 [fool's errand]
5548 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5554 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5555 [http:// bare protocols don't count]</p>
5556 !! end
5557
5558 !! test
5559 Percent encoding in external links
5560 !! wikitext
5561 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5562 !! html/php
5563 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5564 </p>
5565 !! html/parsoid
5566 <p><a rel="mw:ExtLink"
5567 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5568 !! end
5569
5570 !! test
5571 Use url link syntax for links where the content is equal the link target
5572 !! wikitext
5573 http://example.com
5574 !! html/php
5575 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5576 </p>
5577 !! html/parsoid
5578 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5579 !! end
5580
5581 !! test
5582 Parenthesis in external links, especially URL links
5583 !! wikitext
5584 http://example.com)
5585
5586 http://example.com/test)
5587
5588 http://example.com/(test)
5589
5590 http://example.com/((test)
5591
5592 (http://example.com/(test))
5593
5594 (http://example.com/(test)))))
5595
5596 http://example.com/a)b
5597
5598 [http://example.com) foo]
5599 !! html/php
5600 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5601 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5602 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5603 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5604 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</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/a)b">http://example.com/a)b</a>
5607 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5608 </p>
5609 !! html/parsoid
5610 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5611 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5612 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5613 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5614 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</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/a)b">http://example.com/a)b</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5618 !! end
5619
5620 !! test
5621 Parenthesis in external links, w/ transclusion or comment
5622 !! wikitext
5623 (http://example.com/{{echo|hi}})
5624
5625 (http://example.com<!-- hi -->)
5626 !! html/php
5627 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5629 </p>
5630 !! html/parsoid
5631 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5632
5633 <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>
5634 !! end
5635
5636 !! test
5637 Serialize <a> tags with invalid link targets as plain text
5638 !! options
5639 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5640 !! html/parsoid
5641 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5642 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5644 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5645 !! wikitext
5646 text
5647 <nowiki>*</nowiki>text
5648 <nowiki>[[foo]]</nowiki>
5649 <nowiki>*a [[foo]]</nowiki>
5650 !! end
5651
5652 !! test
5653 mw:ExtLink -vs- mw:WikiLink (T94723)
5654 !! options
5655 parsoid=html2wt
5656 !! html/parsoid
5657 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5658 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5659 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5660 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5661 <p>
5662 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5663 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5664 </p>
5665 !! wikitext
5666 [[Foo|Bar]]
5667 [[Foo|Bar]]
5668 [[wikipedia:Foo|Bar]]
5669 [[wikipedia:Foo|Bar]]
5670
5671 [[wikipedia:European_Robin|European Robin]]
5672 [[wikipedia:European_Robin|European Robin]]
5673 !! end
5674
5675 !! test
5676 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5677 !! options
5678 parsoid=wt2wt
5679 !! wikitext
5680 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5681 !! html/parsoid
5682 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5683 !! end
5684
5685
5686 ###
5687 ### Quotes
5688 ###
5689
5690 !! test
5691 Quotes
5692 !! wikitext
5693 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5694
5695 Normal text. '''''Bold italic text.''''' Normal text.
5696 !! html
5697 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5698 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5699 </p>
5700 !! end
5701
5702
5703 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5704 # parser strips. The wikitext contains just the first half of the bold
5705 # quote pair.
5706 !! test
5707 Unclosed and unmatched quotes
5708 !! wikitext
5709 '''''Bold italic text '''with bold deactivated''' in between.'''''
5710
5711 '''''Bold italic text ''with italic deactivated'' in between.'''''
5712
5713 '''Bold text..
5714
5715 ..spanning two paragraphs (should not work).'''
5716
5717 '''Bold tag left open
5718
5719 ''Italic tag left open
5720
5721 Normal text.
5722
5723 <!-- Unmatching number of opening, closing tags: -->
5724 '''This year''''s election ''should'' beat '''last year''''s.
5725
5726 ''Tom'''s car is bigger than ''Susan'''s.
5727
5728 Plain ''italic'''s plain
5729 !! html/php
5730 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5731 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5732 </p><p><b>Bold text..</b>
5733 </p><p>..spanning two paragraphs (should not work).
5734 </p><p><b>Bold tag left open</b>
5735 </p><p><i>Italic tag left open</i>
5736 </p><p>Normal text.
5737 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5738 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5739 </p><p>Plain <i>italic'</i>s plain
5740 </p>
5741 !! html/parsoid
5742 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5743 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5744 </p><p><b>Bold text..</b>
5745 </p><p>..spanning two paragraphs (should not work).<b></b>
5746 </p><p><b>Bold tag left open</b>
5747 </p><p><i>Italic tag left open</i>
5748 </p><p>Normal text.
5749 </p>
5750 <!-- Unmatching number of opening, closing tags: -->
5751 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5752 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5753 </p><p>Plain <i>italic'</i>s plain
5754 </p>
5755 !! end
5756
5757 ###
5758 ### Tables
5759 ###
5760 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5761 ###
5762
5763 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5764 # is the bare minimum required by the spec, see:
5765 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5766 # Parsoid team replies: empty table tags are legal in HTML5
5767 !! test
5768 A table with no data.
5769 !! options
5770 parsoid=wt2html
5771 !! wikitext
5772 {||}
5773 !! html/php
5774
5775 !! html/parsoid
5776 <table></table>
5777
5778 !! end
5779
5780 !! test
5781 A table with stray table end tags on start tag line (wt2html)
5782 !! options
5783 parsoid=wt2html
5784 !! wikitext
5785 {|style="color: red;"|}
5786
5787 {|style="color: red;" |}
5788 |foo
5789 |}
5790
5791 {|style="color: red;"|} id="foo"
5792 |foo
5793 |}
5794
5795 {|style="color: red;" |} id="foo"
5796 |foo
5797 |}
5798 !! html
5799 <table style="color: red;"></table>
5800
5801 <table style="color: red;">
5802 <tbody><tr>
5803 <td>foo</td>
5804 </tr></tbody>
5805 </table>
5806
5807 <table style="color: red;" id="foo">
5808 <tbody><tr>
5809 <td>foo</td>
5810 </tr></tbody>
5811 </table>
5812
5813 <table style="color: red;" id="foo">
5814 <tbody><tr>
5815 <td>foo</td>
5816 </tr></tbody>
5817 </table>
5818
5819 !! end
5820
5821 !! test
5822 A table with no data (take 2)
5823 !! wikitext
5824 {|
5825 |}
5826 !! html/parsoid
5827 <table></table>
5828 !! end
5829
5830 # A table with nothing but a caption is invalid XHTML, we might want to render
5831 # this as <p>caption</p>
5832 # Parsoid team replies: table with only a caption is legal in HTML5
5833 !! test
5834 A table with nothing but a caption
5835 !! wikitext
5836 {|
5837 |+ caption
5838 |}
5839 !! html/php
5840 <table>
5841 <caption> caption
5842 </caption><tr><td></td></tr></table>
5843
5844 !! html/parsoid
5845 <table><caption> caption</caption></table>
5846 !! end
5847
5848 !! test
5849 A table with caption with default-spaced attributes and a table row
5850 !! wikitext
5851 {|
5852 |+ style="color: red;" | caption1
5853 |-
5854 | foo
5855 |}
5856 !! html
5857 <table>
5858 <caption style="color: red;"> caption1
5859 </caption>
5860 <tr>
5861 <td> foo
5862 </td></tr></table>
5863
5864 !! end
5865
5866 !! test
5867 A table with captions with non-default spaced attributes and a table row
5868 !! wikitext
5869 {|
5870 |+style="color: red;"|caption2
5871 |+ style="color: red;"| caption3
5872 |-
5873 | foo
5874 |}
5875 !! html
5876 <table>
5877 <caption style="color: red;">caption2
5878 </caption>
5879 <caption style="color: red;"> caption3
5880 </caption>
5881 <tr>
5882 <td> foo
5883 </td></tr></table>
5884
5885 !! end
5886
5887 !! test
5888 Table td-cell syntax variations
5889 !! wikitext
5890 {|
5891 | foo bar foo | baz
5892 | foo bar foo || baz
5893 | style='color:red;' | baz
5894 | style='color:red;' || baz
5895 |}
5896 !! html
5897 <table>
5898 <tr>
5899 <td> baz
5900 </td>
5901 <td> foo bar foo </td>
5902 <td> baz
5903 </td>
5904 <td style="color:red;"> baz
5905 </td>
5906 <td> style='color:red;' </td>
5907 <td> baz
5908 </td></tr></table>
5909
5910 !! end
5911
5912 !! test
5913 Simple table
5914 !! wikitext
5915 {|
5916 | 1 || 2
5917 |-
5918 | 3 || 4
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <td> 1 </td>
5924 <td> 2
5925 </td></tr>
5926 <tr>
5927 <td> 3 </td>
5928 <td> 4
5929 </td></tr></table>
5930
5931 !! end
5932
5933 !! test
5934 Simple table but with multiple dashes for row wikitext
5935 !! wikitext
5936 {|
5937 | foo
5938 |-----
5939 | bar
5940 |}
5941 !! html
5942 <table>
5943 <tr>
5944 <td> foo
5945 </td></tr>
5946 <tr>
5947 <td> bar
5948 </td></tr></table>
5949
5950 !! end
5951
5952 !! test
5953 Multiplication table
5954 !! wikitext
5955 {| border="1" cellpadding="2"
5956 |+Multiplication table
5957 |-
5958 ! &times; !! 1 !! 2 !! 3
5959 |-
5960 ! 1
5961 | 1 || 2 || 3
5962 |-
5963 ! 2
5964 | 2 || 4 || 6
5965 |-
5966 ! 3
5967 | 3 || 6 || 9
5968 |-
5969 ! 4
5970 | 4 || 8 || 12
5971 |-
5972 ! 5
5973 | 5 || 10 || 15
5974 |}
5975 !! html
5976 <table border="1" cellpadding="2">
5977 <caption>Multiplication table
5978 </caption>
5979 <tr>
5980 <th> &#215; </th>
5981 <th> 1 </th>
5982 <th> 2 </th>
5983 <th> 3
5984 </th></tr>
5985 <tr>
5986 <th> 1
5987 </th>
5988 <td> 1 </td>
5989 <td> 2 </td>
5990 <td> 3
5991 </td></tr>
5992 <tr>
5993 <th> 2
5994 </th>
5995 <td> 2 </td>
5996 <td> 4 </td>
5997 <td> 6
5998 </td></tr>
5999 <tr>
6000 <th> 3
6001 </th>
6002 <td> 3 </td>
6003 <td> 6 </td>
6004 <td> 9
6005 </td></tr>
6006 <tr>
6007 <th> 4
6008 </th>
6009 <td> 4 </td>
6010 <td> 8 </td>
6011 <td> 12
6012 </td></tr>
6013 <tr>
6014 <th> 5
6015 </th>
6016 <td> 5 </td>
6017 <td> 10 </td>
6018 <td> 15
6019 </td></tr></table>
6020
6021 !! end
6022
6023 !! test
6024 Accept "||" in table headings
6025 !! wikitext
6026 {|
6027 !h1 || h2
6028 |}
6029 !! html
6030 <table>
6031 <tr>
6032 <th>h1 </th>
6033 <th> h2
6034 </th></tr></table>
6035
6036 !! end
6037
6038 !! test
6039 Accept "!!" in table data
6040 !! wikitext
6041 {|
6042 | Foo!! ||
6043 |}
6044 !! html
6045 <table>
6046 <tr>
6047 <td> Foo!! </td>
6048 <td>
6049 </td></tr></table>
6050
6051 !! html/parsoid
6052 <table>
6053 <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>
6054 </tbody></table>
6055 !! end
6056
6057 !! test
6058 Accept "||" in indented table headings
6059 !! wikitext
6060 :{|
6061 !h1 || h2
6062 |}
6063 !! html
6064 <dl><dd><table>
6065 <tr>
6066 <th>h1 </th>
6067 <th> h2
6068 </th></tr></table></dd></dl>
6069
6070 !! end
6071
6072 !! test
6073 Accept "!!" in templates
6074 !! wikitext
6075 {|
6076 !a {{echo|b!!c}}
6077 |}
6078 !! html/php
6079 <table>
6080 <tr>
6081 <th>a b</th>
6082 <th>c
6083 </th></tr></table>
6084
6085 !! html/parsoid
6086 <table>
6087 <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>
6088 !! end
6089
6090 !! test
6091 Accept "!!" in table headings after newline
6092 !! wikitext
6093 {|
6094 !a
6095 b!!c
6096 |}
6097 !! html/php
6098 <table>
6099 <tr>
6100 <th>a
6101 <p>b!!c
6102 </p>
6103 </th></tr></table>
6104
6105 !! html/parsoid
6106 <table>
6107 <tbody><tr><th>a
6108 <p>b!!c</p></th></tr>
6109 </tbody></table>
6110 !! end
6111
6112 !! test
6113 Accept "!!" in table data of mixed wikitext / html syntax
6114 !! wikitext
6115 {|
6116 !a
6117 <tr><td>b!!c</td></tr>
6118 |}
6119 !! html+tidy
6120 <table>
6121 <tr>
6122 <th>a</th>
6123 </tr>
6124 <tr>
6125 <td>b!!c</td>
6126 </tr>
6127 </table>
6128 !! html/parsoid
6129 <table>
6130 <tbody><tr><th>a</th></tr>
6131 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6132 </tbody></table>
6133 !! end
6134
6135 !! test
6136 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6137 !! wikitext
6138 {|
6139 !| h1
6140 || a
6141 |}
6142 !! html
6143 <table>
6144 <tr>
6145 <th> h1
6146 </th>
6147 <td> a
6148 </td></tr></table>
6149
6150 !! end
6151
6152 !!test
6153 Accept "| !" at start of line in tables (ignore !-attribute)
6154 !! wikitext
6155 {|
6156 |-
6157 | !style="color:red" | bar
6158 |}
6159 !! html
6160 <table>
6161
6162 <tr>
6163 <td> bar
6164 </td></tr></table>
6165
6166 !!end
6167
6168 !!test
6169 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 +/-
6170 !! wikitext
6171 {|
6172 |-
6173 |style='color:red;'|+1
6174 |style='color:blue;'|-1
6175 |-
6176 | 1 || 2 || 3
6177 | 1 ||+2 ||-3
6178 |-
6179 | +1
6180 | -1
6181 |}
6182 !! html
6183 <table>
6184
6185 <tr>
6186 <td style="color:red;">+1
6187 </td>
6188 <td style="color:blue;">-1
6189 </td></tr>
6190 <tr>
6191 <td> 1 </td>
6192 <td> 2 </td>
6193 <td> 3
6194 </td>
6195 <td> 1 </td>
6196 <td>+2 </td>
6197 <td>-3
6198 </td></tr>
6199 <tr>
6200 <td> +1
6201 </td>
6202 <td> -1
6203 </td></tr></table>
6204
6205 !!end
6206
6207 !! test
6208 Table rowspan
6209 !! wikitext
6210 {| border=1
6211 | Cell 1, row 1
6212 |rowspan=2| Cell 2, row 1 (and 2)
6213 | Cell 3, row 1
6214 |-
6215 | Cell 1, row 2
6216 | Cell 3, row 2
6217 |}
6218 !! html
6219 <table border="1">
6220 <tr>
6221 <td> Cell 1, row 1
6222 </td>
6223 <td rowspan="2"> Cell 2, row 1 (and 2)
6224 </td>
6225 <td> Cell 3, row 1
6226 </td></tr>
6227 <tr>
6228 <td> Cell 1, row 2
6229 </td>
6230 <td> Cell 3, row 2
6231 </td></tr></table>
6232
6233 !! end
6234
6235 !! test
6236 Nested table
6237 !! wikitext
6238 {| border=1
6239 | &alpha;
6240 |
6241 {| bgcolor=#ABCDEF border=2
6242 |nested
6243 |-
6244 |table
6245 |}
6246 |the original table again
6247 |}
6248 !! html
6249 <table border="1">
6250 <tr>
6251 <td> &#945;
6252 </td>
6253 <td>
6254 <table bgcolor="#ABCDEF" border="2">
6255 <tr>
6256 <td>nested
6257 </td></tr>
6258 <tr>
6259 <td>table
6260 </td></tr></table>
6261 </td>
6262 <td>the original table again
6263 </td></tr></table>
6264
6265 !! end
6266
6267 !! test
6268 Invalid attributes in table cell (bug 1830)
6269 !! wikitext
6270 {|
6271 |Cell:|broken
6272 |}
6273 !! html
6274 <table>
6275 <tr>
6276 <td>broken
6277 </td></tr></table>
6278
6279 !! end
6280
6281 !! test
6282 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6283 !! wikitext
6284 {|
6285 | title="foo" |bar
6286 | title="foo<nowiki>|</nowiki>" |bar
6287 | title="foo<nowiki>|</nowiki>" bar
6288 |}
6289 !! html/php
6290 <table>
6291 <tr>
6292 <td title="foo">bar
6293 </td>
6294 <td title="foo&#124;">bar
6295 </td>
6296 <td> title="foo|" bar
6297 </td></tr></table>
6298
6299 !! html/parsoid
6300 <table>
6301 <tbody><tr><td title="foo">bar</td>
6302 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6303 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6304 </tbody></table>
6305 !! end
6306
6307 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6308 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6309 # *2wt modes will fail.
6310 !! test
6311 Table security: embedded pipes
6312 !! options
6313 parsoid=wt2html,html2html
6314 !! wikitext
6315 {|
6316 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6317 !! html/php
6318 <table>
6319 <tr>
6320 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6321 <td>]" onmouseover="alert(document.cookie)"&gt;test
6322 </td>
6323 </tr>
6324 </table>
6325
6326 !! html/parsoid
6327 <table><tbody>
6328 <tr>
6329 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6330 !! end
6331
6332 !! test
6333 ! and || in element attributes should not be parsed as <th>/<td>
6334 !! wikitext
6335 {|
6336 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6337 |}
6338 !! html/php
6339 <table>
6340 <tr>
6341 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6347 </tbody></table>
6348 !! end
6349
6350 # FIXME: The output seems broken. Filed as T110268.
6351 !! test
6352 ! and || in td attributes should not be parsed as <th>/<td>
6353 !! options
6354 parsoid=wt2html
6355 !! wikitext
6356 {|
6357 | style="color: red !important;" data-contrived="put this here ||" | foo
6358 |}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <td> style="color: red !important;" data-contrived="put this here </td>
6363 <td> foo
6364 </td></tr></table>
6365
6366 !! html/parsoid
6367 <table>
6368 <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>
6369 </tbody></table>
6370 !! end
6371
6372 !! test
6373 Break on | in element attribute in template
6374 !! options
6375 parsoid=wt2html,html2html
6376 !! wikitext
6377 {{echo|1=<div class="hi|ho">ha</div>}}
6378 !! html/php
6379 <p>ho"&gt;ha&lt;/div&gt;
6380 </p>
6381 !! html/parsoid
6382 <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>
6383 !! end
6384
6385 !! test
6386 Indented table markup mixed with indented pre content (proposed in bug 6200)
6387 !! wikitext
6388 <table>
6389 <tr>
6390 <td>
6391 Text that should be rendered preformatted
6392 </td>
6393 </tr>
6394 </table>
6395 !! html
6396 <table>
6397 <tr>
6398 <td>
6399 <pre>Text that should be rendered preformatted
6400 </pre>
6401 </td>
6402 </tr>
6403 </table>
6404
6405 !! end
6406
6407 !! test
6408 1. Template-generated table cell attributes and cell content
6409 !! wikitext
6410 {|
6411 |{{table_attribs}}
6412 | {{table_attribs}}
6413 || {{table_attribs_5}}
6414 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6415 |align=center {{table_attribs}}
6416 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6417 |}
6418 !! html
6419 <table>
6420 <tr>
6421 <td style="color:red;">Foo
6422 </td>
6423 <td style="color:red;">Foo
6424 </td>
6425 <td> style="color:red;"</td>
6426 <td>Bar
6427 </td>
6428 <td style="color:red;">Foo
6429 </td>
6430 <td align="center" style="color:red;">Foo
6431 </td>
6432 <td align="center" style="color:red;">Foo
6433 </td></tr></table>
6434
6435 !! end
6436
6437 !! test
6438 2. Template-generated table cell attributes and cell content
6439 !! wikitext
6440 {|
6441 |{{table_attribs_2}}
6442 |}
6443 !! html/php
6444 <table>
6445 <tr>
6446 <td style="color:red;">Foo
6447 </td>
6448 <td>Bar</td>
6449 <td>Baz
6450 </td></tr></table>
6451
6452 !! html/parsoid
6453 <table>
6454 <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>
6455 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6456 </tbody></table>
6457 !! end
6458
6459 !! test
6460 3. Template-generated table cell attributes and cell content
6461 !! wikitext
6462 {|
6463 !align=center {{table_header_cells}}
6464 |-
6465 |align=center {{table_cells}}
6466 |}
6467 !! html/php
6468 <table>
6469 <tr>
6470 <th align="center" style="color:red;">Foo</th>
6471 <th style="color:red;"><i>Bar</i></th>
6472 <th style="color:brown;"><i>Foo</i> and Baz
6473 </th></tr>
6474 <tr>
6475 <td align="center" style="color:red;">Foo</td>
6476 <td style="color:red;"><i>Bar</i></td>
6477 <td style="color:brown;"><i>Foo</i> and Baz
6478 </td></tr></table>
6479
6480 !! html/parsoid
6481 <table>
6482 <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>
6483 <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>
6484 </tbody></table>
6485 !! end
6486
6487 !! test
6488 4. Template-generated table cell attributes and cell content inside a templated table
6489 !! wikitext
6490 {{tbl-start}}
6491 !align=center {{table_header_cells}}
6492 |-
6493 |align=center {{table_cells}}
6494 {{tbl-end}}
6495 !! html/php
6496 <table>
6497 <tr>
6498 <th align="center" style="color:red;">Foo</th>
6499 <th style="color:red;"><i>Bar</i></th>
6500 <th style="color:brown;"><i>Foo</i> and Baz
6501 </th></tr>
6502 <tr>
6503 <td align="center" style="color:red;">Foo</td>
6504 <td style="color:red;"><i>Bar</i></td>
6505 <td style="color:brown;"><i>Foo</i> and Baz
6506 </td></tr></table>
6507
6508 !! html/parsoid
6509 <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}}]}'>
6510 <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>
6511 <tr>
6512 <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>
6513 </tbody></table>
6514 !! end
6515
6516 ## Edge case fix to prevent future regressions
6517 !! test
6518 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6519 !! wikitext
6520 {|
6521 |{{table_attribs_7}}
6522 |}
6523 <references />
6524 !! html/parsoid
6525 <table>
6526 <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>
6527 </tbody></table>
6528 <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>
6529 !! end
6530
6531 !! test
6532 Table with row followed by newlines and table heading
6533 !! wikitext
6534 {|
6535 |-
6536
6537 ! foo
6538 |}
6539 !! html
6540 <table>
6541
6542
6543 <tr>
6544 <th> foo
6545 </th></tr></table>
6546
6547 !! end
6548
6549 !! test
6550 Table with empty line following the start tag
6551 !! wikitext
6552 {|
6553
6554 |-
6555 | foo
6556 |}
6557 !! html
6558 <table>
6559
6560
6561 <tr>
6562 <td> foo
6563 </td></tr></table>
6564
6565 !! end
6566
6567 !! test
6568 Table attributes with empty value
6569 !! wikitext
6570 {|
6571 | style=| hello
6572 |}
6573 !! html/php
6574 <table>
6575 <tr>
6576 <td style=""> hello
6577 </td></tr></table>
6578
6579 !! html/parsoid
6580 <table>
6581 <tbody>
6582 <tr>
6583 <td style=""> hello
6584 </td></tr></tbody></table>
6585
6586 !! end
6587
6588 !! test
6589 Wikitext table with a lot of comments
6590 !! wikitext
6591 {|
6592 <!-- c0 -->
6593 | foo
6594 <!-- c1 -->
6595 |-<!-- c2 -->
6596 <!-- c3 -->
6597 |<!-- c4 -->
6598 <!-- c5 -->
6599 |}
6600 !! html
6601 <table>
6602 <tr>
6603 <td> foo
6604 </td></tr>
6605 <tr>
6606 <td>
6607 </td></tr></table>
6608
6609 !! end
6610
6611 !! test
6612 Wikitext table comments represented in parsoid dom
6613 !! wikitext
6614 {|<!--c1--><!--c2-->
6615 |-<!--c3-->
6616 | x
6617 |}
6618 !! html/php+tidy
6619 <table>
6620 <tr>
6621 <td>x</td>
6622 </tr>
6623 </table>
6624 !! html/parsoid
6625 <table><!--c1--><!--c2-->
6626 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6627 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6628 </tbody></table>
6629 !! end
6630
6631 !! test
6632 Wikitext table with double-line table cell
6633 !! wikitext
6634 {|
6635 |a
6636 b
6637 |}
6638 !! html
6639 <table>
6640 <tr>
6641 <td>a
6642 <p>b
6643 </p>
6644 </td></tr></table>
6645
6646 !! end
6647
6648 !! test
6649 Table cell with a single comment
6650 !! wikitext
6651 {|
6652 | <!-- c1 -->
6653 | a
6654 |}
6655 !! html
6656 <table>
6657 <tr>
6658 <td>
6659 </td>
6660 <td> a
6661 </td></tr></table>
6662
6663 !! end
6664
6665 !! test
6666 Table-cell after a comment-only-empty-line
6667 !! wikitext
6668 {|
6669 |a
6670 <!--c1-->
6671 <!--c2-->| b
6672 |}
6673 !! html
6674 <table>
6675 <tr>
6676 <td>a
6677 </td>
6678 <td> b
6679 </td></tr></table>
6680
6681 !! html/parsoid
6682 <table>
6683 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6684 <!--c1-->
6685 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6686 </tbody></table>
6687
6688 !! end
6689
6690 !! test
6691 Build table with {{!}}
6692 !! wikitext
6693 {{{!}} class="wikitable"
6694 ! header
6695 ! second header
6696 {{!}}- style="color:red;"
6697 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6698 {{!}}}
6699 !! html
6700 <table class="wikitable">
6701 <tr>
6702 <th> header
6703 </th>
6704 <th> second header
6705 </th></tr>
6706 <tr style="color:red;">
6707 <td> data </td>
6708 <td style="color:red;"> second data
6709 </td></tr></table>
6710
6711 !! end
6712
6713 !! test
6714 Build table with pipe as data
6715 !! wikitext
6716 {| class="wikitable"
6717 ! header
6718 ! second header
6719 |- style="color:red;"
6720 | data || style="color:red;" | second data
6721 |-
6722 | style="color:red;" | data with | || style="color:red;" | second data with |
6723 |-
6724 || data with | ||| second data with |
6725 |}
6726 !! html
6727 <table class="wikitable">
6728 <tr>
6729 <th> header
6730 </th>
6731 <th> second header
6732 </th></tr>
6733 <tr style="color:red;">
6734 <td> data </td>
6735 <td style="color:red;"> second data
6736 </td></tr>
6737 <tr>
6738 <td style="color:red;"> data with | </td>
6739 <td style="color:red;"> second data with |
6740 </td></tr>
6741 <tr>
6742 <td> data with | </td>
6743 <td> second data with |
6744 </td></tr></table>
6745
6746 !! end
6747
6748 !! test
6749 Build table with wikilink
6750 !! wikitext
6751 {| class="wikitable"
6752 ! header || second header
6753 |- style="color:red;"
6754 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6755 |-
6756 | data || second data [[Main Page|link|text with pipe]]
6757 |}
6758 !! html
6759 <table class="wikitable">
6760 <tr>
6761 <th> header </th>
6762 <th> second header
6763 </th></tr>
6764 <tr style="color:red;">
6765 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6766 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6767 </td></tr>
6768 <tr>
6769 <td> data </td>
6770 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6771 </td></tr></table>
6772
6773 !! end
6774
6775 # The expected HTML structure in this test is debatable. The PHP parser does
6776 # not parse this kind of table at all. The main focus for Parsoid is on
6777 # round-tripping, so this output is ok for now. TODO: revisit!
6778 !! test
6779 Wikitext table with html-syntax row
6780 !! wikitext
6781 {|
6782 |-
6783 <td>foo</td>
6784 |}
6785 !! html/parsoid
6786 <table>
6787 <tbody>
6788 <tr>
6789 <td>foo</td></tr></tbody></table>
6790 !! end
6791
6792 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6793 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6794 ## PHP parser, which tidy then compounds by fostering the content
6795 ## entirely out of the table. Parsoid recognizes the table context
6796 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6797 ## depends on PHP's treatment of broken table markup!
6798 !! test
6799 Implicit <td> after a |-
6800 !! options
6801 parsoid=wt2html,html2html
6802 !! wikitext
6803 {|
6804 |-
6805 a
6806 |}
6807 !! html/php
6808 <table>
6809
6810 a
6811 </table>
6812
6813 !! html/php+tidy
6814 <p>a</p>
6815 !! html/parsoid
6816 <table>
6817 <tr><td>a</td></tr>
6818 </table>
6819 !! end
6820
6821 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6822 !! test
6823 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6824 !! options
6825 parsoid=wt2html,html2html
6826 !! wikitext
6827 {|
6828 |-
6829 |
6830 a
6831 |-
6832 b
6833 |}
6834 !! html/php
6835 <table>
6836
6837 <tr>
6838 <td>
6839 <pre>a
6840 </pre>
6841 </td></tr>
6842 b
6843 </table>
6844
6845 !! html/php+tidy
6846 <p>b</p>
6847 <table>
6848 <tr>
6849 <td>
6850 <pre>
6851 a
6852 </pre></td>
6853 </tr>
6854 </table>
6855 !! html/parsoid
6856 <table>
6857 <tbody>
6858 <tr><td><pre>a</pre></td></tr>
6859 <tr><td> b</td></tr>
6860 </tbody>
6861 </table>
6862 !! end
6863
6864 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6865 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6866 !! test
6867 Lists should be recognized in an implicit <td> context
6868 !! options
6869 parsoid=wt2html,html2html
6870 !! wikitext
6871 {|
6872 |-
6873 *a
6874 |}
6875 !! html/php
6876 <table>
6877
6878 <ul><li>a</li></ul>
6879 </table>
6880
6881 !! html/php+tidy
6882 <ul>
6883 <li>a</li>
6884 </ul>
6885 !! html/parsoid
6886 <table>
6887 <tr>
6888 <td><ul>
6889 <li>a</li>
6890 </ul></td>
6891 </tr>
6892 </table>
6893 !! end
6894
6895 !! test
6896 Table cells not properly parsed in an implicit-td context
6897 !! wikitext
6898 {|
6899 |-
6900 {{table_attribs_4}} || a || b
6901 |}
6902 !! html/php+tidy
6903 <table>
6904 <tr>
6905 <td style="background-color:#DC241f;" width="10px"></td>
6906 <td>a</td>
6907 <td>b</td>
6908 </tr>
6909 </table>
6910 !! html/parsoid
6911 <table>
6912 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6913 <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>
6914 </tbody></table>
6915 !! end
6916
6917 !! test
6918 Parsoid: Round-trip tables directly followed by content (bug 51219)
6919 !! options
6920 parsoid=wt2html,wt2wt
6921 !! wikitext
6922 {|
6923 |foo
6924 |} bar
6925
6926 {|
6927 |baz
6928 |}<b>quux</b>
6929 !! html+tidy
6930 <table>
6931 <tr>
6932 <td>foo</td>
6933 </tr>
6934 </table>
6935 <p>bar</p>
6936 <table>
6937 <tr>
6938 <td>baz</td>
6939 </tr>
6940 </table>
6941 <p><b>quux</b></p>
6942 !! end
6943
6944 !! test
6945 Parsoid: Default to a newline after tables in new content (bug 51219)
6946 !! options
6947 parsoid=html2wt
6948 !! html/parsoid
6949 <table><tbody>
6950 <tr><td>foo</td></tr></tbody></table> bar
6951 <table><tbody>
6952 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6953 !! wikitext
6954 {|
6955 |foo
6956 |}
6957 <nowiki> </nowiki>bar
6958 {|
6959 |baz
6960 |}
6961 '''quux'''
6962 !! end
6963
6964 !! test
6965 Parsoid: newline inducing block nodes don't suppress <nowiki>
6966 !! options
6967 parsoid=html2wt
6968 !! html/parsoid
6969 a<h1>foo</h1>
6970 !! wikitext
6971 <nowiki> </nowiki>a
6972
6973 = foo =
6974 !! end
6975
6976 !! test
6977 Parsoid: Row-syntax table headings followed by comment & table cells
6978 !! options
6979 parsoid=wt2html,wt2wt
6980 !! wikitext
6981 {|
6982 ! foo || bar
6983 <!-- foo --> || baz || quux
6984 |}
6985 !! html/php
6986 <table>
6987 <tr>
6988 <th> foo </th>
6989 <th> bar
6990 </th>
6991 <td> baz </td>
6992 <td> quux
6993 </td></tr></table>
6994
6995 !! html/parsoid
6996 <table>
6997 <tbody><tr><th> foo </th><th> bar
6998 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6999 </tbody></table>
7000 !! end
7001
7002 !!test
7003 Parsoid: Recover better from broken table attributes
7004 !!options
7005 parsoid=wt2html
7006 !!wikitext
7007 {| class="foo
7008 | class="bar" |
7009 foo
7010 |}
7011 !!html/php+tidy
7012 <table class="foo">
7013 <tr>
7014 <td class="bar">
7015 <p>foo</p>
7016 </td>
7017 </tr>
7018 </table>
7019 !!html/parsoid
7020 <table class="foo">
7021 <tr>
7022 <td class="bar">
7023 <p>foo</p></td></tr>
7024 </tbody></table>
7025 !!end
7026
7027 !! test
7028 Tables: Digest broken attributes on table and tr tag
7029 !! options
7030 parsoid=wt2html
7031 !! wikitext
7032 {| || |} ++
7033 |- || || ++ --
7034 |- > [
7035 |}
7036 !! html
7037 <table>
7038 <tbody>
7039 <tr></tr>
7040 <tr></tr>
7041 </tbody></table>
7042 !! end
7043
7044 !! test
7045 Strip unsupported table tags
7046 !! options
7047 parsoid=html2wt
7048 !! html/parsoid
7049 <table>
7050 <thead>
7051 <tr>
7052 <th>Month</th>
7053 <th>Savings</th>
7054 </tr>
7055 </thead>
7056 <tbody>
7057 <tr>
7058 <td>January</td>
7059 <td>$100</td>
7060 </tr>
7061 <tr>
7062 <td>February</td>
7063 <td>$80</td>
7064 </tr>
7065 </tbody>
7066 <tfoot>
7067 <tr>
7068 <td>Sum</td>
7069 <td>$180</td>
7070 </tr>
7071 </tfoot>
7072 </table>
7073 !! wikitext
7074 {|
7075
7076 !Month
7077 !Savings
7078
7079 |January
7080 |$100
7081
7082 |-
7083 |February
7084 |$80
7085
7086 |Sum
7087 |$180
7088
7089 |}
7090 !! end
7091
7092 !!test
7093 Testing serialization after deletion of table cells
7094 !!options
7095 parsoid={
7096 "modes": ["wt2wt", "selser"],
7097 "changes": [
7098 ["#x", "remove"]
7099 ]
7100 }
7101 !!wikitext
7102 {|
7103 !h1 !!h2 !!h3
7104 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7105 |}
7106 !! wikitext/edited
7107 {|
7108 !h1 !!h2 !!h3
7109 |c2 |||c3
7110 |}
7111 !!end
7112
7113 ###
7114 ### Internal links
7115 ###
7116 !! test
7117 Plain link, capitalized
7118 !! wikitext
7119 [[Main Page]]
7120 !! html
7121 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7122 </p>
7123 !! end
7124
7125 !! test
7126 Plain link, uncapitalized
7127 !! wikitext
7128 [[main Page]]
7129 !! html
7130 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7131 </p>
7132 !! end
7133
7134 !! test
7135 Piped link
7136 !! wikitext
7137 [[Main Page|The Main Page]]
7138 !! html
7139 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Piped link with comment in link text
7145 !! wikitext
7146 [[Main Page|The Main<!--front--> Page]]
7147 !! html
7148 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7149 </p>
7150 !! end
7151
7152 !! test
7153 Piped link with multiple pipe characters in link text
7154 !! wikitext
7155 [[Main Page||The|Main|Page|]]
7156 !! html/php
7157 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7158 </p>
7159 !! html/parsoid
7160 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7161 !! end
7162
7163 !! test
7164 Piped link with no link text
7165 !! wikitext
7166 [[Thomas Bek (bishop of St David's)|]]
7167 !! html/php
7168 <p>[[Thomas Bek (bishop of St David's)|]]
7169 </p>
7170 !! html/parsoid
7171 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7172 !! end
7173
7174 !! test
7175 Broken link
7176 !! wikitext
7177 [[Zigzagzogzagzig]]
7178 !! html
7179 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7180 </p>
7181 !! end
7182
7183 !! test
7184 Broken link with fragment
7185 !! wikitext
7186 [[Zigzagzogzagzig#zug]]
7187 !! html
7188 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7189 </p>
7190 !! end
7191
7192 !! test
7193 Special page link with fragment
7194 !! wikitext
7195 [[Special:Version#anchor]]
7196 !! html
7197 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7198 </p>
7199 !! end
7200
7201 !! test
7202 Nonexistent special page link with fragment
7203 !! wikitext
7204 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7205 !! html
7206 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7207 </p>
7208 !! end
7209
7210 !! test
7211 Link with prefix
7212 !! wikitext
7213 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7214 !! html
7215 <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>
7216 </p>
7217 !! end
7218
7219 !! test
7220 Link with suffix
7221 !! wikitext
7222 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7223 !! html
7224 <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>!!!
7225 </p>
7226 !! end
7227
7228 !! article
7229 prefixed article
7230 !! text
7231 Some text
7232 !! endarticle
7233
7234 !! test
7235 Bug 43661: Piped links with identical prefixes
7236 !! wikitext
7237 [[prefixed article|prefixed articles with spaces]]
7238
7239 [[prefixed article|prefixed articlesaoeu]]
7240
7241 [[Main Page|Main Page test]]
7242 !! html
7243 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7244 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7245 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7246 </p>
7247 !! end
7248
7249
7250 !! test
7251 Link with HTML entity in suffix / tail
7252 !! wikitext
7253 [[Main Page]]&quot;, [[Main Page]]&#97;
7254 !! html/php
7255 <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;
7256 </p>
7257 !! html/parsoid
7258 <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>
7259 !! end
7260
7261 !! test
7262 Link with 3 brackets
7263 !! wikitext
7264 [[[Main Page]]]
7265 Foo [[[Main Page]]]
7266 !! html
7267 <p>[[[Main Page]]]
7268 Foo [[[Main Page]]]
7269 </p>
7270 !! end
7271
7272 !! test
7273 Link with 4 brackets
7274 !! wikitext
7275 [[[[Main Page]]]]
7276 !! html
7277 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7278 </p>
7279 !! end
7280
7281 !! test
7282 Piped link with 3 brackets
7283 !! wikitext
7284 [[[main page|the main page]]]
7285 !! html
7286 <p>[[[main page|the main page]]]
7287 </p>
7288 !! end
7289
7290 !! test
7291 Piped link with extlink-like text
7292 !! wikitext
7293 [[Main Page|[bar]]]
7294 [[Main Page|This is a [bar]]]
7295 !! html/php
7296 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7297 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7298 </p>
7299 !! html/parsoid
7300 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7301 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7302 !! end
7303
7304 !! test
7305 Link with multiple pipes
7306 !! wikitext
7307 [[Main Page|The|Main|Page]]
7308 !! html
7309 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7310 </p>
7311 !! end
7312
7313 # Note that parsoid does not munge anchor text; all non-space
7314 # characters are valid in HTML5 ids.
7315 !! test
7316 Anchor containing a #. (bug 63430)
7317 !! wikitext
7318 [[Main Page#And#Link]]
7319 !! html/php
7320 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7321 </p>
7322 !! html/parsoid
7323 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7324 !! end
7325
7326 !! test
7327 Link to namespaces
7328 !! wikitext
7329 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7330 !! html
7331 <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>
7332 </p>
7333 !! end
7334
7335 !! test
7336 Link with space in namespace
7337 !! wikitext
7338 [[User talk:Foo bar]]
7339 !! html
7340 <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>
7341 </p>
7342 !! end
7343
7344 !! article
7345 MemoryAlpha:AlphaTest
7346 !! text
7347 This is an article in the MemoryAlpha namespace
7348 (which shadows the memoryalpha interwiki link).
7349 !! endarticle
7350
7351 !! test
7352 Namespace takes precedence over interwiki link (bug 51680)
7353 !! wikitext
7354 [[MemoryAlpha:AlphaTest]]
7355 !! html
7356 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7357 </p>
7358 !! end
7359
7360 # The previous test doesn't work correctly in html2*, due to not recognizing the
7361 # link as an internal one. This one checks for the correct behavior.
7362 !! test
7363 Link to namespace preferred over interwiki with correct rel attribute
7364 !! options
7365 parsoid=html2wt,html2html
7366 !! html/parsoid
7367 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7368 !! wikitext
7369 [[MemoryAlpha:AlphaTest]]
7370 !! end
7371
7372 !! test
7373 Piped link to namespace
7374 !! wikitext
7375 [[Meta:Disclaimers|The disclaimers]]
7376 !! html
7377 <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>
7378 </p>
7379 !! end
7380
7381 !! test
7382 Link containing }
7383 !! wikitext
7384 [[Usually caused by a typo (oops}]]
7385 !! html
7386 <p>[[Usually caused by a typo (oops}]]
7387 </p>
7388 !! end
7389
7390 !! article
7391 7% Solution
7392 !! text
7393 Just a test of an article title containing a percent.
7394 !! endarticle
7395
7396 !! test
7397 Link containing % (not as a hex sequence)
7398 !! wikitext
7399 [[7% Solution]]
7400 !! html/php
7401 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7402 </p>
7403 !! html/parsoid
7404 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7405 !! end
7406
7407 # note that the parsoid HTML is identical to the previous test output,
7408 # so the previous test ensures that the html2wt mode will generate the
7409 # "not as a hex sequence" wikitext.
7410 !! test
7411 Link containing % as a single hex sequence interpreted to char
7412 !! options
7413 parsoid=wt2wt,wt2html,html2html
7414 !! wikitext
7415 [[7%25 Solution]]
7416 !! html/php
7417 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7418 </p>
7419 !! html/parsoid
7420 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7421 !!end
7422
7423 !! test
7424 Link containing % as a double hex sequence interpreted to hex sequence
7425 !! wikitext
7426 [[7%2525 Solution]]
7427 !! html
7428 <p>[[7%2525 Solution]]
7429 </p>
7430 !!end
7431
7432 # note that parsoid does not munge anchor text; all non-space
7433 # characters are valid in HTML5 anchors.
7434 !! test
7435 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7436 Example for such a section: == < ==
7437 !! wikitext
7438 [[%23%3c]][[%23%3e]]
7439 !! html/php
7440 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7441 </p>
7442 !! html/parsoid
7443 <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>
7444 !! end
7445
7446 !! test
7447 Link containing "<#" and ">#" as a hex sequences
7448 !! wikitext
7449 [[%3c%23]][[%3e%23]]
7450 !! html
7451 <p>[[%3c%23]][[%3e%23]]
7452 </p>
7453 !! end
7454
7455 !! test
7456 Link containing an equals sign
7457 !! wikitext
7458 [[Special:BookSources/isbn=4-00-026157-6]]
7459 !! html/php
7460 <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>
7461 </p>
7462 !! html/parsoid
7463 <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>
7464 !! end
7465
7466 !! article
7467 Foo~bar
7468 !! text
7469 Just a test of an article title containing a tilde.
7470 !! endarticle
7471
7472 # note that links containing signatures, like [[Foo~~~~]], are
7473 # massaged by the pre-save transform (PST) and so the tildes are never
7474 # seen by the parser.
7475 !! test
7476 Link containing a tilde
7477 !! wikitext
7478 [[Foo~bar]]
7479 !! html/php
7480 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7481 </p>
7482 !! html/parsoid
7483 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7484 !! end
7485
7486 !! test
7487 Link containing double-single-quotes '' (bug 4598)
7488 !! wikitext
7489 [[Lista d''e paise d''o munno]]
7490 !! html/php
7491 <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>
7492 </p>
7493 !! html/parsoid
7494 <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>
7495 !! end
7496
7497 !! test
7498 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7499 !! wikitext
7500 Some [[Link|pretty ''italics'' and stuff]]!
7501 !! html/php
7502 <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>!
7503 </p>
7504 !! html/parsoid
7505 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7506 !! end
7507
7508 !! test
7509 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7510 !! wikitext
7511 ''Some [[Link|pretty ''italics'' and stuff]]!''
7512 !! html
7513 <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>
7514 </p>
7515 !! end
7516
7517 !! test
7518 Link with double quotes in title part (literal) and alternate part (interpreted)
7519 !! wikitext
7520 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7521
7522 [[''Pentecoste'']]
7523
7524 [[''Pentecoste''|Pentecoste]]
7525
7526 [[''Pentecoste''|''Pentecoste'']]
7527 !! html/php
7528 <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>
7529 </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>
7530 </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>
7531 </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>
7532 </p>
7533 !! html/parsoid
7534 <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>
7535 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7536 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7537 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7538 !! end
7539
7540 !! test
7541 Broken image links with HTML captions (bug 39700)
7542 !! wikitext
7543 [[File:Nonexistent|<script></script>]]
7544 [[File:Nonexistent|100x100px|<script></script>]]
7545 [[File:Nonexistent|&lt;]]
7546 [[File:Nonexistent|a<i>b</i>c]]
7547 !! html/php
7548 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7549 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7550 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7551 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7552 </p>
7553 !! html/parsoid
7554 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7555 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7556 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7557 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7558 !! end
7559
7560 !! test
7561 Plain link to URL
7562 !! wikitext
7563 [[http://www.example.com]]
7564 !! html/php
7565 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7566 </p>
7567 !! html/parsoid
7568 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7569 !! end
7570
7571 !! test
7572 Plain link to URL with link text
7573 !! wikitext
7574 [[http://www.example.com Link text]]
7575 !! html
7576 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7577 </p>
7578 !! end
7579
7580 !! test
7581 Plain link to protocol-relative URL
7582 !! wikitext
7583 [[//www.example.com]]
7584 !! html/php
7585 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7586 </p>
7587 !! html/parsoid
7588 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7589 !! end
7590
7591 !! test
7592 Plain link to protocol-relative URL with link text
7593 !! wikitext
7594 [[//www.example.com Link text]]
7595 !! html
7596 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7597 </p>
7598 !! end
7599
7600 !! test
7601 Plain link to page with question mark in title
7602 !! wikitext
7603 [[A?b]]
7604
7605 [[A?b|Baz]]
7606 !! html
7607 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7608 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7609 </p>
7610 !! end
7611
7612
7613 # I'm fairly sure the expected result here is wrong.
7614 # We want these to be URL links, not pseudo-pages with URLs for titles....
7615 # However the current output is also pretty screwy.
7616 #
7617 # ----
7618 # I'm changing it to match the current output--it arguably makes more
7619 # sense in the light of the test above. Old expected result was:
7620 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7621 #</p>
7622 # But I think this test is bordering on "garbage in, garbage out" anyway.
7623 # -- wtm
7624 !! test
7625 Piped link to URL
7626 !! wikitext
7627 Piped link to URL: [[http://www.example.com|an example URL]]
7628 !! html/php
7629 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7630 </p>
7631 !! html/parsoid
7632 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7633 !! end
7634
7635 !! test
7636 BUG 2: [[page|http://url/]] should link to page, not http://url/
7637 !! wikitext
7638 [[Main Page|http://url/]]
7639 !! html/php
7640 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7641 </p>
7642 !! html/parsoid
7643 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7644 !! end
7645
7646 # Parsoid does not mark self-links, by design.
7647 !! test
7648 BUG 337: Escaped self-links should be bold
7649 !! options
7650 title=[[Bug462]]
7651 !! wikitext
7652 [[Bu&#103;462]] [[Bug462]]
7653 !! html/php
7654 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7655 </p>
7656 !! html/php+tidy
7657 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7658 !! html/parsoid
7659 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7660 !! end
7661
7662 !! test
7663 Self-link to section should not be bold
7664 !! options
7665 title=[[Main Page]]
7666 !! wikitext
7667 [[Main Page#section]]
7668 !! html
7669 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7670 </p>
7671 !! end
7672
7673 !! article
7674 00
7675 !! text
7676 This is 00.
7677 !! endarticle
7678
7679 !!test
7680 Self-link to numeric title
7681 !!options
7682 title=[[0]]
7683 !! wikitext
7684 [[0]]
7685 !! html
7686 <p><strong class="selflink">0</strong>
7687 </p>
7688 !!end
7689
7690 !!test
7691 Link to numeric-equivalent title
7692 !!options
7693 title=[[0]]
7694 !! wikitext
7695 [[00]]
7696 !! html
7697 <p><a href="/wiki/00" title="00">00</a>
7698 </p>
7699 !!end
7700
7701 !! test
7702 <nowiki> inside a link
7703 !! wikitext
7704 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7705 !! html
7706 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7707 </p>
7708 !! end
7709
7710 !! test
7711 Non-breaking spaces in title
7712 !! wikitext
7713 [[&nbsp; Main &nbsp; Page &nbsp;]]
7714 !! html
7715 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7716 </p>
7717 !!end
7718
7719 !! test
7720 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7721 !! options
7722 language=ca
7723 !! wikitext
7724 '''[[Main Page]]'''
7725 !! html
7726 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7727 </p>
7728 !! end
7729
7730 !! test
7731 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7732 !! options
7733 language=ca
7734 !! wikitext
7735 ''[[Main Page]]''
7736 !! html
7737 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7738 </p>
7739 !! end
7740
7741 !! test
7742 Internal link with en linktrail: no apostrophes (bug 27473)
7743 !! options
7744 language=en
7745 !! wikitext
7746 [[Something]]'nice
7747 !! html
7748 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7749 </p>
7750 !! end
7751
7752 !! test
7753 Internal link with ca linktrail with apostrophes (bug 27473)
7754 !! options
7755 language=ca
7756 !! wikitext
7757 [[Something]]'nice
7758 !! html
7759 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7760 </p>
7761 !! end
7762
7763 !! test
7764 Internal link with kaa linktrail with apostrophes (bug 27473)
7765 !! options
7766 language=kaa
7767 !! wikitext
7768 [[Something]]'nice
7769 !! html
7770 <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>
7771 </p>
7772 !! end
7773
7774 !! test
7775 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7776 !! wikitext
7777 [[User:Foo/Test/63636:Bar|Test]]
7778 !! html/php
7779 <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>
7780 </p>
7781 !! html/parsoid
7782 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7783 !! end
7784
7785 !! test
7786 Purely hash wikilink
7787 !! options
7788 title=[[User:test/123]]
7789 !! wikitext
7790 [[#a|b]]
7791 !! html/php
7792 <p><a href="#a">b</a>
7793 </p>
7794 !! html/parsoid
7795 <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>
7796 !! end
7797
7798 !! test
7799 1. Interaction of linktrail and template encapsulation
7800 !! options
7801 parsoid
7802 !! wikitext
7803 {{echo|[[Foo]]}}l
7804 !! html
7805 <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>
7806 !! end
7807
7808 !! test
7809 2. Interaction of linktrail and template encapsulation
7810 !! options
7811 parsoid
7812 !! wikitext
7813 {{echo|Some [[Fool]]}}s
7814 !! html
7815 <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>
7816 !! end
7817
7818 !! test
7819 3. Interaction of linktrail and template encapsulation
7820 !! options
7821 parsoid
7822 !! wikitext
7823 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7824 !! html
7825 <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>
7826 !! end
7827
7828 !! article
7829 Söfnuður
7830 !! text
7831 Test.
7832 !! endarticle
7833
7834 !! test
7835 Internal link with is link prefix
7836 !! options
7837 language=is
7838 !! wikitext
7839 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7840 !! html
7841 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7842 </p>
7843 !! end
7844
7845 !! article
7846 Mótmælendatrú
7847 !! text
7848 Test.
7849 !! endarticle
7850
7851 !! test
7852 Internal link with is link trail and link prefix
7853 !! options
7854 language=is
7855 !! wikitext
7856 [[mótmælendatrú|xxx]]ar
7857 [[mótmælendatrú]]ar
7858 mótmælenda[[söfnuður]]
7859 mótmælenda[[söfnuður|söfnuðir]]
7860 mótmælenda[[söfnuður|söfnuðir]]xxx
7861 !! html
7862 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7863 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7864 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7865 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7866 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7867 </p>
7868 !! end
7869
7870 !! test
7871 Parsoid link trail escaping
7872 !! options
7873 parsoid=html2wt,html2html
7874 !! html/parsoid
7875 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7876 !! wikitext
7877 [[apple]]<nowiki/>s
7878 !! end
7879
7880 !! test
7881 Parsoid link prefix escaping
7882 !! options
7883 language=is
7884 parsoid=html2wt,html2html
7885 !! html/parsoid
7886 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7887 !! wikitext
7888 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7889 !! end
7890
7891 !! test
7892 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7893 !! wikitext
7894 [[Foo| bar]]
7895
7896 [[Foo| ''bar'']]
7897
7898 [http://wp.org foo]
7899
7900 [http://wp.org ''foo'']
7901 !! html
7902 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7903 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7904 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7905 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7906 </p>
7907 !! end
7908
7909 !! test
7910 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7911 !! options
7912 parsoid
7913 !! wikitext
7914 [[Foo|{{echo|a}} b {{echo|c}}]]
7915 !! html
7916 <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>
7917 !! end
7918
7919 !! test
7920 Link with angle bracket after anchor
7921 !! wikitext
7922 [[Foo#<bar>]]
7923 !! html/php
7924 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7925 </p>
7926 !! html/parsoid
7927 <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>
7928 !! end
7929
7930 ###
7931 ### Interwiki links (see maintenance/interwiki.sql)
7932 ###
7933
7934 !! test
7935 Inline interwiki link
7936 !! options
7937 parsoid=wt2html,wt2wt,html2html
7938 !! wikitext
7939 [[MeatBall:SoftSecurity]]
7940 !! html/php
7941 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7942 </p>
7943 !! html/parsoid
7944 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7945 !! end
7946
7947 !! test
7948 Inline interwiki link with empty title (bug 2372)
7949 !! options
7950 parsoid=wt2html,wt2wt,html2html
7951 !! wikitext
7952 [[MeatBall:]]
7953 !! html/php
7954 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7955 </p>
7956 !! html/parsoid
7957 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7958 !! end
7959
7960 !! test
7961 Interwiki link encoding conversion (bug 1636)
7962 !! wikitext
7963 *[[Wikipedia:ro:Olteni&#0355;a]]
7964 *[[Wikipedia:ro:Olteni&#355;a]]
7965 !! html
7966 <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>
7967 <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>
7968
7969 !! html+tidy
7970 <ul>
7971 <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>
7972 <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>
7973 </ul>
7974 !! end
7975
7976 !! test
7977 Interwiki link with fragment (bug 2130)
7978 !! wikitext
7979 [[MeatBall:SoftSecurity#foo]]
7980 !! html
7981 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7982 </p>
7983 !! end
7984
7985 # Ideally the wikipedia: prefix here should be proto-relative too
7986 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7987 # define the 'en' prefix, and originally the test used 'wikipedia',
7988 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7989 # article.
7990 !! test
7991 Different interwiki prefixes mapping to the same URL
7992 !! wikitext
7993 [[:en:Foo]]
7994
7995 [[:en:Foo|Foo]]
7996
7997 [[wikipedia:Foo]]
7998
7999 [[:wikipedia:Foo|Foo]]
8000
8001 [[wikipedia:en:Foo]]
8002
8003 [[:wikipedia:en:Foo]]
8004
8005 [[ wikiPEdia :Foo]]
8006 !! html/parsoid
8007 <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>
8008
8009 <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>
8010
8011 <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>
8012
8013 <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>
8014
8015 <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>
8016
8017 <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>
8018
8019 <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>
8020 !! end
8021
8022 !! test
8023 Interwiki links that cannot be represented in wiki syntax
8024 !! wikitext
8025 [[meatball:ok]]
8026 [[meatball:ok#foo|ok with fragment]]
8027 [[meatball:ok_as_well?|ok ending with ? mark]]
8028 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8029 [http://de.wikipedia.org/wiki/#foo is just fragment]
8030
8031 !! html/php
8032 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8033 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8034 <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>
8035 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8036 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8037 </p>
8038 !! html/parsoid
8039 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8040 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8041 <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>
8042 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8043 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8044 !! end
8045
8046 !! test
8047 Interwiki links: trail
8048 !! wikitext
8049 [[wikipedia:Foo|Ba]]r
8050 !! html/php
8051 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8052 </p>
8053 !! html/parsoid
8054 <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>
8055 !! end
8056
8057 !! test
8058 Local interwiki link
8059 !! options
8060 parsoid=wt2html,wt2wt,html2html
8061 !! wikitext
8062 [[local:Template:Foo]]
8063 !! html/php
8064 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8065 </p>
8066 !! html/parsoid
8067 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8068 !! end
8069
8070 # Parsoid does not mark self-links, by design.
8071 !! test
8072 Local interwiki link: self-link to current page
8073 !! options
8074 title=[[Main Page]]
8075 parsoid=wt2html,wt2wt,html2html
8076 !! wikitext
8077 [[local:Main Page]]
8078 !! html/php
8079 <p><strong class="selflink">local:Main Page</strong>
8080 </p>
8081 !! html/parsoid
8082 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8083 !! end
8084
8085 !! test
8086 Local interwiki link: prefix only (bug 64167)
8087 !! options
8088 parsoid=wt2html,wt2wt,html2html
8089 !! wikitext
8090 [[local:]]
8091 !! html/php
8092 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8093 </p>
8094 !! html/parsoid
8095 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8096 !! end
8097
8098 !! test
8099 Local interwiki link: with additional interwiki prefix (bug 61357)
8100 !! options
8101 parsoid=wt2html,wt2wt,html2html
8102 !! wikitext
8103 [[local:meatball:Hello]]
8104 !! html/php
8105 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8106 </p>
8107 !! html/parsoid
8108 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8109 !! end
8110
8111 !! test
8112 Multiple local interwiki link prefixes
8113 !! wikitext
8114 [[local:local:local:local:mi:local:Foo]]
8115 !! options
8116 parsoid=wt2html,wt2wt,html2html
8117 !! html/php
8118 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8119 </p>
8120 !! html/parsoid
8121 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8122 !! end
8123
8124 ###
8125 ### Interlanguage links
8126 ### Language links (so that searching for '### language' matches..)
8127 ###
8128
8129 !! test
8130 Interlanguage link
8131 !! options
8132 parsoid=wt2html,wt2wt,html2html
8133 !! wikitext
8134 Blah blah blah
8135 [[zh:Chinese]]
8136 !! html/php
8137 <p>Blah blah blah
8138 </p>
8139 !! html/parsoid
8140 <p>Blah blah blah</p>
8141 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8142 !! end
8143
8144 !! test
8145 Interlanguage link with spacing
8146 !! options
8147 parsoid=wt2html,wt2wt,html2html
8148 !! wikitext
8149 Blah blah blah
8150 [[ zh : Chinese ]]
8151 !! html/php
8152 <p>Blah blah blah
8153 </p>
8154 !! html/parsoid
8155 <p>Blah blah blah</p>
8156 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8157 !! end
8158
8159 !! test
8160 Double interlanguage link
8161 !! options
8162 parsoid=wt2html,wt2wt,html2html
8163 !! wikitext
8164 Blah blah blah
8165 [[es:Spanish]]
8166 [[zh:Chinese]]
8167 !! html/php
8168 <p>Blah blah blah
8169 </p>
8170 !! html/parsoid
8171 <p>Blah blah blah</p>
8172 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8173 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8174 !! end
8175
8176 !! test
8177 Interlanguage link variations
8178 !! options
8179 parsoid=wt2html,wt2wt,html2html
8180 !! wikitext
8181 Blah blah blah
8182 [[ es :Spanish]]
8183 [[ ZH :Chinese]]
8184 [[es:Foo_bar]]
8185 !! html/php
8186 <p>Blah blah blah
8187 </p>
8188 !! html/parsoid
8189 <p>Blah blah blah</p>
8190 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8191 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8192 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8193 !! end
8194
8195 !! test
8196 Space and question mark encoding in interlanguage links (T95473)
8197 !! options
8198 parsoid=wt2html,wt2wt,html2html
8199 !! wikitext
8200 Blah blah blah
8201 [[es:Foo bar?]]
8202 !! html/php
8203 <p>Blah blah blah
8204 </p>
8205 !! html/parsoid
8206 <p>Blah blah blah</p>
8207 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8208 !! end
8209
8210 !! test
8211 Interlanguage link, with prefix links
8212 !! options
8213 language=ln
8214 !! wikitext
8215 Blah blah blah
8216 [[zh:Chinese]]
8217 !! html/php
8218 <p>Blah blah blah
8219 </p>
8220 !! html/parsoid
8221 <p>Blah blah blah</p>
8222 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8223 !! end
8224
8225 !! test
8226 Double interlanguage link, with prefix links (bug 8897)
8227 !! options
8228 language=ln
8229 !! wikitext
8230 Blah blah blah
8231 [[es:Spanish]]
8232 [[zh:Chinese]]
8233 !! html/php
8234 <p>Blah blah blah
8235 </p>
8236 !! html/parsoid
8237 <p>Blah blah blah</p>
8238 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8239 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8240 !! end
8241
8242 !! test
8243 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8244 !! wikitext
8245 Blah blah blah
8246 [[mul:Article]]
8247 !! html/php
8248 <p>Blah blah blah
8249 </p>
8250 !! html/parsoid
8251 <p>Blah blah blah</p>
8252 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8253 !! end
8254
8255 !! test
8256 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8257 !! options
8258 language=ln
8259 !! wikitext
8260 [[WW&nbsp;II]]
8261 !! html
8262 <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>
8263 </p>
8264 !! end
8265
8266 !! test
8267 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8268 !! options
8269 parsoid=html2wt
8270 !! html/parsoid
8271 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8272 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8273 !! wikitext
8274 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8275
8276 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8277 !! end
8278
8279 !! test
8280 Parsoid: handle constructor well
8281 !! wikitext
8282 [[constructor]]
8283
8284 [[constructor:foo]]
8285 !! html/php
8286 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8287 </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>
8288 </p>
8289 !! html/parsoid
8290 <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>
8291
8292 <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>
8293 !! end
8294
8295 !! article
8296 ko:
8297 !! text
8298 Test.
8299 !! endarticle
8300
8301 # Note that `ko` isn't a known interlanguage prefix
8302 !! test
8303 Parsoid: recognize interlanguage links without a target page
8304 !! options
8305 ill
8306 !! wikitext
8307 [[es:]]
8308
8309 [[ko:]]
8310 !! html/php
8311 es:
8312 !! html/parsoid
8313 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8314
8315 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8316 !! end
8317
8318 # Note that `ko` isn't a known interwiki prefix
8319 !! test
8320 Parsoid: recognize interwiki links without a target page
8321 !! options
8322 parsoid=wt2html,wt2wt,html2html
8323 !! wikitext
8324 [[:es:]]
8325
8326 [[:ko:]]
8327 !! html/php
8328 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8329 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8330 </p>
8331 !! html/parsoid
8332 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8333 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8334 !! end
8335
8336 !! test
8337 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8338 !! wikitext
8339 [[mi:Foo]]
8340 !! html/php
8341 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8342 </p>
8343 !! html/parsoid
8344 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8345 !! end
8346
8347 !! test
8348 Interlanguage link with preceding local interwiki link (bug 68085)
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 Blah blah blah
8353 [[local:es:Spanish]]
8354 !! html/php
8355 <p>Blah blah blah
8356 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8357 </p>
8358 !! html/parsoid
8359 <p>Blah blah blah
8360 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8361 !! end
8362
8363 !! test
8364 Looks like an interlanguage link, but is actually a local interwiki
8365 !! options
8366 parsoid=wt2html,wt2wt,html2html
8367 !! wikitext
8368 Blah blah blah
8369 [[mi:Template:Foo]]
8370 !! html/php
8371 <p>Blah blah blah
8372 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8373 </p>
8374 !! html/parsoid
8375 <p>Blah blah blah
8376 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8377 !! end
8378
8379 ###
8380 ### Redirects, Parsoid-only
8381 ###
8382
8383 !! test
8384 1. Simple redirect to page
8385 !! wikitext
8386 #REDIRECT [[Main Page]]
8387 !! html/parsoid
8388 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8389 !! end
8390
8391 !! test
8392 2. Other redirect variants
8393 !! wikitext
8394 #REDIRECT [[Main_Page]]
8395 !! html/parsoid
8396 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8397 !! end
8398
8399 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8400 # This tests the Parsoid bail-out code.
8401 !! test
8402 3. Other redirect variants
8403 !! wikitext
8404 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8405 !! html/parsoid
8406 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8407 !! end
8408
8409 !! test
8410 4. Redirect to a templated destination
8411 !! wikitext
8412 #REDIRECT [[{{echo|Foo}}bar]]
8413 !! html/parsoid
8414 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8415 !! end
8416
8417 !! test
8418 Empty redirect
8419 !! options
8420 parsoid=wt2html,wt2wt
8421 !! wikitext
8422 #REDIRECT [[]]
8423 !! html/parsoid
8424 <ol>
8425 <li>REDIRECT [[]]</li></ol>
8426 !! end
8427
8428 !! test
8429 Optional colon in #REDIRECT
8430 !! options
8431 # the colon is archaic syntax. we support it for wt2html, but we
8432 # don't care that it roundtrips back to the modern syntax.
8433 parsoid=wt2html,html2html
8434 !! wikitext
8435 #REDIRECT:[[Main Page]]
8436 !! html/parsoid
8437 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8438 !! end
8439
8440 !! test
8441 Whitespace in #REDIRECT with optional colon
8442 !! options
8443 # the colon and gratuitous whitespace is archaic syntax. we support
8444 # it for wt2html, but we don't care that it roundtrips back to the
8445 # modern syntax (without extra whitespace)
8446 parsoid=wt2html,html2html
8447 !! wikitext
8448
8449 #REDIRECT
8450 :
8451 [[Main Page]]
8452 !! html/parsoid
8453 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8454 !! end
8455
8456 !! test
8457 Piped link in #REDIRECT
8458 !! options
8459 # content after piped link is ignored. we support this syntax,
8460 # but don't care that the piped link is lost when we roundtrip this.
8461 parsoid=wt2html
8462 !! wikitext
8463 #REDIRECT [[Main Page|bar]]
8464 !! html/parsoid
8465 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8466 !! end
8467
8468 !! test
8469 Redirect to category (T104502)
8470 !! options
8471 parsoid=wt2html,wt2wt
8472 !! wikitext
8473 #REDIRECT [[Category:Foo]]
8474 !! html/parsoid
8475 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8476 !! end
8477
8478 !! test
8479 Redirect to category with URL encoding (T104502)
8480 !! options
8481 parsoid=wt2html
8482 !! wikitext
8483 #REDIRECT [[Category%3AFoo]]
8484 !! html/parsoid
8485 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8486 !! end
8487
8488 !! test
8489 Redirect to category page
8490 !! wikitext
8491 #REDIRECT [[:Category:Foo]]
8492 !! html/parsoid
8493 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8494 !! end
8495
8496 !! test
8497 Redirect to image page (1)
8498 !! wikitext
8499 #REDIRECT [[File:Wiki.png]]
8500 !! html/parsoid
8501 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8502 !! end
8503
8504 !! test
8505 Redirect to image page (2)
8506 !! wikitext
8507 #REDIRECT [[Image:Wiki.png]]
8508 !! html/parsoid
8509 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8510 !! end
8511
8512 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8513 # Next test confirms this.
8514 !! test
8515 Redirect to language (1) (T104918)
8516 !! options
8517 parsoid=wt2html,wt2wt,html2html
8518 !! wikitext
8519 #REDIRECT [[en:File:Wiki.png]]
8520 !! html/parsoid
8521 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8522 !! end
8523
8524 !! test
8525 Redirect to language (2) (T104918)
8526 !! wikitext
8527 #REDIRECT [[:en:File:Wiki.png]]
8528 !! html/parsoid
8529 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8530 !! end
8531
8532 !! test
8533 Redirect to interwiki (T104918)
8534 !! wikitext
8535 #REDIRECT [[meatball:File:Wiki.png]]
8536 !! html/parsoid
8537 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8538 !! end
8539
8540 !! test
8541 Non-English #REDIRECT
8542 !! options
8543 language=is
8544 !! wikitext
8545 #TILVÍSUN [[Main Page]]
8546 !! html/parsoid
8547 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8548 !! end
8549
8550 !! test
8551 Redirect syntax under text isn't considered a redirect
8552 !! wikitext
8553 some text
8554 #redirect [[Main Page]]
8555 !! html/parsoid
8556 <p>some text</p>
8557 <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>
8558 !! end
8559
8560 # FIXME: Should hoist the redirect to the top of the page and ensure there
8561 # is only one.
8562 !! test
8563 New redirect
8564 !! options
8565 parsoid=html2wt
8566 !! html/parsoid
8567 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8568 !! wikitext
8569 Foo
8570 #REDIRECT [[Foo]]
8571 !! end
8572
8573 ##
8574 ## XHTML tidiness
8575 ###
8576
8577 !! test
8578 <br> to <br />
8579 !! wikitext
8580 1<br>2<br />3
8581 !! html
8582 <p>1<br />2<br />3
8583 </p>
8584 !! end
8585
8586 !! test
8587 Broken br tag sanitization
8588 !! wikitext
8589 </br>
8590 !! html/php
8591 <p>&lt;/br&gt;
8592 </p>
8593 !! end
8594
8595 # TODO: Fix html2html mode (bug 51055)!
8596 !! test
8597 Parsoid: Broken br tag recognition
8598 !! options
8599 parsoid=wt2html
8600 !! wikitext
8601 </br>
8602
8603 <br/ >
8604 !! html+tidy
8605 <p><br /></p>
8606 <p><br /></p>
8607 !! end
8608
8609 !! test
8610 Incorrecly removing closing slashes from correctly formed XHTML
8611 !! wikitext
8612 <br style="clear:both;" />
8613 !! html
8614 <p><br style="clear:both;" />
8615 </p>
8616 !! end
8617
8618 !! test
8619 Failing to transform badly formed HTML into correct XHTML
8620 !! wikitext
8621 <br style="clear: left;">
8622 <br style="clear: right;">
8623 <br style="clear: both;">
8624 !! html
8625 <p><br style="clear: left;" />
8626 <br style="clear: right;" />
8627 <br style="clear: both;" />
8628 </p>
8629 !!end
8630
8631 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8632 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8633 !! test
8634 Handling html with a div self-closing tag
8635 !! wikitext
8636 <div title />
8637 <div title/>
8638 <div title/ >
8639 <div title=bar />
8640 <div title=bar/>
8641 <div title=bar/ >
8642 !! html/php
8643 <p>&lt;div title /&gt;
8644 &lt;div title/&gt;
8645 </p>
8646 <div>
8647 <p>&lt;div title=bar /&gt;
8648 &lt;div title=bar/&gt;
8649 </p>
8650 <div title="bar/"></div>
8651 </div>
8652
8653 !! html/parsoid
8654 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8655 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8656 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8657 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8658 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8659 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8660 !! end
8661
8662 !! test
8663 Handling html with a br self-closing tag
8664 !! wikitext
8665 <br title />
8666 <br title/>
8667 <br title/ >
8668 <br title=bar />
8669 <br title=bar/>
8670 <br title=bar/ >
8671 !! html/php
8672 <p><br title="" />
8673 <br title="" />
8674 <br />
8675 <br title="bar" />
8676 <br title="bar" />
8677 <br title="bar/" />
8678 </p>
8679 !! html/parsoid
8680 <p><br title="" />
8681 <br title="" />
8682 <br title="" />
8683 <br title="bar" />
8684 <br title="bar" />
8685 <br title="bar/" />
8686 </p>
8687 !! end
8688
8689 !! test
8690 Horizontal ruler (should it add that extra space?)
8691 !! wikitext
8692 <hr>
8693 <hr >
8694 foo <hr
8695 > bar
8696 !! html+tidy
8697 <hr />
8698 <hr />
8699 <p>foo</p>
8700 <hr />
8701 <p>bar</p>
8702 !! end
8703
8704 !! test
8705 Horizontal ruler -- 4+ dashes render hr
8706 !! wikitext
8707 ----
8708 !! html
8709 <hr />
8710
8711 !! end
8712
8713 !! test
8714 Horizontal ruler -- eats additional dashes on the same line
8715 !! wikitext
8716 ---------
8717 !! html
8718 <hr />
8719
8720 !! end
8721
8722 !! test
8723 Horizontal ruler -- does not collapse dashes on consecutive lines
8724 !! wikitext
8725 ----
8726 ----
8727 !! html
8728 <hr />
8729 <hr />
8730
8731 !! end
8732
8733 !! test
8734 Horizontal ruler -- <4 dashes render as plain text
8735 !! wikitext
8736 ---
8737 !! html
8738 <p>---
8739 </p>
8740 !! end
8741
8742 !! test
8743 Horizontal ruler -- Supports content following dashes on same line
8744 !! wikitext
8745 ---- Foo
8746 !! html
8747 <hr /> Foo
8748
8749 !! html+tidy
8750 <hr />
8751 <p>Foo</p>
8752 !! end
8753
8754 ###
8755 ### Block-level elements
8756 ###
8757 !! test
8758 Common list
8759 !! wikitext
8760 *Common list
8761 * item 2
8762 *item 3
8763 !! html
8764 <ul><li>Common list</li>
8765 <li> item 2</li>
8766 <li>item 3</li></ul>
8767
8768 !! end
8769
8770 !! test
8771 Numbered list
8772 !! wikitext
8773 #Numbered list
8774 #item 2
8775 # item 3
8776 !! html
8777 <ol><li>Numbered list</li>
8778 <li>item 2</li>
8779 <li> item 3</li></ol>
8780
8781 !! end
8782
8783 !! test
8784 Mixed list
8785 !! wikitext
8786 *Mixed list
8787 *# with numbers
8788 ** and bullets
8789 *# and numbers
8790 *bullets again
8791 **bullet level 2
8792 ***bullet level 3
8793 ***#Number on level 4
8794 **bullet level 2
8795 **#Number on level 3
8796 **#Number on level 3
8797 *#number level 2
8798 *Level 1
8799 *** Level 3
8800 #** Level 3, but ordered
8801 !! html
8802 <ul><li>Mixed list
8803 <ol><li> with numbers</li></ol>
8804 <ul><li> and bullets</li></ul>
8805 <ol><li> and numbers</li></ol></li>
8806 <li>bullets again
8807 <ul><li>bullet level 2
8808 <ul><li>bullet level 3
8809 <ol><li>Number on level 4</li></ol></li></ul></li>
8810 <li>bullet level 2
8811 <ol><li>Number on level 3</li>
8812 <li>Number on level 3</li></ol></li></ul>
8813 <ol><li>number level 2</li></ol></li>
8814 <li>Level 1
8815 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8816 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8817
8818 !! end
8819
8820 !! test
8821 1. Nested mixed wikitext and html list
8822 !! wikitext
8823 * hi
8824 * <ul><li>ho</li></ul>
8825 * hi
8826 ** ho
8827 !! html/php
8828 <ul><li> hi</li>
8829 <li> <ul><li>ho</li></ul></li>
8830 <li> hi
8831 <ul><li> ho</li></ul></li></ul>
8832
8833 !! html/parsoid
8834 <ul><li> hi</li>
8835 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8836 <li> hi
8837 <ul><li> ho</li></ul></li></ul>
8838 !! end
8839
8840 !! test
8841 2. Nested mixed wikitext and html list (incompatible)
8842 !! wikitext
8843 ; hi
8844 : {{echo|<li>ho</li>}}
8845 !! html/php
8846 <dl><dt> hi</dt>
8847 <dd> <li>ho</li></dd></dl>
8848
8849 !! html/parsoid
8850 <dl><dt> hi</dt>
8851 <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>
8852 !! end
8853
8854 !! test
8855 Nested lists 1
8856 !! wikitext
8857 *foo
8858 **bar
8859 !! html
8860 <ul><li>foo
8861 <ul><li>bar</li></ul></li></ul>
8862
8863 !! end
8864
8865 !! test
8866 Nested lists 2
8867 !! wikitext
8868 **foo
8869 *bar
8870 !! html
8871 <ul><li><ul><li>foo</li></ul></li>
8872 <li>bar</li></ul>
8873
8874 !! end
8875
8876 !! test
8877 Nested lists 3 (first element empty)
8878 !! wikitext
8879 *
8880 **bar
8881 !! html
8882 <ul><li>
8883 <ul><li>bar</li></ul></li></ul>
8884
8885 !! end
8886
8887 !! test
8888 Nested lists 4 (first element empty)
8889 !! wikitext
8890 **
8891 *bar
8892 !! html
8893 <ul><li><ul><li></li></ul></li>
8894 <li>bar</li></ul>
8895
8896 !! end
8897
8898 !! test
8899 Nested lists 5 (both elements empty)
8900 !! wikitext
8901 **
8902 *
8903 !! html
8904 <ul><li><ul><li></li></ul></li>
8905 <li></li></ul>
8906
8907 !! end
8908
8909 !! test
8910 Nested lists 6 (both elements empty)
8911 !! wikitext
8912 *
8913 **
8914 !! html
8915 <ul><li>
8916 <ul><li></li></ul></li></ul>
8917
8918 !! end
8919
8920 !! test
8921 Nested lists 7 (skip initial nesting levels)
8922 !! wikitext
8923 *** foo
8924 !! html
8925 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8926
8927 !! end
8928
8929 !! test
8930 Nested lists 8 (multiple nesting transitions)
8931 !! wikitext
8932 * foo
8933 *** bar
8934 ** baz
8935 * boo
8936 !! html
8937 <ul><li> foo
8938 <ul><li><ul><li> bar</li></ul></li>
8939 <li> baz</li></ul></li>
8940 <li> boo</li></ul>
8941
8942 !! end
8943
8944 !! test
8945 Nested lists 9 (extension interaction)
8946 !! options
8947 parsoid
8948 !! wikitext
8949 *<references />
8950 !! html/parsoid
8951 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8952 !! end
8953
8954 !! test
8955 1. Lists with start-of-line-transparent tokens before bullets: Comments
8956 !! wikitext
8957 *foo
8958 *<!--cmt-->bar
8959 <!--cmt-->*baz
8960 !! html
8961 <ul><li>foo</li>
8962 <li>bar</li>
8963 <li>baz</li></ul>
8964
8965 !! end
8966
8967 !! test
8968 2. Lists with start-of-line-transparent tokens before bullets: Template close
8969 !! wikitext
8970 *foo {{echo|bar
8971 }}*baz
8972 !! html
8973 <ul><li>foo bar</li>
8974 <li>baz</li></ul>
8975
8976 !! end
8977
8978 !! test
8979 List items are not parsed correctly following a <pre> block (bug 785)
8980 !! wikitext
8981 * <pre>foo</pre>
8982 * <pre>bar</pre>
8983 * zar
8984 !! html/php
8985 <ul><li> <pre>foo</pre></li>
8986 <li> <pre>bar</pre></li>
8987 <li> zar</li></ul>
8988
8989 !! html/parsoid
8990 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8991 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8992 <li> zar</li></ul>
8993 !! end
8994
8995 !! test
8996 List items from template
8997 !! wikitext
8998
8999 {{inner list}}
9000 * item 2
9001
9002 * item 0
9003 {{inner list}}
9004 * item 2
9005
9006 * item 0
9007 * notSOL{{inner list}}
9008 * item 2
9009 !! html
9010 <ul><li> item 1</li>
9011 <li> item 2</li></ul>
9012 <ul><li> item 0</li>
9013 <li> item 1</li>
9014 <li> item 2</li></ul>
9015 <ul><li> item 0</li>
9016 <li> notSOL</li>
9017 <li> item 1</li>
9018 <li> item 2</li></ul>
9019
9020 !! end
9021
9022 !! test
9023 List interrupted by empty line or heading
9024 !! wikitext
9025 * foo
9026
9027 ** bar
9028 == A heading ==
9029 * Another list item
9030 !! html
9031 <ul><li> foo</li></ul>
9032 <ul><li><ul><li> bar</li></ul></li></ul>
9033 <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>
9034 <ul><li> Another list item</li></ul>
9035
9036 !!end
9037
9038 !!test
9039 Multiple list tags generated by templates
9040 !! wikitext
9041 {{echo|<li>}}a
9042 {{echo|<li>}}b
9043 {{echo|<li>}}c
9044 !! html
9045 <li>a
9046 <li>b
9047 <li>c</li>
9048 </li>
9049 </li>
9050
9051 !! html+tidy
9052 <ul>
9053 <li>a</li>
9054 <li>b</li>
9055 <li>c</li>
9056 </ul>
9057 !!end
9058
9059 !!test
9060 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9061 !! wikitext
9062 *a
9063 <!--This line will NOT split the list-->
9064 *b
9065 <!--This line will NOT split the list either-->
9066 *c
9067 <!--foo--> <!----> <!--This line NOT split the list either-->
9068 *d
9069 !! html
9070 <ul><li>a</li>
9071 <li>b</li>
9072 <li>c</li>
9073 <li>d</li></ul>
9074
9075 !!end
9076
9077 !!test
9078 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9079 !! wikitext
9080 *a
9081 <!--This line will NOT split the list-->
9082 *b
9083 <!--This line will NOT split the list either-->
9084 *c
9085 <!--foo--> <!----> <!--This line NOT split the list
9086 either-->
9087 *d
9088 !! html
9089 <ul><li>a</li>
9090 <li>b</li>
9091 <li>c</li>
9092 <li>d</li></ul>
9093
9094 !!end
9095
9096 !!test
9097 Test the li-hack
9098 (The PHP parser relies on Tidy for the hack)
9099 !!options
9100 parsoid=wt2html,wt2wt
9101 !! wikitext
9102 * foo
9103 * <li>li-hack
9104 * {{echo|<li>templated li-hack}}
9105 * <!--foo--> <li> unsupported li-hack with preceding comments
9106
9107 <ul>
9108 <li><li>not a li-hack
9109 </li>
9110 </ul>
9111 !! html+tidy
9112 <ul>
9113 <li>foo</li>
9114 <li>li-hack</li>
9115 <li>templated li-hack</li>
9116 <li>unsupported li-hack with preceding comments</li>
9117 </ul>
9118 <ul>
9119 <li>not a li-hack</li>
9120 </ul>
9121 !!end
9122
9123 !! test
9124 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9125 !! options
9126 parsoid
9127 !! wikitext
9128 # foo
9129 ## bar
9130 * foo
9131 ** bar
9132 : foo
9133 :: bar
9134 !! html
9135 <ol>
9136 <li> foo<ol>
9137 <li> bar</li>
9138 </ol></li>
9139 </ol><ul>
9140 <li> foo<ul>
9141 <li> bar</li>
9142 </ul></li>
9143 </ul><dl>
9144 <dd> foo<dl>
9145 <dd> bar</dd>
9146 </dl></dd>
9147 </dl>
9148 !! end
9149
9150 !! test
9151 Parsoid: Test of whitespace serialization with Templated bullets
9152 !! options
9153 parsoid
9154 !! wikitext
9155 * {{bullet}}
9156 !! html
9157 <ul>
9158 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9159 </ul>
9160 !! end
9161
9162 # ------------------------------------------------------------------------
9163 # The next set of tests are about Parsoid's ability to handle badly nested
9164 # tags (parse, minimize scope of fixup, and roundtrip back)
9165 # ------------------------------------------------------------------------
9166
9167 !! test
9168 Unbalanced closing block tags break a list
9169 (php parser relies on Tidy to fix up)
9170 !! wikitext
9171 <div>
9172 *a</div><div>
9173 *b</div>
9174 !! html+tidy
9175 <div>
9176 <ul>
9177 <li>a</li>
9178 </ul>
9179 </div>
9180 <div>
9181 <ul>
9182 <li>b</li>
9183 </ul>
9184 </div>
9185 !! end
9186
9187 # Parsoid fails this test, but it might be tricky to support properly.
9188 # See bug 68395.
9189 !! test
9190 Unbalanced closing non-block tags don't break a list
9191 (php parser relies on Tidy to fix up)
9192 !! wikitext
9193 <span>
9194 *a</span><span>
9195 *b</span>
9196 !! html/php+tidy
9197 <ul>
9198 <li><span>a</span></li>
9199 <li><span>b</span></li>
9200 </ul>
9201 !! html/parsoid
9202 <span>
9203 <ul>
9204 <li>a<span></span>
9205 </li>
9206 <li>b
9207 </li>
9208 </ul>
9209 </span>
9210 !! end
9211
9212 !! test
9213 Unclosed formatting tags that straddle lists are closed and reopened
9214 (php parser relies on Tidy to fix up)
9215 !! options
9216 parsoid=wt2html,wt2wt,html2html
9217 !! wikitext
9218 # <s> a
9219 # b </s>
9220 !! html/php+tidy
9221 <ol>
9222 <li><s>a</s></li>
9223 <li><s>b</s></li>
9224 </ol>
9225 !! html/parsoid
9226 <ol><li> <s> a</s></li>
9227 <li><s> b </s></li></ol>
9228 !! end
9229
9230 # See bug 68395.
9231 !!test
9232 1. List embedded in a formatting tag
9233 !! wikitext
9234 <small>
9235 * foo
9236 </small>
9237 !! html/php+tidy
9238 <ul>
9239 <li><small>foo</small></li>
9240 </ul>
9241 !! html/parsoid
9242 <small>
9243 <ul>
9244 <li> foo</li>
9245 </ul>
9246 </small>
9247 !!end
9248
9249 ## Ugly Parsoid output here
9250 ## Not sure what the right output is.
9251 !!test
9252 2. List embedded in a formatting tag
9253 !! wikitext
9254 <small>
9255 *a
9256 *b</small>
9257 !! html/php+tidy
9258 <ul>
9259 <li><small>a</small></li>
9260 <li><small>b</small></li>
9261 </ul>
9262 !! html/parsoid
9263 <small></small>
9264 <ul><small>
9265 <li>a</li>
9266 </small>
9267 <li><small>b</small></li>
9268 </ul>
9269 !!end
9270
9271 # Ugly Parsoid and PHP parser output here
9272 # Not sure if we want to make this a test!
9273 #
9274 ## !!test
9275 ## 3. Unclosed formatting tags in list elements
9276 ## !! wikitext
9277 ## *<small>a
9278 ## *<small>b
9279 ## !! html/php+tidy
9280 ## <ul>
9281 ## <li><small>a</small></li>
9282 ## <li><small><small>b</small></small></li>
9283 ## </ul>
9284 ## !! html/parsoid
9285 ## <ul>
9286 ## <li><small>a</small></li>
9287 ## <small>
9288 ## <li><small>b</small></li>
9289 ## </small></ul>
9290 ## !!end
9291
9292 # This is a bug in the PHP parser + tidy combination.
9293 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9294 # and then fostered out of the table by tidy.)
9295 # We believe the Parsoid output to be correct.
9296 !! test
9297 Table with missing opening <tr> tag
9298 !! options
9299 parsoid=wt2html,wt2wt
9300 !! wikitext
9301 <table>
9302 <td>foo</td>
9303 </tr>
9304 </table>
9305 !! html+tidy
9306 <table>
9307 <tr>
9308 <td>foo</td>
9309 </tr>
9310 </table>
9311 !! end
9312
9313 ###
9314 ### Magic Words
9315 ###
9316
9317 # Note that the current date is hard-coded as
9318 # 1970-01-01T00:02:03Z (a Thursday)
9319 # when running parser tests. The timezone is also fixed to GMT, so
9320 # local date will be identical to current date.
9321
9322 !! test
9323 Magic Word: {{CURRENTDAY}}
9324 !! wikitext
9325 {{CURRENTDAY}}
9326 !! html
9327 <p>1
9328 </p>
9329 !! end
9330
9331 !! test
9332 Magic Word: {{CURRENTDAY2}}
9333 !! wikitext
9334 {{CURRENTDAY2}}
9335 !! html
9336 <p>01
9337 </p>
9338 !! end
9339
9340 !! test
9341 Magic Word: {{CURRENTDAYNAME}}
9342 !! wikitext
9343 {{CURRENTDAYNAME}}
9344 !! html
9345 <p>Thursday
9346 </p>
9347 !! end
9348
9349 !! test
9350 Magic Word: {{CURRENTDOW}}
9351 !! wikitext
9352 {{CURRENTDOW}}
9353 !! html
9354 <p>4
9355 </p>
9356 !! end
9357
9358 !! test
9359 Magic Word: {{CURRENTMONTH}}
9360 !! wikitext
9361 {{CURRENTMONTH}}
9362 !! html
9363 <p>01
9364 </p>
9365 !! end
9366
9367 !! test
9368 Magic Word: {{CURRENTMONTH1}}
9369 !! wikitext
9370 {{CURRENTMONTH1}}
9371 !! html
9372 <p>1
9373 </p>
9374 !! end
9375
9376 !! test
9377 Magic Word: {{CURRENTMONTHABBREV}}
9378 !! wikitext
9379 {{CURRENTMONTHABBREV}}
9380 !! html
9381 <p>Jan
9382 </p>
9383 !! end
9384
9385 !! test
9386 Magic Word: {{CURRENTMONTHNAME}}
9387 !! wikitext
9388 {{CURRENTMONTHNAME}}
9389 !! html
9390 <p>January
9391 </p>
9392 !! end
9393
9394 !! test
9395 Magic Word: {{CURRENTMONTHNAMEGEN}}
9396 !! wikitext
9397 {{CURRENTMONTHNAMEGEN}}
9398 !! html
9399 <p>January
9400 </p>
9401 !! end
9402
9403 !! test
9404 Magic Word: {{CURRENTTIME}}
9405 !! wikitext
9406 {{CURRENTTIME}}
9407 !! html
9408 <p>00:02
9409 </p>
9410 !! end
9411
9412 !! test
9413 Magic Word: {{CURRENTHOUR}}
9414 !! wikitext
9415 {{CURRENTHOUR}}
9416 !! html
9417 <p>00
9418 </p>
9419 !! end
9420
9421 !! test
9422 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9423 !! wikitext
9424 {{CURRENTWEEK}}
9425 !! html
9426 <p>1
9427 </p>
9428 !! end
9429
9430 !! test
9431 Magic Word: {{CURRENTYEAR}}
9432 !! wikitext
9433 {{CURRENTYEAR}}
9434 !! html
9435 <p>1970
9436 </p>
9437 !! end
9438
9439 !! test
9440 Magic Word: {{CURRENTTIMESTAMP}}
9441 !! wikitext
9442 {{CURRENTTIMESTAMP}}
9443 !! html
9444 <p>19700101000203
9445 </p>
9446 !! end
9447
9448 !! test
9449 Magic Words LOCAL (UTC)
9450 !! wikitext
9451 * {{LOCALMONTH}}
9452 * {{LOCALMONTH1}}
9453 * {{LOCALMONTHNAME}}
9454 * {{LOCALMONTHNAMEGEN}}
9455 * {{LOCALMONTHABBREV}}
9456 * {{LOCALDAY}}
9457 * {{LOCALDAY2}}
9458 * {{LOCALDAYNAME}}
9459 * {{LOCALYEAR}}
9460 * {{LOCALTIME}}
9461 * {{LOCALHOUR}}
9462 * {{LOCALWEEK}}
9463 * {{LOCALDOW}}
9464 * {{LOCALTIMESTAMP}}
9465 !! html
9466 <ul><li> 01</li>
9467 <li> 1</li>
9468 <li> January</li>
9469 <li> January</li>
9470 <li> Jan</li>
9471 <li> 1</li>
9472 <li> 01</li>
9473 <li> Thursday</li>
9474 <li> 1970</li>
9475 <li> 00:02</li>
9476 <li> 00</li>
9477 <li> 1</li>
9478 <li> 4</li>
9479 <li> 19700101000203</li></ul>
9480
9481 !! end
9482
9483 !! test
9484 Magic Word: {{FULLPAGENAME}}
9485 !! options
9486 title=[[User:Ævar Arnfjörð Bjarmason]]
9487 !! wikitext
9488 {{FULLPAGENAME}}
9489 !! html
9490 <p>User:Ævar Arnfjörð Bjarmason
9491 </p>
9492 !! end
9493
9494 !! test
9495 Magic Word: {{FULLPAGENAMEE}}
9496 !! options
9497 title=[[User:Ævar Arnfjörð Bjarmason]]
9498 !! wikitext
9499 {{FULLPAGENAMEE}}
9500 !! html
9501 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9502 </p>
9503 !! end
9504
9505 !! test
9506 Magic Word: {{TALKSPACE}}
9507 !! options
9508 title=[[User:Ævar Arnfjörð Bjarmason]]
9509 !! wikitext
9510 {{TALKSPACE}}
9511 !! html
9512 <p>User talk
9513 </p>
9514 !! end
9515
9516 !! test
9517 Magic Word: {{TALKSPACE}}, same namespace
9518 !! options
9519 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9520 !! wikitext
9521 {{TALKSPACE}}
9522 !! html
9523 <p>User talk
9524 </p>
9525 !! end
9526
9527 !! test
9528 Magic Word: {{TALKSPACE}}, main namespace
9529 !! options
9530 title=[[Parser Test]]
9531 !! wikitext
9532 {{TALKSPACE}}
9533 !! html
9534 <p>Talk
9535 </p>
9536 !! end
9537
9538 !! test
9539 Magic Word: {{TALKSPACEE}}
9540 !! options
9541 title=[[User:Ævar Arnfjörð Bjarmason]]
9542 !! wikitext
9543 {{TALKSPACEE}}
9544 !! html
9545 <p>User_talk
9546 </p>
9547 !! end
9548
9549 !! test
9550 Magic Word: {{SUBJECTSPACE}}
9551 !! options
9552 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9553 !! wikitext
9554 {{SUBJECTSPACE}}
9555 !! html
9556 <p>User
9557 </p>
9558 !! end
9559
9560 !! test
9561 Magic Word: {{SUBJECTSPACE}}, same namespace
9562 !! options
9563 title=[[User:Ævar Arnfjörð Bjarmason]]
9564 !! wikitext
9565 {{SUBJECTSPACE}}
9566 !! html
9567 <p>User
9568 </p>
9569 !! end
9570
9571 !! test
9572 Magic Word: {{SUBJECTSPACE}}, main namespace
9573 !! options
9574 title=[[Parser Test]]
9575 !! wikitext
9576 {{SUBJECTSPACE}}
9577 !! html
9578
9579 !! end
9580
9581 !! test
9582 Magic Word: {{SUBJECTSPACEE}}
9583 !! options
9584 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9585 !! wikitext
9586 {{SUBJECTSPACEE}}
9587 !! html
9588 <p>User
9589 </p>
9590 !! end
9591
9592 !! test
9593 Magic Word: {{NAMESPACE}}
9594 !! options
9595 title=[[User:Ævar Arnfjörð Bjarmason]]
9596 !! wikitext
9597 {{NAMESPACE}}
9598 !! html
9599 <p>User
9600 </p>
9601 !! end
9602
9603 !! test
9604 Magic Word: {{NAMESPACEE}}
9605 !! options
9606 title=[[User:Ævar Arnfjörð Bjarmason]]
9607 !! wikitext
9608 {{NAMESPACEE}}
9609 !! html
9610 <p>User
9611 </p>
9612 !! end
9613
9614 !! test
9615 Magic Word: {{NAMESPACENUMBER}}
9616 !! options
9617 title=[[User:Ævar Arnfjörð Bjarmason]]
9618 !! wikitext
9619 {{NAMESPACENUMBER}}
9620 !! html
9621 <p>2
9622 </p>
9623 !! end
9624
9625 !! test
9626 Magic Word: {{SUBPAGENAME}}
9627 !! options
9628 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9629 !! wikitext
9630 {{SUBPAGENAME}}
9631 !! html
9632 <p>sub ö
9633 </p>
9634 !! end
9635
9636 !! test
9637 Magic Word: {{SUBPAGENAMEE}}
9638 !! options
9639 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9640 !! wikitext
9641 {{SUBPAGENAMEE}}
9642 !! html
9643 <p>sub_%C3%B6
9644 </p>
9645 !! end
9646
9647 !! test
9648 Magic Word: {{ROOTPAGENAME}}
9649 !! options
9650 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9651 !! wikitext
9652 {{ROOTPAGENAME}}
9653 !! html
9654 <p>Ævar Arnfjörð Bjarmason
9655 </p>
9656 !! end
9657
9658 !! test
9659 Magic Word: {{ROOTPAGENAMEE}}
9660 !! options
9661 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9662 !! wikitext
9663 {{ROOTPAGENAMEE}}
9664 !! html
9665 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9666 </p>
9667 !! end
9668
9669 !! test
9670 Magic Word: {{BASEPAGENAME}}
9671 !! options
9672 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9673 !! wikitext
9674 {{BASEPAGENAME}}
9675 !! html
9676 <p>Ævar Arnfjörð Bjarmason
9677 </p>
9678 !! end
9679
9680 !! test
9681 Magic Word: {{BASEPAGENAMEE}}
9682 !! options
9683 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9684 !! wikitext
9685 {{BASEPAGENAMEE}}
9686 !! html
9687 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9688 </p>
9689 !! end
9690
9691 !! test
9692 Magic Word: {{TALKPAGENAME}}
9693 !! options
9694 title=[[User:Ævar Arnfjörð Bjarmason]]
9695 !! wikitext
9696 {{TALKPAGENAME}}
9697 !! html
9698 <p>User talk:Ævar Arnfjörð Bjarmason
9699 </p>
9700 !! end
9701
9702 !! test
9703 Magic Word: {{TALKPAGENAMEE}}
9704 !! options
9705 title=[[User:Ævar Arnfjörð Bjarmason]]
9706 !! wikitext
9707 {{TALKPAGENAMEE}}
9708 !! html
9709 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9710 </p>
9711 !! end
9712
9713 !! test
9714 Magic Word: {{SUBJECTPAGENAME}}
9715 !! options
9716 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9717 !! wikitext
9718 {{SUBJECTPAGENAME}}
9719 !! html
9720 <p>User:Ævar Arnfjörð Bjarmason
9721 </p>
9722 !! end
9723
9724 !! test
9725 Magic Word: {{SUBJECTPAGENAMEE}}
9726 !! options
9727 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9728 !! wikitext
9729 {{SUBJECTPAGENAMEE}}
9730 !! html
9731 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9732 </p>
9733 !! end
9734
9735 !! test
9736 Magic Word: {{NUMBEROFFILES}}
9737 !! wikitext
9738 {{NUMBEROFFILES}}
9739 !! html
9740 <p>6
9741 </p>
9742 !! end
9743
9744 !! test
9745 Magic Word: {{PAGENAME}}
9746 !! options
9747 title=[[User:Ævar Arnfjörð Bjarmason]]
9748 !! wikitext
9749 {{PAGENAME}}
9750 !! html
9751 <p>Ævar Arnfjörð Bjarmason
9752 </p>
9753 !! end
9754
9755 !! test
9756 Magic Word: {{PAGENAME}} with metacharacters
9757 !! options
9758 title=[['foo & bar = baz']]
9759 !! wikitext
9760 ''{{PAGENAME}}''
9761 !! html/php
9762 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9763 </p>
9764 !! html+tidy
9765 <p><i>'foo &amp; bar = baz'</i></p>
9766 !! end
9767
9768 !! test
9769 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9770 !! options
9771 title=[[*RFC 1234 http://example.com/]]
9772 !! wikitext
9773 {{PAGENAME}}
9774 !! html/php
9775 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9776 </p>
9777 !! html+tidy
9778 <p>*RFC 1234 http://example.com/</p>
9779 !! end
9780
9781 !! test
9782 Magic Word: {{PAGENAMEE}}
9783 !! options
9784 title=[[User:Ævar Arnfjörð Bjarmason]]
9785 !! wikitext
9786 {{PAGENAMEE}}
9787 !! html
9788 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9794 !! options
9795 title=[[*RFC 1234 http://example.com/]]
9796 !! wikitext
9797 {{PAGENAMEE}}
9798 !! html/php
9799 <p>&#42;RFC_1234_http&#58;//example.com/
9800 </p>
9801 !! html+tidy
9802 <p>*RFC_1234_http://example.com/</p>
9803 !! end
9804
9805 !! test
9806 Magic Word: {{REVISIONID}}
9807 !! wikitext
9808 {{REVISIONID}}
9809 !! html
9810 <p>1337
9811 </p>
9812 !! end
9813
9814 !! test
9815 Magic Word: {{SCRIPTPATH}}
9816 !! wikitext
9817 {{SCRIPTPATH}}
9818 !! html
9819
9820 !! end
9821
9822 !! test
9823 Magic Word: {{STYLEPATH}}
9824 !! wikitext
9825 {{STYLEPATH}}
9826 !! html
9827 <p>/skins
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: {{SERVER}}
9833 !! wikitext
9834 {{SERVER}}
9835 !! html
9836 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9837 </p>
9838 !! end
9839
9840 !! test
9841 Magic Word: {{SERVERNAME}}
9842 !! wikitext
9843 {{SERVERNAME}}
9844 !! html
9845 <p>example.org
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{SITENAME}}
9851 !! wikitext
9852 {{SITENAME}}
9853 !! html
9854 <p>MediaWiki
9855 </p>
9856 !! end
9857
9858 !! test
9859 Case-sensitive magic words, when cased differently, should just be template transclusions
9860 !! wikitext
9861 {{CurrentMonth}}
9862 {{currentday}}
9863 {{cURreNTweEK}}
9864 {{currentHour}}
9865 !! html
9866 <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>
9867 <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>
9868 <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>
9869 <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>
9870 </p>
9871 !! end
9872
9873 !! test
9874 Case-insensitive magic words should still work with weird casing.
9875 !! wikitext
9876 {{sErVeRNaMe}}
9877 {{LCFirst:AOEU}}
9878 {{ucFIRST:aoeu}}
9879 {{SERver}}
9880 !! html
9881 <p>example.org
9882 aOEU
9883 Aoeu
9884 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9885 </p>
9886 !! end
9887
9888 # From plwiki:PLOS_ONE
9889 !! test
9890 Parsoid: Page property magic word with magic word contents
9891 !! wikitext
9892 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9893 !! html/parsoid
9894 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9895 !! end
9896
9897 !! test
9898 Parsoid: Template-generated DISPLAYTITLE
9899 !! wikitext
9900 {{{{echo|DISPLAYTITLE}}:Foo}}
9901 !! html/parsoid
9902 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9903 !! end
9904
9905 !! test
9906 Namespace 1 {{ns:1}}
9907 !! wikitext
9908 {{ns:1}}
9909 !! html
9910 <p>Talk
9911 </p>
9912 !! end
9913
9914 !! test
9915 Namespace 1 {{ns:01}}
9916 !! wikitext
9917 {{ns:01}}
9918 !! html
9919 <p>Talk
9920 </p>
9921 !! end
9922
9923 !! test
9924 Namespace 0 {{ns:0}} (bug 4783)
9925 !! wikitext
9926 {{ns:0}}
9927 !! html
9928
9929 !! end
9930
9931 !! test
9932 Namespace 0 {{ns:00}} (bug 4783)
9933 !! wikitext
9934 {{ns:00}}
9935 !! html
9936
9937 !! end
9938
9939 !! test
9940 Namespace -1 {{ns:-1}}
9941 !! wikitext
9942 {{ns:-1}}
9943 !! html
9944 <p>Special
9945 </p>
9946 !! end
9947
9948 !! test
9949 Namespace User {{ns:User}}
9950 !! wikitext
9951 {{ns:User}}
9952 !! html
9953 <p>User
9954 </p>
9955 !! end
9956
9957 !! test
9958 Namespace User talk {{ns:User_talk}}
9959 !! wikitext
9960 {{ns:User_talk}}
9961 !! html
9962 <p>User talk
9963 </p>
9964 !! end
9965
9966 !! test
9967 Namespace User talk {{ns:uSeR tAlK}}
9968 !! wikitext
9969 {{ns:uSeR tAlK}}
9970 !! html
9971 <p>User talk
9972 </p>
9973 !! end
9974
9975 !! test
9976 Namespace File {{ns:File}}
9977 !! wikitext
9978 {{ns:File}}
9979 !! html
9980 <p>File
9981 </p>
9982 !! end
9983
9984 !! test
9985 Namespace File {{ns:Image}}
9986 !! wikitext
9987 {{ns:Image}}
9988 !! html
9989 <p>File
9990 </p>
9991 !! end
9992
9993 !! test
9994 Namespace (lang=de) Benutzer {{ns:User}}
9995 !! options
9996 language=de
9997 !! wikitext
9998 {{ns:User}}
9999 !! html
10000 <p>Benutzer
10001 </p>
10002 !! end
10003
10004 !! test
10005 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10006 !! options
10007 language=de
10008 !! wikitext
10009 {{ns:3}}
10010 !! html
10011 <p>Benutzer Diskussion
10012 </p>
10013 !! end
10014
10015
10016 !! test
10017 Urlencode
10018 !! wikitext
10019 {{urlencode:hi world?!}}
10020 {{urlencode:hi world?!|WIKI}}
10021 {{urlencode:hi world?!|PATH}}
10022 {{urlencode:hi world?!|QUERY}}
10023 !! html
10024 <p>hi+world%3F%21
10025 hi_world%3F!
10026 hi%20world%3F%21
10027 hi+world%3F%21
10028 </p>
10029 !! end
10030
10031 !! test
10032 Magic Word: prioritize type info over data-parsoid
10033 !! options
10034 parsoid=html2wt
10035 !! html/parsoid
10036 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10037 !! wikitext
10038 __FORCETOC__
10039 !! end
10040
10041 !! test
10042 Magic Word: serialize on separate line (parsoid)
10043 !! options
10044 parsoid=wt2wt,html2wt
10045 !! wikitext
10046 foo
10047 __NOTOC__
10048 bar
10049 !! html/parsoid
10050 foo<meta property="mw:PageProp/notoc"/>bar
10051 !! end
10052
10053 !! test
10054 Magic Word: rt non-english wikis
10055 !! options
10056 parsoid=wt2wt
10057 language=de
10058 !! wikitext
10059 __NOEDITSECTION__
10060 !! html/parsoid
10061 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10062 !! end
10063
10064 !!test
10065 __proto__ is treated as normal wikitext (T105997)
10066 !!wikitext
10067 __proto__
10068 !!html
10069 <p>__proto__
10070 </p>
10071 !!end
10072
10073 ###
10074 ### Magic links
10075 ###
10076 !! test
10077 Magic links: internal link to RFC (bug 479)
10078 !! wikitext
10079 [[RFC 123]]
10080 !! html/php
10081 <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>
10082 </p>
10083 !! html/parsoid
10084 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10085 !! end
10086
10087 !! test
10088 Magic links: RFC (bug 479)
10089 !! wikitext
10090 RFC 822
10091 !! html/php
10092 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10093 </p>
10094 !! html/parsoid
10095 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10096 !! end
10097
10098 !! test
10099 Magic links: RFC (bug 65278)
10100 !! wikitext
10101 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10102 !! html/php
10103 <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.
10104 </p>
10105 !! html/parsoid
10106 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10107 !! end
10108
10109 !! test
10110 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10111 !! wikitext
10112 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10113 RFC
10114 822
10115 !! html/php
10116 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10117 RFC
10118 822
10119 </p>
10120 !! html/parsoid
10121 <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>
10122 RFC
10123 822</p>
10124 !! end
10125
10126 !! test
10127 Magic links: ISBN (bug 1937)
10128 !! wikitext
10129 ISBN 0-306-40615-2
10130 !! html/php
10131 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10132 </p>
10133 !! html/parsoid
10134 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10135 !! end
10136
10137 !! test
10138 Magic links: ISBN (bug 65278)
10139 !! wikitext
10140 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10141 !! html/php
10142 <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.
10143 </p>
10144 !! html/parsoid
10145 <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>
10146 !! end
10147
10148 !! test
10149 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10150 !! wikitext
10151 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10152 ISBN
10153 9780316098113
10154 ISBN 978
10155 0316098113
10156 !! html/php
10157 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10158 ISBN
10159 9780316098113
10160 ISBN 978
10161 0316098113
10162 </p>
10163 !! html/parsoid
10164 <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>
10165 ISBN
10166 9780316098113
10167 ISBN 978
10168 0316098113</p>
10169 !! end
10170
10171 !! test
10172 Magic links: PMID incorrectly converts space to underscore
10173 !! wikitext
10174 PMID 1234
10175 !! html/php
10176 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10177 </p>
10178 !! html/parsoid
10179 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10180 !! end
10181
10182 !! test
10183 Magic links: PMID (bug 65278)
10184 !! wikitext
10185 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10186 !! html/php
10187 <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.
10188 </p>
10189 !! html/parsoid
10190 <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>
10191 !! end
10192
10193 !! test
10194 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10195 !! wikitext
10196 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10197 PMID
10198 1234
10199 !! html/php
10200 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10201 PMID
10202 1234
10203 </p>
10204 !! html/parsoid
10205 <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>
10206 PMID
10207 1234</p>
10208 !! end
10209
10210 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10211 # since these are ExtLinkText, not MagicLinkText
10212 !! test
10213 Magic links: use appropriate serialization for "almost" magic links.
10214 !! wikitext
10215 X[[Special:BookSources/0978739256|foo]]
10216
10217 X[//tools.ietf.org/html/rfc1234 foo]
10218 !! html/php
10219 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10220 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10221 </p>
10222 !! html/parsoid
10223 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10224 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10225 !! end
10226
10227 ###
10228 ### Templates
10229 ####
10230
10231 !! test
10232 Nonexistent template
10233 !! wikitext
10234 {{thistemplatedoesnotexist}}
10235 !! html
10236 <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>
10237 </p>
10238 !! end
10239
10240 !! test
10241 Template with invalid target containing tags
10242 !! wikitext
10243 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10244 !! html
10245 <p>{{a<b>b</b>|foo|a=b|a = b}}
10246 </p>
10247 !! end
10248
10249 !! test
10250 Template with invalid target containing unclosed tag
10251 !! wikitext
10252 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10253 !! html
10254 <p>{{a<b>|foo|a=b|a = b}}</b>
10255 </p>
10256 !! end
10257
10258 !! test
10259 Template with invalid target containing wikilink
10260 !! wikitext
10261 {{[[Main Page]]}}
10262 !! html/php
10263 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10264 </p>
10265 !! html/parsoid
10266 <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>
10267 !! end
10268
10269 !! test
10270 Template with just whitespace in it, bug #68421
10271 !! wikitext
10272 {{echo|{{ }}}}
10273 !! html/parsoid
10274 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
10275 !! end
10276
10277 !! article
10278 Template:test
10279 !! text
10280 This is a test template
10281 !! endarticle
10282
10283 !! test
10284 Simple template
10285 !! wikitext
10286 {{test}}
10287 !! html
10288 <p>This is a test template
10289 </p>
10290 !! end
10291
10292 !! test
10293 Template with explicit namespace
10294 !! wikitext
10295 {{Template:test}}
10296 !! html
10297 <p>This is a test template
10298 </p>
10299 !! end
10300
10301
10302 !! article
10303 Template:paramtest
10304 !! text
10305 This is a test template with parameter {{{param}}}
10306 !! endarticle
10307
10308 !! test
10309 Template parameter
10310 !! wikitext
10311 {{paramtest|param=foo}}
10312 !! html
10313 <p>This is a test template with parameter foo
10314 </p>
10315 !! end
10316
10317 !! article
10318 Template:paramtestnum
10319 !! text
10320 [[{{{1}}}|{{{2}}}]]
10321 !! endarticle
10322
10323 !! test
10324 Template unnamed parameter
10325 !! wikitext
10326 {{paramtestnum|Main Page|the main page}}
10327 !! html
10328 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10329 </p>
10330 !! end
10331
10332 !! article
10333 Template:templatesimple
10334 !! text
10335 (test)
10336 !! endarticle
10337
10338 !! article
10339 Template:templateredirect
10340 !! text
10341 #redirect [[Template:templatesimple]]
10342 !! endarticle
10343
10344 !! article
10345 Template:templateasargtestnum
10346 !! text
10347 {{{{{1}}}}}
10348 !! endarticle
10349
10350 !! article
10351 Template:templateasargtest
10352 !! text
10353 {{template{{{templ}}}}}
10354 !! endarticle
10355
10356 !! article
10357 Template:templateasargtest2
10358 !! text
10359 {{{{{templ}}}}}
10360 !! endarticle
10361
10362 !! test
10363 Template with template name as unnamed argument
10364 !! wikitext
10365 {{templateasargtestnum|templatesimple}}
10366 !! html
10367 <p>(test)
10368 </p>
10369 !! end
10370
10371 !! test
10372 Template with template name as argument
10373 !! wikitext
10374 {{templateasargtest|templ=simple}}
10375 !! html
10376 <p>(test)
10377 </p>
10378 !! end
10379
10380 !! test
10381 Template with template name as argument (2)
10382 !! wikitext
10383 {{templateasargtest2|templ=templatesimple}}
10384 !! html
10385 <p>(test)
10386 </p>
10387 !! end
10388
10389 !! article
10390 Template:templateasargtestdefault
10391 !! text
10392 {{{{{templ|templatesimple}}}}}
10393 !! endarticle
10394
10395 !! article
10396 Template:templa
10397 !! text
10398 '''templ'''
10399 !! endarticle
10400
10401 !! test
10402 Template with default value
10403 !! wikitext
10404 {{templateasargtestdefault}}
10405 !! html
10406 <p>(test)
10407 </p>
10408 !! end
10409
10410 !! test
10411 Template with default value (value set)
10412 !! wikitext
10413 {{templateasargtestdefault|templ=templa}}
10414 !! html
10415 <p><b>templ</b>
10416 </p>
10417 !! end
10418
10419 !! test
10420 Template redirect
10421 !! wikitext
10422 {{templateredirect}}
10423 !! html/php
10424 <p>(test)
10425 </p>
10426 !! html/parsoid
10427 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10428 !! end
10429
10430 !! test
10431 Template with argument in separate line
10432 !! wikitext
10433 {{ templateasargtest |
10434 templ = simple }}
10435 !! html
10436 <p>(test)
10437 </p>
10438 !! end
10439
10440 !! test
10441 Template with complex template as argument
10442 !! wikitext
10443 {{paramtest|
10444 param ={{ templateasargtest |
10445 templ = simple }}}}
10446 !! html
10447 <p>This is a test template with parameter (test)
10448 </p>
10449 !! end
10450
10451 !! test
10452 Template with thumb image (with link in description)
10453 !! wikitext
10454 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10455 !! html/php
10456 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>
10457
10458 !! html+tidy
10459 <p>This is a test template with parameter</p>
10460 <div class="thumb tright">
10461 <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>
10462 <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>
10463 </div>
10464 </div>
10465 !! html/parsoid
10466 <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>
10467 !! end
10468
10469 !! article
10470 Template:complextemplate
10471 !! text
10472 {{{1}}} {{paramtest|
10473 param ={{{param}}}}}
10474 !! endarticle
10475
10476 !! test
10477 Template with complex arguments
10478 !! wikitext
10479 {{complextemplate|
10480 param ={{ templateasargtest |
10481 templ = simple }}|[[Template:complextemplate|link]]}}
10482 !! html
10483 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10484 </p>
10485 !! end
10486
10487 !! test
10488 BUG 553: link with two variables in a piped link
10489 !! wikitext
10490 {|
10491 |[[{{{1}}}|{{{2}}}]]
10492 |}
10493 !! html/php
10494 <table>
10495 <tr>
10496 <td>[[{{{1}}}|{{{2}}}]]
10497 </td></tr></table>
10498
10499 !! html/parsoid
10500 <table>
10501 <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>
10502 !! end
10503
10504 # See: T2553
10505 !! test
10506 Abort table cell attribute parsing on wikilink
10507 !! wikitext
10508 {|
10509 | testing [[one|two]] | three || four
10510 | testing one two | three || four
10511 |}
10512 !! html/php
10513 <table>
10514 <tr>
10515 <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>
10516 <td> four
10517 </td>
10518 <td> three </td>
10519 <td> four
10520 </td></tr></table>
10521
10522 !! html/parsoid
10523 <table>
10524 <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>
10525 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10526 </tbody></table>
10527 !! end
10528
10529 !! test
10530 Don't abort table cell attribute parsing if wikilink is found in template arg
10531 !! wikitext
10532 {|
10533 | Test {{#tag:ref|One two "[[three]]" four}}
10534 |}
10535 !! html/parsoid
10536 <table>
10537 <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>
10538 </tbody></table>
10539 !! end
10540
10541 !! test
10542 Magic variable as template parameter
10543 !! wikitext
10544 {{paramtest|param={{SITENAME}}}}
10545 !! html
10546 <p>This is a test template with parameter MediaWiki
10547 </p>
10548 !! end
10549
10550 !! article
10551 Template:linktest
10552 !! text
10553 [[{{{param}}}|link]]
10554 !! endarticle
10555
10556 !! test
10557 Template parameter as link source
10558 !! wikitext
10559 {{linktest|param=Main Page}}
10560 !! html
10561 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10562 </p>
10563 !! end
10564
10565 !!article
10566 Template:paramtest2
10567 !! text
10568 including another template, {{paramtest|param={{{arg}}}}}
10569 !! endarticle
10570
10571 !! test
10572 Template passing argument to another template
10573 !! wikitext
10574 {{paramtest2|arg='hmm'}}
10575 !! html
10576 <p>including another template, This is a test template with parameter 'hmm'
10577 </p>
10578 !! end
10579
10580 !! article
10581 Template:Linktest2
10582 !! text
10583 Main Page
10584 !! endarticle
10585
10586 !! test
10587 Template as link source
10588 !! wikitext
10589 [[{{linktest2}}]]
10590
10591 [[{{linktest2}}|Main Page]]
10592
10593 [[{{linktest2}}]]Page
10594 !! html
10595 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10596 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10597 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10598 </p>
10599 !! end
10600
10601
10602 !! article
10603 Template:loop1
10604 !! text
10605 {{loop2}}
10606 !! endarticle
10607
10608 !! article
10609 Template:loop2
10610 !! text
10611 {{loop1}}
10612 !! endarticle
10613
10614 !! test
10615 Template infinite loop
10616 !! wikitext
10617 {{loop1}}
10618 !! html
10619 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10620 </p>
10621 !! end
10622
10623 !! test
10624 Template from main namespace
10625 !! wikitext
10626 {{:Main Page}}
10627 !! html
10628 <p>blah blah
10629 </p>
10630 !! end
10631
10632 !! article
10633 Template:table
10634 !! text
10635 {|
10636 | 1 || 2
10637 |-
10638 | 3 || 4
10639 |}
10640 !! endarticle
10641
10642 !! test
10643 BUG 529: Template with table, not included at beginning of line
10644 !! wikitext
10645 foo {{table}}
10646 !! html
10647 <p>foo
10648 </p>
10649 <table>
10650 <tr>
10651 <td> 1 </td>
10652 <td> 2
10653 </td></tr>
10654 <tr>
10655 <td> 3 </td>
10656 <td> 4
10657 </td></tr></table>
10658
10659 !! end
10660
10661 !! test
10662 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10663 !! wikitext
10664 foo
10665 {{table}}
10666 !! html
10667 <p>foo
10668 </p>
10669 <table>
10670 <tr>
10671 <td> 1 </td>
10672 <td> 2
10673 </td></tr>
10674 <tr>
10675 <td> 3 </td>
10676 <td> 4
10677 </td></tr></table>
10678
10679 !! end
10680
10681 !! test
10682 BUG 41: Template parameters shown as broken links
10683 !! wikitext
10684 {{{parameter}}}
10685 !! html
10686 <p>{{{parameter}}}
10687 </p>
10688 !! end
10689
10690 !! test
10691 Template with targets containing wikilinks
10692 !! wikitext
10693 {{[[foo]]}}
10694
10695 {{[[{{echo|foo}}]]}}
10696
10697 {{{{echo|[[foo}}]]}}
10698 !! html
10699 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10700 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10701 </p><p>{{[[foo}}]]
10702 </p>
10703 !! end
10704
10705 !! article
10706 Template:''
10707 !! text
10708 bar
10709 !! endarticle
10710
10711 !! test
10712 Templates: Double quotes as template target
10713 !! wikitext
10714 foo {{''}} baz
10715 !! html/php
10716 <p>foo bar baz
10717 </p>
10718 !! html/parsoid
10719 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10720 </p>
10721 !! end
10722
10723 ## This test is about making sure Parsoid's data-mw is well formed in the
10724 ## face of multiple templates with intersecting and overlapping ranges. The
10725 ## wikitext itself is wretched.
10726 !! test
10727 Templates with intersecting and overlapping ranges
10728 !! wikitext
10729 {|{{echo|
10730 <p>ha</p>}}
10731 {|{{echo|
10732 <p>ho</p>}}
10733 {{echo|{{!}}hi}}
10734 |}
10735 !! html/php+tidy
10736 <p>ha</p>
10737 <p>ho</p>
10738 <table>
10739 <tr>
10740 <td></td>
10741 </tr>
10742 <tr>
10743 <td>hi</td>
10744 </tr>
10745 </table>
10746 <table>
10747 <tr>
10748 <td></td>
10749 </tr>
10750 </table>
10751 !! html/parsoid
10752 <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":""}]]}'>
10753
10754 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10755
10756 <tbody><tr><td>hi</td></tr>
10757 </tbody></table>
10758 !! end
10759
10760 !! article
10761 Template:MSGNW test
10762 !! text
10763 ''None'' of '''this''' should be
10764 * interpreted
10765 but rather passed unmodified
10766 {{test}}
10767 <gallery>
10768 File:Foobar.jpg
10769 </gallery>
10770 <!-- comment -->
10771 !! endarticle
10772
10773 # hmm, fix this or just deprecate msgnw and document its behavior?
10774 !! test
10775 msgnw keyword
10776 !! wikitext
10777 {{msgnw:MSGNW test}}
10778 !! html/php
10779 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10780 &#42; interpreted
10781 &#32;but rather passed unmodified
10782 &#123;&#123;test&#125;&#125;
10783 &#60;gallery&#62;
10784 File:Foobar.jpg
10785 &#60;/gallery&#62;
10786 &#60;!-- comment --&#62;
10787 </p>
10788 !! end
10789
10790 !! test
10791 int keyword
10792 !! wikitext
10793 {{int:youhavenewmessages|lots of money|not!}}
10794 !! html
10795 <p>You have lots of money (not!).
10796 </p>
10797 !! end
10798
10799 !! test
10800 int keyword - non-existing message
10801 !! wikitext
10802 {{int:var}}
10803 !! html
10804 <p>&lt;var&gt;
10805 </p>
10806 !! end
10807
10808 !! article
10809 Template:Includes
10810 !! text
10811 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10812 !! endarticle
10813
10814 !! test
10815 <includeonly> and <noinclude> being included
10816 !! wikitext
10817 {{Includes}}
10818 !! html
10819 <p>Foobar
10820 </p>
10821 !! end
10822
10823 !! article
10824 Template:Includes2
10825 !! text
10826 <onlyinclude>Foo</onlyinclude>bar
10827 !! endarticle
10828
10829 !! test
10830 <onlyinclude> being included
10831 !! wikitext
10832 {{Includes2}}
10833 !! html
10834 <p>Foo
10835 </p>
10836 !! end
10837
10838
10839 !! article
10840 Template:Includes3
10841 !! text
10842 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10843 !! endarticle
10844
10845 !! test
10846 <onlyinclude> and <includeonly> being included
10847 !! wikitext
10848 {{Includes3}}
10849 !! html
10850 <p>Foo
10851 </p>
10852 !! end
10853
10854 !! test
10855 <includeonly> and <noinclude> on a page
10856 !! wikitext
10857 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10858 !! html
10859 <p>Foozar
10860 </p>
10861 !! end
10862
10863 !! test
10864 Un-closed <noinclude>
10865 !! wikitext
10866 <noinclude>
10867 !! html
10868 !! end
10869
10870 !! test
10871 <onlyinclude> on a page
10872 !! wikitext
10873 <onlyinclude>Foo</onlyinclude>bar
10874 !! html
10875 <p>Foobar
10876 </p>
10877 !! end
10878
10879 !! test
10880 Un-closed <onlyinclude>
10881 !! wikitext
10882 <onlyinclude>
10883 !! html
10884 !! end
10885
10886 !!test
10887 Self-closed noinclude, includeonly, onlyinclude tags
10888 !! wikitext
10889 <noinclude />
10890 <includeonly />
10891 <onlyinclude />
10892 !! html
10893 <p><br />
10894 </p>
10895 !!end
10896
10897 !!test
10898 Unbalanced includeonly and noinclude tags
10899 !! wikitext
10900 {|
10901 |a</noinclude>
10902 |b</noinclude></noinclude>
10903 |c</noinclude></includeonly>
10904 |d</includeonly></includeonly>
10905 |}
10906 !! html
10907 <table>
10908 <tr>
10909 <td>a
10910 </td>
10911 <td>b
10912 </td>
10913 <td>c&lt;/includeonly&gt;
10914 </td>
10915 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10916 </td></tr></table>
10917
10918 !!end
10919
10920 !! article
10921 Template:Includeonly section
10922 !! text
10923 <includeonly>
10924 ==Includeonly section==
10925 </includeonly>
10926 ==Section T-1==
10927 !!endarticle
10928
10929 !! test
10930 Bug 6563: Edit link generation for section shown by <includeonly>
10931 !! wikitext
10932 {{includeonly section}}
10933 !! html
10934 <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>
10935 <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>
10936
10937 !! end
10938
10939 # Uses same input as the contents of [[Template:Includeonly section]]
10940 !! test
10941 Bug 6563: Section extraction for section shown by <includeonly>
10942 !! options
10943 section=T-2
10944 !! wikitext
10945 <includeonly>
10946 ==Includeonly section==
10947 </includeonly>
10948 ==Section T-2==
10949 !! html
10950 ==Section T-2==
10951 !! end
10952
10953 !! test
10954 Bug 6563: Edit link generation for section suppressed by <includeonly>
10955 !! wikitext
10956 <includeonly>
10957 ==Includeonly section==
10958 </includeonly>
10959 ==Section 1==
10960 !! html
10961 <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>
10962
10963 !! end
10964
10965 !! test
10966 Bug 6563: Section extraction for section suppressed by <includeonly>
10967 !! options
10968 section=1
10969 !! wikitext
10970 <includeonly>
10971 ==Includeonly section==
10972 </includeonly>
10973 ==Section 1==
10974 !! html
10975 ==Section 1==
10976 !! end
10977
10978 !! test
10979 Un-closed <includeonly>
10980 !! wikitext
10981 <includeonly>
10982 !! html/php
10983 !! html/parsoid
10984 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
10985 !! end
10986
10987 ## We used to, but no longer wt2wt this test since the default serializer
10988 ## will normalize the include directives to serialize on their own line.
10989 ## Selser will take care of preserving formatting in scenarios where they
10990 ## intermingled with other wikitext.
10991 !! test
10992 Includes and comments at SOL
10993 !! options
10994 parsoid=wt2html,html2html
10995 !! wikitext
10996 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10997
10998 <noinclude>
10999 some
11000 </noinclude>* stuff
11001 * here
11002
11003 <includeonly>can have stuff</includeonly>=== here ===
11004
11005 !! html/php
11006 <h2><span class="mw-headline" id="hu">hu</span></h2>
11007 <p>some
11008 </p>
11009 <ul><li> stuff</li>
11010 <li> here</li></ul>
11011 <h3><span class="mw-headline" id="here">here</span></h3>
11012
11013 !! html/parsoid
11014 <!-- 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>
11015
11016 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11017 <p>some</p>
11018 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11019 <li> here</li></ul>
11020
11021 <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>
11022
11023 !! end
11024
11025 # TODO: test with DOM fragment reuse!
11026 !! test
11027 Parsoid: DOM fragment reuse
11028 !! options
11029 parsoid=wt2wt,wt2html
11030 !! wikitext
11031 a{{echo|b<table></table>c}}d
11032
11033 a{{echo|b
11034 <table></table>
11035 c}}d
11036
11037 {{echo|a
11038
11039 <table></table>
11040
11041 b}}
11042 !! html
11043 <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>
11044
11045 <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">
11046 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11047 </span><p about="#mwt2">cd</p>
11048
11049 <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">
11050
11051 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11052
11053 </span><p about="#mwt3">b</p>
11054 !! end
11055
11056 !! test
11057 Parsoid: Merge double tds (T52603)
11058 !! options
11059 parsoid
11060 !! wikitext
11061 {|
11062 |{{echo|{{!}} foo}}
11063 |}
11064 !! html
11065 <table><tbody>
11066 <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>
11067 </tbody></table>
11068 !! end
11069
11070 !! test
11071 Parsoid: Merge double tds in nested transclusion content (T52603)
11072 !! options
11073 parsoid
11074 !! wikitext
11075 {{echo|<div>}}
11076 {|
11077 |{{echo|{{!}} foo}}
11078 |}
11079 {{echo|</div>}}
11080 !! html
11081 <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}}]}'>
11082 <table><tbody>
11083 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11084 </tbody></table>
11085 </div>
11086 !! end
11087
11088 ###
11089 ### <includeonly> and <noinclude> in attributes
11090 ###
11091 !!test
11092 0. includeonly around the entire attribute
11093 !! wikitext
11094 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11095 !! html
11096 <p><span id="v2">bar</span>
11097 </p>
11098 !!end
11099
11100 !!test
11101 1. includeonly in html attr key
11102 !! wikitext
11103 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11104 !! html
11105 <p><span id="foo">bar</span>
11106 </p>
11107 !!end
11108
11109 !!test
11110 2. includeonly in html attr value
11111 !! wikitext
11112 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11113 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11114 !! html
11115 <p><span id="v1">bar</span>
11116 <span id="v1">bar</span>
11117 </p>
11118 !!end
11119
11120 !!test
11121 3. includeonly in part of an attr value
11122 !! wikitext
11123 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11124 !! html
11125 <p><span style="color:red;">bar</span>
11126 </p>
11127 !!end
11128
11129 !!test
11130 4. includeonly in table attributes
11131 !! wikitext
11132 {|
11133 |- <noinclude>
11134 |-
11135 |a
11136 </noinclude>
11137 |- <includeonly>
11138 |-
11139 |b
11140 </includeonly>
11141 |}
11142 !! html
11143 <table>
11144
11145
11146 <tr>
11147 <td>a
11148 </td></tr>
11149 </table>
11150
11151 !!end
11152
11153 ###
11154 ### Token Stream Patcher tests
11155 ###
11156 ### These tests won't always pass wt2wt and other modes because
11157 ### on serialization, the table will be output on a new line.
11158 ### For now, we are blacklisting them, and using this to test selser.
11159 ###
11160
11161 !!test
11162 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11163 !!options
11164 parsoid=wt2html,wt2wt
11165 !!wikitext
11166 {{echo|}}{| width = '100%'
11167 |foo
11168 |}
11169 !!html/parsoid
11170 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11171 <tbody><tr><td>foo</td></tr>
11172 </tbody></table>
11173 !!end
11174
11175 ## We used to, but no longer wt2wt this test since the default serializer
11176 ## will normalize the include directives to serialize on their own line.
11177 ## Selser will take care of preserving formatting in scenarios where they
11178 ## intermingled with other wikitext.
11179 !!test
11180 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11181 !!options
11182 parsoid=wt2html
11183 !!wikitext
11184 <includeonly>a</includeonly>{| {{{b}}}
11185 |c
11186 |}
11187 !!html/parsoid
11188 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
11189 <tbody><tr><td>c</td></tr>
11190 </tbody></table>
11191
11192 !!end
11193
11194 ###
11195 ### Testing parsing of templates where a template arg
11196 ### has the same name as the template itself.
11197 ###
11198
11199 !! article
11200 Template:quote
11201 !! text
11202 {{{quote|{{{1}}}}}}
11203 !! endarticle
11204
11205 !!test
11206 Templates: Template Name/Arg clash: 1. Use of positional param
11207 !! wikitext
11208 {{quote|foo}}
11209 !! html
11210 <p>foo
11211 </p>
11212 !!end
11213
11214 !!test
11215 Templates: Template Name/Arg clash: 2. Use of named param
11216 !! wikitext
11217 {{quote|quote=foo}}
11218 !! html
11219 <p>foo
11220 </p>
11221 !!end
11222
11223 !!test
11224 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11225 !! wikitext
11226 {{quote|quote}}
11227 !! html
11228 <p>quote
11229 </p>
11230 !!end
11231
11232 ###
11233 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11234 ###
11235
11236 !!test
11237 Templates: 1. Simple use
11238 !! wikitext
11239 {{echo|Foo}}
11240 !! html
11241 <p>Foo
11242 </p>
11243 !!end
11244
11245 !!test
11246 Templates: 2. Inside a block tag
11247 !! wikitext
11248 <div>{{echo|Foo}}</div>
11249 <blockquote>{{echo|Foo}}</blockquote>
11250 !! html
11251 <div>Foo</div>
11252 <blockquote>Foo</blockquote>
11253
11254 !! html+tidy
11255 <div>Foo</div>
11256 <blockquote>
11257 <p>Foo</p>
11258 </blockquote>
11259 !!end
11260
11261 !!test
11262 Templates: P-wrapping: 1a. Templates on consecutive lines
11263 !! wikitext
11264 {{echo|Foo}}
11265 {{echo|bar}}
11266 !! html
11267 <p>Foo
11268 bar
11269 </p>
11270 !!end
11271
11272 !!test
11273 Templates: P-wrapping: 1b. Templates on consecutive lines
11274 !! wikitext
11275 Foo
11276
11277 {{echo|bar}}
11278 {{echo|baz}}
11279 !! html
11280 <p>Foo
11281 </p><p>bar
11282 baz
11283 </p>
11284 !!end
11285
11286 !!test
11287 Templates: P-wrapping: 1c. Templates on consecutive lines
11288 !! wikitext
11289 {{echo|Foo}}
11290 {{echo|bar}} <div>baz</div>
11291 !! html
11292 <p>Foo
11293 </p>
11294 bar <div>baz</div>
11295
11296 !! html+tidy
11297 <p>Foo</p>
11298 <p>bar</p>
11299 <div>baz</div>
11300 !! end
11301
11302 !!test
11303 Templates: P-wrapping: 1d. Template preceded by comment-only line
11304 !!options
11305 parsoid
11306 !! wikitext
11307 <!-- foo -->
11308 {{echo|Bar}}
11309 !! html
11310 <!-- foo -->
11311
11312 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11313 !!end
11314
11315 !!test
11316 Templates: Inline Text: 1. Multiple template uses
11317 !! wikitext
11318 {{echo|Foo}}bar{{echo|baz}}
11319 !! html
11320 <p>Foobarbaz
11321 </p>
11322 !!end
11323
11324 !!test
11325 Templates: Inline Text: 2. Back-to-back template uses
11326 !! wikitext
11327 {{echo|Foo}}{{echo|bar}}
11328 !! html
11329 <p>Foobar
11330 </p>
11331 !!end
11332
11333 !!test
11334 Templates: Block Tags: 1. Multiple template uses
11335 !! wikitext
11336 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11337 !! html
11338 <div>Foo</div><div>bar</div><div>baz</div>
11339
11340 !!end
11341
11342 !!test
11343 Templates: Block Tags: 2. Back-to-back template uses
11344 !! wikitext
11345 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11346 !! html
11347 <div>Foo</div><div>bar</div>
11348
11349 !!end
11350
11351 # This is an edge case relating to paragraph wrapping.
11352 !!test
11353 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11354 !! wikitext
11355 {{echo|a
11356 b</p>}}
11357 !! html/parsoid
11358 <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
11359 b</p>
11360 !!end
11361
11362 !!test
11363 Templates: Links: 1. Simple example
11364 !! wikitext
11365 {{echo|[[Foo|bar]]}}
11366 !! html
11367 <p><a href="/wiki/Foo" title="Foo">bar</a>
11368 </p>
11369 !!end
11370
11371 !!test
11372 Templates: Links: 2. Generation of link href
11373 !! wikitext
11374 [[{{echo|Foo}}|bar]]
11375 !! html
11376 <p><a href="/wiki/Foo" title="Foo">bar</a>
11377 </p>
11378 !!end
11379
11380 !!test
11381 Templates: Links: 3. Generation of part of a link href
11382 !! wikitext
11383 [[Fo{{echo|o}}|bar]]
11384
11385 [[Foo{{echo|bar}}]]
11386
11387 [[Foo{{echo|bar}}baz]]
11388
11389 [[Foo{{echo|bar}}|bar]]
11390
11391 [[:Foo{{echo|bar}}]]
11392
11393 [[:Foo{{echo|bar}}|bar]]
11394 !! html
11395 <p><a href="/wiki/Foo" title="Foo">bar</a>
11396 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11397 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11398 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11399 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11400 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11401 </p>
11402 !!end
11403
11404 !!test
11405 Templates: Links: 4. Multiple templates generating link href
11406 !! wikitext
11407 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11408 !! html
11409 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11410 </p>
11411 !!end
11412
11413 !!test
11414 Templates: Links: 5. Generation of link text
11415 !! wikitext
11416 [[Foo|{{echo|bar}}]]
11417 !! html
11418 <p><a href="/wiki/Foo" title="Foo">bar</a>
11419 </p>
11420 !!end
11421
11422 !!test
11423 Templates: Links: 5. Nested templates (only outermost template should be marked)
11424 !! wikitext
11425 {{echo|[[{{echo|Foo}}|bar]]}}
11426 !! html
11427 <p><a href="/wiki/Foo" title="Foo">bar</a>
11428 </p>
11429 !!end
11430
11431 !!test
11432 Templates: HTML Tag: 1. Generation of HTML attr. key
11433 !! wikitext
11434 <div {{echo|style}}="color:red;">foo</div>
11435 !! html
11436 <div style="color:red;">foo</div>
11437
11438 !!end
11439
11440 !!test
11441 Templates: HTML Tag: 2. Generation of HTML attr. value
11442 !! wikitext
11443 <div style={{echo|'color:red;'}}>foo</div>
11444 !! html
11445 <div style="color:red;">foo</div>
11446
11447 !!end
11448
11449 !!test
11450 Templates: HTML Tag: 3. Generation of HTML attr key and value
11451 !! wikitext
11452 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11453 !! html
11454 <div style="color:red;">foo</div>
11455
11456 !!end
11457
11458 !!test
11459 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11460 !! wikitext
11461 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11462 !! html
11463 <div title="This is a long title with just one piece templated">foo</div>
11464
11465 !!end
11466
11467 !!test
11468 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11469 !! wikitext
11470 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11471 !! html
11472 <div title="This is a long title with just one piece templated">foo</div>
11473
11474 !!end
11475
11476 !!test
11477 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11478 !! wikitext
11479 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11480 !! html
11481 <div title="This is a long title with just one piece templated">foo</div>
11482
11483 !!end
11484
11485 # SSS FIXME: While it is great we added support for all this,
11486 # do we want to make this part of the spec? Maybe we want to
11487 # deprecate this kind of usage in the future?
11488 !!test
11489 Templates: HTML Tag: 7. Generation of partial attribute key string
11490 !! wikitext
11491 <div st{{echo|yle}}="color:red;">foo</div>
11492 !! html
11493 <div style="color:red;">foo</div>
11494
11495 !!end
11496
11497 !! test
11498 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11499 !! wikitext
11500 <div {{echo|1=id="v1"}}>bar</div>
11501 !! html
11502 <div id="v1">bar</div>
11503
11504 !!end
11505
11506 !! test
11507 Templates: HTML Tag: 9. Multiple template-generated attributes
11508 !! wikitext
11509 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11510 !! html
11511 <div id="v1" title="foo">bar</div>
11512
11513 !!end
11514
11515 !! test
11516 Templates: Support for templates generating attributes and content
11517 !! wikitext
11518 {| {{mixed_attr_content_template}}
11519 |-
11520 |bar
11521 |}
11522 !! html/php
11523 <table style="color:red;" title="T48811">
11524
11525 <tr>
11526 <td>foo
11527 </td></tr>
11528 <tr>
11529 <td>bar
11530 </td></tr></table>
11531
11532 !! html/parsoid
11533 <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|}"]}'>
11534 <tbody><tr>
11535 <td>foo</td></tr>
11536 <tr>
11537 <td>bar</td></tr>
11538 </tbody></table>
11539 !!end
11540
11541 !! test
11542 1. Entities and nowikis inside templated attributes should be handled correctly
11543 !! wikitext
11544 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11545 !! html/php
11546 <div style="background:#f9f9f9;">foo</div>
11547
11548 !! html/parsoid
11549 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11550 !! end
11551
11552 !! test
11553 2. Entities and nowikis inside templated attributes should be handled correctly
11554 !! wikitext
11555 {|
11556 |{{table_attribs_3}}
11557 |}
11558 !! html/php
11559 <table>
11560 <tr>
11561 <td style="background:#f9f9f9;">Foo
11562 </td></tr></table>
11563
11564 !! html/parsoid
11565 <table>
11566 <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>
11567 </tbody></table>
11568 !! end
11569
11570 !! test
11571 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11572 !! wikitext
11573 {{tbl-start}}
11574 |{{table_attribs_3}}
11575 {{tbl-end}}
11576 !! html/php
11577 <table>
11578 <tr>
11579 <td style="background:#f9f9f9;">Foo
11580 </td></tr></table>
11581
11582 !! html/parsoid
11583 <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}}]}'>
11584 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11585 </tbody></table>
11586 !! end
11587
11588 # T107622
11589 !! test
11590 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11591 !! wikitext
11592 {|
11593 | {{table_attribs_6}} hi
11594 |}
11595 !! html/php
11596 <table>
11597 <tr>
11598 <td style="background: red;"> hi
11599 </td></tr></table>
11600
11601 !! html/parsoid
11602 <table>
11603 <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>
11604 </tbody></table>
11605 !! end
11606
11607 !!test
11608 Templates: HTML Tables: 1. Generating start of a HTML table
11609 !! wikitext
11610 {{echo|<table><tr><td>foo</td>}}</tr></table>
11611 !! html
11612 <table><tr><td>foo</td></tr></table>
11613
11614 !!end
11615
11616 !!test
11617 Templates: HTML Tables: 2a. Generating middle of a HTML table
11618 !! wikitext
11619 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11620 !! html
11621 <table><tr><td>foo</td></tr></table>
11622
11623 !!end
11624
11625 !!test
11626 Templates: HTML Tables: 2b. Generating middle of a HTML table
11627 !! wikitext
11628 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11629 !! html
11630 <table><tr><td>foo</td></tr></table>
11631
11632 !!end
11633
11634 !!test
11635 Templates: HTML Tables: 3. Generating end of a HTML table
11636 !! wikitext
11637 <table><tr>{{echo|<td>foo</td></tr></table>}}
11638 !! html
11639 <table><tr><td>foo</td></tr></table>
11640
11641 !!end
11642
11643 !!test
11644 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11645 !! wikitext
11646 {{echo|<table>}}<tr><td>foo</td></tr></table>
11647 !! html
11648 <table><tr><td>foo</td></tr></table>
11649
11650 !!end
11651
11652 !!test
11653 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11654 !! wikitext
11655 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11656 !! html
11657 <table><tr><td>foo</td></tr></table>
11658
11659 !!end
11660
11661 !!test
11662 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11663 !! wikitext
11664 <table><tr>{{echo|<td>}}foo</td></tr></table>
11665 !! html
11666 <table><tr><td>foo</td></tr></table>
11667
11668 !!end
11669
11670 !!test
11671 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11672 !! wikitext
11673 <table><tr><td>foo{{echo|</td>}}</tr></table>
11674 !! html
11675 <table><tr><td>foo</td></tr></table>
11676
11677 !!end
11678
11679 !!test
11680 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11681 !! wikitext
11682 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11683 !! html
11684 <table><tr><td>foo</td></tr></table>
11685
11686 !!end
11687
11688 !!test
11689 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11690 !! wikitext
11691 <table><tr><td>foo</td></tr>{{echo|</table>}}
11692 !! html
11693 <table><tr><td>foo</td></tr></table>
11694
11695 !!end
11696
11697 !!test
11698 Templates: HTML Tables: 5. Proper fostering of categories from inside
11699 !!options
11700 parsoid=wt2html,wt2wt
11701 !! wikitext
11702 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11703 <!--Two categories (Bug 50330)-->
11704 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11705 !! html
11706 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11707 <!--Two categories (Bug 50330)-->
11708 <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>
11709 !!end
11710
11711 !!test
11712 Templates: Wiki Tables: 1a. Fostering of entire template content
11713 !! wikitext
11714 {|
11715 {{echo|a}}
11716 |}
11717 !! html
11718 <table>
11719 a
11720 <tr><td></td></tr></table>
11721
11722 !! html+tidy
11723 <p>a</p>
11724 <table>
11725 <tr>
11726 <td></td>
11727 </tr>
11728 </table>
11729 !! end
11730
11731 !!test
11732 Templates: Wiki Tables: 1b. Fostering of entire template content
11733 !! wikitext
11734 {|
11735 {{echo|<div>}}
11736 foo
11737 {{echo|</div>}}
11738 |}
11739 !! html
11740 <table>
11741 <div>
11742 <p>foo
11743 </p>
11744 </div>
11745 <tr><td></td></tr></table>
11746
11747 !! html+tidy
11748 <div>
11749 <p>foo</p>
11750 </div>
11751 <table>
11752 <tr>
11753 <td></td>
11754 </tr>
11755 </table>
11756 !! end
11757
11758 !!test
11759 Templates: Wiki Tables: 2. Fostering of partial template content
11760 !! wikitext
11761 {|
11762 {{echo|a
11763 <div>b</div>}}
11764 |}
11765 !! html
11766 <table>
11767 a
11768 <div>b</div>
11769 <tr><td></td></tr></table>
11770
11771 !! html+tidy
11772 <p>a</p>
11773 <div>b</div>
11774 <table>
11775 <tr>
11776 <td></td>
11777 </tr>
11778 </table>
11779 !! end
11780
11781 !!test
11782 Templates: Wiki Tables: 3. td-content via multiple templates
11783 !! wikitext
11784 {|
11785 {{echo|{{pipe}}a}}{{echo|b}}
11786 |}
11787 !! html
11788 <table>
11789 <tr>
11790 <td>ab
11791 </td></tr></table>
11792
11793 !!end
11794
11795 !!test
11796 Templates: Wiki Tables: 4. Templated tags, no content
11797 !! wikitext
11798 {{tbl-start}}
11799 {{tbl-end}}
11800 !! html
11801 <table>
11802 <tr><td></td></tr></table>
11803
11804 !!end
11805
11806 !!test
11807 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11808 !! wikitext
11809 {{tbl-start}}
11810 |foo
11811 {{tbl-end}}
11812 !! html
11813 <table>
11814 <tr>
11815 <td>foo
11816 </td></tr></table>
11817
11818 !!end
11819
11820 !!test
11821 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11822 !! wikitext
11823 {{tbl-start}}
11824 {{!}}foo
11825 {{tbl-end}}
11826 !! html
11827 <table>
11828 <tr>
11829 <td>foo
11830 </td></tr></table>
11831
11832 !!end
11833
11834 ## This test case is very specific to Parsoid's internals
11835 ## and is hence only tested for Parsoid's code. Parsoid uses
11836 ## a <meta> marker tag for <ref> tags and they are expanded
11837 ## much later. We are verifying that this <meta> tag usage
11838 ## doesn't prevent foster parenting.
11839 !!test
11840 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11841 !!wikitext
11842 {{PartialTable}}<ref>foo</ref>
11843 |}
11844
11845 <references />
11846 !!html/parsoid
11847 <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">
11848 <tbody>
11849 </tbody></table>
11850
11851 <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>
11852 !!end
11853
11854 !! test
11855 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11856 !! wikitext
11857 {{echo|
11858 {{{!}}
11859 {{!}}-}}
11860 <onlyinclude>
11861 |foo
11862 </onlyinclude>
11863 {{!}}}
11864 !! html/parsoid
11865 <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{{!}}}"]}'>
11866 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11867 <tbody><tr>
11868
11869 <td>foo
11870 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11871 </tbody></table>
11872 !! end
11873
11874 !!test
11875 Templates: Lists: Multi-line list-items via templates
11876 !! wikitext
11877 *{{echo|a {{nonexistent|
11878 unused}}}}
11879 *{{echo|b {{nonexistent|
11880 unused}}}}
11881 !! html
11882 <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>
11883 <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>
11884
11885 !!end
11886
11887 !!test
11888 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11889 !! wikitext
11890 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11891 !! html
11892 <p><i>ab</i>c<i>d</i>e
11893 </p>
11894 !!end
11895
11896 !!test
11897 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11898 (PHP parser generates misnested html)
11899 !! wikitext
11900 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11901 !! html/parsoid
11902 <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>
11903 !!end
11904
11905 !!test
11906 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11907 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11908 !! options
11909 parsoid=wt2html,wt2wt
11910 !! wikitext
11911 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11912 !! html
11913 <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>
11914 <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>
11915 <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>
11916 !!end
11917
11918 !!test
11919 Templates: Ugly nesting: 4. Divs opened/closed across templates
11920 !! wikitext
11921 a<div>b{{echo|c</div>d}}e
11922 !! html
11923 a<div>bc</div>de
11924
11925 !! html+tidy
11926 <p>a</p>
11927 <div>bc</div>
11928 <p>de</p>
11929 !! end
11930
11931 !!test
11932 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11933 (Parsoid-centric)
11934 !! options
11935 parsoid
11936 !! wikitext
11937 {|
11938 |{{echo|foo</table>}}
11939 |bar
11940 |}
11941 !! html
11942 <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|}"]}'>
11943
11944 <tbody>
11945 <tr>
11946 <td>foo</td></tr></tbody></table><span about="#mwt1">
11947 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11948 |}</span>
11949 !!end
11950
11951 !!test
11952 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11953 (Parsoid-centric)
11954 !! options
11955 parsoid
11956 !! wikitext
11957 <table>
11958 <tr>
11959 <td>
11960 <table>
11961 <tr>
11962 <td>1. {{echo|foo </table>}}</td>
11963 <td> bar </td>
11964 <td>2. {{echo|baz </table>}}</td>
11965 </tr>
11966 <tr>
11967 <td>abc</td>
11968 </tr>
11969 </table>
11970 </td>
11971 </tr>
11972 <tr>
11973 <td>xyz</td>
11974 </tr>
11975 </table>
11976 !! html
11977 <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>"]}'>
11978 <tbody><tr>
11979 <td>
11980 <table>
11981 <tbody><tr>
11982 <td>1. foo </td></tr></tbody></table></td>
11983 <td> bar </td>
11984 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11985 </span><span about="#mwt2">
11986 </span><span about="#mwt2">
11987 </span><span about="#mwt2">abc</span><span about="#mwt2">
11988 </span><span about="#mwt2">
11989 </span><span about="#mwt2">
11990 </span><span about="#mwt2">
11991 </span><span about="#mwt2">
11992 </span><span about="#mwt2">
11993 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11994 </span><span about="#mwt2">
11995 </span>
11996 !!end
11997
11998 !! test
11999 Templates: Ugly templates: 3. newline-only template parameter
12000 !! wikitext
12001 foo {{echo|
12002 }}
12003 !! html
12004 <p>foo
12005 </p>
12006 !! end
12007
12008 # This looks like a bug: a single newline triggers p/br for some reason.
12009 !! test
12010 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12011 !! wikitext
12012 {{echo|
12013 }}
12014 !! html
12015 <p><br />
12016 </p>
12017 !! end
12018
12019 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12020 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12021 !! test
12022 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12023 !! wikitext
12024 {{echo|<table>}}
12025 {{echo|<div>foo}}
12026 {{echo|</table>}}
12027 !! html/parsoid
12028 <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
12029 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12030 </table>
12031 !! end
12032
12033 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12034 # that are "identical" and generate nesting cycles in the algorithm
12035 !! test
12036 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12037 !! wikitext
12038 {{echo|<table><tr><td><table>}}
12039 {{echo|<div>}}
12040 {{echo|</div>}}
12041 !! html/parsoid
12042 <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"}'>
12043 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12044 </table></td></tr></tbody></table>
12045 !! end
12046
12047 !! test
12048 Templates: Parameters substituted at the top-level
12049 !! wikitext
12050 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12051 !! html/php
12052 <p><i>who</i> me? <b>never!</b>
12053 </p>
12054 !! html/parsoid
12055 <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>
12056 !! end
12057
12058 !!test
12059 Parser Functions: 1. Simple example
12060 !! wikitext
12061 {{uc:foo}}
12062 !! html
12063 <p>FOO
12064 </p>
12065 !!end
12066
12067 !!test
12068 Parser Functions: 2. Nested use (only outermost should be marked up)
12069 !! wikitext
12070 {{uc:{{lc:FOO}}}}
12071 !! html
12072 <p>FOO
12073 </p>
12074 !!end
12075
12076 ###
12077 ### Pre-save transform tests
12078 ###
12079 !! test
12080 pre-save transform: subst:
12081 !! options
12082 pst
12083 !! wikitext
12084 {{subst:test}}
12085 !! html/php
12086 This is a test template
12087 !! end
12088
12089 !! test
12090 pre-save transform: normal template
12091 !! options
12092 pst
12093 !! wikitext
12094 {{test}}
12095 !! html/php
12096 {{test}}
12097 !! end
12098
12099 !! test
12100 pre-save transform: nonexistent template
12101 !! options
12102 pst
12103 !! wikitext
12104 {{thistemplatedoesnotexist}}
12105 !! html/php
12106 {{thistemplatedoesnotexist}}
12107 !! end
12108
12109 !! test
12110 pre-save transform: subst magic variables
12111 !! options
12112 pst
12113 !! wikitext
12114 {{subst:SITENAME}}
12115 !! html/php
12116 MediaWiki
12117 !! end
12118
12119 # This is bug 89, which I fixed. -- wtm
12120 !! test
12121 pre-save transform: subst: templates with parameters
12122 !! options
12123 pst
12124 !! wikitext
12125 {{subst:paramtest|param="something else"}}
12126 !! html/php
12127 This is a test template with parameter "something else"
12128 !! end
12129
12130 !! article
12131 Template:nowikitest
12132 !! text
12133 <nowiki>'''not wiki'''</nowiki>
12134 !! endarticle
12135
12136 !! test
12137 pre-save transform: nowiki in subst (bug 1188)
12138 !! options
12139 pst
12140 !! wikitext
12141 {{subst:nowikitest}}
12142 !! html/php
12143 <nowiki>'''not wiki'''</nowiki>
12144 !! end
12145
12146 !! article
12147 Template:commenttest
12148 !! text
12149 This template has <!-- a comment --> in it.
12150 !! endarticle
12151
12152 !! test
12153 pre-save transform: comment in subst (bug 1936)
12154 !! options
12155 pst
12156 !! wikitext
12157 {{subst:commenttest}}
12158 !! html/php
12159 This template has <!-- a comment --> in it.
12160 !! end
12161
12162 !! test
12163 pre-save transform: unclosed tag
12164 !! options
12165 pst
12166 !! wikitext
12167 <nowiki>'''not wiki'''
12168 !! html/php
12169 <nowiki>'''not wiki'''
12170 !! end
12171
12172 !! test
12173 pre-save transform: mixed tag case
12174 !! options
12175 pst
12176 !! wikitext
12177 <NOwiki>'''not wiki'''</noWIKI>
12178 !! html/php
12179 <NOwiki>'''not wiki'''</noWIKI>
12180 !! end
12181
12182 !! test
12183 pre-save transform: unclosed comment in <nowiki>
12184 !! options
12185 pst
12186 !! wikitext
12187 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12188 !! html/php
12189 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12190 !!end
12191
12192 # Leading @ in this template definition works around a limitation
12193 # in parsoid's parserTests which otherwise strips the <span> from the
12194 # result (confusing it for a template wrapper)
12195 !! article
12196 Template:dangerous
12197 !!text
12198 @<span onmouseover="alert('crap')">Oh no</span>
12199 !!endarticle
12200
12201 !!test
12202 (confirming safety of fix for subst bug 1936)
12203 !! wikitext
12204 {{Template:dangerous}}
12205 !! html
12206 <p>@<span>Oh no</span>
12207 </p>
12208 !! end
12209
12210 !! test
12211 pre-save transform: comment containing gallery (bug 5024)
12212 !! options
12213 pst
12214 !! wikitext
12215 <!-- <gallery>data</gallery> -->
12216 !! html/php
12217 <!-- <gallery>data</gallery> -->
12218 !!end
12219
12220 !! test
12221 pre-save transform: comment containing extension
12222 !! options
12223 pst
12224 !! wikitext
12225 <!-- <tag>data</tag> -->
12226 !! html/php
12227 <!-- <tag>data</tag> -->
12228 !!end
12229
12230 !! test
12231 pre-save transform: comment containing nowiki
12232 !! options
12233 pst
12234 !! wikitext
12235 <!-- <nowiki>data</nowiki> -->
12236 !! html/php
12237 <!-- <nowiki>data</nowiki> -->
12238 !!end
12239
12240 !! test
12241 pre-save transform: <noinclude> in subst (bug 3298)
12242 !! options
12243 pst
12244 !! wikitext
12245 {{subst:Includes}}
12246 !! html/php
12247 Foobar
12248 !! end
12249
12250 !! test
12251 pre-save transform: <onlyinclude> in subst (bug 3298)
12252 !! options
12253 pst
12254 !! wikitext
12255 {{subst:Includes2}}
12256 !! html/php
12257 Foo
12258 !! end
12259
12260 !! article
12261 Template:SubstTest
12262 !!text
12263 {{<includeonly>subst:</includeonly>Includes}}
12264 !! endarticle
12265
12266 !! article
12267 Template:SafeSubstTest
12268 !! text
12269 {{<includeonly>safesubst:</includeonly>Includes}}
12270 !! endarticle
12271
12272 !! test
12273 bug 22297: safesubst: works during PST
12274 !! options
12275 pst
12276 !! wikitext
12277 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12278 !! html/php
12279 FoobarFoobar
12280 !! end
12281
12282 !! test
12283 bug 22297: safesubst: works during normal parse
12284 !! wikitext
12285 {{SafeSubstTest}}
12286 !! html
12287 <p>Foobar
12288 </p>
12289 !! end
12290
12291 !! test
12292 subst: does not work during normal parse
12293 !! wikitext
12294 {{SubstTest}}
12295 !! html
12296 <p>{{subst:Includes}}
12297 </p>
12298 !! end
12299
12300 !! test
12301 pre-save transform: context links ("pipe trick")
12302 !! options
12303 pst
12304 !! wikitext
12305 [[Article (context)|]]
12306 [[Bar:Article|]]
12307 [[:Bar:Article|]]
12308 [[Bar:Article (context)|]]
12309 [[:Bar:Article (context)|]]
12310 [[|Article]]
12311 [[|Article (context)]]
12312 [[Bar:X (Y) Z|]]
12313 [[:Bar:X (Y) Z|]]
12314 !! html/php
12315 [[Article (context)|Article]]
12316 [[Bar:Article|Article]]
12317 [[:Bar:Article|Article]]
12318 [[Bar:Article (context)|Article]]
12319 [[:Bar:Article (context)|Article]]
12320 [[Article]]
12321 [[Article (context)]]
12322 [[Bar:X (Y) Z|X (Y) Z]]
12323 [[:Bar:X (Y) Z|X (Y) Z]]
12324 !! end
12325
12326 !! test
12327 pre-save transform: context links ("pipe trick") with interwiki prefix
12328 !! options
12329 pst
12330 !! wikitext
12331 [[interwiki:Article|]]
12332 [[:interwiki:Article|]]
12333 [[interwiki:Bar:Article|]]
12334 [[:interwiki:Bar:Article|]]
12335 !! html/php
12336 [[interwiki:Article|Article]]
12337 [[:interwiki:Article|Article]]
12338 [[interwiki:Bar:Article|Bar:Article]]
12339 [[:interwiki:Bar:Article|Bar:Article]]
12340 !! end
12341
12342 !! test
12343 pre-save transform: context links ("pipe trick") with parens in title
12344 !! options
12345 pst title=[[Somearticle (context)]]
12346 !! wikitext
12347 [[|Article]]
12348 !! html/php
12349 [[Article (context)|Article]]
12350 !! end
12351
12352 !! test
12353 pre-save transform: context links ("pipe trick") with comma in title
12354 !! options
12355 pst title=[[Someplace, Somewhere]]
12356 !! wikitext
12357 [[|Otherplace]]
12358 [[Otherplace, Elsewhere|]]
12359 [[Otherplace, Elsewhere, Anywhere|]]
12360 !! html/php
12361 [[Otherplace, Somewhere|Otherplace]]
12362 [[Otherplace, Elsewhere|Otherplace]]
12363 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12364 !! end
12365
12366 !! test
12367 pre-save transform: context links ("pipe trick") with parens and comma
12368 !! options
12369 pst title=[[Someplace (IGNORED), Somewhere]]
12370 !! wikitext
12371 [[|Otherplace]]
12372 [[Otherplace (place), Elsewhere|]]
12373 !! html/php
12374 [[Otherplace, Somewhere|Otherplace]]
12375 [[Otherplace (place), Elsewhere|Otherplace]]
12376 !! end
12377
12378 !! test
12379 pre-save transform: context links ("pipe trick") with comma and parens
12380 !! options
12381 pst title=[[Who, me? (context)]]
12382 !! wikitext
12383 [[|Yes, you.]]
12384 [[Me, Myself, and I (1937 song)|]]
12385 !! html/php
12386 [[Yes, you. (context)|Yes, you.]]
12387 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12388 !! end
12389
12390 !! test
12391 pre-save transform: context links ("pipe trick") with namespace
12392 !! options
12393 pst title=[[Ns:Somearticle]]
12394 !! wikitext
12395 [[|Article]]
12396 !! html/php
12397 [[Ns:Article|Article]]
12398 !! end
12399
12400 !! test
12401 pre-save transform: context links ("pipe trick") with namespace and parens
12402 !! options
12403 pst title=[[Ns:Somearticle (context)]]
12404 !! wikitext
12405 [[|Article]]
12406 !! html/php
12407 [[Ns:Article (context)|Article]]
12408 !! end
12409
12410 !! test
12411 pre-save transform: context links ("pipe trick") with namespace and comma
12412 !! options
12413 pst title=[[Ns:Somearticle, Context, Whatever]]
12414 !! wikitext
12415 [[|Article]]
12416 !! html/php
12417 [[Ns:Article, Context, Whatever|Article]]
12418 !! end
12419
12420 !! test
12421 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12422 !! options
12423 pst title=[[Ns:Somearticle, Context (context)]]
12424 !! wikitext
12425 [[|Article]]
12426 !! html/php
12427 [[Ns:Article (context)|Article]]
12428 !! end
12429
12430 !! test
12431 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12432 !! options
12433 pst title=[[Ns:Somearticle (IGNORED), Context]]
12434 !! wikitext
12435 [[|Article]]
12436 !! html/php
12437 [[Ns:Article, Context|Article]]
12438 !! end
12439
12440 !! test
12441 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12442 !! options
12443 pst
12444 !! wikitext
12445 [[Article(context)|]]
12446 [[Bar:Article(context)|]]
12447 [[:Bar:Article(context)|]]
12448 [[|Article(context)]]
12449 [[Bar:X(Y)Z|]]
12450 [[:Bar:X(Y)Z|]]
12451 !! html/php
12452 [[Article(context)|Article]]
12453 [[Bar:Article(context)|Article]]
12454 [[:Bar:Article(context)|Article]]
12455 [[Article(context)]]
12456 [[Bar:X(Y)Z|X(Y)Z]]
12457 [[:Bar:X(Y)Z|X(Y)Z]]
12458 !! end
12459
12460 !! test
12461 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12462 !! options
12463 pst
12464 !! wikitext
12465 [[Article (context)|]]
12466 [[Bar:Article (context)|]]
12467 [[:Bar:Article (context)|]]
12468 [[|Article (context)]]
12469 [[Bar:X (Y) Z|]]
12470 [[:Bar:X (Y) Z|]]
12471 !! html/php
12472 [[Article (context)|Article]]
12473 [[Bar:Article (context)|Article]]
12474 [[:Bar:Article (context)|Article]]
12475 [[Article (context)]]
12476 [[Bar:X (Y) Z|X (Y) Z]]
12477 [[:Bar:X (Y) Z|X (Y) Z]]
12478 !! end
12479
12480 !! test
12481 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12482 !! options
12483 pst
12484 !! wikitext
12485 [[Article(context)|]]
12486 [[Bar:Article(context)|]]
12487 [[:Bar:Article(context)|]]
12488 [[|Article(context)]]
12489 [[Bar:X(Y)Z|]]
12490 [[:Bar:X(Y)Z|]]
12491 !! html/php
12492 [[Article(context)|Article]]
12493 [[Bar:Article(context)|Article]]
12494 [[:Bar:Article(context)|Article]]
12495 [[Article(context)]]
12496 [[Bar:X(Y)Z|X(Y)Z]]
12497 [[:Bar:X(Y)Z|X(Y)Z]]
12498 !! end
12499
12500 !! test
12501 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12502 !! options
12503 pst
12504 !! wikitext
12505 [[Article (context), context|]]
12506 [[Article (context),context|]]
12507 [[Bar:Article (context), context|]]
12508 [[Bar:Article (context),context|]]
12509 [[:Bar:Article (context), context|]]
12510 [[:Bar:Article (context),context|]]
12511 !! html/php
12512 [[Article (context), context|Article]]
12513 [[Article (context),context|Article]]
12514 [[Bar:Article (context), context|Article]]
12515 [[Bar:Article (context),context|Article]]
12516 [[:Bar:Article (context), context|Article]]
12517 [[:Bar:Article (context),context|Article]]
12518 !! end
12519
12520 !! test
12521 pre-save transform: trim trailing empty lines
12522 !! options
12523 pst
12524 !! wikitext
12525 Empty lines are trimmed
12526
12527
12528
12529
12530 !! html/php
12531 Empty lines are trimmed
12532 !! end
12533
12534 !! test
12535 pre-save transform: Signature expansion
12536 !! options
12537 pst
12538 !! wikitext
12539 * ~~~
12540 * <noinclude>~~~</noinclude>
12541 * <includeonly>~~~</includeonly>
12542 * <onlyinclude>~~~</onlyinclude>
12543 !! html/php
12544 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12545 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12546 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12547 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12548 !! end
12549
12550
12551 !! test
12552 pre-save transform: Signature expansion in nowiki tags (bug 93)
12553 !! options
12554 pst disabled
12555 !! wikitext
12556 Shall not expand:
12557
12558 <nowiki>~~~~</nowiki>
12559
12560 <includeonly><nowiki>~~~~</nowiki></includeonly>
12561
12562 <noinclude><nowiki>~~~~</nowiki></noinclude>
12563
12564 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12565
12566 {{subst:Foo}} shall be converted to FOO
12567
12568 As well as inside noinclude/onlyinclude
12569 <noinclude>{{subst:Foo}}</noinclude>
12570 <onlyinclude>{{subst:Foo}}</onlyinclude>
12571
12572 But not inside includeonly
12573 <includeonly>{{subst:Foo}}</includeonly>
12574 !! html/php
12575 Shall not expand:
12576
12577 <nowiki>~~~~</nowiki>
12578
12579 <includeonly><nowiki>~~~~</nowiki></includeonly>
12580
12581 <noinclude><nowiki>~~~~</nowiki></noinclude>
12582
12583 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12584
12585 FOO shall be converted to FOO
12586
12587 As well as inside noinclude/onlyinclude
12588 <noinclude>FOO</noinclude>
12589 <onlyinclude>FOO</onlyinclude>
12590
12591 But not inside includeonly
12592 <includeonly>{{subst:Foo}}</includeonly>
12593 !! end
12594
12595 !! test
12596 Parsoid: Recognize nowiki with trailing space in tags
12597 !! options
12598 parsoid=wt2html
12599 !! wikitext
12600 <nowiki ><div>[[foo]]</nowiki >
12601
12602 a<nowiki / >b
12603
12604 c<nowiki />d
12605
12606 e<nowiki/ >f
12607 !! html
12608 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12609 <p>ab</p>
12610 <p>cd</p>
12611 <p>ef</p>
12612 !! end
12613
12614 !! test
12615 Parsoid: Recognize nowiki with odd capitalization
12616 !! options
12617 parsoid=wt2html
12618 !! wikitext
12619 <noWikI ><div>[[foo]]</Nowiki >
12620 !! html
12621 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12622 !! end
12623
12624
12625 !! test
12626 Parsoid: Escape nowiki with trailing space in tags
12627 !! options
12628 parsoid=html2wt
12629 !! html/parsoid
12630 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12631 <p>a&lt;nowiki /&gt;b</p>
12632 <p>c&lt;nowiki/ &gt;d</p>
12633 !! wikitext
12634 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12635
12636 a&lt;nowiki /&gt;b
12637
12638 c&lt;nowiki/ &gt;d
12639 !! end
12640
12641 !! test
12642 Parsoid: Escape weird noWikI capitalizations
12643 !! options
12644 parsoid=html2wt
12645 !! html/parsoid
12646 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12647 !! wikitext
12648 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12649 !! end
12650
12651 ###
12652 ### Message transform tests
12653 ###
12654 !! test
12655 message transform: magic variables
12656 !! options
12657 msg
12658 !! wikitext
12659 {{SITENAME}}
12660 !! html
12661 MediaWiki
12662 !! end
12663
12664 !! test
12665 message transform: should not transform wiki markup
12666 !! options
12667 msg
12668 !! wikitext
12669 ''test''
12670 !! html
12671 ''test''
12672 !! end
12673
12674 !! test
12675 message transform: <noinclude> in transcluded template (bug 4926)
12676 !! options
12677 msg
12678 !! wikitext
12679 {{Includes}}
12680 !! html
12681 Foobar
12682 !! end
12683
12684 !! test
12685 message transform: <onlyinclude> in transcluded template (bug 4926)
12686 !! options
12687 msg
12688 !! wikitext
12689 {{Includes2}}
12690 !! html
12691 Foo
12692 !! end
12693
12694 !! test
12695 {{#special:}} page name, known
12696 !! options
12697 msg
12698 !! wikitext
12699 {{#special:Recentchanges}}
12700 !! html
12701 Special:RecentChanges
12702 !! end
12703
12704 !! test
12705 {{#special:}} page name with subpage, known
12706 !! options
12707 msg
12708 !! wikitext
12709 {{#special:Recentchanges/param}}
12710 !! html
12711 Special:RecentChanges/param
12712 !! end
12713
12714 !! test
12715 {{#special:}} page name, unknown
12716 !! options
12717 msg
12718 !! wikitext
12719 {{#special:foobar nonexistent}}
12720 !! html
12721 Special:Foobar nonexistent
12722 !! end
12723
12724 !! test
12725 {{#speciale:}} page name, known
12726 !! options
12727 msg
12728 !! wikitext
12729 {{#speciale:Recentchanges}}
12730 !! html
12731 Special:RecentChanges
12732 !! end
12733
12734 !! test
12735 {{#speciale:}} page name with subpage, known
12736 !! options
12737 msg
12738 !! wikitext
12739 {{#speciale:Recentchanges/param}}
12740 !! html
12741 Special:RecentChanges/param
12742 !! end
12743
12744 !! test
12745 {{#speciale:}} page name, unknown
12746 !! options
12747 msg
12748 !! wikitext
12749 {{#speciale:foobar nonexistent}}
12750 !! html
12751 Special:Foobar_nonexistent
12752 !! end
12753
12754 ###
12755 ### Images
12756 ###
12757 ### For Parsoid-specific tests, see
12758 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12759
12760 !! test
12761 Simple image
12762 !! options
12763 parsoid=wt2html,wt2wt,html2html
12764 !! wikitext
12765 [[Image:foobar.jpg]]
12766 !! html/php
12767 <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>
12768 </p>
12769 !! html/parsoid
12770 <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>
12771 !! end
12772
12773 !! test
12774 Simple image (using File: namespace, now canonical)
12775 !! wikitext
12776 [[File:Foobar.jpg]]
12777 !! html/php
12778 <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>
12779 </p>
12780 !! html/parsoid
12781 <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>
12782 !! end
12783
12784 !! test
12785 Right-aligned image
12786 !! wikitext
12787 [[File:Foobar.jpg|right]]
12788 !! html/php
12789 <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>
12790
12791 !! html/parsoid
12792 <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>
12793 !! end
12794
12795 !! test
12796 Image with caption
12797 !! wikitext
12798 [[File:Foobar.jpg|right|Caption text]]
12799 !! html/php
12800 <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>
12801
12802 !! html/parsoid
12803 <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>
12804 !! end
12805
12806 !! test
12807 Image with caption, bug 53312 #1
12808 !! wikitext
12809 [[File:Foobar.jpg|right|Caption page stuff]]
12810 !! html/php
12811 <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>
12812
12813 !! html/parsoid
12814 <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>
12815 !! end
12816
12817 !! test
12818 Image with caption, bug 53312 #2
12819 !! wikitext
12820 [[File:Foobar.jpg|right|Caption page=]]
12821 !! html/php
12822 <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>
12823
12824 !! html/parsoid
12825 <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>
12826 !! end
12827
12828 !! test
12829 Image with caption, bug 53312 #3
12830 !! wikitext
12831 [[File:Foobar.jpg|right|Caption page=stuff]]
12832 !! html/php
12833 <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>
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><figcaption>Caption page=stuff</figcaption></figure>
12837 !! end
12838
12839 !! test
12840 Allow empty links in image captions (Bug 60753)
12841 !! options
12842 thumbsize=220
12843 !! wikitext
12844 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12845 [[]]
12846 [[Link2]]
12847 ]]
12848 !! html/php
12849 <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>
12850
12851 !! html/parsoid
12852 <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>
12853 [[]]
12854 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12855 </figcaption></figure>
12856 !! end
12857
12858 !! test
12859 Titles in unlinked images (T23454)
12860 !! wikitext
12861 [[File:Foobar.jpg|link=|stuff]]
12862 !! html/php
12863 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12864 </p>
12865 !! end
12866
12867 !! test
12868 Link with empty target
12869 !! wikitext
12870 [[]]
12871 !! html
12872 <p>[[]]
12873 </p>
12874 !! end
12875
12876 !! test
12877 Image with link trail
12878 !! wikitext
12879 Linktrails should not work for images: [[File:Foobar.jpg]]s
12880 !! html/php
12881 <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
12882 </p>
12883 !! html/parsoid
12884 <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>
12885 !! end
12886
12887 !! test
12888 Image with empty attribute
12889 !! options
12890 parsoid=wt2html,wt2wt,html2html
12891 !! wikitext
12892 [[File:Foobar.jpg|right||Caption text]]
12893 !! html/php
12894 <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>
12895
12896 !! html/parsoid
12897 <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>
12898 !! end
12899
12900 !! test
12901 1. Block image with individual attributes from templates
12902 !! wikitext
12903 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12904 !! html/php
12905 <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>
12906
12907 !! html/parsoid
12908 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12909 !! end
12910
12911 !! test
12912 2. Block Image with individual attributes from templates
12913 !! wikitext
12914 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12915 !! html/php
12916 <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>
12917
12918 !! html/parsoid
12919 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12920 !! end
12921
12922 !! test
12923 3. Inline image with individual attributes from templates
12924 !! wikitext
12925 [[File:Foobar.jpg|{{echo|50px}}]]
12926 !! html/php
12927 <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>
12928 </p>
12929 !! html/parsoid
12930 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12931 !! end
12932
12933 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12934 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12935 !! test
12936 Image with multiple attributes from the same template
12937 !! wikitext
12938 [[File:Foobar.jpg|{{image_attribs}}]]
12939 !! html/php
12940 <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>
12941
12942 !! html/parsoid
12943 <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>
12944 !! end
12945
12946 !! test
12947 Image with link tails
12948 !! options
12949 thumbsize=220
12950 !! wikitext
12951 123[[File:Foobar.jpg]]456
12952 123[[File:Foobar.jpg|right]]456
12953 123[[File:Foobar.jpg|thumb]]456
12954 !! html/php
12955 <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
12956 </p>
12957 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
12958 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
12959
12960 !! html/php+tidy
12961 <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>
12962 <p>123</p>
12963 <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>
12964 <p>456 123</p>
12965 <div class="thumb tright">
12966 <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>
12967 <div class="thumbcaption">
12968 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12969 </div>
12970 </div>
12971 </div>
12972 <p>456</p>
12973 !! html/parsoid
12974 <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>
12975 <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>
12976 <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>
12977 !! end
12978
12979 !! test
12980 Image with multiple captions -- only last one is accepted
12981 !! wikitext
12982 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12983 !! html/php
12984 <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>
12985
12986 !! html/parsoid
12987 <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>
12988 !! end
12989
12990 !! test
12991 Image with multiple widths -- use last
12992 !! wikitext
12993 [[File:Foobar.jpg|200px|300px|caption]]
12994 !! html/php
12995 <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>
12996 </p>
12997 !! html/parsoid
12998 <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>
12999 !! end
13000
13001 !! test
13002 Image with multiple alignments -- use first (bug 48664)
13003 !! options
13004 thumbsize=220
13005 !! wikitext
13006 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13007
13008 [[File:Foobar.jpg|middle|text-top|caption]]
13009 !! html/php
13010 <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>
13011 <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>
13012 </p>
13013 !! html/parsoid
13014 <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>
13015 <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>
13016 !! end
13017
13018 !! test
13019 Image with width attribute at different positions
13020 !! wikitext
13021 [[File:Foobar.jpg|200px|right|Caption]]
13022 [[File:Foobar.jpg|right|200px|Caption]]
13023 [[File:Foobar.jpg|right|Caption|200px]]
13024 !! html/php
13025 <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>
13026 <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>
13027 <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>
13028
13029 !! html/parsoid
13030 <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>
13031 <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>
13032 <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>
13033 !! end
13034
13035 # a sad bit of backward-compatibility
13036 !! test
13037 Image with size specified with pxpx (bug 13500, 51628)
13038 !! options
13039 parsoid=wt2html,wt2wt,html2html
13040 !! wikitext
13041 [[File:Foobar.jpg|20pxpx]]
13042 [[File:Foobar.jpg|200x20pxpx]]
13043 !! html/php
13044 <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>
13045 <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>
13046 </p>
13047 !! html/parsoid
13048 <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>
13049 !! end
13050
13051 !! test
13052 Image with link parameter, wiki target
13053 !! wikitext
13054 [[File:Foobar.jpg|link=Main Page]]
13055 !! html/php
13056 <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>
13057 </p>
13058 !! html/parsoid
13059 <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>
13060 !! end
13061
13062 # parsoid bug 49293 (part 1)
13063 !! test
13064 Image with link parameter, URL target
13065 !! wikitext
13066 [[File:Foobar.jpg|link=http://example.com/]]
13067 !! html/php
13068 <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>
13069 </p>
13070 !! html/parsoid
13071 <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>
13072 !! end
13073
13074 # parsoid bug 49293 (part 2)
13075 !! test
13076 Image with link parameter, protocol-less URL target
13077 !! wikitext
13078 [[File:Foobar.jpg|link=//example.com/]]
13079 !! html/php
13080 <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>
13081 </p>
13082 !! html/parsoid
13083 <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>
13084 !! end
13085
13086 !! test
13087 Escaping non-block captions (T107435)
13088 !! options
13089 parsoid={
13090 "modes": ["wt2wt"],
13091 "changes": [
13092 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13093 ]
13094 }
13095 !! wikitext
13096 [[Image:Foobar.jpg|caption]]
13097 !! wikitext/edited
13098 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13099 !! end
13100
13101 # wgExternalLinkTarget not supported by Parsoid
13102 !! test
13103 Image with link parameter, wgExternalLinkTarget
13104 !! wikitext
13105 [[Image:foobar.jpg|link=http://example.com/]]
13106 !! config
13107 wgExternalLinkTarget='foobar'
13108 !! html/php
13109 <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>
13110 </p>
13111 !! end
13112
13113 !! test
13114 Image with link parameter, wgNoFollowLinks set to false
13115 !! wikitext
13116 [[Image:foobar.jpg|link=http://example.com/]]
13117 !! config
13118 wgNoFollowLinks=false
13119 !! html
13120 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13121 </p>
13122 !! end
13123
13124 !! test
13125 Image with link parameter, wgNoFollowDomainExceptions
13126 !! wikitext
13127 [[Image:foobar.jpg|link=http://example.com/]]
13128 !! config
13129 wgNoFollowDomainExceptions='example.com'
13130 !! html
13131 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13132 </p>
13133 !! end
13134
13135 # wgExternalLinkTarget not supported by Parsoid
13136 !! test
13137 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13138 !! wikitext
13139 [[Image:foobar.jpg|link=http://example.com/|Title]]
13140 !! config
13141 wgExternalLinkTarget='foobar'
13142 !! html/php
13143 <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>
13144 </p>
13145 !! end
13146
13147 !! test
13148 Image with empty link parameter
13149 !! wikitext
13150 [[File:Foobar.jpg|link=]]
13151 !! html/php
13152 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13153 </p>
13154 !! html/parsoid
13155 <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>
13156 !! end
13157
13158 !! test
13159 Image with link parameter (wiki target) and unnamed parameter
13160 !! wikitext
13161 [[File:Foobar.jpg|link=Main_Page|Title]]
13162 !! html/php
13163 <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>
13164 </p>
13165 !! html/parsoid
13166 <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>
13167 !! end
13168
13169 !! test
13170 Image with link parameter (URL target) and unnamed parameter
13171 !! wikitext
13172 [[File:Foobar.jpg|link=http://example.com/|Title]]
13173 !! html/php
13174 <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>
13175 </p>
13176 !! html/parsoid
13177 <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>
13178 !! end
13179
13180 !! test
13181 Thumbnail image with link parameter
13182 !! options
13183 thumbsize=220
13184 parsoid=wt2html,wt2wt,html2html
13185 !! wikitext
13186 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13187 !! html/php
13188 <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>
13189
13190 !! html/parsoid
13191 <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>
13192 !! end
13193
13194 !! test
13195 Manually-specified thumbnail image
13196 !! options
13197 thumbsize=220
13198 !! wikitext
13199 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13200 !! html/php
13201 <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>
13202
13203 !! html/parsoid
13204 <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>
13205 !! end
13206
13207 !! test
13208 Manually-specified thumbnail image with explicit link to wiki page
13209 !! options
13210 thumbsize=220
13211 parsoid=wt2html,wt2wt,html2html
13212 !! wikitext
13213 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13214 !! html/php
13215 <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>
13216
13217 !! html/parsoid
13218 <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>
13219 !! end
13220
13221 !! test
13222 Manually-specified thumbnail image with explicit link to url
13223 !! options
13224 thumbsize=220
13225 parsoid=wt2html,wt2wt,html2html
13226 !! wikitext
13227 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13228 !! html/php
13229 <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>
13230
13231 !! html/parsoid
13232 <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>
13233 !! end
13234
13235 !! test
13236 Manually-specified thumbnail image with explicit no link
13237 !! options
13238 thumbsize=220
13239 parsoid=wt2html,wt2wt,html2html
13240 !! wikitext
13241 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13242 !! html/php
13243 <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>
13244
13245 !! html/parsoid
13246 <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>
13247 !! end
13248
13249 !! test
13250 Manually-specified thumbnail image with explicit link and alt text
13251 !! options
13252 thumbsize=220
13253 parsoid=wt2html,wt2wt,html2html
13254 !! wikitext
13255 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13256 !! html/php
13257 <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>
13258
13259 !! html/parsoid
13260 <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>
13261 !! end
13262
13263 !! test
13264 Image with frame and link
13265 !! options
13266 parsoid=wt2html,wt2wt,html2html
13267 !! wikitext
13268 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13269 !! html/php
13270 <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>
13271
13272 !! html/parsoid
13273 <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>
13274 !! end
13275
13276 !! test
13277 Image with frame and link and explicit alt
13278 !! options
13279 parsoid=wt2html,wt2wt,html2html
13280 !! wikitext
13281 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13282 !! html/php
13283 <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>
13284
13285 !! html/parsoid
13286 <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>
13287 !! end
13288
13289 !! test
13290 Image with wiki markup in implicit alt
13291 !! wikitext
13292 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13293
13294 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13295 !! html/php
13296 <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>
13297 </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>
13298 </p>
13299 !! html/parsoid
13300 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13301 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13302 !! end
13303
13304 !! test
13305 Alt image option should handle most kinds of wikitext without barfing
13306 !! wikitext
13307 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13308 !! html/php
13309 <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>
13310
13311 !! html/parsoid
13312 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13313 !! end
13314
13315 ###################
13316 # Conflicting image format options.
13317 # First option specified should 'win'.
13318 # All three cases in each test should be identical.
13319
13320 !! test
13321 Image with 'frameless' first.
13322 !! options
13323 parsoid=wt2html,wt2wt,html2html
13324 !! wikitext
13325 [[File:Foobar.jpg|frameless|caption]]
13326
13327 [[File:Foobar.jpg|frameless|frame|caption]]
13328
13329 [[File:Foobar.jpg|frameless|thumb|caption]]
13330 !! html/php
13331 <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>
13332 </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>
13333 </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>
13334 </p>
13335 !! html/parsoid
13336 <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>
13337 <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>
13338 <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>
13339 !! end
13340
13341 !! test
13342 Image with 'frame' first.
13343 !! options
13344 parsoid=wt2html,wt2wt,html2html
13345 !! wikitext
13346 [[File:Foobar.jpg|frame|caption]]
13347 [[File:Foobar.jpg|frame|frameless|caption]]
13348 [[File:Foobar.jpg|frame|thumb|caption]]
13349 !! html/php
13350 <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>
13351 <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>
13352 <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>
13353
13354 !! html/parsoid
13355 <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>
13356 <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>
13357 <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>
13358 !! end
13359
13360 !! test
13361 Image with 'thumb' first.
13362 !! options
13363 parsoid=wt2html,wt2wt,html2html
13364 !! wikitext
13365 [[File:Foobar.jpg|thumb|caption]]
13366 [[File:Foobar.jpg|thumb|frameless|caption]]
13367 [[File:Foobar.jpg|thumb|frame|caption]]
13368 !! html/php
13369 <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>
13370 <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>
13371 <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>
13372
13373 !! html/parsoid
13374 <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>
13375 <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>
13376 <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>
13377 !! end
13378
13379 ###################
13380 # Image sizing.
13381 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13382 # and https://phabricator.wikimedia.org/T64258
13383 # Foobar has actual size of 1941x220
13384 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13385 # a scalable format.
13386 # 2. Framed images always ignore size options; always render at default size.
13387 # 3. "Unspecified format" and border are the only types which can be
13388 # enlarged.
13389
13390 !! test
13391 Image: "unspecified format" and border enlarge
13392 !! options
13393 parsoid=wt2html,wt2wt,html2html
13394 !! wikitext
13395 [[File:Foobar.jpg|2000px]]
13396
13397 [[File:Foobar.jpg|border|2000px]]
13398 !! html/php
13399 <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>
13400 </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>
13401 </p>
13402 !! html/parsoid
13403 <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>
13404 <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>
13405 !! end
13406
13407 !! test
13408 Image: "unspecified format" and border reduce
13409 !! options
13410 parsoid=wt2html,wt2wt,html2html
13411 !! wikitext
13412 [[File:Foobar.jpg|1000px]]
13413
13414 [[File:Foobar.jpg|border|1000px]]
13415 !! html/php
13416 <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>
13417 </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>
13418 </p>
13419 !! html/parsoid
13420 <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>
13421 <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>
13422 !! end
13423
13424 !! test
13425 Image: thumbs reduce
13426 !! options
13427 parsoid=wt2html,wt2wt,html2html
13428 !! wikitext
13429 [[File:Foobar.jpg|thumb|50px]]
13430 !! html/php
13431 <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>
13432
13433 !! html/parsoid
13434 <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>
13435 !! end
13436
13437 !! test
13438 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13439 !! options
13440 parsoid=wt2html,wt2wt,html2html
13441 !! wikitext
13442 [[File:Foobar.jpg|thumb|2000px]]
13443
13444 [[File:Foobar.svg|thumb|2000px]]
13445 !! html/php
13446 <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>
13447 <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>
13448
13449 !! html/parsoid
13450 <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>
13451 <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>
13452 !! end
13453
13454 !! test
13455 Image: frameless can reduce in size
13456 !! options
13457 parsoid=wt2html,wt2wt,html2html
13458 !! wikitext
13459 [[File:Foobar.jpg|frameless|50px]]
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/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>
13462 </p>
13463 !! html/parsoid
13464 <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>
13465 !! end
13466
13467 !! test
13468 Image: bitmap frameless can't be enlarged past original size, but vector can
13469 !! options
13470 parsoid=wt2html,wt2wt,html2html
13471 !! wikitext
13472 [[File:Foobar.jpg|frameless|2000px]]
13473
13474 [[File:Foobar.svg|frameless|2000px]]
13475 !! html/php
13476 <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>
13477 </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>
13478 </p>
13479 !! html/parsoid
13480 <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>
13481 <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>
13482 !! end
13483
13484 !! test
13485 Image: framed images are always unscaled.
13486 !! options
13487 parsoid=wt2html,wt2wt,html2html
13488 !! wikitext
13489 [[File:Foobar.jpg|frame]]
13490
13491 [[File:Foobar.jpg|frame|50px]]
13492
13493 [[File:Foobar.jpg|frame|50x50px]]
13494
13495 [[File:Foobar.jpg|frame|2000px]]
13496 !! html/php
13497 <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>
13498 <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>
13499 <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>
13500 <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>
13501
13502 !! html/parsoid
13503 <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>
13504 <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>
13505 <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>
13506 <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>
13507 !! end
13508
13509 ###################
13510
13511 !! test
13512 Link to image page- image page normally doesn't exists, hence edit link
13513 Add test with existing image page
13514 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13515 !! wikitext
13516 [[:Image:test]]
13517 !! html
13518 <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>
13519 </p>
13520 !! end
13521
13522 !! test
13523 bug 18784 Link to non-existent image page with caption should use caption as link text
13524 !! wikitext
13525 [[:Image:test|caption]]
13526 !! html
13527 <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>
13528 </p>
13529 !! end
13530
13531 !! test
13532 Frameless image caption with a free URL
13533 !! wikitext
13534 [[File:Foobar.jpg|http://example.com]]
13535 !! html/php
13536 <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>
13537 </p>
13538 !! html/parsoid
13539 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13540 !! end
13541
13542 !! test
13543 Thumbnail image caption with a free URL
13544 !! options
13545 thumbsize=220
13546 !! wikitext
13547 [[File:Foobar.jpg|thumb|http://example.com]]
13548 !! html/php
13549 <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>
13550
13551 !! html/parsoid
13552 <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>
13553 !! end
13554
13555 !! test
13556 Thumbnail image caption with a free URL and explicit alt
13557 !! options
13558 thumbsize=220
13559 parsoid=wt2html,wt2wt,html2html
13560 !! wikitext
13561 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13562 !! html/php
13563 <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>
13564
13565 !! html/parsoid
13566 <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>
13567 !! end
13568
13569 !! test
13570 SVG thumbnails with no language set
13571 !! options
13572 !! wikitext
13573 [[File:Foobar.svg|thumb|caption]]
13574 !! html/php
13575 <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>
13576
13577 !! html/parsoid
13578 <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>
13579 !! end
13580
13581 !! test
13582 SVG thumbnails with language de
13583 !! options
13584 parsoid=wt2html,wt2wt,html2html
13585 !! wikitext
13586 [[File:Foobar.svg|thumb|caption|lang=de]]
13587 !! html/php
13588 <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>
13589
13590 !! html/parsoid
13591 <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>
13592 !! end
13593
13594 !! test
13595 SVG thumbnails with invalid language code
13596 !! options
13597 parsoid=wt2html,wt2wt,html2html
13598 !! wikitext
13599 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13600 !! html/php
13601 <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>
13602
13603 !! html/parsoid
13604 <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>
13605 !! end
13606
13607 !! test
13608 BUG 1887: A ISBN with a thumbnail
13609 !! wikitext
13610 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13611 !! html/php
13612 <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>
13613
13614 !! html/parsoid
13615 <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>
13616 !! end
13617
13618 !! test
13619 BUG 1887: A RFC with a thumbnail
13620 !! wikitext
13621 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13622 !! html/php
13623 <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>
13624
13625 !! html/parsoid
13626 <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>
13627 !! end
13628
13629 !! test
13630 BUG 1887: A mailto link with a thumbnail
13631 !! wikitext
13632 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13633 !! html/php
13634 <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>
13635
13636 !! html/parsoid
13637 <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>
13638 !! end
13639
13640 # Pending resolution to bug 368
13641 !! test
13642 BUG 648: Frameless image caption with a link
13643 !! wikitext
13644 [[File:Foobar.jpg|text with a [[link]] in it]]
13645 !! html/php
13646 <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>
13647 </p>
13648 !! html/parsoid
13649 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,38,2,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13650 !! end
13651
13652 !! test
13653 BUG 648: Frameless image caption with a link (suffix)
13654 !! wikitext
13655 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13656 !! html/php
13657 <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>
13658 </p>
13659 !! html/parsoid
13660 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13661 !! end
13662
13663 !! test
13664 BUG 648: Frameless image caption with an interwiki link
13665 !! wikitext
13666 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13667 !! html/php
13668 <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>
13669 </p>
13670 !! html/parsoid
13671 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13672 !! end
13673
13674 !! test
13675 BUG 648: Frameless image caption with a piped interwiki link
13676 !! wikitext
13677 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13678 !! html/php
13679 <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>
13680 </p>
13681 !! html/parsoid
13682 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13683 !! end
13684
13685 !! test
13686 T107474: Frameless image caption with <nowiki>
13687 !! wikitext
13688 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13689 !! html/parsoid
13690 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13691 !! end
13692
13693 !! test
13694 Escape HTML special chars in image alt text
13695 !! wikitext
13696 [[File:Foobar.jpg|& < > "]]
13697 !! html/php
13698 <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>
13699 </p>
13700 !! html/parsoid
13701 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13702 !! end
13703
13704 !! test
13705 BUG 499: Alt text should have &#1234;, not &amp;1234;
13706 !! wikitext
13707 [[File:Foobar.jpg|&#9792;]]
13708 !! html/php
13709 <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>
13710 </p>
13711 !! html/parsoid
13712 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13713 !! end
13714
13715 !! test
13716 Broken image caption with link
13717 !! options
13718 parsoid=wt2html,wt2wt,html2html
13719 !! wikitext
13720 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13721 !! html/php
13722 <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.
13723 </p>
13724 !! html/parsoid
13725 <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>
13726 !! end
13727
13728 !! test
13729 Image caption containing another image
13730 !! wikitext
13731 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13732 !! html/php
13733 <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>
13734
13735 !! html/parsoid
13736 <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>
13737 !! end
13738
13739 !! test
13740 Image: caption containing a newline
13741 !! wikitext
13742 [[File:Foobar.jpg|This
13743 *is some text]]
13744 !! html/php
13745 <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>
13746 </p>
13747 !! html/parsoid
13748 <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>
13749 !!end
13750
13751 !!test
13752 Image: caption containing leading space
13753 (The leading space should not trigger nowiki escaping in wt2wt mode)
13754 !! wikitext
13755 [[File:Foobar.jpg|thumb| bar]]
13756 !! html/php
13757 <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>
13758
13759 !! html/parsoid
13760 <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>
13761 !!end
13762
13763 !! test
13764 Image: caption containing a table
13765 !! options
13766 parsoid=wt2html,wt2wt,html2html
13767 !! wikitext
13768 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13769 {|
13770 ! Foo !! Bar
13771 |-
13772 | Foo1 || Bar1
13773 |}
13774 and some more text.]]
13775 !! html/php
13776 <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>
13777
13778 !! html/parsoid
13779 <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
13780 <table>
13781 <tbody>
13782 <tr><th>Foo </th><th>Bar</th></tr>
13783 <tr>
13784 <td>Foo1 </td>
13785 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13786 !! end
13787
13788 !! test
13789 Bug 3090: External links other than http: in image captions
13790 !! wikitext
13791 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13792 !! html/php
13793 <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>
13794
13795 !! html/parsoid
13796 <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>
13797 !! end
13798
13799 !! test
13800 Custom class
13801 !! options
13802 parsoid=wt2html,wt2wt,html2html
13803 !! wikitext
13804 [[Image:foobar.jpg|a|class=b]]
13805 !! html/php
13806 <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>
13807 </p>
13808 !! html/parsoid
13809 <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>
13810 !! end
13811
13812 !! test
13813 Localized image handling (1).
13814 !! options
13815 parsoid=wt2html,wt2wt,html2html
13816 language=es
13817 !! wikitext
13818 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13819 !! html/php
13820 <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>
13821
13822 !! html/parsoid
13823 <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>
13824 !! end
13825
13826 !! test
13827 Localized image handling (2).
13828 !! options
13829 thumbsize=220
13830 parsoid=wt2html,wt2wt,html2html
13831 language=es
13832 !! wikitext
13833 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13834 !! html/php
13835 <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>
13836
13837 !! html/parsoid
13838 <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>
13839 !! end
13840
13841 !! test
13842 "border", "frameless" and "class" attributes on an image.
13843 !! options
13844 thumbsize=220
13845 parsoid=wt2html,wt2wt,html2html
13846 !! wikitext
13847 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13848 !! html/php
13849 <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>
13850 </p>
13851 !! html/parsoid
13852 <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>
13853 !! end
13854
13855 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13856 !! test
13857 Invalid image attributes (bug 62500)
13858 !! options
13859 thumbsize=220
13860 parsoid=wt2html,wt2wt,html2html
13861 !! wikitext
13862 [[File:Foobar.jpg|thumb|float|left|caption]]
13863
13864 [[File:Foobar.jpg|thumb|righ|caption]]
13865
13866 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13867 !! html/php
13868 <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>
13869 <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>
13870 <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>
13871
13872 !! html/parsoid
13873 <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>
13874 <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>
13875 <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>
13876 !! end
13877
13878 !! article
13879 File:Barfoo.jpg
13880 !! text
13881 #REDIRECT [[File:Barfoo.jpg]]
13882 !! endarticle
13883
13884 # FIXME: Parsoid should run this test -- but we'd need to teach the
13885 # mockAPI about the redirected Barfoo.jpg image.
13886 !! test
13887 Redirected image
13888 !! wikitext
13889 [[Image:Barfoo.jpg]]
13890 !! html/php
13891 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13892 </p>
13893 !! end
13894
13895 !! test
13896 Missing image with uploads disabled
13897 !! options
13898 wgEnableUploads=0
13899 !! wikitext
13900 [[File:Foobaz.jpg]]
13901 !! html/php
13902 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13903 </p>
13904 !! html/parsoid
13905 <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>
13906 !! end
13907
13908 # Parsoid-specific testing for images
13909 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13910 # Currently imperfect due to a flaw in the Parsoid testrunner
13911 # Work in progress
13912 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13913 # image tests.
13914
13915 !! test
13916 Parsoid-specific image handling - simple image with size and middle alignment
13917 !! wikitext
13918 [[File:Foobar.jpg|middle|50px]]
13919 !! html/parsoid
13920 <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>
13921 !! end
13922
13923 !! test
13924 Parsoid-specific image handling - simple image with size, middle alignment,
13925 non-standard namespace alias
13926 !! options
13927 parsoid=wt2wt,wt2html,html2html
13928 !! wikitext
13929 [[Image:Foobar.jpg|middle|50px]]
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 Parsoid-specific image handling - simple image with size and middle alignment
13936 (existing content)
13937 !! wikitext
13938 [[File:Foobar.jpg|50px|middle]]
13939 !! html/parsoid
13940 <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>
13941 !! end
13942
13943 !! test
13944 Parsoid-specific image handling - simple image with size and middle alignment
13945 and non-standard namespace name
13946 !! options
13947 parsoid=wt2html,wt2wt,html2html
13948 !! wikitext
13949 [[Image:Foobar.jpg|50px|middle]]
13950 !! html/parsoid
13951 <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>
13952 !! end
13953
13954 !! test
13955 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13956 !! wikitext
13957 [[File:Foobar.jpg|500x10px|baseline|caption]]
13958 !! html/parsoid
13959 <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>
13960 !! end
13961
13962 !! test
13963 Parsoid-specific image handling - simple image with border and size spec
13964 !! wikitext
13965 [[File:Foobar.jpg|50px|border|caption]]
13966 !! html/parsoid
13967 <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>
13968 !! end
13969
13970 !! test
13971 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13972 !! wikitext
13973 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13974 !! html/parsoid
13975 <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>
13976 !! end
13977
13978 !! test
13979 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13980 (existing content)
13981 !! wikitext
13982 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13983 !! html/parsoid
13984 <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>
13985 !! end
13986
13987 !! test
13988 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13989 !! wikitext
13990 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 Parsoid-specific image handling - thumbnail with specific size, halign,
13997 valign, and caption (existing content)
13998 !! wikitext
13999 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14000 !! html/parsoid
14001 <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>
14002 !! end
14003
14004 !! test
14005 Parsoid-specific image handling - framed image with specific size and caption
14006 (size is ignored)
14007 !! options
14008 parsoid=wt2html,wt2wt,html2html
14009 !! wikitext
14010 [[File:Foobar.jpg|frame|500x50px|caption]]
14011 !! html/parsoid
14012 <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>
14013 !! end
14014
14015 !! test
14016 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14017 (size is ignored)
14018 !! options
14019 parsoid=wt2html,wt2wt,html2html
14020 !! wikitext
14021 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14022 !! html/parsoid
14023 <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>
14024 !! end
14025
14026 !! test
14027 Parsoid-specific image handling - frameless image with specific size, border, and caption
14028 !! wikitext
14029 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 Parsoid-specific image handling - simple image with a formatted caption
14036 !! wikitext
14037 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14038 !! html/parsoid
14039 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14040 !! end
14041
14042 !! test
14043 Parsoid-specific image handling - caption with a template in it
14044 !! wikitext
14045 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14046 !! html/parsoid
14047 <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>
14048 !! end
14049
14050 !! test
14051 Parsoid-specific image handling - caption with unbalanced tags in it
14052 !! options
14053 parsoid=wt2html,wt2wt,html2html
14054 !! wikitext
14055 foo
14056 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14057 bar
14058 !! html/parsoid
14059 <p>foo</p>
14060 <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>
14061 <p>bar</p>
14062 !! end
14063
14064 !! test
14065 Parsoid-specific image handling - empty caption (1)
14066 !! options
14067 parsoid=wt2html,wt2wt
14068 !! wikitext
14069 [[File:Foobar.jpg|thumb|]]
14070 !! html/parsoid
14071 <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>
14072 !! end
14073
14074 # empty captions don't get serialized unless we're in the "round trip" case
14075 !! test
14076 Parsoid-specific image handling - empty caption (2)
14077 !! options
14078 parsoid=html2wt
14079 !! html/parsoid
14080 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14081 <a href="./File:Foobar.jpg">
14082 <img resource="./File:Foobar.jpg"
14083 src="//example.com/images/3/3a/Foobar.jpg"
14084 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14085 height="25" width="220"/>
14086 </a>
14087 <figcaption></figcaption>
14088 </figure>
14089 !! wikitext
14090 [[File:Foobar.jpg|thumb]]
14091 !! end
14092
14093 !! test
14094 Parsoid-specific image handling - whitespace caption
14095 !! wikitext
14096 [[File:Foobar.jpg|thumb| ]]
14097 !! html/parsoid
14098 <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>
14099 !! end
14100
14101 !! test
14102 Parsoid-specific image handling - lang option
14103 !! wikitext
14104 foo
14105 [[File:Foobar.svg|lang=de|caption]]
14106 bar
14107 !! html/parsoid
14108 <p>foo
14109 <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>
14110 bar</p>
14111 !! end
14112
14113 ## Edge case bugs in Parsoid from T93580
14114 !! test
14115 T93580: 1. Templated <ref> inside block images
14116 !! wikitext
14117 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14118
14119 <references />
14120 !! html/parsoid
14121 <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>
14122
14123 <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>
14124 !! end
14125
14126 !! test
14127 T93580: 2. <ref> inside inline images
14128 !! wikitext
14129 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14130
14131 <references />
14132 !! html/parsoid
14133 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14134
14135 <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>
14136 !! end
14137
14138 !! test
14139 T93580: 3. Templated <ref> inside inline images
14140 !! wikitext
14141 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14142
14143 <references />
14144 !! html/parsoid
14145 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14146
14147 <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>
14148 !! end
14149
14150 ###
14151 ### Subpages
14152 ###
14153 !! article
14154 Subpage test/subpage
14155 !! text
14156 foo
14157 !! endarticle
14158
14159 !! test
14160 Subpage link
14161 !! options
14162 subpage title=[[Subpage test]]
14163 !! wikitext
14164 [[/subpage]]
14165 !! html
14166 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14167 </p>
14168 !! end
14169
14170 !! test
14171 Subpage noslash link
14172 !! options
14173 subpage title=[[Subpage test]]
14174 !! wikitext
14175 [[/subpage/]]
14176 !! html
14177 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14178 </p>
14179 !! end
14180
14181 !! article
14182 Subpage test/1/2/subpage
14183 !! text
14184 blah
14185 !! endarticle
14186
14187 !! test
14188 Relative subpage noslash link
14189 !! options
14190 parsoid=wt2wt,wt2html,html2html
14191 subpage title=[[Subpage test/1/2/3/4]]
14192 !! wikitext
14193 [[../../subpage/]]
14194
14195 [[../../subpage]]
14196 !! html/php
14197 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14198 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14199 </p>
14200 !! html/parsoid
14201 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14202 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14203 !! end
14204
14205 !! test
14206 Parsoid: dot-slash prefixed wikilinks
14207 !! wikitext
14208 [[./foo]]
14209
14210 [[././bar]]
14211
14212 [[././baz/]]
14213 !! html/php
14214 <p>[[./foo]]
14215 </p><p>[[././bar]]
14216 </p><p>[[././baz/]]
14217 </p>
14218 !! html/parsoid
14219 <p>[[./foo]]
14220 </p><p>[[././bar]]
14221 </p><p>[[././baz/]]
14222 </p>
14223 !! end
14224
14225 !! test
14226 Render invalid page names as plain text (bug 51090)
14227 !! wikitext
14228 [[./../foo|bar]]
14229 [[foo�|bar]]
14230 [[foo/.|bar]]
14231 [[foo/..|bar]]
14232 [[foo~~~bar]]
14233 [[foo>bar]]
14234 [[foo[bar]]
14235 [[.]]
14236 [[..]]
14237 [[foo././bar]]
14238
14239 [[{{echo|./../foo}}|bar]]
14240 [[{{echo|foo/.}}|bar]]
14241 [[{{echo|foo/..}}|bar]]
14242 [[{{echo|foo~~~~bar}}]]
14243 [[{{echo|foo>bar}}]]
14244 [[{{echo|foo././bar}}]]
14245 [[{{echo|foo{bar}}]]
14246 [[{{echo|foo}bar}}]]
14247 [[{{echo|foo[bar}}]]
14248 [[{{echo|foo]bar}}]]
14249 [[{{echo|foo<bar}}]]
14250 !!html/php
14251 <p>[[./../foo|bar]]
14252 [[foo�|bar]]
14253 [[foo/.|bar]]
14254 [[foo/..|bar]]
14255 [[foo~~~bar]]
14256 [[foo&gt;bar]]
14257 [[foo[bar]]
14258 [[.]]
14259 [[..]]
14260 [[foo././bar]]
14261 </p><p>[[./../foo|bar]]
14262 [[foo/.|bar]]
14263 [[foo/..|bar]]
14264 [[foo~~~~bar]]
14265 [[foo&gt;bar]]
14266 [[foo././bar]]
14267 [[foo{bar]]
14268 [[foo}bar]]
14269 [[foo[bar]]
14270 [[foo]bar]]
14271 [[foo&lt;bar]]
14272 </p>
14273 !!html/parsoid
14274 <p>[[./../foo|bar]]
14275 [[foo�|bar]]
14276 [[foo/.|bar]]
14277 [[foo/..|bar]]
14278 [[foo~~~bar]]
14279 [[foo>bar]]
14280 [[foo[bar]]
14281 [[.]]
14282 [[..]]
14283 [[foo././bar]]</p>
14284
14285 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14286 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14287 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14288 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14289 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14290 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14291 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14292 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14293 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14294 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14295 [[<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>
14296 !!end
14297
14298 !! test
14299 Disabled subpages
14300 !! wikitext
14301 [[/subpage]]
14302 !! html
14303 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14304 </p>
14305 !! end
14306
14307 !! test
14308 BUG 561: {{/Subpage}}
14309 !! options
14310 subpage title=[[Page]]
14311 !! wikitext
14312 {{/Subpage}}
14313 !! html
14314 <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>
14315 </p>
14316 !! end
14317
14318 ###
14319 ### Categories
14320 ###
14321 !! article
14322 Category:MediaWiki User's Guide
14323 !! text
14324 blah
14325 !! endarticle
14326
14327 !! test
14328 Link to category
14329 !! wikitext
14330 [[:Category:MediaWiki User's Guide]]
14331 !! html
14332 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14333 </p>
14334 !! end
14335
14336 !! test
14337 Simple category
14338 !! options
14339 cat
14340 !! wikitext
14341 [[Category:MediaWiki User's Guide]]
14342 !! html
14343 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14344 !! end
14345
14346 !! test
14347 PAGESINCATEGORY invalid title fatal (r33546 fix)
14348 !! wikitext
14349 {{PAGESINCATEGORY:<bogus>}}
14350 !! html
14351 <p>0
14352 </p>
14353 !! end
14354
14355 !! test
14356 Category with different sort key
14357 !! options
14358 cat
14359 !! wikitext
14360 [[Category:MediaWiki User's Guide|Foo]]
14361 !! html
14362 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14363 !! end
14364
14365 !! test
14366 Category with identical sort key
14367 !! options
14368 cat
14369 !! wikitext
14370 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14371 !! html
14372 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14373 !! end
14374
14375 !! test
14376 Category with empty sort key
14377 !! options
14378 cat
14379 pst
14380 !! wikitext
14381 [[Category:MediaWiki User's Guide|]]
14382 !! html/php
14383 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14384 !! end
14385
14386 !! test
14387 Category with empty sort key and parentheses
14388 !! options
14389 cat
14390 pst
14391 !! wikitext
14392 [[Category:Foo (bar)|]]
14393 !! html/php
14394 [[Category:Foo (bar)|Foo]]
14395 !! end
14396
14397 ## We used to, but no longer wt2wt this test since the default serializer
14398 ## will normalize all categories to serialize on their own line.
14399 ## This wikitext usage is going to be fairly uncommon in production and
14400 ## selser will take care of preserving formatting in those scenarios.
14401 !! test
14402 Category with link tail
14403 !! options
14404 cat
14405 pst
14406 parsoid=wt2html
14407 !! wikitext
14408 123[[Category:Foo]]456
14409 !! html/php
14410 123[[Category:Foo]]456
14411 !! html/parsoid
14412 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14413 !! end
14414
14415 !! test
14416 Category with template
14417 !! options
14418 cat
14419 pst
14420 !! wikitext
14421 [[Category:{{echo|Foo}}]]
14422 !! html/php
14423 [[Category:{{echo|Foo}}]]
14424 !! end
14425
14426 !! test
14427 Category with template in sort key
14428 !! options
14429 cat
14430 pst
14431 !! wikitext
14432 [[Category:Foo|{{echo|Bar}}]]
14433 !! html/php
14434 [[Category:Foo|{{echo|Bar}}]]
14435 !! end
14436
14437 !! test
14438 Category with template in sort key and title
14439 !! options
14440 cat
14441 pst
14442 !! wikitext
14443 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14444 !! html/php
14445 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14446 !! end
14447
14448 ## We used to, but no longer wt2wt this test since the default serializer
14449 ## will normalize all categories to serialize on their own line.
14450 ## This wikitext usage is going to be fairly uncommon in production and
14451 ## selser will take care of preserving formatting in those scenarios.
14452 !! test
14453 Category / paragraph interactions
14454 !! options
14455 parsoid=wt2html
14456 !! wikitext
14457 Foo [[Category:Baz]] Bar
14458
14459 Foo [[Category:Baz]]
14460 Bar
14461
14462 Foo
14463 [[Category:Baz]]
14464 Bar
14465
14466 Foo
14467 [[Category:Baz]] Bar
14468
14469 Foo
14470 [[Category:Baz]]
14471 [[Category:Baz]]
14472 [[Category:Baz]]
14473 Bar
14474
14475 [[Category:Baz]]
14476 [[Category:Baz]]
14477 [[Category:Baz]]
14478
14479 [[Category:Baz]]
14480 {{echo|[[Category:Baz]]}}
14481 [[Category:Baz]]
14482 !! html/php
14483 <p>Foo Bar
14484 </p><p>Foo
14485 Bar
14486 </p><p>Foo
14487 Bar
14488 </p><p>Foo Bar
14489 </p><p>Foo
14490 Bar
14491 </p>
14492 !! html/parsoid
14493 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14494 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14495 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14496 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14497 <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>
14498 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14499 !! end
14500
14501 ## We used to, but no longer wt2wt this test since the default serializer
14502 ## will normalize all categories to serialize on their own line.
14503 ## This wikitext usage is going to be fairly uncommon in production and
14504 ## selser will take care of preserving formatting in those scenarios.
14505 ##
14506 ## The whitespace on the empty line is part of the test. Please do not delete
14507 !! test
14508 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14509 !! options
14510 parsoid=wt2html
14511 !! wikitext
14512 This
14513
14514 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14515
14516 {{echo|[[Category:Foo]] and so should this!}}
14517 !! html/php
14518 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14519 </p>
14520 !! html/parsoid
14521 <p>This
14522
14523 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14524
14525 <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>
14526 !! end
14527
14528 ## Parsoid will not try to wt2wt this while preserving newlines because
14529 ## it suppresses excess newlines within list items -- and we don't want to
14530 ## introduce a special case just for categories, which is, in reality somewhat
14531 ## odd behavior -- categories are unlikely to be used in list items like this
14532 ## in top-level pages and are only likely to show up in template-generated
14533 ## list items where this RT-ing is a non-issue.
14534 ##
14535 ## The whitespace on the empty line is part of the test. Please do not delete
14536 !! test
14537 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14538 !! options
14539 parsoid=wt2html
14540 !! wikitext
14541 * This
14542
14543 [[Category:Foo]] and this should be part of the same list item
14544 * So should this
14545
14546 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14547 !! html
14548 <ul><li>This and this should be part of the same list item</li>
14549 <li>So should this and this should be part of the same list item</li></ul>
14550 !! html/parsoid
14551 <ul>
14552 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14553 <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>
14554 </ul>
14555 !! end
14556
14557 ## Newlines and categories that follow the last item of a list
14558 ## are treated differently because this (list followed by categories)
14559 ## is an extremely common pattern on wikis.
14560 !! test
14561 3. Categories and newlines: newline suppression for last list item should RT properly
14562 !! wikitext
14563 * a
14564 * b
14565
14566 [[Category:Foo]]
14567
14568 [[Category:Bar]]
14569 [[Category:Baz]]
14570 !! html/parsoid
14571 <ul><li> a</li>
14572 <li> b</li></ul>
14573
14574 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14575
14576 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14577 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14578 !! end
14579
14580 !! test
14581 4. Categories and newlines: newline suppression for last list item should RT properly
14582 !! wikitext
14583 * a
14584 **** b
14585
14586 [[Category:Foo]]
14587 !! html/parsoid
14588 <ul><li> a
14589 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14590
14591 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14592 !! end
14593
14594 ## only wt2html for this to make sure the algo only applies to the rightmost path
14595 !! test
14596 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14597 !! options
14598 parsoid=wt2html
14599 !! wikitext
14600 * a
14601 ** b
14602 [[Category:Foo]]
14603 * c
14604 ** d
14605 [[Category:Foo]]
14606 !! html/parsoid
14607 <ul><li> a
14608 <ul><li> b
14609 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14610 <li> c
14611 <ul><li> d</li></ul></li></ul>
14612 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14613 !! end
14614
14615 ## We used to, but no longer wt2wt this test since the default serializer
14616 ## will normalize all categories to serialize on their own line.
14617 ## This wikitext usage is going to be fairly uncommon in production and
14618 ## selser will take care of preserving formatting in those scenarios.
14619 !! test
14620 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14621 !! options
14622 parsoid=wt2html
14623 !! wikitext
14624 * a [[Category:Foo]]
14625 !! html/parsoid
14626 <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>
14627 !! end
14628
14629 # This test also demonstrates because of newline+category tunneling
14630 # through the list hander, template wrapping doesn't expand to the
14631 # containing list when the list item swallows the category.
14632 !! test
14633 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14634 !! wikitext
14635 * {{echo|a
14636 [[Category:Foo]]}}
14637 !! html/parsoid
14638 <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
14639 </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>
14640 !! end
14641
14642 !! test
14643 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14644 !! wikitext
14645 * a
14646
14647 {{echo|[[Category:Foo]]
14648 [[Category:Bar]]}}
14649 [[Category:Baz]]
14650 !! html/parsoid
14651 <ul><li> a</li></ul>
14652
14653 <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">
14654 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14655 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14656 !! end
14657
14658 !! test
14659 Parsoid: Serialize link to category page with colon escape
14660 !! options
14661 parsoid
14662 !! wikitext
14663
14664 [[:Category:Foo]]
14665 [[:Category:Foo|Bar]]
14666 !! html
14667 <p>
14668 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14669 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14670 </p>
14671 !! end
14672
14673 # We used to, but no longer wt2wt this test since the default serializer
14674 # will normalize all categories to serialize on their own line.
14675 # This wikitext usage is going to be fairly uncommon in production and
14676 # selser will take care of preventing whitespace insertion if this
14677 # occurs in an article.
14678 #
14679 # html2html disabled for the same reason (whitespace insertion between
14680 # x and y).
14681 #
14682 # html2wt disabled because it localizes the "Category" namespace.
14683 !! test
14684 Link prefix/suffixes aren't applied to category links
14685 !! options
14686 parsoid=wt2html
14687 language=is
14688 !! wikitext
14689 x[[Category:Foo]]y
14690 !! html/php
14691 <p>xy
14692 </p>
14693 !! html/parsoid
14694 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14695 !! end
14696
14697 !! test
14698 Parsoid: Serialize link to file page with colon escape
14699 !! options
14700 parsoid
14701 !! wikitext
14702
14703 [[:File:Foo.png]]
14704 [[:File:Foo.png|Bar]]
14705 !! html
14706 <p>
14707 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14708 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14709 </p>
14710 !! end
14711
14712 !! test
14713 Parsoid: Serialize a genuine category link without colon escape
14714 !! options
14715 parsoid
14716 !! wikitext
14717 [[Category:Foo]]
14718 [[Category:Foo|Bar]]
14719 !! html
14720 <link rel="mw:PageProp/Category" href="./Category:Foo">
14721 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14722 !! end
14723
14724 !! test
14725 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14726 !! options
14727 parsoid=html2wt
14728 !! html/parsoid
14729 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14730 !! wikitext
14731 [[Category:Toxine bactérienne]]
14732 !! end
14733
14734 !! test
14735 Parsoid: Defaultsort
14736 !! wikitext
14737 {{DEFAULTSORT:Foo}}
14738 !! html/parsoid
14739 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14740 !! end
14741
14742 !! test
14743 Parsoid: Defaultsort (template-generated)
14744 !! wikitext
14745 {{{{echo|DEFAULTSORT}}:Foo}}
14746 !! html/parsoid
14747 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14748 !! end
14749
14750 ###
14751 ### Inter-language links
14752 ###
14753 !! test
14754 Interlanguage links
14755 !! options
14756 ill
14757 !! wikitext
14758 [[es:Alimento]]
14759 [[fr:Nourriture]]
14760 [[zh:食品]]
14761 !! html/php
14762 es:Alimento fr:Nourriture zh:食品
14763 !! html/parsoid
14764 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14765 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14766 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14767 !! end
14768
14769 !! test
14770 Duplicate interlanguage links (bug 24502)
14771 !! options
14772 ill
14773 !! wikitext
14774 [[es:1]]
14775 [[es:2]]
14776 [[fr:1]]
14777 [[fr:2]]
14778 !! html/php
14779 es:1 fr:1
14780 !! html/parsoid
14781 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14782 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14783 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14784 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14785 !! end
14786
14787 ###
14788 ### Sections
14789 ###
14790 !! test
14791 Basic section headings
14792 !! wikitext
14793 == Headline 1 ==
14794 Some text
14795
14796 ==Headline 2==
14797 More
14798 ===Smaller headline===
14799 Blah blah
14800 !! html
14801 <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>
14802 <p>Some text
14803 </p>
14804 <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>
14805 <p>More
14806 </p>
14807 <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>
14808 <p>Blah blah
14809 </p>
14810 !! end
14811
14812 !! test
14813 Section headings with TOC
14814 !! wikitext
14815 == Headline 1 ==
14816 === Subheadline 1 ===
14817 ===== Skipping a level =====
14818 ====== Skipping a level ======
14819
14820 == Headline 2 ==
14821 Some text
14822 ===Another headline===
14823 !! html
14824 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14825 <ul>
14826 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14827 <ul>
14828 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14829 <ul>
14830 <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>
14831 <ul>
14832 <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>
14833 </ul>
14834 </li>
14835 </ul>
14836 </li>
14837 </ul>
14838 </li>
14839 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14840 <ul>
14841 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14842 </ul>
14843 </li>
14844 </ul>
14845 </div>
14846
14847 <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>
14848 <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>
14849 <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>
14850 <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>
14851 <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>
14852 <p>Some text
14853 </p>
14854 <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>
14855
14856 !! end
14857
14858 !! test
14859 TOC anchors don't collide
14860 !! wikitext
14861 __FORCETOC__
14862 == Headline 2 ==
14863 == Headline ==
14864 == Headline 2 ==
14865 == Headline ==
14866 !! html/php
14867 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14868 <ul>
14869 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14870 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14871 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14872 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14873 </ul>
14874 </div>
14875
14876 <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>
14877 <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>
14878 <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>
14879 <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>
14880
14881 !! end
14882
14883 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14884 !! test
14885 Handling of sections up to level 6 and beyond
14886 !! wikitext
14887 = Level 1 Heading=
14888 == Level 2 Heading==
14889 === Level 3 Heading===
14890 ==== Level 4 Heading====
14891 ===== Level 5 Heading=====
14892 ====== Level 6 Heading======
14893 ======= Level 7 Heading=======
14894 ======== Level 8 Heading========
14895 ========= Level 9 Heading=========
14896 ========== Level 10 Heading==========
14897 !! html
14898 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14899 <ul>
14900 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14901 <ul>
14902 <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>
14903 <ul>
14904 <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>
14905 <ul>
14906 <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>
14907 <ul>
14908 <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>
14909 <ul>
14910 <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>
14911 <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>
14912 <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>
14913 <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>
14914 <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>
14915 </ul>
14916 </li>
14917 </ul>
14918 </li>
14919 </ul>
14920 </li>
14921 </ul>
14922 </li>
14923 </ul>
14924 </li>
14925 </ul>
14926 </div>
14927
14928 <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>
14929 <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>
14930 <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>
14931 <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>
14932 <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>
14933 <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>
14934 <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>
14935 <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>
14936 <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>
14937 <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>
14938
14939 !! end
14940
14941 !! test
14942 TOC regression (T11764)
14943 !! wikitext
14944 == title 1 ==
14945 === title 1.1 ===
14946 ==== title 1.1.1 ====
14947 === title 1.2 ===
14948 == title 2 ==
14949 === title 2.1 ===
14950 !! html
14951 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14952 <ul>
14953 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14954 <ul>
14955 <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>
14956 <ul>
14957 <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>
14958 </ul>
14959 </li>
14960 <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>
14961 </ul>
14962 </li>
14963 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14964 <ul>
14965 <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>
14966 </ul>
14967 </li>
14968 </ul>
14969 </div>
14970
14971 <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>
14972 <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>
14973 <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>
14974 <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>
14975 <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>
14976 <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>
14977
14978 !! end
14979
14980 !! test
14981 TOC for heading containing <span id="..."></span> (T96153)
14982 !! wikitext
14983 __FORCETOC__
14984 ==<span id="old-anchor"></span>New title==
14985 !! html/php
14986 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14987 <ul>
14988 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14989 </ul>
14990 </div>
14991
14992 <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>
14993
14994 !! end
14995
14996 !! test
14997 TOC with wgMaxTocLevel=3 (bug 6204)
14998 !! options
14999 wgMaxTocLevel=3
15000 !! wikitext
15001 == title 1 ==
15002 === title 1.1 ===
15003 ==== title 1.1.1 ====
15004 === title 1.2 ===
15005 == title 2 ==
15006 === title 2.1 ===
15007 !! html
15008 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15009 <ul>
15010 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15011 <ul>
15012 <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>
15013 <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>
15014 </ul>
15015 </li>
15016 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15017 <ul>
15018 <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>
15019 </ul>
15020 </li>
15021 </ul>
15022 </div>
15023
15024 <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>
15025 <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>
15026 <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>
15027 <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>
15028 <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>
15029 <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>
15030
15031 !! end
15032
15033 !! test
15034 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15035 !! options
15036 wgMaxTocLevel=3
15037 !! wikitext
15038 ==Section 1==
15039 ===Section 1.1===
15040 ====Section 1.1.1====
15041 ====Section 1.1.1.1====
15042 ==Section 2==
15043 !! html
15044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15045 <ul>
15046 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15047 <ul>
15048 <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>
15049 </ul>
15050 </li>
15051 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15052 </ul>
15053 </div>
15054
15055 <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>
15056 <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>
15057 <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>
15058 <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>
15059 <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>
15060
15061 !! end
15062
15063
15064 !! test
15065 Resolving duplicate section names
15066 !! wikitext
15067 == Foo bar ==
15068 == Foo bar ==
15069 !! html
15070 <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>
15071 <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>
15072
15073 !! end
15074
15075 !! test
15076 Resolving duplicate section names with differing case (bug 10721)
15077 !! wikitext
15078 == Foo bar ==
15079 == Foo Bar ==
15080 !! html
15081 <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>
15082 <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>
15083
15084 !! end
15085
15086 !! article
15087 Template:sections
15088 !! text
15089 ===Section 1===
15090 ==Section 2==
15091 !! endarticle
15092
15093 !! test
15094 Template with sections, __NOTOC__
15095 !! wikitext
15096 __NOTOC__
15097 ==Section 0==
15098 {{sections}}
15099 ==Section 4==
15100 !! html
15101 <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>
15102 <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>
15103 <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>
15104 <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>
15105
15106 !! end
15107
15108 !! test
15109 __NOEDITSECTION__ keyword
15110 !! wikitext
15111 __NOEDITSECTION__
15112 ==Section 1==
15113 ==Section 2==
15114 !! html
15115 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15116 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15117
15118 !! end
15119
15120 !! test
15121 Link inside a section heading
15122 !! wikitext
15123 ==Section with a [[Main Page|link]] in it==
15124 !! html
15125 <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>
15126
15127 !! end
15128
15129 !! test
15130 TOC regression (T14077)
15131 !! wikitext
15132 __TOC__
15133 == title 1 ==
15134 === title 1.1 ===
15135 == title 2 ==
15136 !! html
15137 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15138 <ul>
15139 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15140 <ul>
15141 <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>
15142 </ul>
15143 </li>
15144 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15145 </ul>
15146 </div>
15147
15148 <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>
15149 <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>
15150 <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>
15151
15152 !! end
15153
15154 !! test
15155 BUG 1219 URL next to image (good)
15156 !! wikitext
15157 http://example.com [[File:Foobar.jpg]]
15158 !! html/php
15159 <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>
15160 </p>
15161 !! html/parsoid
15162 <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>
15163 !!end
15164
15165 !! test
15166 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15167 !! wikitext
15168 ===
15169 The line above must have a trailing space!
15170 === <!--
15171 --> <!-- -->
15172 But just in case it doesn't...
15173 !! html
15174 <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>
15175 <p>The line above must have a trailing space!
15176 </p>
15177 <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>
15178 <p>But just in case it doesn't...
15179 </p>
15180 !! end
15181
15182 !! test
15183 Header with special characters (bug 25462)
15184 !! wikitext
15185 The tooltips shall not show entities to the user (ie. be double escaped)
15186
15187 == text > text ==
15188 section 1
15189
15190 == text < text ==
15191 section 2
15192
15193 == text & text ==
15194 section 3
15195
15196 == text ' text ==
15197 section 4
15198
15199 == text " text ==
15200 section 5
15201 !! html
15202 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15203 </p>
15204 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15205 <ul>
15206 <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>
15207 <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>
15208 <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>
15209 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15210 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15211 </ul>
15212 </div>
15213
15214 <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>
15215 <p>section 1
15216 </p>
15217 <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>
15218 <p>section 2
15219 </p>
15220 <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>
15221 <p>section 3
15222 </p>
15223 <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>
15224 <p>section 4
15225 </p>
15226 <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>
15227 <p>section 5
15228 </p>
15229 !! end
15230
15231 !! test
15232 Header with space, plus and underscore as entity
15233 !! wikitext
15234 Id should not contain + for spaces
15235
15236 == Space between Text ==
15237 section 1
15238
15239 == Space-Entity&#32;between&#32;Text ==
15240 section 2
15241
15242 == Plus+between+Text ==
15243 section 3
15244
15245 == Plus-Entity&#43;between&#43;Text ==
15246 section 4
15247
15248 == Underscore_between_Text ==
15249 section 5
15250
15251 == Underscore-Entity&#95;between&#95;Text ==
15252 section 6
15253
15254 [[#Space between Text]]
15255 [[#Space-Entity&#32;between&#32;Text]]
15256 [[#Plus+between+Text]]
15257 [[#Plus-Entity&#43;between&#43;Text]]
15258 [[#Underscore_between_Text]]
15259 [[#Underscore-Entity&#95;between&#95;Text]]
15260 !! html
15261 <p>Id should not contain + for spaces
15262 </p>
15263 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15264 <ul>
15265 <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>
15266 <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>
15267 <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>
15268 <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>
15269 <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>
15270 <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>
15271 </ul>
15272 </div>
15273
15274 <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>
15275 <p>section 1
15276 </p>
15277 <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>
15278 <p>section 2
15279 </p>
15280 <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>
15281 <p>section 3
15282 </p>
15283 <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>
15284 <p>section 4
15285 </p>
15286 <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>
15287 <p>section 5
15288 </p>
15289 <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>
15290 <p>section 6
15291 </p><p><a href="#Space_between_Text">#Space between Text</a>
15292 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15293 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15294 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15295 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15296 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15297 </p>
15298 !! end
15299
15300 !! test
15301 Headers with excess '=' characters
15302 (Are similar tests necessary beyond the 1st level?)
15303 !! wikitext
15304 =foo==
15305 ==foo=
15306 =''italic'' heading==
15307 ==''italic'' heading=
15308 !! html
15309 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15310 <ul>
15311 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15312 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15313 <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>
15314 <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>
15315 </ul>
15316 </div>
15317
15318 <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>
15319 <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>
15320 <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>
15321 <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>
15322
15323 !! end
15324
15325 !! test
15326 HTML headers vs TOC (bug 23393)
15327 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15328 !! wikitext
15329 <h1>Header 1</h1>
15330 == Header 1.1 ==
15331 == Header 1.2 ==
15332
15333 <h1>Header 2
15334 </h1>
15335 == Header 2.1 ==
15336 == Header 2.2 ==
15337 __NOEDITSECTION__
15338 !! html
15339 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15340 <ul>
15341 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15342 <ul>
15343 <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>
15344 <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>
15345 </ul>
15346 </li>
15347 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15348 <ul>
15349 <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>
15350 <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>
15351 </ul>
15352 </li>
15353 </ul>
15354 </div>
15355
15356 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15357 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15358 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15359 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15360 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15361 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15362
15363 !! end
15364
15365 !! test
15366 Single-line or multiline-comments can follow headings
15367 !! options
15368 parsoid=wt2html,wt2wt
15369 !! wikitext
15370 ==foo==<!---->
15371 ==bar==<!--c1-->
15372 ==baz==<!--
15373 c2
15374 c3-->
15375 !! html
15376 <h2><span class="mw-headline" id="foo">foo</span></h2>
15377 <h2><span class="mw-headline" id="bar">bar</span></h2>
15378 <h2><span class="mw-headline" id="baz">baz</span></h2>
15379
15380 !! end
15381
15382 !! test
15383 BUG 1219 URL next to image (broken)
15384 !! wikitext
15385 http://example.com[[File:Foobar.jpg]]
15386 !! html/php
15387 <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>
15388 </p>
15389 !! html/parsoid
15390 <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>
15391 !!end
15392
15393 !! test
15394 Bug 1186 news: in the middle of text
15395 !! wikitext
15396 http://en.wikinews.org/wiki/Wikinews:Workplace
15397 !! html
15398 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15399 </p>
15400 !!end
15401
15402
15403 !! test
15404 Namespaced link must have a title
15405 !! wikitext
15406 [[Project:]]
15407 !! html
15408 <p>[[Project:]]
15409 </p>
15410 !!end
15411
15412 !! test
15413 Namespaced link must have a title (bad fragment version)
15414 !! wikitext
15415 [[Project:#fragment]]
15416 !! html
15417 <p>[[Project:#fragment]]
15418 </p>
15419 !!end
15420
15421
15422 ###
15423 ### HTML tags and HTML attributes
15424 ###
15425
15426 !! test
15427 div with no attributes
15428 !! wikitext
15429 <div>HTML rocks</div>
15430 !! html
15431 <div>HTML rocks</div>
15432
15433 !! end
15434
15435 !! test
15436 div with double-quoted attribute
15437 !! wikitext
15438 <div id="rock">HTML rocks</div>
15439 !! html
15440 <div id="rock">HTML rocks</div>
15441
15442 !! end
15443
15444 !! test
15445 div with single-quoted attribute
15446 !! wikitext
15447 <div id='rock'>HTML rocks</div>
15448 !! html
15449 <div id="rock">HTML rocks</div>
15450
15451 !! end
15452
15453 !! test
15454 div with unquoted attribute
15455 !! wikitext
15456 <div id=rock>HTML rocks</div>
15457 !! html
15458 <div id="rock">HTML rocks</div>
15459
15460 !! end
15461
15462 !! test
15463 div with illegal double attributes
15464 !! wikitext
15465 <div id="a" id="b">HTML rocks</div>
15466 !! html
15467 <div id="b">HTML rocks</div>
15468
15469 !!end
15470
15471 !! test
15472 div with empty attribute value, space before equals
15473 !! wikitext
15474 <div class =>HTML rocks</div>
15475 !! html
15476 <div class="">HTML rocks</div>
15477
15478 !! end
15479
15480 # FIXME: Parsoid doesn't match the html5 spec
15481 !! test
15482 div with multiple empty attribute values
15483 !! options
15484 parsoid=wt2html,html2html
15485 !! wikitext
15486 <div id= title=>HTML rocks</div>
15487 !! html/php
15488 <div id="title.3D">HTML rocks</div>
15489
15490 !! html/parsoid
15491 <div id="" title="">HTML rocks</div>
15492 !! end
15493
15494 # FIXME: Parsoid doesn't match the html5 spec
15495 !! test
15496 table with multiple empty attribute values
15497 !! options
15498 parsoid=wt2html,html2html
15499 !! wikitext
15500 {| title= id=
15501 | hi
15502 |}
15503 !! html/php
15504 <table title="id=">
15505 <tr>
15506 <td> hi
15507 </td></tr></table>
15508
15509 !! html/parsoid
15510 <table title="" id="">
15511 <tbody><tr><td> hi</td></tr>
15512 </tbody></table>
15513 !! end
15514
15515 !! test
15516 div with braces in attribute value
15517 !! wikitext
15518 <div title="{}">Foo</div>
15519 !! html/php
15520 <div title="&#123;}">Foo</div>
15521
15522 !! html/parsoid
15523 <div title="{}">Foo</div>
15524 !! end
15525
15526 !! test
15527 div with empty attribute value, no space before equals
15528 !! options
15529 parsoid=wt2html,html2html
15530 !! wikitext
15531 <div class=>HTML rocks</div>
15532 !! html/php
15533 <div class="">HTML rocks</div>
15534
15535 !! html/parsoid
15536 <div class="">HTML rocks</div>
15537 !! end
15538
15539 !! test
15540 HTML multiple attributes correction
15541 !! wikitext
15542 <p class="error" class="awesome">Awesome!</p>
15543 !! html
15544 <p class="awesome">Awesome!</p>
15545
15546 !!end
15547
15548 !! test
15549 Table multiple attributes correction
15550 !! wikitext
15551 {|
15552 !+ class="error" class="awesome"| status
15553 |}
15554 !! html
15555 <table>
15556 <tr>
15557 <th class="awesome"> status
15558 </th></tr></table>
15559
15560 !!end
15561
15562 !! test
15563 DIV IN UPPERCASE
15564 !! wikitext
15565 <DIV ID="x">HTML ROCKS</DIV>
15566 !! html
15567 <div id="x">HTML ROCKS</div>
15568
15569 !!end
15570
15571 !! test
15572 Non-ASCII pseudo-tags are rendered as text
15573 !! wikitext
15574 <khyô>
15575 !! html
15576 <p>&lt;khyô&gt;
15577 </p>
15578 !! end
15579
15580 !! test
15581 Pseudo-tag with URL 'name' renders as url link
15582 !! wikitext
15583 <http://example.com/>
15584 !! html
15585 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15586 </p>
15587 !! end
15588
15589 !! test
15590 text with amp in the middle of nowhere
15591 !! wikitext
15592 Remember AT&T?
15593 !! html
15594 <p>Remember AT&amp;T?
15595 </p>
15596 !! end
15597
15598 !! test
15599 text with character entity: eacute
15600 !! wikitext
15601 I always thought &eacute; was a cute letter.
15602 !! html
15603 <p>I always thought &#233; was a cute letter.
15604 </p>
15605 !! html+tidy
15606 <p>I always thought é was a cute letter.</p>
15607 !! end
15608
15609 !! test
15610 text with entity-escaped character entity-like string: eacute
15611 !! wikitext
15612 I always thought &amp;eacute; was a cute letter.
15613 !! html
15614 <p>I always thought &amp;eacute; was a cute letter.
15615 </p>
15616 !! end
15617
15618 !! test
15619 text with undefined character entity: xacute
15620 !! wikitext
15621 I always thought &xacute; was a cute letter.
15622 !! html
15623 <p>I always thought &amp;xacute; was a cute letter.
15624 </p>
15625 !! end
15626
15627 !! test
15628 HTML5 tags
15629 !! wikitext
15630 <data value="5">five</data>
15631 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15632 <mark>This highlighted text</mark>
15633 !! html
15634 <p><data value="5">five</data>
15635 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15636 <mark>This highlighted text</mark>
15637 </p>
15638 !! end
15639
15640 !! test
15641 HTML tag with leading space is parsed as text
15642 !! wikitext
15643 < div>foo< /div>
15644 !! html
15645 <p>&lt; div&gt;foo&lt; /div&gt;
15646 </p>
15647 !! end
15648
15649 ###
15650 ### Nesting tests (see bug 41545, 50604, 51081)
15651 ###
15652
15653 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15654 # Note that html2wt is considerably more difficult if we use <b> in
15655 # the test case, instead of <big>
15656 !! test
15657 Ensure that HTML adoption agency algorithm is properly implemented.
15658 !! wikitext
15659 <big>X<big>Y</big>Z</big>
15660 !! html
15661 <p><big>X<big>Y</big>Z</big>
15662 </p>
15663 !! end
15664
15665 # This was bug 41545 in the PHP parser.
15666 # Note that tidy doesn't handle this correctly.
15667 !! test
15668 Nesting of <kbd>
15669 !! wikitext
15670 <kbd>X<kbd>Y</kbd>Z</kbd>
15671 !! html
15672 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15673 </p>
15674 !! end
15675
15676 # The following cases were bug 51081 in the PHP parser.
15677 # Note that there are some other nestable tags (b, i, etc) which are
15678 # not covered; see bug 51081 for discussion.
15679
15680 # Note that tidy doesn't handle this correctly.
15681 !! test
15682 Nesting of <em>
15683 !! wikitext
15684 <em>X<em>Y</em>Z</em>
15685 !! html
15686 <p><em>X<em>Y</em>Z</em>
15687 </p>
15688 !! end
15689
15690 # Note that tidy doesn't handle this correctly.
15691 !! test
15692 Nesting of <strong>
15693 !! wikitext
15694 <strong>X<strong>Y</strong>Z</strong>
15695 !! html
15696 <p><strong>X<strong>Y</strong>Z</strong>
15697 </p>
15698 !! end
15699
15700 !! test
15701 Nesting of <q>
15702 !! wikitext
15703 <q>X<q>Y</q>Z</q>
15704 !! html+tidy
15705 <p><q>X<q>Y</q>Z</q></p>
15706 !! end
15707
15708 # Note that tidy doesn't handle this correctly.
15709 !! test
15710 Nesting of <ruby>
15711 !! wikitext
15712 <ruby>X<ruby>Y</ruby>Z</ruby>
15713 !! html
15714 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15715 </p>
15716 !! end
15717
15718 # Note that tidy doesn't handle this correctly.
15719 !! test
15720 Nesting of <bdo>
15721 !! wikitext
15722 <bdo>X<bdo>Y</bdo>Z</bdo>
15723 !! html
15724 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15725 </p>
15726 !! end
15727
15728
15729 ###
15730 ### Media links
15731 ###
15732
15733 !! test
15734 Media link
15735 !! wikitext
15736 [[Media:Foobar.jpg]]
15737 !! html
15738 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15739 </p>
15740 !! end
15741
15742 !! test
15743 Media link with text
15744 !! wikitext
15745 [[Media:Foobar.jpg|A neat file to look at]]
15746 !! html
15747 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15748 </p>
15749 !! end
15750
15751 # FIXME: this is still bad HTML tag nesting
15752 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15753 !! test
15754 Media link with nasty text
15755 !! wikitext
15756 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15757 !! html
15758 <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>
15759
15760 !! html+tidy
15761 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15762 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15763 !! end
15764
15765 !! test
15766 Media link to nonexistent file (bug 1702)
15767 !! wikitext
15768 [[Media:No such.jpg]]
15769 !! html
15770 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15771 </p>
15772 !! end
15773
15774 !! test
15775 Image link to nonexistent file (bug 1850 - good)
15776 !! wikitext
15777 [[File:No_such.jpg]]
15778 !! html/php
15779 <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>
15780 </p>
15781 !! html/parsoid
15782 <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>
15783 !! end
15784
15785 !! test
15786 :Image link to nonexistent file (bug 1850 - bad)
15787 !! wikitext
15788 [[:Image:No such.jpg]]
15789 !! html/php
15790 <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>
15791 </p>
15792 !! html/parsoid
15793 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15794 !! end
15795
15796
15797
15798 !! test
15799 Character reference normalization in link text (bug 1938)
15800 !! wikitext
15801 [[Main Page|this&that]]
15802 !! html
15803 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15804 </p>
15805 !!end
15806
15807 !! article
15808 אַ
15809 !! text
15810 Test for unicode normalization
15811
15812 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15813 !! endarticle
15814
15815 !! test
15816 (bug 19451) Links should refer to the normalized form.
15817 !! wikitext
15818 [[&#xFB2E;]]
15819 [[&#x5d0;&#x5b7;]]
15820 [[&#x5d0;ַ]]
15821 [[א&#x5b7;]]
15822 [[אַ]]
15823 !! html
15824 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15825 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15826 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15827 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15828 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15829 </p>
15830 !! end
15831
15832 !! test
15833 Empty attribute crash test (bug 2067)
15834 !! wikitext
15835 <font color="">foo</font>
15836 !! html
15837 <p><font color="">foo</font>
15838 </p>
15839 !! end
15840
15841 !! test
15842 Empty attribute crash test single-quotes (bug 2067)
15843 !! wikitext
15844 <font color=''>foo</font>
15845 !! html
15846 <p><font color="">foo</font>
15847 </p>
15848 !! end
15849
15850 !! test
15851 Attribute test: equals, then nothing
15852 !! wikitext
15853 <font color=>foo</font>
15854 !! html
15855 <p><font color="">foo</font>
15856 </p>
15857 !! end
15858
15859 !! test
15860 Attribute test: unquoted value
15861 !! wikitext
15862 <font color=x>foo</font>
15863 !! html
15864 <p><font color="x">foo</font>
15865 </p>
15866 !! end
15867
15868 !! test
15869 Attribute test: unquoted but illegal value (hash)
15870 !! wikitext
15871 <font color=#x>foo</font>
15872 !! html
15873 <p><font color="#x">foo</font>
15874 </p>
15875 !! end
15876
15877 # Parsoid does not serialize to empty attribute syntax,
15878 # so wt2wt and html2wt cases are skipped
15879 !! test
15880 Attribute test: no value (T54330)
15881 !! options
15882 parsoid=wt2html,html2html
15883 !! wikitext
15884 <font color>foo</font>
15885 !! html/php
15886 <p><font color="">foo</font>
15887 </p>
15888 !! html/parsoid
15889 <p><font color="">foo</font></p>
15890 !! end
15891
15892 !! test
15893 Bug 2095: link with three closing brackets
15894 !! wikitext
15895 [[Main Page]]]
15896 !! html/php
15897 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15898 </p>
15899 !! html/parsoid
15900 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15901 !! end
15902
15903 !! test
15904 Bug 2095: link with pipe and three closing brackets
15905 !! wikitext
15906 [[Main Page|link]]]
15907 !! html/php
15908 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15909 </p>
15910 !! html/parsoid
15911 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15912 !! end
15913
15914 !! test
15915 Bug 2095: link with pipe and three closing brackets, version 2
15916 !! wikitext
15917 [[Main Page|[http://example.com/]]]
15918 !! html/php
15919 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15920 </p>
15921 !! html/parsoid
15922 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15923 !! end
15924
15925
15926 ###
15927 ### Safety
15928 ###
15929
15930 !! article
15931 Template:Dangerous attribute
15932 !! text
15933 " onmouseover="alert(document.cookie)
15934 !! endarticle
15935
15936 !! article
15937 Template:Dangerous style attribute
15938 !! text
15939 border-size: expression(alert(document.cookie))
15940 !! endarticle
15941
15942 !! article
15943 Template:Div style
15944 !! text
15945 <div style="float: right; {{{1}}}">Magic div</div>
15946 !! endarticle
15947
15948 !! test
15949 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15950 !! wikitext
15951 <div title="{{test}}"></div>
15952 !! html
15953 <div title="This is a test template"></div>
15954
15955 !! end
15956
15957 # Parsoid has enough context to handle this case
15958 !! test
15959 Bug 2304: HTML attribute safety (dangerous template; 2309)
15960 !! wikitext
15961 <div title="{{dangerous attribute}}"></div>
15962 !! html/php
15963 <div title=""></div>
15964
15965 !! html/parsoid
15966 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15967 !! end
15968
15969 !! test
15970 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15971 !! wikitext
15972 <div style="{{dangerous style attribute}}"></div>
15973 !! html
15974 <div style="/* insecure input */"></div>
15975
15976 !! end
15977
15978 !! test
15979 Bug 2304: HTML attribute safety (safe parameter; 2309)
15980 !! wikitext
15981 {{div style|width: 200px}}
15982 !! html
15983 <div style="float: right; width: 200px">Magic div</div>
15984
15985 !! end
15986
15987 !! test
15988 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15989 !! wikitext
15990 {{div style|width: expression(alert(document.cookie))}}
15991 !! html
15992 <div style="/* insecure input */">Magic div</div>
15993
15994 !! end
15995
15996 !! test
15997 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15998 !! wikitext
15999 {{div style|"><script>alert(document.cookie)</script>}}
16000 !! html
16001 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16002
16003 !! end
16004
16005 !! test
16006 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16007 !! wikitext
16008 {{div style|" ><script>alert(document.cookie)</script>}}
16009 !! html
16010 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16011
16012 !! end
16013
16014 !! test
16015 Bug 2304: HTML attribute safety (link)
16016 !! wikitext
16017 <div title="[[Main Page]]"></div>
16018 !! html
16019 <div title="&#91;&#91;Main Page]]"></div>
16020
16021 !! end
16022
16023 !! test
16024 Bug 2304: HTML attribute safety (italics)
16025 !! wikitext
16026 <div title="''foobar''"></div>
16027 !! html
16028 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16029
16030 !! end
16031
16032 !! test
16033 Bug 2304: HTML attribute safety (bold)
16034 !! wikitext
16035 <div title="'''foobar'''"></div>
16036 !! html
16037 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16038
16039 !! end
16040
16041
16042 !! test
16043 Bug 2304: HTML attribute safety (ISBN)
16044 !! wikitext
16045 <div title="ISBN 1234567890"></div>
16046 !! html
16047 <div title="&#73;SBN 1234567890"></div>
16048
16049 !! end
16050
16051 !! test
16052 Bug 2304: HTML attribute safety (RFC)
16053 !! wikitext
16054 <div title="RFC 1234"></div>
16055 !! html
16056 <div title="&#82;FC 1234"></div>
16057
16058 !! end
16059
16060 !! test
16061 Bug 2304: HTML attribute safety (PMID)
16062 !! wikitext
16063 <div title="PMID 1234567890"></div>
16064 !! html
16065 <div title="&#80;MID 1234567890"></div>
16066
16067 !! end
16068
16069 !! test
16070 Bug 2304: HTML attribute safety (web link)
16071 !! wikitext
16072 <div title="http://example.com/"></div>
16073 !! html
16074 <div title="http&#58;//example.com/"></div>
16075
16076 !! end
16077
16078 !! test
16079 Bug 2304: HTML attribute safety (named web link)
16080 !! wikitext
16081 <div title="[http://example.com/ link]"></div>
16082 !! html
16083 <div title="&#91;http&#58;//example.com/ link]"></div>
16084
16085 !! end
16086
16087 !! test
16088 Bug 3244: HTML attribute safety (extension; safe)
16089 !! wikitext
16090 <div style="<nowiki>background:blue</nowiki>"></div>
16091 !! html
16092 <div style="background:blue"></div>
16093
16094 !! end
16095
16096 !! test
16097 Bug 3244: HTML attribute safety (extension; unsafe)
16098 !! wikitext
16099 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16100 !! html
16101 <div style="/* insecure input */"></div>
16102
16103 !! end
16104
16105 # More MSIE fun discovered by Tom Gilder
16106
16107 !! test
16108 MSIE CSS safety test: spurious slash
16109 !! wikitext
16110 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16111 !! html
16112 <div style="/* insecure input */">evil</div>
16113
16114 !! end
16115
16116 !! test
16117 MSIE CSS safety test: hex code
16118 !! wikitext
16119 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16120 !! html
16121 <div style="/* insecure input */">evil</div>
16122
16123 !! end
16124
16125 !! test
16126 MSIE CSS safety test: comment in url
16127 !! wikitext
16128 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16129 !! html
16130 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16131
16132 !! end
16133
16134 !! test
16135 MSIE CSS safety test: comment in expression
16136 !! wikitext
16137 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16138 !! html
16139 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16140
16141 !! end
16142
16143 !! test
16144 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16145 !! wikitext
16146 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16147 !! html
16148 <p style="/* invalid control char */">A</p>
16149
16150 !! end
16151
16152 !! test
16153 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16154 !! wikitext
16155 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16156 <div style="top:EXPRESSION(alert())">B</div>
16157 !! html
16158 <p style="/* insecure input */">A</p>
16159 <div style="/* insecure input */">B</div>
16160
16161 !! end
16162
16163 !! test
16164 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16165 !! wikitext
16166 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16167 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16168 !! html
16169 <div style="/* insecure input */">A</div>
16170 <p style="/* insecure input */">B</p>
16171
16172 !! end
16173
16174 !! test
16175 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16176 !! wikitext
16177 <div style="background-image:url⁽javascript:alert())">A</div>
16178 <div style="background-image:url₍javascript:alert())">B</div>
16179 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16180 !! html
16181 <div style="/* insecure input */">A</div>
16182 <div style="/* insecure input */">B</div>
16183 <p style="/* insecure input */">C</p>
16184
16185 !! end
16186
16187 # FIXME: Parsoid fails to sanitize this! See T58846.
16188 !! test
16189 Opera -o-link CSS
16190 !! wikitext
16191 <div
16192 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;"
16193 style="-o-link:attr(title);-o-link-source:current">X</div>
16194 !! html
16195 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16196
16197 !! end
16198
16199 !! test
16200 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16201 !! wikitext
16202 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16203 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16204 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16205 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16206 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16207 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16208 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16209 !! html
16210 <p style="/* insecure input */">A</p>
16211 <p style="/* insecure input */">B</p>
16212 <p style="/* insecure input */">C</p>
16213 <p style="/* insecure input */">D</p>
16214 <p style="/* insecure input */">E</p>
16215 <p style="/* insecure input */">F</p>
16216 <p style="/* insecure input */">G</p>
16217
16218 !! end
16219
16220 !! test
16221 Table attribute legitimate extension
16222 !! wikitext
16223 {|
16224 !+ style="<nowiki>color:blue</nowiki>"| status
16225 |}
16226 !! html
16227 <table>
16228 <tr>
16229 <th style="color:blue"> status
16230 </th></tr></table>
16231
16232 !!end
16233
16234 !! test
16235 Table attribute safety
16236 !! wikitext
16237 {|
16238 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16239 |}
16240 !! html
16241 <table>
16242 <tr>
16243 <th style="/* insecure input */"> status
16244 </th></tr></table>
16245
16246 !! end
16247
16248 !! test
16249 CSS line continuation 1
16250 !! wikitext
16251 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16252 !! html
16253 <div style="/* insecure input */"></div>
16254
16255 !! end
16256
16257 !! test
16258 CSS line continuation 2
16259 !! wikitext
16260 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16261 !! html
16262 <div style="/* invalid control char */"></div>
16263
16264 !! end
16265
16266 !! article
16267 Template:Identity
16268 !! text
16269 {{{1}}}
16270 !! endarticle
16271
16272 !! test
16273 Expansion of multi-line templates in attribute values (bug 6255)
16274 !! wikitext
16275 <div style="background: {{identity|#00FF00}}">-</div>
16276 !! html
16277 <div style="background: #00FF00">-</div>
16278
16279 !! end
16280
16281
16282 !! test
16283 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16284 !! wikitext
16285 <div style="background:
16286 #00FF00">-</div>
16287 !! html/php
16288 <div style="background: #00FF00">-</div>
16289
16290 !! html/parsoid
16291 <div style="background:
16292 #00FF00">-</div>
16293 !! end
16294
16295 !! test
16296 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16297 !! wikitext
16298 <div style="background: &#10;#00FF00">-</div>
16299 !! html
16300 <div style="background: &#10;#00FF00">-</div>
16301
16302 !! end
16303
16304 !! test
16305 evil <math>-wiki-tags without Extension:Math enabled
16306 !! wikitext
16307 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16308 !! html+tidy
16309 <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>
16310 !! end
16311
16312 ###
16313 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16314 ###
16315 !! test
16316 Parser hook: empty input
16317 !! wikitext
16318 <tag></tag>
16319 !! html/php
16320 <pre>
16321 ''
16322 array (
16323 )
16324 </pre>
16325
16326 !! html/parsoid
16327 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16328 !! end
16329
16330 ## Don't expect parsoid to rt this form.
16331 !! test
16332 Parser hook: empty input using terminated empty elements
16333 !! options
16334 parsoid=wt2html,html2html
16335 !! wikitext
16336 <tag/>
16337 !! html/php
16338 <pre>
16339 NULL
16340 array (
16341 )
16342 </pre>
16343
16344 !! html/parsoid
16345 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16346 !! end
16347
16348 !! test
16349 Parser hook: empty input using terminated empty elements (space before)
16350 !! wikitext
16351 <tag />
16352 !! html/php
16353 <pre>
16354 NULL
16355 array (
16356 )
16357 </pre>
16358
16359 !! html/parsoid
16360 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16361 !! end
16362
16363 !! test
16364 Parser hook: basic input
16365 !! wikitext
16366 <tag>input</tag>
16367 !! html/php
16368 <pre>
16369 'input'
16370 array (
16371 )
16372 </pre>
16373
16374 !! html/parsoid
16375 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16376 !! end
16377
16378 ## Don't expect parsoid to rt this form.
16379 !! test
16380 Parser hook: case insensitive
16381 !! options
16382 parsoid=wt2html,html2html
16383 !! wikitext
16384 <TAG>input</TAG>
16385 !! html/php
16386 <pre>
16387 'input'
16388 array (
16389 )
16390 </pre>
16391
16392 !! html/parsoid
16393 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16394 !! end
16395
16396 ## Don't expect parsoid to rt this form.
16397 !! test
16398 Parser hook: case insensitive, redux
16399 !! options
16400 parsoid=wt2html,html2html
16401 !! wikitext
16402 <TaG>input</TAg>
16403 !! html/php
16404 <pre>
16405 'input'
16406 array (
16407 )
16408 </pre>
16409
16410 !! html/parsoid
16411 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16412 !! end
16413
16414 !! test
16415 Parser hook: nested tags
16416 !! wikitext
16417 <tag><tag></tag></tag>
16418 !! html/php
16419 <pre>
16420 '<tag>'
16421 array (
16422 )
16423 </pre>&lt;/tag&gt;
16424
16425 !! html/parsoid
16426 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16427 !! end
16428
16429 !! test
16430 Parser hook: basic arguments
16431 !! wikitext
16432 <tag width="200" height="100" depth="50" square=""></tag>
16433 !! html/php
16434 <pre>
16435 ''
16436 array (
16437 'width' => '200',
16438 'height' => '100',
16439 'depth' => '50',
16440 'square' => '',
16441 )
16442 </pre>
16443
16444 !! html/parsoid
16445 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16446 !! end
16447
16448 ## Don't expect parsoid to rt this form.
16449 !! test
16450 Parser hook: basic arguments, variations
16451 !! options
16452 parsoid=wt2html,html2html
16453 !! wikitext
16454 <tag width=200 height = "100" depth = '50' square></tag>
16455 !! html/php
16456 <pre>
16457 ''
16458 array (
16459 'width' => '200',
16460 'height' => '100',
16461 'depth' => '50',
16462 'square' => '',
16463 )
16464 </pre>
16465
16466 !! html/parsoid
16467 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16468 !! end
16469
16470 !! test
16471 Parser hook: argument containing a forward slash (bug 5344)
16472 !! wikitext
16473 <tag filename="/tmp/bla"></tag>
16474 !! html/php
16475 <pre>
16476 ''
16477 array (
16478 'filename' => '/tmp/bla',
16479 )
16480 </pre>
16481
16482 !! html/parsoid
16483 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16484 !! end
16485
16486 ## Don't expect parsoid to rt this form.
16487 !! test
16488 Parser hook: empty input using terminated empty elements (bug 2374)
16489 !! options
16490 parsoid=wt2html,html2html
16491 !! wikitext
16492 <tag foo=bar/>text
16493 !! html/php
16494 <pre>
16495 NULL
16496 array (
16497 'foo' => 'bar',
16498 )
16499 </pre>text
16500
16501 !! html/parsoid
16502 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16503 !! end
16504
16505 # </tag> should be output literally since there is no matching tag that begins it
16506 !! test
16507 Parser hook: basic arguments using terminated empty elements (bug 2374)
16508 !! wikitext
16509 <tag width=200 height = "100" depth = '50' square/>
16510 other stuff
16511 </tag>
16512 !! html/php
16513 <pre>
16514 NULL
16515 array (
16516 'width' => '200',
16517 'height' => '100',
16518 'depth' => '50',
16519 'square' => '',
16520 )
16521 </pre>
16522 <p>other stuff
16523 &lt;/tag&gt;
16524 </p>
16525 !! end
16526
16527 ###
16528 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16529 ###
16530
16531 !! test
16532 Parser hook: static parser hook not inside a comment
16533 !! wikitext
16534 <statictag>hello, world</statictag>
16535
16536 <statictag action="flush" />
16537 !! html/php
16538 <p><br />
16539 hello, world
16540 </p>
16541 !! html/parsoid
16542 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16543 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16544 !! end
16545
16546 !! test
16547 Parser hook: static parser hook inside a comment
16548 !! wikitext
16549 <!-- <statictag>hello, world</statictag> -->
16550 <statictag action="flush" />
16551 !! html/php
16552 <p><br />
16553 </p>
16554 !! html/parsoid
16555 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16556 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16557 !! end
16558
16559 # Nested template calls; this case was broken by Parser.php rev 1.506,
16560 # since reverted.
16561
16562 !! article
16563 Template:One-parameter
16564 !! text
16565 (My parameter is: {{{1}}})
16566 !! endarticle
16567
16568 !! article
16569 Template:Map-one-parameter
16570 !! text
16571 {{{{{1}}}|{{{2}}}}}
16572 !! endarticle
16573
16574 !! test
16575 Nested template calls
16576 !! wikitext
16577 {{Map-one-parameter|One-parameter|param}}
16578 !! html
16579 <p>(My parameter is: param)
16580 </p>
16581 !! end
16582
16583
16584 ###
16585 ### Sanitizer
16586 ###
16587
16588 # HTML+Tidy effectively strips out the empty tags completely
16589 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16590 # which Tidy would have done for the PHP parser had there been content inside it.
16591 !! test
16592 Sanitizer: Closing of open tags
16593 !! wikitext
16594 <s></s><table></table>
16595 !! html
16596 <s></s><table></table>
16597
16598 !! html/parsoid
16599 <p><s></s></p><table></table>
16600 !! end
16601
16602 !! test
16603 Sanitizer: Closing of open but not closed tags
16604 !! wikitext
16605 <s>foo
16606 !! html
16607 <p><s>foo</s>
16608 </p>
16609 !! end
16610
16611 !! test
16612 Sanitizer: Closing of closed but not open tags
16613 !! options
16614 parsoid=wt2html
16615 !! wikitext
16616 </s>
16617 !! html/php+tidy
16618 !! html/parsoid
16619 !! end
16620
16621 !! test
16622 Sanitizer: Closing of closed but not open table tags
16623 !! options
16624 parsoid=wt2html
16625 !! wikitext
16626 Table not started</td></tr></table>
16627 !! html/php+tidy
16628 <p>Table not started</p>
16629 !! html/parsoid
16630 <p>Table not started</p>
16631 !! end
16632
16633 !! test
16634 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16635 !! wikitext
16636 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16637 !! html
16638 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16639 </p>
16640 !! end
16641
16642 # In HTML5, the restrictions are that id must contain at least one character,
16643 # and must not contain any space characters.
16644 !! test
16645 Sanitizer: Validating the contents of the id attribute (bug 4515)
16646 !! options
16647 disabled
16648 !! wikitext
16649 <br id="" /><br id="a space" />
16650 !! html
16651 Something ...
16652 !! end
16653
16654 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16655 !! test
16656 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16657 !! options
16658 disabled
16659 !! wikitext
16660 <br id="foo" /><br id="foo" />
16661 !! html
16662 Something need to be done. foo-2 ?
16663 !! end
16664
16665 !! test
16666 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16667 !! wikitext
16668 <div itemscope>
16669 <meta itemprop="hello" content="world">
16670 <meta http-equiv="refresh" content="5">
16671 <meta itemprop="hello" http-equiv="refresh" content="5">
16672 <link itemprop="hello" href="{{SERVER}}">
16673 <link rel="stylesheet" href="{{SERVER}}">
16674 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16675 </div>
16676 !! html
16677 <div itemscope="">
16678 <p> <meta itemprop="hello" content="world" />
16679 &lt;meta http-equiv="refresh" content="5"&gt;
16680 <meta itemprop="hello" content="5" />
16681 </p>
16682 <link itemprop="hello" href="http&#58;//example.org" />
16683 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16684 <link itemprop="hello" href="http&#58;//example.org" />
16685 </div>
16686
16687 !! end
16688
16689 !! test
16690 Language converter: output gets cut off unexpectedly (bug 5757)
16691 !! options
16692 language=zh
16693 !! wikitext
16694 this bit is safe: }-
16695
16696 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16697
16698 then we get cut off here: }-
16699
16700 all additional text is vanished
16701 !! html
16702 <p>this bit is safe: }-
16703 </p><p>but if we add a conversion instance: xxx
16704 </p><p>then we get cut off here: }-
16705 </p><p>all additional text is vanished
16706 </p>
16707 !! end
16708
16709 !! test
16710 Self closed html pairs (bug 5487)
16711 !! options
16712 !! wikitext
16713 <center><font id="bug" />Centered text</center>
16714 <div><font id="bug2" />In div text</div>
16715 !! html
16716 <center>&lt;font id="bug" /&gt;Centered text</center>
16717 <div>&lt;font id="bug2" /&gt;In div text</div>
16718
16719 !! end
16720
16721 #
16722 #
16723 #
16724
16725 !! test
16726 Punctuation: nbsp before exclamation
16727 !! wikitext
16728 C'est grave !
16729 !! html
16730 <p>C'est grave&#160;!
16731 </p>
16732 !! end
16733
16734 !! test
16735 Punctuation: CSS !important (bug 11874)
16736 !! wikitext
16737 <div style="width:50% !important">important</div>
16738 !! html
16739 <div style="width:50% !important">important</div>
16740
16741 !!end
16742
16743 !! test
16744 Punctuation: CSS ! important (bug 11874; with space after)
16745 !! wikitext
16746 <div style="width:50% ! important">important</div>
16747 !! html
16748 <div style="width:50% ! important">important</div>
16749
16750 !!end
16751
16752 !! test
16753 HTML bullet list, closed tags (bug 5497)
16754 !! wikitext
16755 <ul>
16756 <li>One</li>
16757 <li>Two</li>
16758 </ul>
16759 !! html/php
16760 <ul>
16761 <li>One</li>
16762 <li>Two</li>
16763 </ul>
16764
16765 !! html/parsoid
16766 <ul data-parsoid='{"stx":"html"}'>
16767 <li data-parsoid='{"stx":"html"}'>One</li>
16768 <li data-parsoid='{"stx":"html"}'>Two</li>
16769 </ul>
16770
16771 !! end
16772
16773 !! test
16774 HTML bullet list, unclosed tags (bug 5497)
16775 !! wikitext
16776 <ul>
16777 <li>One
16778 <li>Two
16779 </ul>
16780 !! html/php+tidy
16781 <ul>
16782 <li>One</li>
16783 <li>Two</li>
16784 </ul>
16785 !! html/parsoid
16786 <ul data-parsoid='{"stx":"html"}'>
16787 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16788 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16789 </ul>
16790
16791 !! end
16792
16793 !! test
16794 HTML ordered list, closed tags (bug 5497)
16795 !! wikitext
16796 <ol>
16797 <li>One</li>
16798 <li>Two</li>
16799 </ol>
16800 !! html/php
16801 <ol>
16802 <li>One</li>
16803 <li>Two</li>
16804 </ol>
16805
16806 !! html/parsoid
16807 <ol data-parsoid='{"stx":"html"}'>
16808 <li data-parsoid='{"stx":"html"}'>One</li>
16809 <li data-parsoid='{"stx":"html"}'>Two</li>
16810 </ol>
16811
16812 !! end
16813
16814 !! test
16815 HTML ordered list, unclosed tags (bug 5497)
16816 !! options
16817 !! wikitext
16818 <ol>
16819 <li>One
16820 <li>Two
16821 </ol>
16822 !! html/php+tidy
16823 <ol>
16824 <li>One</li>
16825 <li>Two</li>
16826 </ol>
16827 !! html/parsoid
16828 <ol data-parsoid='{"stx":"html"}'>
16829 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16830 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16831 </ol>
16832
16833 !! end
16834
16835 !! test
16836 HTML nested bullet list, closed tags (bug 5497)
16837 !! wikitext
16838 <ul>
16839 <li>One</li>
16840 <li>Two:
16841 <ul>
16842 <li>Sub-one</li>
16843 <li>Sub-two</li>
16844 </ul>
16845 </li>
16846 </ul>
16847 !! html
16848 <ul>
16849 <li>One</li>
16850 <li>Two:
16851 <ul>
16852 <li>Sub-one</li>
16853 <li>Sub-two</li>
16854 </ul>
16855 </li>
16856 </ul>
16857
16858 !! end
16859
16860 !! test
16861 HTML nested bullet list, open tags (bug 5497)
16862 !! wikitext
16863 <ul>
16864 <li>One
16865 <li>Two:
16866 <ul>
16867 <li>Sub-one
16868 <li>Sub-two
16869 </ul>
16870 </ul>
16871 !! html/php+tidy
16872 <ul>
16873 <li>One</li>
16874 <li>Two:
16875 <ul>
16876 <li>Sub-one</li>
16877 <li>Sub-two</li>
16878 </ul>
16879 </li>
16880 </ul>
16881 !! html/parsoid
16882 <ul>
16883 <li>One
16884 </li>
16885 <li>Two:
16886 <ul>
16887 <li>Sub-one
16888 </li>
16889 <li>Sub-two
16890 </li>
16891 </ul>
16892 </li>
16893 </ul>
16894
16895 !! end
16896
16897 !! test
16898 HTML nested ordered list, closed tags (bug 5497)
16899 !! wikitext
16900 <ol>
16901 <li>One</li>
16902 <li>Two:
16903 <ol>
16904 <li>Sub-one</li>
16905 <li>Sub-two</li>
16906 </ol>
16907 </li>
16908 </ol>
16909 !! html
16910 <ol>
16911 <li>One</li>
16912 <li>Two:
16913 <ol>
16914 <li>Sub-one</li>
16915 <li>Sub-two</li>
16916 </ol>
16917 </li>
16918 </ol>
16919
16920 !! end
16921
16922 !! test
16923 HTML nested ordered list, open tags (bug 5497)
16924 !! wikitext
16925 <ol>
16926 <li>One
16927 <li>Two:
16928 <ol>
16929 <li>Sub-one
16930 <li>Sub-two
16931 </ol>
16932 </ol>
16933 !! html/php
16934 <ol>
16935 <li>One
16936 <li>Two:
16937 <ol>
16938 <li>Sub-one
16939 <li>Sub-two
16940 </ol>
16941 </ol>
16942
16943 !! html/parsoid
16944 <ol>
16945 <li>One
16946 </li>
16947 <li>Two:
16948 <ol>
16949 <li>Sub-one
16950 </li>
16951 <li>Sub-two
16952 </li>
16953 </ol>
16954 </li>
16955 </ol>
16956
16957 !! end
16958
16959 !! test
16960 HTML ordered list item with parameters oddity
16961 !! wikitext
16962 <ol><li id="fragment">One</li>
16963 </ol>
16964 !! html
16965 <ol><li id="fragment">One</li>
16966 </ol>
16967
16968 !! end
16969
16970 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16971 !!test
16972 bug 5918: autonumbering
16973 !! wikitext
16974 [http://first/] [http://second] [ftp://ftp]
16975
16976 ftp://inlineftp
16977
16978 [mailto:enclosed@mail.tld With target]
16979
16980 [mailto:enclosed@mail.tld]
16981
16982 mailto:inline@mail.tld
16983 !! html/php
16984 <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>
16985 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16986 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16987 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16988 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16989 </p>
16990 !! html/parsoid
16991 <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>
16992 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16993 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16994 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16995 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16996 !! end
16997
16998
16999 #
17000 # Security and HTML correctness
17001 # From Nick Jenkins' fuzz testing
17002 #
17003
17004 !! test
17005 Fuzz testing: Parser13
17006 !! wikitext
17007 {|
17008 | http://a|
17009 !! html
17010 <table>
17011 <tr>
17012 <td>
17013 </td>
17014 </tr>
17015 </table>
17016
17017 !! end
17018
17019 !! test
17020 Fuzz testing: Parser14
17021 !! wikitext
17022 == onmouseover= ==
17023 http://__TOC__
17024 !! html
17025 <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>
17026 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17027 <ul>
17028 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17029 </ul>
17030 </div>
17031
17032
17033 !! html+tidy
17034 <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>
17035 <p>http://</p>
17036 <div id="toc" class="toc">
17037 <div id="toctitle">
17038 <h2>Contents</h2>
17039 </div>
17040 <ul>
17041 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17042 </ul>
17043 </div>
17044 <p></p>
17045 !! end
17046
17047 !! test
17048 Fuzz testing: Parser14-table
17049 !! wikitext
17050 ==a==
17051 {| STYLE=__TOC__
17052 !! html
17053 <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>
17054 <table style="&#95;_TOC&#95;_">
17055 <tr><td></td></tr>
17056 </table>
17057
17058 !! html+tidy
17059 <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>
17060 <table style="__TOC__">
17061 <tr>
17062 <td></td>
17063 </tr>
17064 </table>
17065 !! end
17066
17067 # Known to produce bogus xml (extra </td>)
17068 !! test
17069 Fuzz testing: Parser16
17070 !! wikitext
17071 {|
17072 !https://||||||
17073 !! html
17074 <table>
17075 <tr>
17076 <th>https://</th>
17077 <th></th>
17078 <th></th>
17079 <th>
17080 </td>
17081 </tr>
17082 </table>
17083
17084 !! html+tidy
17085 <table>
17086 <tr>
17087 <th>https://</th>
17088 <th></th>
17089 <th></th>
17090 <th></th>
17091 </tr>
17092 </table>
17093 !! end
17094
17095 !! test
17096 Fuzz testing: Parser21
17097 !! wikitext
17098 {|
17099 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17100 |
17101 !! html
17102 <table>
17103 <tr>
17104 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17105 </th>
17106 <td>
17107 </td>
17108 </tr>
17109 </table>
17110
17111 !! end
17112
17113 !! test
17114 Fuzz testing: Parser22
17115 !! wikitext
17116 http://===r:::https://b
17117
17118 {|
17119 !! html
17120 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17121 </p>
17122 <table>
17123 <tr><td></td></tr>
17124 </table>
17125
17126 !! end
17127
17128 # Known to produce bad XML for now
17129 !! test
17130 Fuzz testing: Parser24
17131 !! wikitext
17132 {|
17133 {{{|
17134 <u CLASS=
17135 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17136 <br style="onmouseover='alert(document.cookie);' " />
17137
17138 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17139 |
17140 !! html
17141 <table>
17142 {{{|
17143 <u class="&#124;">}}}} &gt;
17144 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17145
17146 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17147 <tr>
17148 <td></u>
17149 </td>
17150 </tr>
17151 </table>
17152
17153 !! end
17154
17155 # Note: the current result listed for this is not what the original one was,
17156 # but the original bug was JavaScript injection, which is fixed in any case.
17157 # It's not clear that the original result listed was any more correct than the
17158 # current one. Original result:
17159 # <p>{{{|
17160 # </p>
17161 # <li class="&#124;&#124;">
17162 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17163 !!test
17164 Fuzz testing: Parser25 (bug 6055)
17165 !! wikitext
17166 {{{
17167 |
17168 <LI CLASS=||
17169 >
17170 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17171 !! html
17172 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17173 </p>
17174 !! end
17175
17176 !!test
17177 Fuzz testing: URL adjacent extension (with space, clean)
17178 !! wikitext
17179 http://example.com <nowiki>junk</nowiki>
17180 !! html/php
17181 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17182 </p>
17183 !! html/parsoid
17184 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17185 !! end
17186
17187 !!test
17188 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17189 !! wikitext
17190 http://example.com<nowiki>junk</nowiki>
17191 !! html/php
17192 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17193 </p>
17194 !! html/parsoid
17195 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17196 !! end
17197
17198 !!test
17199 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17200 !! wikitext
17201 http://example.com<pre>junk</pre>
17202 !! html/php
17203 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17204
17205 !! html/php+tidy
17206 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17207 <pre>
17208 junk
17209 </pre>
17210 !! html/parsoid
17211 <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>
17212 !!end
17213
17214 !!test
17215 Fuzz testing: image with bogus manual thumbnail
17216 !! wikitext
17217 [[Image:foobar.jpg|thumbnail= ]]
17218 !! html/php
17219 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17220
17221 !! html/parsoid
17222 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17223 !!end
17224
17225 !! test
17226 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17227 !! wikitext
17228 <pre dir="&#10;"></pre>
17229 !! html
17230 <pre dir="&#10;"></pre>
17231
17232 !! end
17233
17234 !! test
17235 Parsing optional HTML elements (Bug 6171)
17236 !! options
17237 !! wikitext
17238 <table>
17239 <tr>
17240 <td> Some tabular data</td>
17241 <td> More tabular data ...
17242 <td> And yet som tabular data</td>
17243 </tr>
17244 </table>
17245 !! html
17246 <table>
17247 <tr>
17248 <td> Some tabular data</td>
17249 <td> More tabular data ...
17250 </td><td> And yet som tabular data</td>
17251 </tr>
17252 </table>
17253
17254 !! end
17255
17256 !! test
17257 Correct handling of <td>, <tr> (Bug 6171)
17258 !! options
17259 !! wikitext
17260 <table>
17261 <tr>
17262 <td> Some tabular data</td>
17263 <td> More tabular data ...</td>
17264 <td> And yet som tabular data</td>
17265 </tr>
17266 </table>
17267 !! html
17268 <table>
17269 <tr>
17270 <td> Some tabular data</td>
17271 <td> More tabular data ...</td>
17272 <td> And yet som tabular data</td>
17273 </tr>
17274 </table>
17275
17276 !! end
17277
17278
17279 !! test
17280 Parsing crashing regression (fr:JavaScript)
17281 !! wikitext
17282 </body></x>
17283 !! html
17284 <p>&lt;/body&gt;&lt;/x&gt;
17285 </p>
17286 !! end
17287
17288 !! test
17289 Inline wiki vs wiki block nesting
17290 !! wikitext
17291 '''Bold paragraph
17292
17293 New wiki paragraph
17294 !! html
17295 <p><b>Bold paragraph</b>
17296 </p><p>New wiki paragraph
17297 </p>
17298 !! end
17299
17300 # FIXME: The current php output is documented
17301 # and desired output is the parsoid target.
17302 !! test
17303 Inline HTML vs wiki block nesting
17304 !! wikitext
17305 <b>Bold paragraph
17306
17307 New wiki paragraph
17308 !! html/php
17309 <p><b>Bold paragraph
17310 </p><p>New wiki paragraph</b>
17311 </p>
17312 !! html/parsoid
17313 <p><b>Bold paragraph</b>
17314 </p><p>New wiki paragraph
17315 </p>
17316 !! end
17317
17318 # Original result was this:
17319 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17320 # </p>
17321 # While that might be marginally more intuitive, maybe, the six-apostrophe
17322 # construct is clearly pathological and the result stated here (which is what
17323 # the parser actually does) is about as reasonable as anything.
17324 !!test
17325 Mixing markup for italics and bold
17326 !! options
17327 !! wikitext
17328 '''bold''''''bold''bolditalics'''''
17329 !! html
17330 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17331 </p>
17332 !! end
17333
17334
17335 !! article
17336 Xyzzyx
17337 !! text
17338 Article for special page transclusion test
17339 !! endarticle
17340
17341 !! test
17342 Special page transclusion
17343 !! options
17344 !! wikitext
17345 {{Special:Prefixindex/Xyzzyx}}
17346 !! html
17347 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17348 </ul>
17349
17350 !! end
17351
17352 !! test
17353 Special page transclusion twice (bug 5021)
17354 !! options
17355 !! wikitext
17356 {{Special:Prefixindex/Xyzzyx}}
17357 {{Special:Prefixindex/Xyzzyx}}
17358 !! html
17359 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17360 </ul>
17361 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17362 </ul>
17363
17364 !! end
17365
17366 !! test
17367 Transclusion of default MediaWiki message
17368 !! wikitext
17369 {{MediaWiki:Mainpage}}
17370 !! html
17371 <p>Main Page
17372 </p>
17373 !! end
17374
17375 !! test
17376 Transclusion of nonexistent MediaWiki message
17377 !! wikitext
17378 {{MediaWiki:Mainpagexxx}}
17379 !! html
17380 <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>
17381 </p>
17382 !! end
17383
17384 !! test
17385 Transclusion of MediaWiki message with underscore
17386 !! wikitext
17387 {{MediaWiki:history_short}}
17388 !! html
17389 <p>History
17390 </p>
17391 !! end
17392
17393 !! test
17394 Transclusion of MediaWiki message with space
17395 !! wikitext
17396 {{MediaWiki:history short}}
17397 !! html
17398 <p>History
17399 </p>
17400 !! end
17401
17402 !! test
17403 Invalid header with following text
17404 !! wikitext
17405 = x = y
17406 !! html
17407 <p>= x = y
17408 </p>
17409 !! end
17410
17411
17412 !! test
17413 Section extraction test (section 0)
17414 !! options
17415 section=0
17416 !! wikitext
17417 start
17418 ==a==
17419 ===aa===
17420 ====aaa====
17421 ==b==
17422 ===ba===
17423 ===bb===
17424 ====bba====
17425 ===bc===
17426 ==c==
17427 ===ca===
17428 !! html/php
17429 start
17430 !! end
17431
17432 !! test
17433 Section extraction test (section 1)
17434 !! options
17435 section=1
17436 !! wikitext
17437 start
17438 ==a==
17439 ===aa===
17440 ====aaa====
17441 ==b==
17442 ===ba===
17443 ===bb===
17444 ====bba====
17445 ===bc===
17446 ==c==
17447 ===ca===
17448 !! html/php
17449 ==a==
17450 ===aa===
17451 ====aaa====
17452 !! end
17453
17454 !! test
17455 Section extraction test (section 2)
17456 !! options
17457 section=2
17458 !! wikitext
17459 start
17460 ==a==
17461 ===aa===
17462 ====aaa====
17463 ==b==
17464 ===ba===
17465 ===bb===
17466 ====bba====
17467 ===bc===
17468 ==c==
17469 ===ca===
17470 !! html/php
17471 ===aa===
17472 ====aaa====
17473 !! end
17474
17475 !! test
17476 Section extraction test (section 3)
17477 !! options
17478 section=3
17479 !! wikitext
17480 start
17481 ==a==
17482 ===aa===
17483 ====aaa====
17484 ==b==
17485 ===ba===
17486 ===bb===
17487 ====bba====
17488 ===bc===
17489 ==c==
17490 ===ca===
17491 !! html/php
17492 ====aaa====
17493 !! end
17494
17495 !! test
17496 Section extraction test (section 4)
17497 !! options
17498 section=4
17499 !! wikitext
17500 start
17501 ==a==
17502 ===aa===
17503 ====aaa====
17504 ==b==
17505 ===ba===
17506 ===bb===
17507 ====bba====
17508 ===bc===
17509 ==c==
17510 ===ca===
17511 !! html/php
17512 ==b==
17513 ===ba===
17514 ===bb===
17515 ====bba====
17516 ===bc===
17517 !! end
17518
17519 !! test
17520 Section extraction test (section 5)
17521 !! options
17522 section=5
17523 !! wikitext
17524 start
17525 ==a==
17526 ===aa===
17527 ====aaa====
17528 ==b==
17529 ===ba===
17530 ===bb===
17531 ====bba====
17532 ===bc===
17533 ==c==
17534 ===ca===
17535 !! html/php
17536 ===ba===
17537 !! end
17538
17539 !! test
17540 Section extraction test (section 6)
17541 !! options
17542 section=6
17543 !! wikitext
17544 start
17545 ==a==
17546 ===aa===
17547 ====aaa====
17548 ==b==
17549 ===ba===
17550 ===bb===
17551 ====bba====
17552 ===bc===
17553 ==c==
17554 ===ca===
17555 !! html/php
17556 ===bb===
17557 ====bba====
17558 !! end
17559
17560 !! test
17561 Section extraction test (section 7)
17562 !! options
17563 section=7
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 ====bba====
17578 !! end
17579
17580 !! test
17581 Section extraction test (section 8)
17582 !! options
17583 section=8
17584 !! wikitext
17585 start
17586 ==a==
17587 ===aa===
17588 ====aaa====
17589 ==b==
17590 ===ba===
17591 ===bb===
17592 ====bba====
17593 ===bc===
17594 ==c==
17595 ===ca===
17596 !! html/php
17597 ===bc===
17598 !! end
17599
17600 !! test
17601 Section extraction test (section 9)
17602 !! options
17603 section=9
17604 !! wikitext
17605 start
17606 ==a==
17607 ===aa===
17608 ====aaa====
17609 ==b==
17610 ===ba===
17611 ===bb===
17612 ====bba====
17613 ===bc===
17614 ==c==
17615 ===ca===
17616 !! html/php
17617 ==c==
17618 ===ca===
17619 !! end
17620
17621 !! test
17622 Section extraction test (section 10)
17623 !! options
17624 section=10
17625 !! wikitext
17626 start
17627 ==a==
17628 ===aa===
17629 ====aaa====
17630 ==b==
17631 ===ba===
17632 ===bb===
17633 ====bba====
17634 ===bc===
17635 ==c==
17636 ===ca===
17637 !! html/php
17638 ===ca===
17639 !! end
17640
17641 !! test
17642 Section extraction test (nonexistent section 11)
17643 !! options
17644 section=11
17645 !! wikitext
17646 start
17647 ==a==
17648 ===aa===
17649 ====aaa====
17650 ==b==
17651 ===ba===
17652 ===bb===
17653 ====bba====
17654 ===bc===
17655 ==c==
17656 ===ca===
17657 !! html/php
17658 !! end
17659
17660 !! test
17661 Section extraction test with bogus heading (section 1)
17662 !! options
17663 section=1
17664 !! wikitext
17665 ==a==
17666 ==bogus== not a legal section
17667 ==b==
17668 !! html/php
17669 ==a==
17670 ==bogus== not a legal section
17671 !! end
17672
17673 !! test
17674 Section extraction test with bogus heading (section 2)
17675 !! options
17676 section=2
17677 !! wikitext
17678 ==a==
17679 ==bogus== not a legal section
17680 ==b==
17681 !! html/php
17682 ==b==
17683 !! end
17684
17685 !! test
17686 Section extraction test with comment after heading (section 1)
17687 !! options
17688 section=1
17689 !! wikitext
17690 ==a==
17691 ==b== <!-- -->
17692 ==c==
17693 !! html/php
17694 ==a==
17695 !! end
17696
17697 !! test
17698 Section extraction test with comment after heading (section 2)
17699 !! options
17700 section=2
17701 !! wikitext
17702 ==a==
17703 ==b== <!-- -->
17704 ==c==
17705 !! html/php
17706 ==b== <!-- -->
17707 !! end
17708
17709 !! test
17710 Section extraction test with bogus <nowiki> heading (section 1)
17711 !! options
17712 section=1
17713 !! wikitext
17714 ==a==
17715 ==bogus== <nowiki>not a legal section</nowiki>
17716 ==b==
17717 !! html/php
17718 ==a==
17719 ==bogus== <nowiki>not a legal section</nowiki>
17720 !! end
17721
17722 !! test
17723 Section extraction test with bogus <nowiki> heading (section 2)
17724 !! options
17725 section=2
17726 !! wikitext
17727 ==a==
17728 ==bogus== <nowiki>not a legal section</nowiki>
17729 ==b==
17730 !! html/php
17731 ==b==
17732 !! end
17733
17734 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17735 # instead of respecting commented sections
17736 !! test
17737 Section extraction prefixed by comment (section 1)
17738 !! options
17739 section=1
17740 !! wikitext
17741 <!-- -->==sec1==
17742 ==sec2==
17743 !! html/php
17744 ==sec2==
17745 !!end
17746
17747 !! test
17748 Section extraction prefixed by comment (section 2)
17749 !! options
17750 section=2
17751 !! wikitext
17752 <!-- -->==sec1==
17753 ==sec2==
17754 !! html/php
17755
17756 !!end
17757
17758 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17759 # instead of respecting HTML-style headings
17760 !! test
17761 Section extraction, mixed wiki and html (section 1)
17762 !! options
17763 section=1
17764 !! wikitext
17765 <h2>unmarked</h2>
17766 unmarked
17767 ==1==
17768 one
17769 ==2==
17770 two
17771 !! html/php
17772 ==1==
17773 one
17774 !! end
17775
17776 !! test
17777 Section extraction, mixed wiki and html (section 2)
17778 !! options
17779 section=2
17780 !! wikitext
17781 <h2>unmarked</h2>
17782 unmarked
17783 ==1==
17784 one
17785 ==2==
17786 two
17787 !! html/php
17788 ==2==
17789 two
17790 !! end
17791
17792
17793 # Formerly testing for bug 3342
17794 !! test
17795 Section extraction, heading surrounded by <noinclude>
17796 !! options
17797 section=1
17798 !! wikitext
17799 <noinclude>==unmarked==</noinclude>
17800 ==marked==
17801 !! html/php
17802 ==marked==
17803 !!end
17804
17805 # Test behavior of bug 19910
17806 !! test
17807 Sectiion with all-equals
17808 !! options
17809 section=2
17810 !! wikitext
17811 ===
17812 The line above must have a trailing space
17813 === <!--
17814 --> <!-- -->
17815 But just in case it doesn't...
17816 !! html/php
17817 === <!--
17818 --> <!-- -->
17819 But just in case it doesn't...
17820 !! end
17821
17822 !! test
17823 Section replacement test (section 0)
17824 !! options
17825 replace=0,"xxx"
17826 !! wikitext
17827 start
17828 ==a==
17829 ===aa===
17830 ====aaa====
17831 ==b==
17832 ===ba===
17833 ===bb===
17834 ====bba====
17835 ===bc===
17836 ==c==
17837 ===ca===
17838 !! html/php
17839 xxx
17840
17841 ==a==
17842 ===aa===
17843 ====aaa====
17844 ==b==
17845 ===ba===
17846 ===bb===
17847 ====bba====
17848 ===bc===
17849 ==c==
17850 ===ca===
17851 !! end
17852
17853 !! test
17854 Section replacement test (section 1)
17855 !! options
17856 replace=1,"xxx"
17857 !! wikitext
17858 start
17859 ==a==
17860 ===aa===
17861 ====aaa====
17862 ==b==
17863 ===ba===
17864 ===bb===
17865 ====bba====
17866 ===bc===
17867 ==c==
17868 ===ca===
17869 !! html/php
17870 start
17871 xxx
17872
17873 ==b==
17874 ===ba===
17875 ===bb===
17876 ====bba====
17877 ===bc===
17878 ==c==
17879 ===ca===
17880 !! end
17881
17882 !! test
17883 Section replacement test (section 2)
17884 !! options
17885 replace=2,"xxx"
17886 !! wikitext
17887 start
17888 ==a==
17889 ===aa===
17890 ====aaa====
17891 ==b==
17892 ===ba===
17893 ===bb===
17894 ====bba====
17895 ===bc===
17896 ==c==
17897 ===ca===
17898 !! html/php
17899 start
17900 ==a==
17901 xxx
17902
17903 ==b==
17904 ===ba===
17905 ===bb===
17906 ====bba====
17907 ===bc===
17908 ==c==
17909 ===ca===
17910 !! end
17911
17912 !! test
17913 Section replacement test (section 3)
17914 !! options
17915 replace=3,"xxx"
17916 !! wikitext
17917 start
17918 ==a==
17919 ===aa===
17920 ====aaa====
17921 ==b==
17922 ===ba===
17923 ===bb===
17924 ====bba====
17925 ===bc===
17926 ==c==
17927 ===ca===
17928 !! html/php
17929 start
17930 ==a==
17931 ===aa===
17932 xxx
17933
17934 ==b==
17935 ===ba===
17936 ===bb===
17937 ====bba====
17938 ===bc===
17939 ==c==
17940 ===ca===
17941 !! end
17942
17943 !! test
17944 Section replacement test (section 4)
17945 !! options
17946 replace=4,"xxx"
17947 !! wikitext
17948 start
17949 ==a==
17950 ===aa===
17951 ====aaa====
17952 ==b==
17953 ===ba===
17954 ===bb===
17955 ====bba====
17956 ===bc===
17957 ==c==
17958 ===ca===
17959 !! html/php
17960 start
17961 ==a==
17962 ===aa===
17963 ====aaa====
17964 xxx
17965
17966 ==c==
17967 ===ca===
17968 !! end
17969
17970 !! test
17971 Section replacement test (section 5)
17972 !! options
17973 replace=5,"xxx"
17974 !! wikitext
17975 start
17976 ==a==
17977 ===aa===
17978 ====aaa====
17979 ==b==
17980 ===ba===
17981 ===bb===
17982 ====bba====
17983 ===bc===
17984 ==c==
17985 ===ca===
17986 !! html/php
17987 start
17988 ==a==
17989 ===aa===
17990 ====aaa====
17991 ==b==
17992 xxx
17993
17994 ===bb===
17995 ====bba====
17996 ===bc===
17997 ==c==
17998 ===ca===
17999 !! end
18000
18001 !! test
18002 Section replacement test (section 6)
18003 !! options
18004 replace=6,"xxx"
18005 !! wikitext
18006 start
18007 ==a==
18008 ===aa===
18009 ====aaa====
18010 ==b==
18011 ===ba===
18012 ===bb===
18013 ====bba====
18014 ===bc===
18015 ==c==
18016 ===ca===
18017 !! html/php
18018 start
18019 ==a==
18020 ===aa===
18021 ====aaa====
18022 ==b==
18023 ===ba===
18024 xxx
18025
18026 ===bc===
18027 ==c==
18028 ===ca===
18029 !! end
18030
18031 !! test
18032 Section replacement test (section 7)
18033 !! options
18034 replace=7,"xxx"
18035 !! wikitext
18036 start
18037 ==a==
18038 ===aa===
18039 ====aaa====
18040 ==b==
18041 ===ba===
18042 ===bb===
18043 ====bba====
18044 ===bc===
18045 ==c==
18046 ===ca===
18047 !! html/php
18048 start
18049 ==a==
18050 ===aa===
18051 ====aaa====
18052 ==b==
18053 ===ba===
18054 ===bb===
18055 xxx
18056
18057 ===bc===
18058 ==c==
18059 ===ca===
18060 !! end
18061
18062 !! test
18063 Section replacement test (section 8)
18064 !! options
18065 replace=8,"xxx"
18066 !! wikitext
18067 start
18068 ==a==
18069 ===aa===
18070 ====aaa====
18071 ==b==
18072 ===ba===
18073 ===bb===
18074 ====bba====
18075 ===bc===
18076 ==c==
18077 ===ca===
18078 !! html/php
18079 start
18080 ==a==
18081 ===aa===
18082 ====aaa====
18083 ==b==
18084 ===ba===
18085 ===bb===
18086 ====bba====
18087 xxx
18088
18089 ==c==
18090 ===ca===
18091 !!end
18092
18093 !! test
18094 Section replacement test (section 9)
18095 !! options
18096 replace=9,"xxx"
18097 !! wikitext
18098 start
18099 ==a==
18100 ===aa===
18101 ====aaa====
18102 ==b==
18103 ===ba===
18104 ===bb===
18105 ====bba====
18106 ===bc===
18107 ==c==
18108 ===ca===
18109 !! html/php
18110 start
18111 ==a==
18112 ===aa===
18113 ====aaa====
18114 ==b==
18115 ===ba===
18116 ===bb===
18117 ====bba====
18118 ===bc===
18119 xxx
18120 !! end
18121
18122 !! test
18123 Section replacement test (section 10)
18124 !! options
18125 replace=10,"xxx"
18126 !! wikitext
18127 start
18128 ==a==
18129 ===aa===
18130 ====aaa====
18131 ==b==
18132 ===ba===
18133 ===bb===
18134 ====bba====
18135 ===bc===
18136 ==c==
18137 ===ca===
18138 !! html/php
18139 start
18140 ==a==
18141 ===aa===
18142 ====aaa====
18143 ==b==
18144 ===ba===
18145 ===bb===
18146 ====bba====
18147 ===bc===
18148 ==c==
18149 xxx
18150 !! end
18151
18152 !! test
18153 Section replacement test with initial whitespace (bug 13728)
18154 !! options
18155 replace=2,"xxx"
18156 !! wikitext
18157 Preformatted initial line
18158 ==a==
18159 ===a===
18160 !! html/php
18161 Preformatted initial line
18162 ==a==
18163 xxx
18164 !! end
18165
18166
18167 !! test
18168 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18169 !! options
18170 section=1
18171 !! wikitext
18172 ==a==
18173 a
18174 !! html/php
18175 ==a==
18176 a
18177 !! end
18178
18179 !! test
18180 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18181 !! options
18182 section=1
18183 !! wikitext
18184 ==a==
18185 a
18186 !! html/php
18187 ==a==
18188 a
18189 !! end
18190
18191
18192 !! test
18193 Section extraction, <pre> around bogus header (bug 10309)
18194 !! options
18195 section=2
18196 !! wikitext
18197 == Section One ==
18198 <pre>
18199 =======
18200 </pre>
18201
18202 == Section Two ==
18203 stuff
18204 !! html/php
18205 == Section Two ==
18206 stuff
18207 !! end
18208
18209 !! test
18210 Section replacement, <pre> around bogus header (bug 10309)
18211 !! options
18212 replace=2,"xxx"
18213 !! wikitext
18214 == Section One ==
18215 <pre>
18216 =======
18217 </pre>
18218
18219 == Section Two ==
18220 stuff
18221 !! html/php
18222 == Section One ==
18223 <pre>
18224 =======
18225 </pre>
18226
18227 xxx
18228 !! end
18229
18230
18231 !! test
18232 Handling of &#x0A; in URLs
18233 !! wikitext
18234 ** irc://&#x0A;a
18235 !! html/php
18236 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18237
18238 !! html/parsoid
18239 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18240 a">irc://
18241 a</a></li></ul></li></ul>
18242 !! end
18243
18244 !! test
18245 Handling of %0A in URLs
18246 !! wikitext
18247 ** irc://%0Aa
18248 !! html/php
18249 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18250
18251 !! html/parsoid
18252 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18253 !! end
18254
18255
18256 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18257 !! test
18258 5 quotes, code coverage +1 line
18259 !! options
18260 parsoid=wt2html
18261 !! wikitext
18262 '''''
18263 !! html/php
18264 !! html/parsoid
18265 <p><b><i></i></b></p>
18266 !! end
18267
18268 # same html as previous, but wikitext adjusted to match parsoid html2wt
18269 # note that wt2html and html2html will put the <i> before the <b>
18270 !! test
18271 5 quotes, code coverage +1 line w/ nowiki (1)
18272 !! options
18273 parsoid=wt2wt,html2wt
18274 !! wikitext
18275 '''''<nowiki/>'''''
18276 !! html/php
18277 <p><i></i>
18278 </p>
18279 !! html/parsoid
18280 <p><b><i></i></b></p>
18281 !! end
18282
18283 # same as previous, just swapping the <i> and <b>
18284 !! test
18285 5 quotes, code coverage +1 line w/ nowiki (2)
18286 !! wikitext
18287 '''''<nowiki/>'''''
18288 !! html/php
18289 <p><i></i>
18290 </p>
18291 !! html/parsoid
18292 <p><i><b></b></i></p>
18293 !! end
18294
18295 !! test
18296 Special:Search page linking.
18297 !! wikitext
18298 {{Special:search}}
18299 !! html
18300 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18301 </p>
18302 !! end
18303
18304 !! test
18305 {{!}} is a magic word
18306 !! wikitext
18307 {{!}} is a magic word there and {{!}} is still a magic word here
18308 | is not a magic word here but {{!}} is still a magic word here
18309 !! html/php
18310 <p>| is a magic word there and | is still a magic word here
18311 | is not a magic word here but | is still a magic word here
18312 </p>
18313 !! html/parsoid
18314 <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
18315 | 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>
18316
18317 !! end
18318
18319 !! test
18320 Say the magic word
18321 !! options
18322 title=[[Parser test]]
18323 !! wikitext
18324 * {{PAGENAME}}
18325 * {{PAGENAMEE}}
18326 * {{FULLPAGENAME}}
18327 * {{FULLPAGENAMEE}}
18328 * {{BASEPAGENAME}}
18329 * {{BASEPAGENAMEE}}
18330 * {{SUBPAGENAME}}
18331 * {{SUBPAGENAMEE}}
18332 * {{ROOTPAGENAME}}
18333 * {{ROOTPAGENAMEE}}
18334 * {{TALKPAGENAME}}
18335 * {{TALKPAGENAMEE}}
18336 * {{SUBJECTPAGENAME}}
18337 * {{SUBJECTPAGENAMEE}}
18338 * {{NAMESPACEE}}
18339 * {{NAMESPACE}}
18340 * {{NAMESPACENUMBER}}
18341 * {{TALKSPACE}}
18342 * {{TALKSPACEE}}
18343 * {{SUBJECTSPACE}}
18344 * {{SUBJECTSPACEE}}
18345 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18346 !! html
18347 <ul><li> Parser test</li>
18348 <li> Parser_test</li>
18349 <li> Parser test</li>
18350 <li> Parser_test</li>
18351 <li> Parser test</li>
18352 <li> Parser_test</li>
18353 <li> Parser test</li>
18354 <li> Parser_test</li>
18355 <li> Parser test</li>
18356 <li> Parser_test</li>
18357 <li> Talk:Parser test</li>
18358 <li> Talk:Parser_test</li>
18359 <li> Parser test</li>
18360 <li> Parser_test</li>
18361 <li> </li>
18362 <li> </li>
18363 <li> 0</li>
18364 <li> Talk</li>
18365 <li> Talk</li>
18366 <li> </li>
18367 <li> </li>
18368 <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>
18369
18370 !! end
18371 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18372
18373 !! test
18374 Gallery
18375 !! wikitext
18376 <gallery>
18377 image1.png |
18378 image2.gif|||||
18379
18380 image3|
18381 image4 |300px| centre
18382 image5.svg| http://///////
18383 [[x|xx]]]]
18384 * image6
18385 </gallery>
18386 !! html
18387 <ul class="gallery mw-gallery-traditional">
18388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18389 <div class="thumb" style="height: 150px;">Image1.png</div>
18390 <div class="gallerytext">
18391 </div>
18392 </div></li>
18393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18394 <div class="thumb" style="height: 150px;">Image2.gif</div>
18395 <div class="gallerytext">
18396 </div>
18397 </div></li>
18398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18399 <div class="thumb" style="height: 150px;">Image3</div>
18400 <div class="gallerytext">
18401 </div>
18402 </div></li>
18403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18404 <div class="thumb" style="height: 150px;">Image4</div>
18405 <div class="gallerytext">
18406 <pre>centre
18407 </pre>
18408 </div>
18409 </div></li>
18410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18411 <div class="thumb" style="height: 150px;">Image5.svg</div>
18412 <div class="gallerytext">
18413 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18414 </p>
18415 </div>
18416 </div></li>
18417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18418 <div class="thumb" style="height: 150px;">* image6</div>
18419 <div class="gallerytext">
18420 </div>
18421 </div></li>
18422 </ul>
18423
18424 !! end
18425
18426 !! test
18427 Gallery (with options)
18428 !! wikitext
18429 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18430 File:Nonexistent.jpg|caption
18431 File:Nonexistent.jpg
18432 image:foobar.jpg|some '''caption''' [[Main Page]]
18433 image:foobar.jpg
18434 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18435 </gallery>
18436 !! html
18437 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18438 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18439 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18440 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18441 <div class="gallerytext">
18442 <p>caption
18443 </p>
18444 </div>
18445 </div></li>
18446 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18447 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18448 <div class="gallerytext">
18449 </div>
18450 </div></li>
18451 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18452 <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>
18453 <div class="gallerytext">
18454 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18455 </p>
18456 </div>
18457 </div></li>
18458 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18459 <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>
18460 <div class="gallerytext">
18461 </div>
18462 </div></li>
18463 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18464 <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>
18465 <div class="gallerytext">
18466 <p>blabla.
18467 </p>
18468 </div>
18469 </div></li>
18470 </ul>
18471
18472 !! end
18473
18474 !! test
18475 Gallery with link that has fragment
18476 !! wikitext
18477 <gallery>
18478 image:foobar.jpg|link=Main_Page
18479 image:foobar.jpg|link=Main_Page#section
18480 image:foobar.jpg|link=Main Page#section|caption
18481 </gallery>
18482 !! html
18483 <ul class="gallery mw-gallery-traditional">
18484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18485 <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>
18486 <div class="gallerytext">
18487 </div>
18488 </div></li>
18489 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18490 <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>
18491 <div class="gallerytext">
18492 </div>
18493 </div></li>
18494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18495 <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>
18496 <div class="gallerytext">
18497 <p>caption
18498 </p>
18499 </div>
18500 </div></li>
18501 </ul>
18502
18503 !! end
18504
18505 !! test
18506 Gallery with wikitext inside caption
18507 !! wikitext
18508 <gallery>
18509 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18510 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18511 </gallery>
18512 !! html
18513 <ul class="gallery mw-gallery-traditional">
18514 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18515 <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>
18516 <div class="gallerytext">
18517 <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>
18518 </p>
18519 </div>
18520 </div></li>
18521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18522 <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>
18523 <div class="gallerytext">
18524 <p>This is a test template
18525 </p>
18526 </div>
18527 </div></li>
18528 </ul>
18529
18530 !! end
18531
18532 !! test
18533 gallery (with showfilename option)
18534 !! wikitext
18535 <gallery showfilename>
18536 File:Nonexistent.jpg|caption
18537 File:Nonexistent.jpg
18538 image:foobar.jpg|some '''caption''' [[Main Page]]
18539 File:Foobar.jpg
18540 </gallery>
18541 !! html
18542 <ul class="gallery mw-gallery-traditional">
18543 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18544 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18545 <div class="gallerytext">
18546 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18547 caption
18548 </p>
18549 </div>
18550 </div></li>
18551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18552 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18553 <div class="gallerytext">
18554 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18555 </p>
18556 </div>
18557 </div></li>
18558 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18559 <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>
18560 <div class="gallerytext">
18561 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18562 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18563 </p>
18564 </div>
18565 </div></li>
18566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18567 <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>
18568 <div class="gallerytext">
18569 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18570 </p>
18571 </div>
18572 </div></li>
18573 </ul>
18574
18575 !! end
18576
18577 !! test
18578 Gallery (with namespace-less filenames)
18579 !! wikitext
18580 <gallery>
18581 File:Nonexistent.jpg
18582 Nonexistent.jpg
18583 image:foobar.jpg
18584 foobar.jpg
18585 </gallery>
18586 !! html
18587 <ul class="gallery mw-gallery-traditional">
18588 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18589 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18590 <div class="gallerytext">
18591 </div>
18592 </div></li>
18593 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18594 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18595 <div class="gallerytext">
18596 </div>
18597 </div></li>
18598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18599 <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>
18600 <div class="gallerytext">
18601 </div>
18602 </div></li>
18603 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18604 <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>
18605 <div class="gallerytext">
18606 </div>
18607 </div></li>
18608 </ul>
18609
18610 !! end
18611
18612 !! test
18613 HTML Hex character encoding (spells the word "JavaScript")
18614 !! options
18615 parsoid=wt2html,wt2wt,html2html
18616 !! wikitext
18617 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18618 !! html/php
18619 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18620 </p>
18621 !! html/php+tidy
18622 <p>JavaScript</p>
18623 !! html/parsoid
18624 <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>
18625 !! end
18626
18627 !! test
18628 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18629 !! wikitext
18630 &#xsee;&#XSEE;
18631 !! html/php
18632 <p>&amp;#xsee;&amp;#XSEE;
18633 </p>
18634 !! html/parsoid
18635 <p>&amp;#xsee;&amp;#XSEE;</p>
18636 !! end
18637
18638 !! test
18639 HTML Hex character encoding mixed case
18640 !! options
18641 parsoid=wt2html,wt2wt,html2html
18642 !! wikitext
18643 &#xEE;&#Xee;
18644 !! html/php
18645 <p>&#xee;&#xee;
18646 </p>
18647 !! html/php+tidy
18648 <p>îî</p>
18649 !! html/parsoid
18650 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18651 !! end
18652
18653 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18654 # Note that U+000C (form feed) is not a valid XML character, so
18655 # it is banned even though allowed in HTML5.
18656 !! test
18657 Illegal character references (T106578)
18658 !! wikitext
18659 ; Null: &#00;
18660 ; FF: &#xC;
18661 ; CR: &#xD;
18662 ; Control (low): &#8;
18663 ; Control (high): &#x7F; &#x9F;
18664 ; Surrogate: &#xD83D;&#xDCA9;
18665 ; This is an okay astral character: &#x1F4A9;
18666 !! html+tidy
18667 <dl>
18668 <dt>Null</dt>
18669 <dd>&amp;#00;</dd>
18670 <dt>FF</dt>
18671 <dd>&amp;#xC;</dd>
18672 <dt>CR</dt>
18673 <dd>&amp;#xD;</dd>
18674 <dt>Control (low)</dt>
18675 <dd>&amp;#8;</dd>
18676 <dt>Control (high)</dt>
18677 <dd>&amp;#x7F; &amp;#x9F;</dd>
18678 <dt>Surrogate</dt>
18679 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18680 <dt>This is an okay astral character</dt>
18681 <dd>💩</dd>
18682 </dl>
18683 !! end
18684
18685 !! test
18686 __FORCETOC__ override
18687 !! wikitext
18688 __NEWSECTIONLINK__
18689 __FORCETOC__
18690 !! html/php
18691 <p><br />
18692 </p>
18693 !! end
18694
18695 !! test
18696 ISBN code coverage
18697 !! wikitext
18698 ISBN 978-0-1234-56&#x20;789
18699 !! html
18700 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18701 </p>
18702 !! html+tidy
18703 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18704 !! html/parsoid
18705 <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>
18706 !! end
18707
18708 !! test
18709 ISBN followed by 5 spaces
18710 !! wikitext
18711 ISBN
18712 !! html
18713 <p>ISBN
18714 </p>
18715 !! end
18716
18717 !! test
18718 Double ISBN
18719 !! wikitext
18720 ISBN ISBN 1234567890
18721 !! html/php
18722 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18723 </p>
18724 !! html/parsoid
18725 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18726 !! end
18727
18728 # Uppercase X and lowercase x as well
18729 !! test
18730 ISBN with an X
18731 !! wikitext
18732 ISBN 3-462-04561-X
18733 ISBN 3-462-04561-x
18734 ISBN 080442957X
18735 ISBN 080442957x
18736 ISBN 978080442957X
18737 ISBN 978080442957x
18738 !! html/php
18739 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18740 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18741 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18742 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18743 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18744 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18745 </p>
18746 !! html/parsoid
18747 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18748 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18749 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18750 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18751 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18752 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18753 !! end
18754
18755 !! test
18756 ISBN with empty prefix (parsoid test)
18757 !! wikitext
18758 ISBN 1234567890
18759 !! html/php
18760 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18761 </p>
18762 !! html/parsoid
18763 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18764 !! end
18765
18766 !! test
18767 Bug 22905: <abbr> followed by ISBN followed by </a>
18768 !! wikitext
18769 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18770 !! html/php
18771 <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>
18772 </p>
18773 !! html/parsoid
18774 <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>
18775 !! end
18776
18777 !! test
18778 Double RFC
18779 !! wikitext
18780 RFC RFC 1234
18781 !! html
18782 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18783 </p>
18784 !! end
18785
18786 !! test
18787 Double RFC with a wiki link
18788 !! wikitext
18789 RFC [[RFC 1234]]
18790 !! html
18791 <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>
18792 </p>
18793 !! end
18794
18795 !! test
18796 RFC code coverage
18797 !! wikitext
18798 RFC 983&#x20;987
18799 !! html
18800 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18801 </p>
18802 !! html+tidy
18803 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18804 !! end
18805
18806 !! test
18807 Centre-aligned image
18808 !! wikitext
18809 [[Image:foobar.jpg|centre]]
18810 !! html
18811 <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>
18812
18813 !!end
18814
18815 !! test
18816 None-aligned image
18817 !! wikitext
18818 [[Image:foobar.jpg|none]]
18819 !! html
18820 <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>
18821
18822 !!end
18823
18824 !! test
18825 Width + Height sized image (using px) (height is ignored)
18826 !! wikitext
18827 [[Image:foobar.jpg|640x480px]]
18828 !! html
18829 <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>
18830 </p>
18831 !!end
18832
18833 !! test
18834 Width-sized image (using px, no following whitespace)
18835 !! wikitext
18836 [[Image:foobar.jpg|640px]]
18837 !! html
18838 <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>
18839 </p>
18840 !!end
18841
18842 !! test
18843 Width-sized image (using px, with following whitespace - test regression from r39467)
18844 !! wikitext
18845 [[Image:foobar.jpg|640px ]]
18846 !! html
18847 <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>
18848 </p>
18849 !!end
18850
18851 !! test
18852 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18853 !! wikitext
18854 [[Image:foobar.jpg| 640px]]
18855 !! html
18856 <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>
18857 </p>
18858 !!end
18859
18860 !! test
18861 Image with page parameter
18862 !! options
18863 djvu
18864 !! wikitext
18865 [[File:LoremIpsum.djvu|page=2]]
18866 !! html/php
18867 <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>
18868 </p>
18869 !! html/parsoid
18870 <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>
18871 !! end
18872
18873 !! test
18874 Another italics / bold test
18875 !! wikitext
18876 ''' ''x'
18877 !! html
18878 <pre>'<i> </i>x'
18879 </pre>
18880 !!end
18881
18882 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18883 !! test
18884 dt/dd/dl test
18885 !! wikitext
18886 :;;;::
18887 !! html/php
18888 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18889
18890 !! html/parsoid
18891 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18892
18893 !!end
18894
18895
18896 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18897 !! test
18898 Images with the "|" character in the comment
18899 !! wikitext
18900 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18901 !! html/php
18902 <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>
18903
18904 !! html/parsoid
18905 <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>
18906 !! end
18907
18908 !! test
18909 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18910 !! wikitext
18911 <html><script>alert(1);</script></html>
18912 !! html
18913 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18914 </p>
18915 !! end
18916
18917 !! test
18918 HTML with raw HTML ($wgRawHtml==true)
18919 !! options
18920 wgRawHtml=1
18921 !! wikitext
18922 <html><script>alert(1);</script></html>
18923 !! html
18924 <p><script>alert(1);</script>
18925 </p>
18926 !! end
18927
18928 !! test
18929 Parents of subpages, one level up
18930 !! options
18931 subpage title=[[Subpage test/L1/L2/L3]]
18932 !! wikitext
18933 [[../|L2]]
18934 !! html
18935 <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>
18936 </p>
18937 !! end
18938
18939
18940 !! test
18941 Parents of subpages, one level up, not named
18942 !! options
18943 subpage title=[[Subpage test/L1/L2/L3]]
18944 !! wikitext
18945 [[../]]
18946 !! html
18947 <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>
18948 </p>
18949 !! end
18950
18951
18952
18953 !! test
18954 Parents of subpages, two levels up
18955 !! options
18956 subpage title=[[Subpage test/L1/L2/L3]]
18957 !! wikitext
18958 [[../../|L1]]2
18959
18960 [[../../|L1]]l
18961 !! html
18962 <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
18963 </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>
18964 </p>
18965 !! end
18966
18967 !! test
18968 Parents of subpages, two levels up, without trailing slash or name.
18969 !! options
18970 subpage title=[[Subpage test/L1/L2/L3]]
18971 !! wikitext
18972 [[../..]]
18973 !! html
18974 <p>[[../..]]
18975 </p>
18976 !! end
18977
18978 !! test
18979 Parents of subpages, two levels up, with lots of extra trailing slashes.
18980 !! options
18981 subpage title=[[Subpage test/L1/L2/L3]]
18982 !! wikitext
18983 [[../../////]]
18984 !! html
18985 <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>
18986 </p>
18987 !! end
18988
18989 !! article
18990 Subpage test/L1/L2/L3Sibling
18991 !! text
18992 Sibling article
18993 !! endarticle
18994
18995 !! test
18996 Transclusion of a sibling page (one level up)
18997 !! options
18998 subpage title=[[Subpage test/L1/L2/L3]]
18999 !! wikitext
19000 {{../L3Sibling}}
19001 !! html
19002 <p>Sibling article
19003 </p>
19004 !! end
19005
19006 !! test
19007 Transclusion of a child page
19008 !! options
19009 subpage title=[[Subpage test/L1/L2]]
19010 !! wikitext
19011 {{/L3Sibling}}
19012 !! html
19013 <p>Sibling article
19014 </p>
19015 !! end
19016
19017 !! test
19018 Non-transclusion because of too many up levels
19019 !! options
19020 subpage title=[[Subpage test/L1/L2/L3]]
19021 !! wikitext
19022 {{../../../../More than parent}}
19023 !! html
19024 <p>{{../../../../More than parent}}
19025 </p>
19026 !! end
19027
19028 !! test
19029 Definition list code coverage
19030 !! wikitext
19031 ; title : def
19032 ; title : def
19033 ;title: def
19034 !! html/php
19035 <dl><dt> title &#160;</dt>
19036 <dd> def</dd>
19037 <dt> title&#160;</dt>
19038 <dd> def</dd>
19039 <dt>title</dt>
19040 <dd> def</dd></dl>
19041
19042 !! html/parsoid
19043 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19044 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19045 <dt>title</dt><dd> def</dd></dl>
19046 !! end
19047
19048 !! test
19049 Don't fall for the self-closing div
19050 !! wikitext
19051 <div>hello world</div/>
19052 !! html
19053 <div>hello world</div>
19054
19055 !! end
19056
19057 !! test
19058 MSGNW magic word
19059 !! wikitext
19060 {{MSGNW:msg}}
19061 !! html/php
19062 <p>&#91;&#91;:Template:Msg&#93;&#93;
19063 </p>
19064 !! end
19065
19066 !! test
19067 RAW magic word
19068 !! wikitext
19069 {{RAW:QUERTY}}
19070 !! html
19071 <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>
19072 </p>
19073 !! end
19074
19075 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19076 !! test
19077 Always escape literal '>' in output, not just after '<'
19078 !! wikitext
19079 ><>
19080 !! html
19081 <p>&gt;&lt;&gt;
19082 </p>
19083 !! end
19084
19085 !! test
19086 Template caching
19087 !! wikitext
19088 {{Test}}
19089 {{Test}}
19090 !! html
19091 <p>This is a test template
19092 This is a test template
19093 </p>
19094 !! end
19095
19096
19097 !! article
19098 MediaWiki:Fake
19099 !! text
19100 ==header==
19101 !! endarticle
19102
19103 !! test
19104 Inclusion of !userCanEdit() content
19105 !! wikitext
19106 {{MediaWiki:Fake}}
19107 !! html
19108 <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>
19109
19110 !! end
19111
19112
19113 !! test
19114 Out-of-order TOC heading levels
19115 !! wikitext
19116 ==2==
19117 ======6======
19118 ===3===
19119 =1=
19120 =====5=====
19121 ==2==
19122 !! html
19123 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19124 <ul>
19125 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19126 <ul>
19127 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19128 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19129 </ul>
19130 </li>
19131 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19132 <ul>
19133 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19134 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19135 </ul>
19136 </li>
19137 </ul>
19138 </div>
19139
19140 <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>
19141 <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>
19142 <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>
19143 <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>
19144 <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>
19145 <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>
19146
19147 !! end
19148
19149
19150 !! test
19151 ISBN with a dummy number
19152 !! wikitext
19153 ISBN ---
19154 !! html
19155 <p>ISBN ---
19156 </p>
19157 !! end
19158
19159
19160 !! test
19161 ISBN with space-delimited number
19162 !! wikitext
19163 ISBN 92 9017 032 8
19164 !! html
19165 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19166 </p>
19167 !! end
19168
19169
19170 !! test
19171 ISBN with multiple spaces, no number
19172 !! wikitext
19173 ISBN foo
19174 !! html
19175 <p>ISBN foo
19176 </p>
19177 !! end
19178
19179
19180 !! test
19181 ISBN length
19182 !! wikitext
19183 ISBN 123456789
19184
19185 ISBN 1234567890
19186
19187 ISBN 12345678901
19188 !! html
19189 <p>ISBN 123456789
19190 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19191 </p><p>ISBN 12345678901
19192 </p>
19193 !! end
19194
19195
19196 !! test
19197 ISBN with trailing year (bug 8110)
19198 !! wikitext
19199 ISBN 1-234-56789-0 - 2006
19200
19201 ISBN 1 234 56789 0 - 2006
19202 !! html
19203 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19204 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19205 </p>
19206 !! end
19207
19208
19209 !! test
19210 anchorencode
19211 !! wikitext
19212 {{anchorencode:foo bar©#%n}}
19213 !! html
19214 <p>foo_bar.C2.A9.23.25n
19215 </p>
19216 !! end
19217
19218 !! test
19219 anchorencode trims spaces
19220 !! wikitext
19221 {{anchorencode: __pretty__please__}}
19222 !! html
19223 <p>pretty_please
19224 </p>
19225 !! end
19226
19227 !! test
19228 anchorencode deals with links
19229 !! wikitext
19230 {{anchorencode: [[hello|world]] [[hi]]}}
19231 !! html
19232 <p>world_hi
19233 </p>
19234 !! end
19235
19236 !! test
19237 anchorencode deals with templates
19238 !! wikitext
19239 {{anchorencode: {{Foo}} }}
19240 !! html
19241 <p>FOO
19242 </p>
19243 !! end
19244
19245 !! test
19246 anchorencode encodes like the TOC generator: (bug 18431)
19247 !! wikitext
19248 === _ +:.3A%3A&&amp;]] ===
19249 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19250 __NOEDITSECTION__
19251 !! html
19252 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19253 <p>.2B:.3A.253A.26.26.5D.5D
19254 </p>
19255 !! end
19256
19257 !! test
19258 Bug 6200: blockquotes and paragraph formatting
19259 !! wikitext
19260 <blockquote>
19261 foo
19262 </blockquote>
19263
19264 bar
19265
19266 baz
19267 !! html
19268 <blockquote>
19269 <p>foo
19270 </p>
19271 </blockquote>
19272 <p>bar
19273 </p>
19274 <pre>baz
19275 </pre>
19276 !! end
19277
19278 !! test
19279 Bug 8293: Use of center tag ruins paragraph formatting
19280 !! wikitext
19281 <center>
19282 foo
19283 </center>
19284
19285 bar
19286
19287 baz
19288 !! html
19289 <center>
19290 <p>foo
19291 </p>
19292 </center>
19293 <p>bar
19294 </p>
19295 <pre>baz
19296 </pre>
19297 !! end
19298
19299 !!test
19300 Parsing of overlapping (improperly nested) inline html tags
19301 !! wikitext
19302 <span><s>x</span></s>
19303 !! html/php
19304 <p><span><s>x&lt;/span&gt;</s></span>
19305 </p>
19306 !! html/parsoid
19307 <p><span><s>x</s></span>
19308 </p>
19309 !!end
19310
19311 ###
19312 ### Language variants related tests
19313 ###
19314 !! test
19315 Self-link in language variants
19316 !! options
19317 title=[[Dunav]] language=sr
19318 !! wikitext
19319 Both [[Dunav]] and [[Дунав]] are names for this river.
19320 !! html
19321 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19322 </p>
19323 !!end
19324
19325 !! article
19326 Дуна
19327 !! text
19328 content
19329 !! endarticle
19330
19331 !! test
19332 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19333 !! options
19334 title=[[Duna]] language=sr
19335 !! wikitext
19336 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19337 !! html
19338 <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.
19339 </p>
19340 !! end
19341
19342 !! test
19343 Link to a section of a variant of this title shouldn't be parsed as self-link
19344 !! options
19345 title=[[Duna]] language=sr
19346 !! wikitext
19347 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19348 !! html
19349 <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.
19350 </p>
19351 !! end
19352
19353 !! test
19354 Link to pages in language variants
19355 !! options
19356 language=sr
19357 !! wikitext
19358 Main Page can be written as [[Маин Паге]]
19359 !! html
19360 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19361 </p>
19362 !!end
19363
19364
19365 !! test
19366 Multiple links to pages in language variants
19367 !! options
19368 language=sr
19369 !! wikitext
19370 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19371 !! html
19372 <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>.
19373 </p>
19374 !!end
19375
19376
19377 !! test
19378 Simple template in language variants
19379 !! options
19380 language=sr
19381 !! wikitext
19382 {{тест}}
19383 !! html
19384 <p>This is a test template
19385 </p>
19386 !! end
19387
19388
19389 !! test
19390 Template with explicit namespace in language variants
19391 !! options
19392 language=sr
19393 !! wikitext
19394 {{Template:тест}}
19395 !! html
19396 <p>This is a test template
19397 </p>
19398 !! end
19399
19400
19401 !! test
19402 Basic test for template parameter in language variants
19403 !! options
19404 language=sr
19405 !! wikitext
19406 {{парамтест|param=foo}}
19407 !! html
19408 <p>This is a test template with parameter foo
19409 </p>
19410 !! end
19411
19412
19413 !! test
19414 Simple category in language variants
19415 !! options
19416 language=sr cat
19417 !! wikitext
19418 [[Category:МедиаWики Усер'с Гуиде]]
19419 !! html
19420 <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>
19421 !! end
19422
19423
19424 !! article
19425 Category:分类
19426 !! text
19427 blah
19428 !! endarticle
19429
19430 !! article
19431 Category:分類
19432 !! text
19433 blah
19434 !! endarticle
19435
19436 ## We used to, but no longer wt2wt this test since the default serializer
19437 ## will normalize all categories to serialize on their own line.
19438 ## This wikitext usage is going to be fairly uncommon in production and
19439 ## selser will take care of preserving formatting in those scenarios.
19440 !! test
19441 Don't convert blue categorylinks to another variant (bug 33210)
19442 !! options
19443 cat
19444 language=zh
19445 parsoid=wt2html
19446 !! wikitext
19447 [[A]][[Category:分类]]
19448 !! html/php
19449 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19450 !! html/parsoid
19451 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19452 <link rel="mw:PageProp/Category" href="Category:分类"/>
19453 !! end
19454
19455 !! test
19456 Stripping -{}- tags (language variants)
19457 !! options
19458 language=sr
19459 !! wikitext
19460 Latin proverb: -{Ne nuntium necare}-
19461 !! html
19462 <p>Latin proverb: Ne nuntium necare
19463 </p>
19464 !! end
19465
19466
19467 !! test
19468 Prevent conversion with -{}- tags (language variants)
19469 !! options
19470 language=sr variant=sr-ec
19471 !! wikitext
19472 Latinski: -{Ne nuntium necare}-
19473 !! html
19474 <p>Латински: Ne nuntium necare
19475 </p>
19476 !! end
19477
19478
19479 !! test
19480 Prevent conversion of text with -{}- tags (language variants)
19481 !! options
19482 language=sr variant=sr-ec
19483 !! wikitext
19484 Latinski: -{Ne nuntium necare}-
19485 !! html
19486 <p>Латински: Ne nuntium necare
19487 </p>
19488 !! end
19489
19490
19491 !! test
19492 Prevent conversion of links with -{}- tags (language variants)
19493 !! options
19494 language=sr variant=sr-ec
19495 !! wikitext
19496 -{[[Main Page]]}-
19497 !! html
19498 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19499 </p>
19500 !! end
19501
19502
19503 !! test
19504 -{}- tags within headlines (within html for parserConvert())
19505 !! options
19506 language=sr variant=sr-ec
19507 !! wikitext
19508 == -{Naslov}- ==
19509 !! html
19510 <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>
19511
19512 !! end
19513
19514
19515 !! test
19516 Explicit definition of language variant alternatives
19517 !! options
19518 language=zh variant=zh-tw
19519 !! wikitext
19520 -{zh:China;zh-tw:Taiwan}-, not China
19521 !! html
19522 <p>Taiwan, not China
19523 </p>
19524 !! end
19525
19526
19527 !! test
19528 Conversion around HTML tags
19529 !! options
19530 language=sr variant=sr-ec
19531 !! wikitext
19532 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19533 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19534 !! html
19535 <p>
19536 <span title="ЛаCтин">ски</span>
19537 </p>
19538 !! end
19539
19540
19541 !! test
19542 Explicit session-wise language variant mapping (A flag and - flag)
19543 !! options
19544 language=zh variant=zh-tw
19545 !! wikitext
19546 Taiwan is not China.
19547 But -{A|zh:China;zh-tw:Taiwan}- is China,
19548 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19549 and -{China}- is China.
19550 !! html
19551 <p>Taiwan is not China.
19552 But Taiwan is Taiwan,
19553 (This should be stripped!)
19554 and China is China.
19555 </p>
19556 !! end
19557
19558 !! test
19559 Explicit session-wise language variant mapping (H flag for hide)
19560 !! options
19561 language=zh variant=zh-tw
19562 !! wikitext
19563 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19564 Taiwan is China.
19565 !! html
19566 <p>(This should be stripped!)
19567 Taiwan is Taiwan.
19568 </p>
19569 !! end
19570
19571 !! test
19572 Adding explicit conversion rule for title (T flag)
19573 !! options
19574 language=zh variant=zh-tw showtitle
19575 !! wikitext
19576 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19577 !! html
19578 Taiwan
19579 <p>Should be stripped!
19580 </p>
19581 !! end
19582
19583 !! test
19584 Testing that changing the language variant here in the tests actually works
19585 !! options
19586 language=zh variant=zh showtitle
19587 !! wikitext
19588 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19589 !! html
19590 China
19591 <p>Should be stripped!
19592 </p>
19593 !! end
19594
19595 !! test
19596 Recursive conversion of alt and title attrs shouldn't clear converter state
19597 !! options
19598 language=zh variant=zh-cn showtitle
19599 !! wikitext
19600 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19601 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19602 !! html
19603 China
19604 <p>
19605 Should be stripped<span title="Exclamation">!</span>
19606 </p>
19607 !! end
19608
19609 !! test
19610 Bug 24072: more test on conversion rule for title
19611 !! options
19612 language=zh variant=zh-tw showtitle
19613 !! wikitext
19614 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19615 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19616 !! html
19617 Taiwan
19618 <p>This should be stripped!
19619 This won't take interferes with the title rule.
19620 </p>
19621 !! end
19622
19623 !! test
19624 Partly disable title conversion if variant == main language code
19625 !! options
19626 language=zh variant=zh title=[[ZH]] showtitle
19627 !! wikitext
19628 -{T|zh-cn:CN;zh-tw:TW}-
19629 !! html
19630 ZH
19631 <p>
19632 </p>
19633 !! end
19634
19635 !! test
19636 Partly disable title conversion if variant == main language code, more
19637 !! options
19638 language=zh variant=zh title=[[ZH]] showtitle
19639 !! wikitext
19640 -{T|TW}-
19641 !! html
19642 ZH
19643 <p>
19644 </p>
19645 !! end
19646
19647 !! test
19648 Raw output of variant escape tags (R flag)
19649 !! options
19650 language=zh variant=zh-tw
19651 !! wikitext
19652 Raw: -{R|zh:China;zh-tw:Taiwan}-
19653 !! html
19654 <p>Raw: zh:China;zh-tw:Taiwan
19655 </p>
19656 !! end
19657
19658 !! test
19659 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19660 !! options
19661 language=zh variant=zh-cn
19662 !! input
19663 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19664 !! result
19665 <p>0
19666 </p>
19667 !! end
19668
19669 !! test
19670 Conversion rules from [numeric-only string] to [something else] (T48634)
19671 !! options
19672 language=zh variant=zh-cn
19673 !! input
19674 -{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
19675 !! result
19676 <p>D12345EE12345
19677 </p>
19678 !! end
19679
19680 !! test
19681 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19682 !! options
19683 language=zh variant=zh-cn
19684 !! input
19685 -{H|zh-cn:foo;zh-tw:;}-foobar
19686 !! result
19687 <p>foobar
19688 </p>
19689 !! end
19690
19691 !! test
19692 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19693 !! options
19694 language=zh variant=zh-cn
19695 !! input
19696 -{H|=>zh-cn:foo;}-foobar
19697 !! result
19698 <p>foobar
19699 </p>
19700 !! end
19701
19702 !! test
19703 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19704 !! options
19705 language=zh variant=zh-cn
19706 !! input
19707 -{H|}-foobar
19708 !! result
19709 <p>foobar
19710 </p>
19711 !! end
19712
19713 !! test
19714 Nested using of manual convert syntax
19715 !! options
19716 language=zh variant=zh-hk
19717 !! wikitext
19718 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19719 !! html
19720 <p>Nested: Hello Hong Kong!
19721 </p>
19722 !! end
19723
19724 !! test
19725 Proper conversion of text in external links
19726 !! options
19727 language=sr variant=sr-ec
19728 !! wikitext
19729 http://www.google.com
19730 gopher://www.google.com
19731 [http://www.google.com http://www.google.com]
19732 [gopher://www.google.com gopher://www.google.com]
19733 [https://www.google.com irc://www.google.com]
19734 [ftp://www.google.com www.google.com/ftp://dir]
19735 [//www.google.com www.google.com]
19736 !! html
19737 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19738 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19739 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19740 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19741 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19742 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19743 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19744 </p>
19745 !! end
19746
19747 !! test
19748 Do not convert roman numbers to language variants
19749 !! options
19750 language=sr variant=sr-ec
19751 !! wikitext
19752 Fridrih IV je car.
19753 !! html
19754 <p>Фридрих IV је цар.
19755 </p>
19756 !! end
19757
19758 !! test
19759 Unclosed language converter markup "-{"
19760 !! options
19761 language=sr
19762 !! wikitext
19763 -{T|hello
19764 !! html
19765 <p>-{T|hello
19766 </p>
19767 !! end
19768
19769 !! test
19770 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19771 !! options
19772 language=sr
19773 !! wikitext
19774 -{R|=&gt;}-
19775 !! html
19776 <p>=&gt;
19777 </p>
19778 !!end
19779
19780 !! test
19781 Don't break link parsing if language converter markup is in the caption.
19782 !! options
19783 language=sr variant=sr-ec
19784 !! wikitext
19785 [[Main Page|-{R|main page}-]]
19786 !! html
19787 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19788 </p>
19789 !! end
19790
19791 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19792 !! test
19793 Don't break image parsing if language converter markup is in the caption.
19794 !! options
19795 language=sr
19796 !! wikitext
19797 [[File:Foobar.jpg|-{R|caption}-]]
19798 !! html/parsoid
19799 <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>
19800 </p>
19801 !! end
19802
19803 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19804 !! test
19805 Don't break list handling if language converter markup is in the item.
19806 !! options
19807 language=zh variant=zh-cn
19808 !! wikitext
19809 ;-{zh-cn:AAA;zh-tw:BBB}-
19810 !! html/php
19811 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19812
19813 !! html/parsoid
19814 <dl><dt>AAA
19815 </dt></dl>
19816 !! end
19817
19818 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19819 !! test
19820 Don't break table handling if language converter markup is in the cell.
19821 !! options
19822 language=sr variant=sr-ec
19823 !! wikitext
19824 {|
19825 |-
19826 | -{R|B}-
19827 |}
19828 !! html/php
19829 <table>
19830
19831 <tr>
19832 <td>Б}-
19833 </td></tr></table>
19834
19835 !! html/parsoid
19836 <table>
19837
19838 <tr>
19839 <td> B
19840 </td></tr></table>
19841
19842 !! end
19843
19844 !! test
19845 Bug 529: Uncovered bullet
19846 !! wikitext
19847 * Foo {{bullet}}
19848 !! html
19849 <ul><li> Foo </li>
19850 <li> Bar</li></ul>
19851
19852 !! end
19853
19854 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19855 # Templates in Wikipedia rely on this behavior, as tidy has always been
19856 # enabled there. These tests are normally run *without* tidy, so specify the
19857 # full output here.
19858 # To test realistic parsing behavior, apply a tidy-like transformation to both
19859 # the expected output and your parser's output.
19860 !! test
19861 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19862 !! wikitext
19863 ******* Foo {{bullet}}
19864 !! html
19865 <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>
19866 <li> Bar</li></ul>
19867
19868 !! end
19869
19870 !! test
19871 Bug 529: Uncovered table already at line-start
19872 !! wikitext
19873 x
19874
19875 {{table}}
19876 y
19877 !! html
19878 <p>x
19879 </p>
19880 <table>
19881 <tr>
19882 <td> 1 </td>
19883 <td> 2
19884 </td></tr>
19885 <tr>
19886 <td> 3 </td>
19887 <td> 4
19888 </td></tr></table>
19889 <p>y
19890 </p>
19891 !! end
19892
19893 !! test
19894 Bug 529: Uncovered bullet in parser function result
19895 !! wikitext
19896 * Foo {{lc:{{bullet}} }}
19897 !! html
19898 <ul><li> Foo </li>
19899 <li> bar</li></ul>
19900
19901 !! end
19902
19903 !! test
19904 Bug 5678: Double-parsed template argument
19905 !! wikitext
19906 {{lc:{{{1}}}|hello}}
19907 !! html
19908 <p>{{{1}}}
19909 </p>
19910 !! end
19911
19912 !! test
19913 Bug 5678: Double-parsed template invocation
19914 !! wikitext
19915 {{lc:{{paramtest {{!}} param = hello }} }}
19916 !! html
19917 <p>{{paramtest | param = hello }}
19918 </p>
19919 !! end
19920
19921 !! test
19922 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19923 !! options
19924 language=cs
19925 title=[[Main Page]]
19926 !! wikitext
19927 {{PRVNÍVELKÉ:ěščř}}
19928 {{prvnívelké:ěščř}}
19929 {{PRVNÍMALÉ:ěščř}}
19930 {{prvnímalé:ěščř}}
19931 {{MALÁ:ěščř}}
19932 {{malá:ěščř}}
19933 {{VELKÁ:ěščř}}
19934 {{velká:ěščř}}
19935 !! html
19936 <p>Ěščř
19937 Ěščř
19938 ěščř
19939 ěščř
19940 ěščř
19941 ěščř
19942 ĚŠČŘ
19943 ĚŠČŘ
19944 </p>
19945 !! end
19946
19947 !! test
19948 Morwen/13: Unclosed link followed by heading
19949 !! wikitext
19950 [[link
19951 ==heading==
19952 !! html
19953 <p>[[link
19954 </p>
19955 <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>
19956
19957 !! end
19958
19959 !! test
19960 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19961 !! wikitext
19962 {{foo|
19963 =heading=
19964 !! html
19965 <p>{{foo|
19966 </p>
19967 <h1><span class="mw-headline" id="heading">heading</span></h1>
19968
19969 !! end
19970
19971 !! test
19972 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19973 !! wikitext
19974 {{foo|
19975 ==heading==
19976 !! html
19977 <p>{{foo|
19978 </p>
19979 <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>
19980
19981 !! end
19982
19983 !! test
19984 Tildes in comments
19985 !! options
19986 pst
19987 !! wikitext
19988 <!-- ~~~~ -->
19989 !! html/php
19990 <!-- ~~~~ -->
19991 !! end
19992
19993 !! test
19994 Paragraphs inside divs (no extra line breaks)
19995 !! wikitext
19996 <div>Line one
19997
19998 Line two</div>
19999 !! html
20000 <div>Line one
20001 Line two</div>
20002
20003 !! end
20004
20005 !! test
20006 Paragraphs inside divs (extra line break on open)
20007 !! wikitext
20008 <div>
20009 Line one
20010
20011 Line two</div>
20012 !! html
20013 <div>
20014 <p>Line one
20015 </p>
20016 Line two</div>
20017
20018 !! end
20019
20020 !! test
20021 Paragraphs inside divs (extra line break on close)
20022 !! wikitext
20023 <div>Line one
20024
20025 Line two
20026 </div>
20027 !! html
20028 <div>Line one
20029 <p>Line two
20030 </p>
20031 </div>
20032
20033 !! end
20034
20035 !! test
20036 Paragraphs inside divs (extra line break on open and close)
20037 !! wikitext
20038 <div>
20039 Line one
20040
20041 Line two
20042 </div>
20043 !! html
20044 <div>
20045 <p>Line one
20046 </p><p>Line two
20047 </p>
20048 </div>
20049
20050 !! end
20051
20052 !! test
20053 Nesting tags, paragraphs on lines which begin with <div>
20054 !! wikitext
20055 <div></div><strong>A
20056 B</strong>
20057 !! html/php+tidy
20058 <p><strong>A</strong></p>
20059 <p><strong>B</strong></p>
20060 !! html/parsoid
20061 <div></div>
20062 <p><strong>A
20063 B</strong>
20064 </p>
20065 !! end
20066
20067 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20068 !! test
20069 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20070 !! wikitext
20071 <blockquote>Line one
20072
20073 Line two</blockquote>
20074 !! html
20075 <blockquote>Line one
20076 Line two</blockquote>
20077
20078 !! html+tidy
20079 <blockquote>
20080 <p>Line one Line two</p>
20081 </blockquote>
20082 !! end
20083
20084 !! test
20085 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20086 !! wikitext
20087 <blockquote>
20088 Line one
20089
20090 Line two</blockquote>
20091 !! html
20092 <blockquote>
20093 <p>Line one
20094 </p>
20095 Line two</blockquote>
20096
20097 !! html+tidy
20098 <blockquote>
20099 <p>Line one</p>
20100 Line two</blockquote>
20101 !! end
20102
20103 !! test
20104 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20105 !! wikitext
20106 <blockquote>Line one
20107
20108 Line two
20109 </blockquote>
20110 !! html
20111 <blockquote>Line one
20112 <p>Line two
20113 </p>
20114 </blockquote>
20115
20116 !! html+tidy
20117 <blockquote>
20118 <p>Line one</p>
20119 <p>Line two</p>
20120 </blockquote>
20121 !! end
20122
20123 !! test
20124 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20125 !! wikitext
20126 <blockquote>
20127 Line one
20128
20129 Line two
20130 </blockquote>
20131 !! html
20132 <blockquote>
20133 <p>Line one
20134 </p><p>Line two
20135 </p>
20136 </blockquote>
20137
20138 !! html+tidy
20139 <blockquote>
20140 <p>Line one</p>
20141 <p>Line two</p>
20142 </blockquote>
20143 !! end
20144
20145 !! test
20146 Paragraphs inside blockquotes/divs (no extra line breaks)
20147 !! wikitext
20148 <blockquote><div>Line one
20149
20150 Line two</div></blockquote>
20151 !! html
20152 <blockquote><div>Line one
20153 Line two</div></blockquote>
20154
20155 !! end
20156
20157 !! test
20158 Paragraphs inside blockquotes/divs (extra line break on open)
20159 !! wikitext
20160 <blockquote><div>
20161 Line one
20162
20163 Line two</div></blockquote>
20164 !! html
20165 <blockquote><div>
20166 <p>Line one
20167 </p>
20168 Line two</div></blockquote>
20169
20170 !! end
20171
20172 !! test
20173 Paragraphs inside blockquotes/divs (extra line break on close)
20174 !! wikitext
20175 <blockquote><div>Line one
20176
20177 Line two
20178 </div></blockquote>
20179 !! html
20180 <blockquote><div>Line one
20181 <p>Line two
20182 </p>
20183 </div></blockquote>
20184
20185 !! end
20186
20187 !! test
20188 Paragraphs inside blockquotes/divs (extra line break on open and close)
20189 !! wikitext
20190 <blockquote><div>
20191 Line one
20192
20193 Line two
20194 </div></blockquote>
20195 !! html
20196 <blockquote><div>
20197 <p>Line one
20198 </p><p>Line two
20199 </p>
20200 </div></blockquote>
20201
20202 !! end
20203
20204 !! test
20205 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20206 !! options
20207 wgLinkHolderBatchSize=0
20208 !! wikitext
20209 [[meatball:1]]
20210 [[meatball:2]]
20211 [[meatball:3]]
20212 !! html
20213 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20214 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20215 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20216 </p>
20217 !! end
20218
20219 !! test
20220 Free external link invading image caption
20221 !! wikitext
20222 [[Image:Foobar.jpg|thumb|http://x|hello]]
20223 !! html
20224 <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>
20225
20226 !! end
20227
20228 !! test
20229 Bug 15196: localised external link numbers
20230 !! options
20231 language=fa
20232 !! wikitext
20233 [http://en.wikipedia.org/]
20234 !! html/php
20235 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20236 </p>
20237 !! html/parsoid
20238 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20239 !! end
20240
20241 !! test
20242 Multibyte character in padleft
20243 !! wikitext
20244 {{padleft:-Hello|7|Æ}}
20245 !! html
20246 <p>Æ-Hello
20247 </p>
20248 !! end
20249
20250 !! test
20251 Multibyte character in padright
20252 !! wikitext
20253 {{padright:Hello-|7|Æ}}
20254 !! html
20255 <p>Hello-Æ
20256 </p>
20257 !! end
20258
20259 !!test
20260 formatdate parser function
20261 !! wikitext
20262 {{#formatdate:2009-03-24}}
20263 !! html
20264 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20265 </p>
20266 !! end
20267
20268 !!test
20269 formatdate parser function, with default format
20270 !! wikitext
20271 {{#formatdate:2009-03-24|mdy}}
20272 !! html
20273 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20274 </p>
20275 !! end
20276
20277 !! test
20278 Spacing of numbers in formatted dates
20279 !! wikitext
20280 {{#formatdate:January 15}}
20281 !! html
20282 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20283 </p>
20284 !! end
20285
20286 !! test
20287 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
20288 !! options
20289 language=nl title=[[MediaWiki:Common.css]]
20290 !! wikitext
20291 {{#formatdate:2009-03-24|dmy}}
20292 !! html
20293 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20294 </p>
20295 !! end
20296
20297 #
20298 #
20299 #
20300
20301 #
20302 # Edit comments
20303 #
20304
20305 !! test
20306 Edit comment with link
20307 !! options
20308 comment
20309 !! wikitext
20310 I like the [[Main Page]] a lot
20311 !! html/php
20312 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20313 !!end
20314
20315 !! test
20316 Edit comment with link and link text
20317 !! options
20318 comment
20319 !! wikitext
20320 I like the [[Main Page|best pages]] a lot
20321 !! html/php
20322 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20323 !!end
20324
20325 !! test
20326 Edit comment with link and link text with suffix
20327 !! options
20328 comment
20329 !! wikitext
20330 I like the [[Main Page|best page]]s a lot
20331 !! html/php
20332 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20333 !!end
20334
20335 !! test
20336 Edit comment with section link (non-local, eg in history list)
20337 !! options
20338 comment title=[[Main Page]]
20339 !! wikitext
20340 /* External links */ removed bogus entries
20341 !! html/php
20342 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20343 !!end
20344
20345 !! test
20346 Edit comment with section link and text before it (non-local, eg in history list)
20347 !! options
20348 comment title=[[Main Page]]
20349 !! wikitext
20350 pre-comment text /* External links */ removed bogus entries
20351 !! html/php
20352 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>
20353 !!end
20354
20355 !! test
20356 Edit comment with section link (local, eg in diff view)
20357 !! options
20358 comment local title=[[Main Page]]
20359 !! wikitext
20360 /* External links */ removed bogus entries
20361 !! html/php
20362 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20363 !!end
20364
20365 !! test
20366 Edit comment with subpage link (bug 14080)
20367 !! options
20368 comment
20369 subpage
20370 title=[[Subpage test]]
20371 !! wikitext
20372 Poked at a [[/subpage]] here...
20373 !! html/php
20374 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20375 !!end
20376
20377 !! test
20378 Edit comment with subpage link and link text (bug 14080)
20379 !! options
20380 comment
20381 subpage
20382 title=[[Subpage test]]
20383 !! wikitext
20384 Poked at a [[/subpage|neat little page]] here...
20385 !! html/php
20386 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20387 !!end
20388
20389 !! test
20390 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20391 !! options
20392 comment
20393 title=[[Subpage test]]
20394 !! wikitext
20395 Poked at a [[/subpage]] here...
20396 !! html/php
20397 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...
20398 !!end
20399
20400 !! test
20401 Edit comment with bare anchor link (local, as on diff)
20402 !! options
20403 comment
20404 local
20405 title=[[Main Page]]
20406 !! wikitext
20407 [[#section]]
20408 !! html/php
20409 <a href="#section">#section</a>
20410 !! end
20411
20412 !! test
20413 Edit comment with bare anchor link (non-local, as on history)
20414 !! options
20415 comment
20416 title=[[Main Page]]
20417 !! wikitext
20418 [[#section]]
20419 !! html/php
20420 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20421 !! end
20422
20423 !! test
20424 Anchor starting with underscore
20425 !! options
20426 title=[[Foo]]
20427 !! wikitext
20428 [[#_ref|One]]
20429 !! html/php
20430 <p><a href="#_ref">One</a>
20431 </p>
20432 !! html/parsoid
20433 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20434 !! end
20435
20436 !! test
20437 Id starting with underscore
20438 !! wikitext
20439 <div id="_ref"></div>
20440 !! html/*
20441 <div id="_ref"></div>
20442
20443 !! end
20444
20445 !! test
20446 Space normalisation on autocomment (bug 22784)
20447 !! options
20448 comment
20449 title=[[Main Page]]
20450 !! wikitext
20451 /* __hello__world__ */
20452 !! html/php
20453 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20454 !! end
20455
20456 !! test
20457 percent-encoding and + signs in comments (Bug 26410)
20458 !! options
20459 comment
20460 !! wikitext
20461 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20462 !! html/php
20463 <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>
20464 !! end
20465
20466 # Parsoid doesn't support this yet: see bug 73581
20467 # but it *should* omit the 'src' attribute if the image is bad.
20468 # PHP side of tests was disabled in
20469 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20470 # because of issues in the PHP parserTests infrastructure
20471 # (but the output below is indeed what the PHP side emits)
20472 !! test
20473 Bad images - basic functionality
20474 !! wikitext
20475 [[File:Bad.jpg]]
20476 !! DISABLED/html/php
20477 !! html/parsoid
20478 <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>
20479 !! end
20480
20481 !! test
20482 Bad images - bug 16039: text after bad image disappears
20483 !! wikitext
20484 Foo bar
20485 [[File:Bad.jpg]]
20486 Bar foo
20487 !! DISABLED/html/php
20488 <p>Foo bar
20489 </p><p>Bar foo
20490 </p>
20491 !! html/parsoid
20492 <p>Foo bar
20493 <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>
20494 Bar foo</p>
20495 !! end
20496
20497 !! test
20498 Verify that displaytitle works (bug #22501) no displaytitle
20499 !! options
20500 showtitle
20501 !! config
20502 wgAllowDisplayTitle=true
20503 wgRestrictDisplayTitle=false
20504 !! wikitext
20505 this is not the the title
20506 !! html/php
20507 Parser test
20508 <p>this is not the the title
20509 </p>
20510 !! end
20511
20512 !! test
20513 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20514 !! options
20515 showtitle
20516 title=[[Screen]]
20517 !! config
20518 wgAllowDisplayTitle=true
20519 wgRestrictDisplayTitle=false
20520 !! wikitext
20521 this is not the the title
20522 {{DISPLAYTITLE:whatever}}
20523 !! html/php
20524 whatever
20525 <p>this is not the the title
20526 </p>
20527 !! end
20528
20529 !! test
20530 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20531 !! options
20532 showtitle
20533 title=[[Screen]]
20534 !! config
20535 wgAllowDisplayTitle=true
20536 wgRestrictDisplayTitle=true
20537 !! wikitext
20538 this is not the the title
20539 {{DISPLAYTITLE:whatever}}
20540 !! html/php
20541 Screen
20542 <p>this is not the the title
20543 </p>
20544 !! end
20545
20546 !! test
20547 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20548 !! options
20549 showtitle
20550 title=[[Screen]]
20551 !! config
20552 wgAllowDisplayTitle=true
20553 wgRestrictDisplayTitle=true
20554 !! wikitext
20555 this is not the the title
20556 {{DISPLAYTITLE:screen}}
20557 !! html/php
20558 screen
20559 <p>this is not the the title
20560 </p>
20561 !! end
20562
20563 !! test
20564 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20565 !! options
20566 showtitle
20567 title=[[Screen]]
20568 !! config
20569 wgAllowDisplayTitle=false
20570 !! wikitext
20571 this is not the the title
20572 {{DISPLAYTITLE:screen}}
20573 !! html/php
20574 Screen
20575 <p>this is not the the title
20576 <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>
20577 </p>
20578 !! end
20579
20580 !! test
20581 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20582 !! options
20583 showtitle
20584 title=[[Screen]]
20585 !! config
20586 wgAllowDisplayTitle=false
20587 !! wikitext
20588 this is not the the title
20589 !! html/php
20590 Screen
20591 <p>this is not the the title
20592 </p>
20593 !! end
20594
20595 !! test
20596 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20597 !! options
20598 showtitle
20599 title=[[Screen]]
20600 !! config
20601 wgAllowDisplayTitle=true
20602 wgRestrictDisplayTitle=true
20603 !! wikitext
20604 this is not the the title
20605 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20606 !! html/php
20607 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20608 <p>this is not the the title
20609 </p>
20610 !! end
20611
20612 !! test
20613 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20614 !! options
20615 showtitle
20616 title=[[Screen]]
20617 !! config
20618 wgAllowDisplayTitle=true
20619 wgRestrictDisplayTitle=true
20620 !! wikitext
20621 this is not the the title
20622 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20623 !! html/php
20624 <span style="color: red;">s</span>creen
20625 <p>this is not the the title
20626 </p>
20627 !! end
20628
20629 !! test
20630 Page status indicators: Empty name is invalid
20631 !! options
20632 showindicators
20633 !! wikitext
20634 <indicator name=" "></indicator>
20635 <indicator></indicator>
20636 !! html
20637 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20638 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20639 </p>
20640 !! end
20641
20642 !! test
20643 Page status indicators: Weird syntaxes that are okay
20644 !! options
20645 showindicators
20646 !! wikitext
20647 <indicator name="empty" />
20648 <indicator name="name"></indicator>
20649 !! html
20650 empty=
20651 name=
20652 <p><br />
20653 </p>
20654 !! end
20655
20656 !! test
20657 Page status indicators: Torture test
20658 !! options
20659 showindicators
20660 !! wikitext
20661 <indicator name="01">hello world</indicator>
20662 <indicator name="02">[[Main Page]]</indicator>
20663 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20664 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20665 <indicator name="05">* foo
20666 * bar</indicator>
20667 <indicator name="06"><nowiki>foo</nowiki></indicator>
20668 <indicator name="07"> Preformatted</indicator>
20669 <indicator name="08"><div>Broken tag</indicator>
20670 <indicator name="09">{| class=wikitable
20671 | cell
20672 |}</indicator>
20673 <indicator name="10">Two
20674
20675 paragraphs</indicator>
20676 !! html
20677 01=hello world
20678 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20679 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" />
20680 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>
20681 05=<ul><li> foo</li>
20682 <li> bar</li></ul>
20683
20684 06=foo
20685 07=<pre>Preformatted
20686 </pre>
20687 08=<div>Broken tag</div>
20688
20689 09=<table class="wikitable">
20690 <tr>
20691 <td> cell
20692 </td></tr></table>
20693
20694 10=<p>Two
20695 </p><p>paragraphs
20696 </p>
20697 <p><br />
20698 </p><p><br />
20699 </p><p><br />
20700 </p><p><br />
20701 </p><p><br />
20702 </p>
20703 !! end
20704
20705 !! test
20706 preload: check <noinclude> and <includeonly>
20707 !! options
20708 preload
20709 !! wikitext
20710 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20711 !! html/php
20712 Hello kind world.
20713 !! end
20714
20715 !! test
20716 preload: check <onlyinclude>
20717 !! options
20718 preload
20719 !! wikitext
20720 Goodbye <onlyinclude>Hello world</onlyinclude>
20721 !! html/php
20722 Hello world
20723 !! end
20724
20725 !! test
20726 preload: can pass tags through if we want to
20727 !! options
20728 preload
20729 !! wikitext
20730 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20731 !! html/php
20732 <includeonly>Hello world</includeonly>
20733 !! end
20734
20735 !! test
20736 preload: check that it doesn't try to do tricks
20737 !! options
20738 preload
20739 !! wikitext
20740 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20741 !! html/php
20742 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20743 !! end
20744
20745 !! test
20746 Play a bit with r67090 and bug 3158
20747 !! wikitext
20748 <div style="width:50% !important">&nbsp;</div>
20749 <div style="width:50%&nbsp;!important">&nbsp;</div>
20750 <div style="width:50%&#160;!important">&nbsp;</div>
20751 <div style="border : solid;">&nbsp;</div>
20752 !! html/php
20753 <div style="width:50% !important">&#160;</div>
20754 <div style="width:50% !important">&#160;</div>
20755 <div style="width:50% !important">&#160;</div>
20756 <div style="border&#160;: solid;">&#160;</div>
20757
20758 !! html/parsoid
20759 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20760 <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>
20761 <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>
20762 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20763
20764 !! end
20765
20766 !! test
20767 HTML5 data attributes
20768 !! wikitext
20769 <span data-foo="bar">Baz</span>
20770 <p data-abc-def_hij="">Quuz</p>
20771 !! html/php
20772 <p><span data-foo="bar">Baz</span>
20773 </p>
20774 <p data-abc-def_hij="">Quuz</p>
20775
20776 !! html/parsoid
20777 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20778 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20779 !! end
20780
20781 !! test
20782 Strip reserved data attributes
20783 !! wikitext
20784 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20785 !! html/php
20786 <div data-ok="fred">d</div>
20787
20788 !! html/parsoid
20789 <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>
20790 !! end
20791
20792 !! test
20793 percent-encoding and + signs in internal links (Bug 26410)
20794 !! wikitext
20795 [[User:+%]] [[Page+title%]]
20796 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20797 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20798 [[%33%45]] [[%33%45+]]
20799 !! html/php
20800 <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>
20801 <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>
20802 <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>
20803 <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>
20804 </p>
20805 !! html/parsoid
20806 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20807 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20808 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
20809 <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>
20810 !! end
20811
20812 !! test
20813 Special characters in embedded file links (bug 27679)
20814 !! wikitext
20815 [[File:Contains & ampersand.jpg]]
20816 [[File:Does not exist.jpg|Title with & ampersand]]
20817 !! html/php
20818 <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>
20819 <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>
20820 </p>
20821 !! html/parsoid
20822 <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>
20823 <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>
20824 !! end
20825
20826 !! test
20827 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20828 !! wikitext
20829 Text&apos;s been normalized?
20830 !! html
20831 <p>Text&#39;s been normalized?
20832 </p>
20833 !! end
20834
20835 !! test
20836 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20837 !! wikitext
20838 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20839 !! html
20840 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20841 </p>
20842 !! end
20843
20844 !! test
20845 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20846 !! wikitext
20847 [http://www.example.org/ ideograms]
20848 !! html
20849 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20850 </p>
20851 !! end
20852
20853 !! test
20854 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20855 !! wikitext
20856 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20857 !! html
20858 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20859 </p>
20860 !! end
20861
20862 !! article
20863 Mediawiki:loop1
20864 !! text
20865 {{Identical|A}}
20866 !! endarticle
20867
20868 !! article
20869 Mediawiki:loop2
20870 !! text
20871 {{Identical|B}}
20872 !! endarticle
20873
20874 !! article
20875 Template:Identical
20876 !! text
20877 {{int:loop1}}
20878 {{int:loop2}}
20879 !! endarticle
20880
20881 !! test
20882 Bug 31098 Template which includes system messages which includes the template
20883 !! wikitext
20884 {{Identical}}
20885 !! html
20886 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20887 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20888 </p>
20889 !! end
20890
20891 !! test
20892 Bug31490 Turkish: ucfirst 'blah'
20893 !! options
20894 language=tr
20895 !! wikitext
20896 {{ucfirst:blah}}
20897 !! html
20898 <p>Blah
20899 </p>
20900 !! end
20901
20902 !! test
20903 Bug31490 Turkish: ucfirst 'ix'
20904 !! options
20905 language=tr
20906 !! wikitext
20907 {{ucfirst:ix}}
20908 !! html
20909 <p>İx
20910 </p>
20911 !! end
20912
20913 !! test
20914 Bug31490 Turkish: lcfirst 'BLAH'
20915 !! options
20916 language=tr
20917 !! wikitext
20918 {{lcfirst:BLAH}}
20919 !! html
20920 <p>bLAH
20921 </p>
20922 !! end
20923
20924 !! test
20925 Bug31490 Turkish: ucfırst (with a dotless i)
20926 !! options
20927 language=tr
20928 !! wikitext
20929 {{ucfırst:blah}}
20930 !! html
20931 <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>
20932 </p>
20933 !! end
20934
20935 !! test
20936 Bug31490 ucfırst (with a dotless i) with English language
20937 !! options
20938 language=en
20939 !! wikitext
20940 {{ucfırst:blah}}
20941 !! html
20942 <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>
20943 </p>
20944 !! end
20945
20946 !! test
20947 Bug 26375: TOC with italics
20948 !! options
20949 title=[[Main Page]]
20950 !! wikitext
20951 __TOC__
20952 == ''Lost'' episodes ==
20953 !! html
20954 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20955 <ul>
20956 <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>
20957 </ul>
20958 </div>
20959
20960 <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>
20961
20962 !! end
20963
20964 !! test
20965 Bug 26375: TOC with bold
20966 !! options
20967 title=[[Main Page]]
20968 !! wikitext
20969 __TOC__
20970 == '''should be bold''' then normal text ==
20971 !! html
20972 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20973 <ul>
20974 <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>
20975 </ul>
20976 </div>
20977
20978 <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>
20979
20980 !! end
20981
20982 !! test
20983 Bug 33845: Headings become cursive in TOC when they contain an image
20984 !! options
20985 title=[[Main Page]]
20986 !! wikitext
20987 __TOC__
20988 == Image [[Image:foobar.jpg]] ==
20989 !! html
20990 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20991 <ul>
20992 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20993 </ul>
20994 </div>
20995
20996 <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>
20997
20998 !! end
20999
21000 !! test
21001 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21002 !! options
21003 title=[[Main Page]]
21004 !! wikitext
21005 __TOC__
21006 == <blockquote>Quote</blockquote> ==
21007 !! html
21008 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21009 <ul>
21010 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21011 </ul>
21012 </div>
21013
21014 <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>
21015
21016 !! html+tidy
21017 <p></p>
21018 <div id="toc" class="toc">
21019 <div id="toctitle">
21020 <h2>Contents</h2>
21021 </div>
21022 <ul>
21023 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21024 </ul>
21025 </div>
21026 <p></p>
21027 <h2><span class="mw-headline" id="Quote"></span></h2>
21028 <blockquote>
21029 <p><span class="mw-headline" id="Quote">Quote</span></p>
21030 </blockquote>
21031 <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>
21032 !! end
21033
21034 !! test
21035 Unclosed tags in TOC
21036 !! options
21037 title=[[Main Page]]
21038 !! wikitext
21039 __TOC__
21040 == Proof: 2 < 3 ==
21041 <small>Hanc marginis exiguitas non caperet.</small>
21042 QED
21043 !! html
21044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21045 <ul>
21046 <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>
21047 </ul>
21048 </div>
21049
21050 <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>
21051 <p><small>Hanc marginis exiguitas non caperet.</small>
21052 QED
21053 </p>
21054 !! end
21055
21056 !! test
21057 Multiple tags in TOC
21058 !! wikitext
21059 __TOC__
21060 == <i>Foo</i> <b>Bar</b> ==
21061
21062 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21063 !! html
21064 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21065 <ul>
21066 <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>
21067 <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>
21068 </ul>
21069 </div>
21070
21071 <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>
21072 <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>
21073
21074 !! html+tidy
21075 <p></p>
21076 <div id="toc" class="toc">
21077 <div id="toctitle">
21078 <h2>Contents</h2>
21079 </div>
21080 <ul>
21081 <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>
21082 <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>
21083 </ul>
21084 </div>
21085 <p></p>
21086 <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>
21087 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21088 <blockquote>
21089 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21090 </blockquote>
21091 <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>
21092 !! end
21093
21094 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21095 # html5 tag parsing.
21096 !! test
21097 Tags with parameters in TOC
21098 !! options
21099 parsoid=wt2html
21100 !! wikitext
21101 __TOC__
21102 == <sup class="in-h2">Hello</sup> ==
21103
21104 == <sup class="a > b">Evilbye</sup> ==
21105 !! html/php
21106 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21107 <ul>
21108 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21109 <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>
21110 </ul>
21111 </div>
21112
21113 <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>
21114 <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>
21115
21116 !! html/parsoid
21117 <meta property="mw:PageProp/toc" />
21118 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21119
21120 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21121 !! end
21122
21123 !! test
21124 span tags with directionality in TOC
21125 !! wikitext
21126 __TOC__
21127 == <span dir="ltr">C++</span> ==
21128
21129 == <span dir="rtl">זבנג!</span> ==
21130
21131 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21132
21133 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21134
21135 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21136 !! html
21137 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21138 <ul>
21139 <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>
21140 <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>
21141 <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>
21142 <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>
21143 <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>
21144 </ul>
21145 </div>
21146
21147 <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>
21148 <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>
21149 <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>
21150 <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>
21151 <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>
21152
21153 !! end
21154
21155 !! test
21156 Bug 72884: bdi element in ToC
21157 !! wikitext
21158 __TOC__
21159 == <bdi>test</bdi> ==
21160 !! html
21161 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21162 <ul>
21163 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21164 </ul>
21165 </div>
21166
21167 <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>
21168
21169 !! end
21170
21171 # Note that the html output does not have the <p></p>, but the
21172 # html+tidy output *does*. This is because the empty <p></p> is
21173 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21174 !! test
21175 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21176 !! wikitext
21177 __TOC__
21178 == x ==
21179 !! html
21180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21181 <ul>
21182 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21183 </ul>
21184 </div>
21185
21186 <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>
21187
21188 !! html+tidy
21189 <p></p>
21190 <div id="toc" class="toc">
21191 <div id="toctitle">
21192 <h2>Contents</h2>
21193 </div>
21194 <ul>
21195 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21196 </ul>
21197 </div>
21198 <p></p>
21199 <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>
21200 !! end
21201
21202 !! article
21203 MediaWiki:Bug32057
21204 !! text
21205 == {{int:headline_sample}} ==
21206 !! endarticle
21207
21208 !! test
21209 Bug 32057: Title needed when expanding <h> nodes.
21210 !! options
21211 title=[[Main Page]]
21212 !! wikitext
21213 {{int:Bug32057}}
21214 !! html
21215 <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>
21216
21217 !! end
21218
21219 !! test
21220 Strip marker in urlencode
21221 !! wikitext
21222 {{urlencode:x<nowiki/>y}}
21223 {{urlencode:x<nowiki/>y|wiki}}
21224 {{urlencode:x<nowiki/>y|path}}
21225 {{urlencode:x<pre id="one">two</pre>y}}
21226 !! html
21227 <p>xy
21228 xy
21229 xy
21230 xy
21231 </p>
21232 !! end
21233
21234 !! test
21235 Strip marker in lc
21236 !! wikitext
21237 {{lc:x<nowiki/>y}}
21238 !! html
21239 <p>xy
21240 </p>
21241 !! end
21242
21243 !! test
21244 Strip marker in uc
21245 !! wikitext
21246 {{uc:x<nowiki/>y}}
21247 !! html
21248 <p>XY
21249 </p>
21250 !! end
21251
21252 !! test
21253 Strip marker in formatNum
21254 !! wikitext
21255 {{formatnum:1<nowiki/>2}}
21256 {{formatnum:1<nowiki/>2|R}}
21257 !! html
21258 <p>12
21259 12
21260 </p>
21261 !! end
21262
21263 !! test
21264 Check noCommafy in formatNum
21265 !! options
21266 language=be-tarask
21267 !! wikitext
21268 {{formatnum:123456.78}}
21269 {{formatnum:123456.78|NOSEP}}
21270 !! html
21271 <p>123 456,78
21272 123456.78
21273 </p>
21274 !! end
21275
21276 !! test
21277 Wrong option for formatNum (bug 56199)
21278 !! wikitext
21279 {{formatnum:1,234.56|Random}}
21280 {{formatnum:1,234.56|EVERYTHING}}
21281 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21282 !! html
21283 <p>1,234.56
21284 1,234.56
21285 1,234.56
21286 </p>
21287 !! end
21288
21289 !! test
21290 Strip marker in grammar
21291 !! options
21292 language=fi
21293 !! wikitext
21294 {{grammar:elative|foo<nowiki/>bar}}
21295 !! html
21296 <p>foobarista
21297 </p>
21298 !! end
21299
21300 !! test
21301 Strip marker in padleft
21302 !! wikitext
21303 {{padleft:|2|x<nowiki/>y}}
21304 !! html
21305 <p>xy
21306 </p>
21307 !! end
21308
21309 !! test
21310 Strip marker in padright
21311 !! wikitext
21312 {{padright:|2|x<nowiki/>y}}
21313 !! html
21314 <p>xy
21315 </p>
21316 !! end
21317
21318 !! test
21319 Strip marker in anchorencode
21320 !! wikitext
21321 {{anchorencode:x<nowiki/>y}}
21322 !! html
21323 <p>xy
21324 </p>
21325 !! end
21326
21327 !! test
21328 nowiki inside link inside heading (bug 18295)
21329 !! wikitext
21330 ==[[foo|x<nowiki>y</nowiki>z]]==
21331 !! html
21332 <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>
21333
21334 !! end
21335
21336 !! test
21337 new support for bdi element (bug 31817)
21338 !! wikitext
21339 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21340 !! html
21341 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21342
21343 !!end
21344
21345 !! test
21346 Ignore pipe between table row attributes
21347 !! wikitext
21348 {|
21349 | quux
21350 |- id=foo | style='color: red'
21351 | bar
21352 |}
21353 !! html
21354 <table>
21355 <tr>
21356 <td> quux
21357 </td></tr>
21358 <tr id="foo" style="color: red">
21359 <td> bar
21360 </td></tr></table>
21361
21362 !! end
21363
21364 !!test
21365 Gallery override link with WikiLink (bug 34852)
21366 !! wikitext
21367 <gallery>
21368 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21369 </gallery>
21370 !! html
21371 <ul class="gallery mw-gallery-traditional">
21372 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21373 <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>
21374 <div class="gallerytext">
21375 <p>caption
21376 </p>
21377 </div>
21378 </div></li>
21379 </ul>
21380
21381 !! end
21382
21383 !!test
21384 Gallery override link with absolute external link (bug 34852)
21385 !! wikitext
21386 <gallery>
21387 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21388 </gallery>
21389 !! html
21390 <ul class="gallery mw-gallery-traditional">
21391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21392 <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>
21393 <div class="gallerytext">
21394 <p>caption
21395 </p>
21396 </div>
21397 </div></li>
21398 </ul>
21399
21400 !! end
21401
21402 !!test
21403 Gallery override link with malicious javascript (bug 34852)
21404 !! wikitext
21405 <gallery>
21406 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21407 </gallery>
21408 !! html
21409 <ul class="gallery mw-gallery-traditional">
21410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21411 <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>
21412 <div class="gallerytext">
21413 <p>caption
21414 </p>
21415 </div>
21416 </div></li>
21417 </ul>
21418
21419 !! end
21420
21421 !!test
21422 Gallery with invalid title as link (bug 43964)
21423 !! wikitext
21424 <gallery>
21425 File:foobar.jpg|link=<
21426 </gallery>
21427 !! html
21428 <ul class="gallery mw-gallery-traditional">
21429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21430 <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>
21431 <div class="gallerytext">
21432 </div>
21433 </div></li>
21434 </ul>
21435
21436 !! end
21437
21438 !!test
21439 Language parser function
21440 !! wikitext
21441 {{#language:ar}}
21442 !! html
21443 <p>العربية
21444 </p>
21445 !! end
21446
21447 !!test
21448 Padleft and padright as substr
21449 !! wikitext
21450 {{padleft:|3|abcde}}
21451 {{padright:|3|abcde}}
21452 !! html
21453 <p>abc
21454 abc
21455 </p>
21456 !! end
21457
21458 !!test
21459 Special parser function
21460 !! wikitext
21461 {{#special:RandomPage}}
21462 {{#special:BaDtItLe}}
21463 {{#special:Foobar}}
21464 !! html
21465 <p>Special:Random
21466 Special:Badtitle
21467 Special:Foobar
21468 </p>
21469 !! end
21470
21471 !!test
21472 Bug 34939 - Case insensitive link parsing ([HttP://])
21473 !! wikitext
21474 [HttP://MediaWiki.Org/]
21475 !! html/php
21476 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21477 </p>
21478 !! html/parsoid
21479 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21480 !! end
21481
21482 !!test
21483 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21484 !! wikitext
21485 [HttP://MediaWiki.Org/ MediaWiki]
21486 !! html
21487 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21488 </p>
21489 !! end
21490
21491 !!test
21492 Bug 34939 - Case insensitive link parsing (HttP://)
21493 !! wikitext
21494 HttP://MediaWiki.Org/
21495 !! html/php
21496 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21497 </p>
21498 !! html/parsoid
21499 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21500 !! end
21501
21502 !!test
21503 Disable TOC
21504 !! options
21505 notoc
21506 !! wikitext
21507 Lead
21508 == Section 1 ==
21509 == Section 2 ==
21510 == Section 3 ==
21511 == Section 4 ==
21512 == Section 5 ==
21513 !! html
21514 <p>Lead
21515 </p>
21516
21517 <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>
21518 <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>
21519 <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>
21520 <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>
21521 <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>
21522
21523 !! end
21524
21525
21526 ###
21527 ### Parsoid-specific tests
21528 ### Parsoid-PHP parser incompatibilities
21529 ###
21530 !!test
21531 1. SOL-sensitive wikitext tokens as template-args
21532 !!options
21533 parsoid=wt2html,wt2wt
21534 !! wikitext
21535 {{echo|*a}}
21536 {{echo|#a}}
21537 {{echo|:a}}
21538 !! html
21539 <span about="#mwt1" typeof="mw:Transclusion">
21540 </span><ul about="#mwt1"><li>a</li>
21541 </ul>
21542 <span about="#mwt2" typeof="mw:Transclusion">
21543 </span><ol about="#mwt2"><li>a</li>
21544 </ol>
21545 <span about="#mwt3" typeof="mw:Transclusion">
21546 </span><dl about="#mwt3"><dd>a</dd>
21547 </dl>
21548 !!end
21549
21550 #### -----------------------------------------------------------------
21551 #### Parsoid-specific functionality tests
21552 #### -----------------------------------------------------------------
21553
21554 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21555 # We know wt2wt will fail, but we expect selser to pass.
21556 # Due to the nature of our testing, wt2wt and selser tests will enter the
21557 # blacklist and we'll catch selser regressions based on changes to the
21558 # blacklist entries for selser tests.
21559 !! test
21560 1. Bad treebuilder fixup of formatting elt is cleaned up
21561 !! options
21562 parsoid=wt2html,wt2wt
21563 !! wikitext
21564 {|
21565 |
21566 <small>
21567 [[Image:Foobar.jpg|right|Test]]
21568 </small>
21569 |}
21570 !! html/parsoid
21571 <table>
21572 <tbody><tr><td>
21573 <small>
21574 <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>
21575 </small>
21576 </td></tr>
21577 </tbody></table>
21578 !! end
21579
21580 !! test
21581 2. Bad treebuilder fixup of formatting elt is cleaned up
21582 !! options
21583 parsoid=wt2html,wt2wt
21584 !! wikitext
21585 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21586
21587 <small>[[Image:Foobar.jpg|right|300px]]</small>
21588 !! html/parsoid
21589
21590 <p><b>foo</b></p>
21591 <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>
21592 <p><b>bar</b></p>
21593 <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>
21594 !! end
21595
21596 !! test
21597 3. Bad treebuilder fixup of formatting elt is cleaned up
21598 !! options
21599 parsoid=wt2html,wt2wt
21600 !! wikitext
21601 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21602 !! html/parsoid
21603 <p><small><b>foo</b></small></p>
21604 <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>
21605 <p><small><b>bar</b></small></p>
21606 !! end
21607
21608 !! test
21609 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21610 !! options
21611 parsoid=wt2html,wt2wt
21612 !! wikitext
21613 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21614 !! html/parsoid
21615 <p><b><small></small></b></p>
21616 <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>
21617 <p></p>
21618 !! end
21619
21620 #### ----------------------------------------------------------------
21621 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21622 #### tags. Parsoid's output for these tags differs from that of the
21623 #### PHP parser.
21624 #### ----------------------------------------------------------------
21625
21626 !!test
21627 Ref: 1. ref-location should be replaced with an index span
21628 !! wikitext
21629 A <ref>foo</ref>
21630 B <ref name="x">foo</ref>
21631 C <ref name="y" />
21632 <references />
21633 !! html/parsoid
21634 <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>
21635 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>
21636 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>
21637 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21638 <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>
21639 <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>
21640 <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>
21641 </ol>
21642 !!end
21643
21644 !!test
21645 Ref: 2. ref-tags with identical names should all get the same index
21646 !! wikitext
21647 A <ref name="x">foo</ref>
21648 B <ref name="x" />
21649 <references />
21650 !! html/parsoid
21651 <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>
21652 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>
21653 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21654 <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>
21655 </ol>
21656 !!end
21657
21658 !!test
21659 Ref: 3. spaces in ref-names should be ignored
21660 !! wikitext
21661 A <ref name="x">foo</ref>
21662 B <ref name=" x " />
21663 C <ref name= x />
21664 <references />
21665 !! html/parsoid
21666 <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>
21667 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>
21668 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>
21669 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21670 <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>
21671 </ol>
21672 !!end
21673
21674 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21675 !!test
21676 Ref: 4. 'constructor' should be accepted as a valid ref-name
21677 !! wikitext
21678 A <ref name="constructor">foo</ref>
21679 <references />
21680 !! html/parsoid
21681 <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>
21682 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21683 <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>
21684 </ol>
21685 !!end
21686
21687 !!test
21688 Ref: 5. body should accept generic wikitext
21689 !! wikitext
21690 A <ref>
21691 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21692 </ref>
21693
21694 <references />
21695 !! html/parsoid
21696 <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>
21697
21698 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21699 <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>
21700 </span></li>
21701 </ol>
21702 !!end
21703
21704 !!test
21705 Ref: 6. indent-pres should not be output in ref-body
21706 !! wikitext
21707 A <ref>
21708 foo
21709 bar
21710 baz
21711 </ref>
21712
21713 <references />
21714 !! html/parsoid
21715 <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>
21716
21717 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21718 <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
21719 bar
21720 baz
21721 </span></li>
21722 </ol>
21723 !!end
21724
21725 !!test
21726 Ref: 7. No p-wrapping in ref-body
21727 !! wikitext
21728 A <ref>
21729 foo
21730
21731 bar
21732
21733
21734 baz
21735
21736
21737
21738 booz
21739 </ref>
21740
21741 <references />
21742 !! html/parsoid
21743 <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>
21744
21745 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21746 <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
21747
21748 bar
21749
21750
21751 baz
21752
21753
21754
21755 booz
21756 </span></li>
21757 </ol>
21758 !!end
21759
21760 !!test
21761 Ref: 8. transclusion wikitext has lower precedence
21762 !! wikitext
21763 A <ref> foo {{echo|</ref> B C}}
21764
21765 <references />
21766 !! html/parsoid
21767 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
21768 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21769 <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>
21770 </ol>
21771 !!end
21772
21773 !!test
21774 Ref: 9. unclosed comments should not leak out of ref-body
21775 !! wikitext
21776 A <ref> foo <!--</ref> B C
21777 <references />
21778 !! html/parsoid
21779 <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>
21780 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21781 <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>
21782 </ol>
21783 !!end
21784
21785 !!test
21786 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21787 !! wikitext
21788 A <ref> <b> foo </ref> B C
21789
21790 <references />
21791 !! html/parsoid
21792 <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>
21793
21794
21795 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21796 <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>
21797 </ol>
21798 !!end
21799
21800 !!test
21801 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21802 !! wikitext
21803 A <ref>foo</ref> B
21804 C <ref>bar</ref> D
21805 <references />
21806 !! html/parsoid
21807 <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
21808 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>
21809 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21810 <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>
21811 <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>
21812 </ol>
21813 !!end
21814
21815 !!test
21816 Ref: 12. ref-tags act as trailing newline migration barrier
21817 !! wikitext
21818 <!--the newline at the end of this line moves out of the p tag-->a
21819
21820 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21821 <ref />
21822
21823 c
21824 <references />
21825 !! html/parsoid
21826 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21827
21828
21829 <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>
21830 <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>
21831
21832 <p>c</p>
21833 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21834 <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>
21835 <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>
21836 !!end
21837
21838 !!test
21839 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21840 !! wikitext
21841 <ref>foo</ref> A
21842 <ref>bar
21843 </ref> B
21844 <references />
21845 !! html/parsoid
21846 <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
21847 <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>
21848 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21849 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21850 <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
21851 </span></li>
21852 </ol>
21853 !!end
21854
21855 !!test
21856 Ref: 14. A nested ref-tag should be emitted as plain text
21857 !! wikitext
21858 <ref>foo <ref>bar</ref> baz</ref>
21859
21860 <references />
21861 !! html/parsoid
21862 <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>
21863 </p>
21864 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21865 <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>
21866 </ol>
21867 !!end
21868
21869 !!test
21870 Ref: 15. ref-tags with identical names should get identical indexes
21871 !! wikitext
21872 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21873 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21874
21875 <references />
21876 !! html/parsoid
21877 <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>
21878 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>
21879
21880 <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>
21881 </ol>
21882 !!end
21883
21884 ## We don't bother wt2wt-ing non-standard whitespace
21885 !!test
21886 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21887 !!options
21888 parsoid=wt2html
21889 !! wikitext
21890 A <ref >foo</ref >
21891
21892 <references />
21893 !! html/parsoid
21894 <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>
21895 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21896 <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>
21897 !!end
21898
21899 !!test
21900 Ref: 17. Generate valid HTML5 id/about attributes
21901 !!wikitext
21902 <ref name="a b">foo</ref>
21903
21904 <references />
21905 !!html/parsoid
21906 <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>
21907 </p>
21908
21909 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21910 <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>
21911 </ol>
21912 !!end
21913
21914 !!test
21915 Ref: 18. T58916: Extension attributes should be parsed as plain text
21916 !!wikitext
21917 <ref name="{{echo|a}}">foo</ref>
21918
21919 <references />
21920 !!html/parsoid
21921 <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>
21922 </p>
21923
21924 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21925 <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>
21926 </ol>
21927 !!end
21928
21929 !!test
21930 Ref: 19. ref-tags with identical name encodings should get identical indexes
21931 !! wikitext
21932 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21933
21934 <references />
21935 !! html/parsoid
21936 <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>
21937 </p>
21938 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21939 <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>
21940 </ol>
21941 !!end
21942
21943 !!test
21944 Ref: 20. ref-tags with identical names but different content should keep it
21945 !! wikitext
21946 A <ref name="foo">Foo one</ref>
21947 B <ref name="foo">Foo two</ref>
21948 C <ref name="foo" />
21949
21950 <references />
21951 !! html/parsoid
21952 <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>
21953 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>
21954 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>
21955
21956 <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>
21957 </ol>
21958 !!end
21959
21960 !!test
21961 References: 1. references tag without any refs should be handled properly
21962 !! wikitext
21963 <references />
21964 !! html/parsoid
21965 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21966 !!end
21967
21968 !!test
21969 References: 2. references tag with group only outputs references from that group
21970 !! wikitext
21971 A <ref group="a">foo</ref>
21972 B <ref group="b">bar</ref>
21973 C <ref>baz</ref>
21974
21975 <references group="a" />
21976 <references />
21977 <references group="b" />
21978 !! html/parsoid
21979 <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>
21980 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>
21981 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>
21982
21983 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21984 <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>
21985 </ol>
21986 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21987 <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>
21988 </ol>
21989 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21990 <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>
21991 </ol>
21992 !!end
21993
21994 !!test
21995 References: 3. ref list should be cleared after processing references
21996 !! wikitext
21997 A <ref>foo</ref>
21998
21999 <references />
22000
22001 B <ref>bar</ref>
22002
22003 <references />
22004 !! html/parsoid
22005 <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>
22006
22007 <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>
22008 </ol>
22009
22010 <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>
22011
22012 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22013 <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>
22014 </ol>
22015 !!end
22016
22017 !!test
22018 References: 4. only referenced group should be cleared after processing references
22019 !! wikitext
22020 A <ref group="a">afoo</ref>
22021 B <ref>bfoo</ref>
22022
22023 <references group="a" />
22024
22025 C <ref>cfoo</ref>
22026
22027 <references />
22028 !! html/parsoid
22029 <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>
22030 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>
22031
22032 <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>
22033 </ol>
22034
22035 <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>
22036
22037 <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>
22038 </ol>
22039 !!end
22040
22041 ## Don't expect this to rt since we're dropping content
22042 !! test
22043 References: 5. ref tags in references should be processed while ignoring all other content
22044 !! options
22045 parsoid=wt2html,html2html
22046 !! wikitext
22047 A <ref name="a" />
22048 B <ref name="b">bar</ref>
22049
22050 <references>
22051 <ref name="a">foo</ref>
22052 This should just get lost.
22053 </references>
22054 !! html/parsoid
22055 <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>
22056 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>
22057
22058
22059 <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;\">&lt;span class=\"mw-reflink-text\">[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>
22060 </ol>
22061 !! end
22062
22063 !! test
22064 References: 6. <references /> from a transclusion
22065 !! wikitext
22066 <ref>Foo</ref> {{echo|<references />}}
22067 !! html/parsoid
22068 <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>
22069 </ol>
22070 !! end
22071
22072 !! test
22073 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22074 !! wikitext
22075 A <ref>foo bar for a</ref>
22076 B <ref group="X" name="b" />
22077
22078 <references />
22079
22080 <references group="X">
22081 <ref name="b">foo</ref>
22082 </references>
22083 !! html/parsoid
22084 <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>
22085 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>
22086 </p>
22087
22088 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22089 <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>
22090 </ol>
22091
22092 <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\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22093 <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>
22094 </ol>
22095 !! end
22096
22097 !! test
22098 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22099 !! wikitext
22100 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22101 <references />
22102 !! html/parsoid
22103 <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>
22104 <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>
22105 </ol>
22106 !!end
22107
22108 # This test only works in wt2html now as the <references /> are always generated
22109 # unless selser is active. Once T72722 is fixed, we should add a changes test
22110 # here to ensure that unrelated changes don't add the new <references /> in
22111 # wt2wt.
22112 !! test
22113 References: 9. Generate missing references list at the end
22114 !! wikitext
22115 A <ref>foo</ref>
22116 B <ref group="inexistent">bar</ref>
22117 !! html/parsoid
22118 <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>
22119 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22120 <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>
22121 </ol>
22122 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22123 <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>
22124 </ol>
22125 !! end
22126
22127 !! test
22128 References: 10. New <references/> shouldn't be added for unrelated edits.
22129 !! options
22130 parsoid={
22131 "modes": ["selser"],
22132 "changes": [["#x", "remove"]],
22133 "selser": "noauto"
22134 }
22135 !! wikitext
22136 Unrelated text<span id="x"> that's going to disappear</span>.
22137 A <ref>foo</ref>
22138 !! wikitext/edited
22139 Unrelated text.
22140 A <ref>foo</ref>
22141 !!end
22142
22143 !! test
22144 Entities in ref name
22145 !! wikitext
22146 <ref name="test &amp; me">hi</ref>
22147 <references />
22148 !! html/parsoid
22149 <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>
22150 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22151 <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>
22152 </ol>
22153 !! end
22154
22155 # This test is wt2html only because we're permitting the serializer to produce
22156 # dirty diffs, normalizing the unclosed references to the self-closed version.
22157 !! test
22158 Generate references for unclosed references tag
22159 !! options
22160 parsoid=wt2html
22161 !! wikitext
22162 a<ref>foo</ref>
22163
22164 <references>
22165 !! html/parsoid
22166 <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>
22167 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22168 <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>
22169 !! end
22170
22171 !! test
22172 New reference serializes on its own line
22173 !! options
22174 parsoid=wt2wt,html2wt
22175 !! wikitext
22176 foo
22177 <references />
22178 !! html/parsoid
22179 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22180 !! end
22181
22182 #### ----------------------------------------------------------------
22183 #### Parsoid-only testing of Parsoid's impl of LST
22184 #### Not implemented yet, see
22185 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22186 #### ----------------------------------------------------------------
22187
22188 !! test
22189 LST Sections: 1. Simple section start and end
22190 !! options
22191 parsoid={ "suppressErrors": true }
22192 !! wikitext
22193 <section begin="2011-05-16" />
22194 <section end="2014-04-10 (MW 1.23wmf22)" />
22195 !! html/parsoid
22196 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22197 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22198 !! end
22199
22200 #--------- Test stripping of empty nodes in template content ----------
22201 !!test
22202 Empty LI and TR nodes should be stripped from template content
22203 !!wikitext
22204 {{EmptyLITest}}
22205 {{EmptyTRTest}}
22206 !!html/parsoid
22207 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22208 <li>a</li>
22209 <li>b</li>
22210 </ul>
22211 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22212 <tbody>
22213 <tr>
22214 <td>foo</td>
22215 </tr>
22216 <tr>
22217 <td>bar</td>
22218 </tr>
22219 </tbody>
22220 </table>
22221 !!end
22222
22223 !!test
22224 Empty LI and TR nodes should not be stripped from top-level content
22225 !!wikitext
22226 * a
22227 *
22228 * b
22229 {|
22230 |-
22231 |-
22232 |foo
22233 |}
22234 !!html/parsoid
22235 <ul>
22236 <li> a</li>
22237 <li></li>
22238 <li> b</li>
22239 </ul>
22240 <table>
22241 <tbody>
22242 <tr></tr>
22243 <tr>
22244 <td>foo</td>
22245 </tr>
22246 </tbody>
22247 </table>
22248 !!end
22249
22250 !!test
22251 Empty TR nodes should not be stripped if they have any attributes set
22252 !!wikitext
22253 {{EmptyTRWithHTMLAttrTest}}
22254 !!html/parsoid
22255 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22256 <tr align="center"></tr>
22257 <tr><td>foo</td></tr>
22258 <tr align="center"></tr>
22259 <tr><td>bar</td></tr>
22260 </table>
22261 !!end
22262
22263 #### ----------------------------------------------------------------
22264 #### The following section of tests are primarily to test
22265 #### wikitext escaping capabilities of Parsoid. Given that
22266 #### escaping can be done any number of ways, the wikitext (input)
22267 #### is always adjusted to reflect how Parsoid adds nowiki
22268 #### escape tags.
22269 ####
22270 #### We are marking several tests as parsoid-only since the
22271 #### HTML in the result section is different from what the
22272 #### PHP parser generates for it.
22273 #### ----------------------------------------------------------------
22274
22275
22276 #### --------------- Headings ---------------
22277 #### 0. Unnested
22278 #### 1. Nested inside html <h1>=foo=</h1>
22279 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22280 #### 3. Nested inside html with wikitext split by html tags
22281 #### 4. No escape needed
22282 #### 5. Empty headings <h1></h1>
22283 #### 6. Heading chars in SOL context
22284 #### ----------------------------------------
22285 !! test
22286 Headings: 0. Unnested
22287 !! options
22288 parsoid=html2wt
22289 !! html/parsoid
22290 <p>=foo=</p>
22291
22292 <p> =foo=
22293 <!--cmt-->
22294 =foo=</p>
22295
22296 <p>=foo<i>a</i>=</p>
22297 !! wikitext
22298 <nowiki>=foo=</nowiki>
22299
22300 <nowiki> </nowiki>=foo=
22301 <!--cmt-->
22302 <nowiki>=foo=</nowiki>
22303
22304 =foo''a''<nowiki>=</nowiki>
22305 !!end
22306
22307 # New headings and existing headings are handled differently
22308 !! test
22309 Headings: 1. Nested inside html
22310 !! options
22311 parsoid=html2wt
22312 !! html/parsoid
22313 <h1>=foo=</h1>
22314 <h2>=foo=</h2>
22315 <h3>=foo=</h3>
22316
22317 <h1 data-parsoid=''>=foo=</h1>
22318 <h2 data-parsoid=''>=foo=</h2>
22319 <h3 data-parsoid=''>=foo=</h3>
22320 <h4 data-parsoid=''>=foo=</h4>
22321 <h5 data-parsoid=''>=foo=</h5>
22322 <h6 data-parsoid=''>=foo=</h6>
22323 !! wikitext
22324 = =foo= =
22325
22326 == =foo= ==
22327
22328 === =foo= ===
22329
22330 =<nowiki>=foo=</nowiki>=
22331 ==<nowiki>=foo=</nowiki>==
22332 ===<nowiki>=foo=</nowiki>===
22333 ====<nowiki>=foo=</nowiki>====
22334 =====<nowiki>=foo=</nowiki>=====
22335 ======<nowiki>=foo=</nowiki>======
22336
22337 !!end
22338
22339 !! test
22340 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22341 !! options
22342 parsoid=html2wt
22343 !! html/parsoid
22344 <h1>foo</h1>*bar
22345 <h1>foo</h1>=bar
22346 <h1>foo</h1>=bar=
22347 !! wikitext
22348 = foo =
22349 <nowiki>*</nowiki>bar
22350
22351 = foo =
22352 =bar
22353
22354 = foo =
22355 <nowiki>=bar=</nowiki>
22356 !!end
22357
22358 !! test
22359 Headings: 3. Nested inside html with wikitext split by html tags
22360 !! options
22361 parsoid=html2wt
22362 !! html/parsoid
22363 <h1>=<b>bold</b>foo=</h1>
22364 !! wikitext
22365 = ='''bold'''foo= =
22366 !!end
22367
22368 !! test
22369 Headings: 4a. No escaping needed (testing just h1 and h2)
22370 !! options
22371 parsoid=html2wt
22372 !! html/parsoid
22373 <h1>=foo</h1>
22374 <h1>foo=</h1>
22375 <h1> =foo= </h1>
22376 <h1>=foo= bar</h1>
22377 <h2>=foo</h2>
22378 <h2>foo=</h2>
22379 <h1>=</h1>
22380 <h1><i>=</i>foo=</h1>
22381 !! wikitext
22382 = =foo =
22383
22384 = foo= =
22385
22386 = =foo= =
22387
22388 = =foo= bar =
22389
22390 == =foo ==
22391
22392 == foo= ==
22393
22394 = = =
22395
22396 = ''=''foo= =
22397 !!end
22398
22399 !! test
22400 Headings: 4b. No escaping needed (inside p-tags)
22401 !! options
22402 parsoid=html2wt
22403 !! html/parsoid
22404 <p>===
22405 =foo= x
22406 =foo= <s></s>
22407 </p>
22408 !! wikitext
22409 ===
22410 =foo= x
22411 =foo= <s></s>
22412 !!end
22413
22414 !! test
22415 Headings: 5. Empty headings
22416 !! options
22417 parsoid=html2wt
22418 !! html/parsoid
22419 <h1 data-parsoid='{}'></h1>
22420
22421 <h2 data-parsoid='{}'></h2>
22422
22423 <h3 data-parsoid='{}'></h3>
22424
22425 <h4 data-parsoid='{}'></h4>
22426
22427 <h5 data-parsoid='{}'></h5>
22428
22429 <h6 data-parsoid='{}'></h6>
22430 !! wikitext
22431 =<nowiki/>=
22432
22433 ==<nowiki/>==
22434
22435 ===<nowiki/>===
22436
22437 ====<nowiki/>====
22438
22439 =====<nowiki/>=====
22440
22441 ======<nowiki/>======
22442 !!end
22443
22444 !! test
22445 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22446 !! options
22447 parsoid=html2wt
22448 !! html/parsoid
22449 <p>=a=</p>
22450
22451 <p>=a=</p>
22452
22453 <p>=a=</p>
22454 !! wikitext
22455 <nowiki>=a=</nowiki>
22456
22457 <nowiki>=a=</nowiki>
22458
22459 <nowiki>=a=</nowiki>
22460 !!end
22461
22462 !! test
22463 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22464 !! options
22465 parsoid=html2wt
22466 !! html/parsoid
22467 <p>=a=
22468 b</p>
22469
22470 <p>=a=
22471 b</p>
22472
22473 <p>=a=
22474 b</p>
22475 !! wikitext
22476 <nowiki>=a=</nowiki>
22477 b
22478
22479 <nowiki>=a=</nowiki>
22480 b
22481
22482 <nowiki>=a=</nowiki>
22483 b
22484 !!end
22485
22486 !! test
22487 Headings: 6c. Heading chars in SOL context (leading newline break)
22488 !! options
22489 parsoid=html2wt
22490 !! html/parsoid
22491 <p>a
22492 =b=</p>
22493 !! wikitext
22494 a
22495 <nowiki>=b=</nowiki>
22496 !!end
22497
22498 !! test
22499 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22500 !! options
22501 parsoid=html2wt
22502 !! html/parsoid
22503 <!--c0--><p>=a=</p>
22504
22505 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22506 !! wikitext
22507 <!--c0--><nowiki>=a=</nowiki>
22508
22509 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22510 !!end
22511
22512 !! test
22513 Headings: 6d. Heading chars in SOL context (No escaping needed)
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 =a=<div>b</div>
22518 !! wikitext
22519 =a=<div>b</div>
22520 !!end
22521
22522 !! test
22523 Headings: 7. Insert a newline between new content and headings
22524 !! options
22525 parsoid=html2wt
22526 !! html/parsoid
22527 <h2>NEW</h2>
22528 <p>new</p>
22529 <h2 data-parsoid='{}'>A</h2>
22530 <p data-parsoid='{}'>a</p>
22531 !! wikitext
22532 == NEW ==
22533 new
22534
22535 ==A==
22536 a
22537
22538 !! end
22539
22540 #### --------------- Lists ---------------
22541 #### 0. Outside nests (*foo, etc.)
22542 #### 1. Nested inside html <ul><li>*foo</li></ul>
22543 #### 2. Inside definition lists
22544 #### 3. Only bullets at start should be escaped
22545 #### 4. No escapes needed
22546 #### 5. No unnecessary escapes
22547 #### 6. Escape bullets in SOL position
22548 #### 7. Escape bullets in a multi-line context
22549 #### ----------------------------------------
22550
22551 !! test
22552 Lists: 0. Outside nests
22553 !! options
22554 parsoid=html2wt
22555 !! html/parsoid
22556 <p>*foo</p>
22557
22558 <p>#foo</p>
22559
22560 <p>;Foo:bar</p>
22561 !! wikitext
22562 <nowiki>*</nowiki>foo
22563
22564 <nowiki>#</nowiki>foo
22565
22566 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22567 !!end
22568
22569 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22570 ## to test wikitext escaping, and insignificant whitespace diffs
22571 ## cause PHP parser tests to barf
22572 !! test
22573 Lists: 1. Nested inside html (No unnecessary escapes)
22574 !! options
22575 parsoid=html2wt
22576 !! html/parsoid
22577 <ul>
22578 <li>*foo</li>
22579 <li>#foo</li>
22580 <li>:foo</li>
22581 <li>;foo</li>
22582 <li data-parsoid='{}'>*foo</li>
22583 <li data-parsoid='{}'>#foo</li>
22584 <li data-parsoid='{}'>:foo</li>
22585 <li data-parsoid='{}'>;foo</li>
22586 </ul>
22587
22588 <ol>
22589 <li>*foo</li>
22590 <li>#foo</li>
22591 <li>:foo</li>
22592 <li>;foo</li>
22593 <li data-parsoid='{}'>*foo</li>
22594 <li data-parsoid='{}'>#foo</li>
22595 <li data-parsoid='{}'>:foo</li>
22596 <li data-parsoid='{}'>;foo</li>
22597 </ol>
22598 !! wikitext
22599 * *foo
22600 * #foo
22601 * :foo
22602 * ;foo
22603 *<nowiki>*foo</nowiki>
22604 *<nowiki>#foo</nowiki>
22605 *<nowiki>:foo</nowiki>
22606 *<nowiki>;foo</nowiki>
22607
22608 # *foo
22609 # #foo
22610 # :foo
22611 # ;foo
22612 #<nowiki>*foo</nowiki>
22613 #<nowiki>#foo</nowiki>
22614 #<nowiki>:foo</nowiki>
22615 #<nowiki>;foo</nowiki>
22616 !!end
22617
22618 !! test
22619 Lists: 2. Inside definition lists
22620 !! options
22621 parsoid=html2wt
22622 !! html/parsoid
22623 <dl><dt>;foo</dt></dl>
22624 <dl><dt>:foo</dt></dl>
22625 <dl><dt>:foo</dt>
22626 <dd>bar</dd></dl>
22627 <dl><dd>:foo</dd></dl>
22628 !! wikitext
22629 ; ;foo
22630
22631 ; <nowiki>:foo</nowiki>
22632
22633 ; <nowiki>:foo</nowiki>
22634 : bar
22635
22636 : :foo
22637 !!end
22638
22639 !! test
22640 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22641 !! options
22642 parsoid=html2wt
22643 !! html/parsoid
22644 <ul>
22645 <li>*foo*bar</li>
22646 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22647 </ul>
22648 !! wikitext
22649 * *foo*bar
22650 *<nowiki>*foo</nowiki>''it''*bar
22651 !!end
22652
22653 !! test
22654 Lists: 4. No escapes needed
22655 !! options
22656 parsoid=html2wt
22657 !! html/parsoid
22658 <ul>
22659 <li>foo*bar
22660 </li>
22661 </ul>
22662 <ul>
22663 <li><i>foo</i>*bar
22664 </li>
22665 </ul>
22666 <ul>
22667 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22668 </li>
22669 </ul>
22670 <ul>
22671 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22672 </li>
22673 </ul>
22674 !! wikitext
22675 *foo*bar
22676
22677 *''foo''*bar
22678
22679 *[[Foo]]: bar
22680
22681 *[[Foo]]*bar
22682 !!end
22683
22684 !! test
22685 Lists: 5. No unnecessary escapes
22686 !! options
22687 parsoid=html2wt
22688 !! html/parsoid
22689 <ul><li> bar <span>[[foo]]</span></li></ul>
22690 <ul><li> =bar <span>[[foo]]</span></li></ul>
22691 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22692 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22693 <ul><li> =bar <span>foo]]</span>=</li></ul>
22694 <ul><li> <s></s>: a</li></ul>
22695 <ul><li> <i>* foo</i></li></ul>
22696
22697 !! wikitext
22698 * bar <span><nowiki>[[foo]]</nowiki></span>
22699
22700 * =bar <span><nowiki>[[foo]]</nowiki></span>
22701
22702 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22703
22704 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22705
22706 * =bar <span>foo]]</span>=
22707
22708 * <s></s>: a
22709
22710 * ''* foo''
22711 !!end
22712
22713 !! test
22714 Lists: 6. Escape bullets in SOL position
22715 !! options
22716 parsoid=html2wt
22717 !! html/parsoid
22718 <p><!--cmt-->*foo</p>
22719 !! wikitext
22720 <!--cmt--><nowiki>*</nowiki>foo
22721 !!end
22722
22723 !! test
22724 Lists: 7. Escape bullets in a multi-line context
22725 !! options
22726 parsoid=html2wt
22727 !! html/parsoid
22728 <p>a
22729 *b
22730 </p>
22731 !! wikitext
22732 a
22733 <nowiki>*</nowiki>b
22734 !!end
22735
22736 !! test
22737 Lists: 8. Escape colons only if not present in tags
22738 !! options
22739 parsoid=html2wt
22740 !! html/parsoid
22741 <dl><dt>a:b<i>c:d</i></dt></dl>
22742 !! wikitext
22743 ; <nowiki>a:b</nowiki>''c:d''
22744 !! end
22745
22746 #### --------------- HRs ---------------
22747 #### 1. Single line
22748 #### -----------------------------------
22749
22750 !! test
22751 HRs: 1. Single line
22752 !! options
22753 parsoid=html2wt
22754 !! html/parsoid
22755 <hr />----
22756 <hr />=foo=
22757 <hr />*foo
22758 !! wikitext
22759 ----<nowiki>----</nowiki>
22760 ----=foo=
22761 ----*foo
22762 !! end
22763
22764 #### --------------- Tables ---------------
22765 #### 1a. Simple example
22766 #### 1b. No escaping needed (!foo)
22767 #### 1c. No escaping needed (|foo)
22768 #### 1d. No escaping needed (|}foo)
22769 ####
22770 #### 2a. Nested in td (<td>foo|bar</td>)
22771 #### 2b. Nested in td (<td>foo||bar</td>)
22772 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22773 ####
22774 #### 3a. Nested in th (<th>foo!bar</th>)
22775 #### 3b. Nested in th (<th>foo!!bar</th>)
22776 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22777 ####
22778 #### 4a. Escape -
22779 #### 4b. Escape +
22780 #### 4c. No escaping needed
22781 #### --------------------------------------
22782
22783 !! test
22784 Tables: 1a. Simple example
22785 !! options
22786 parsoid=html2wt
22787 !! html/parsoid
22788 <p>{|
22789 |}
22790 </p>
22791 !! wikitext
22792 <nowiki>{|</nowiki>
22793 |}
22794 !! end
22795
22796 !! test
22797 Tables: 1b. No escaping needed
22798 !! options
22799 parsoid=html2wt
22800 !! html/parsoid
22801 <p>!foo
22802 </p>
22803 !! wikitext
22804 !foo
22805 !! end
22806
22807 !! test
22808 Tables: 1c. No escaping needed
22809 !! options
22810 parsoid=html2wt
22811 !! html/parsoid
22812 <p>|foo
22813 </p>
22814 !! wikitext
22815 |foo
22816 !! end
22817
22818 !! test
22819 Tables: 1d. No escaping needed
22820 !! options
22821 parsoid=html2wt
22822 !! html/parsoid
22823 <p>|}foo
22824 </p>
22825 !! wikitext
22826 |}foo
22827 !! end
22828
22829 !! test
22830 Tables: 2a. Nested in td
22831 !! options
22832 parsoid=html2wt
22833 !! html/parsoid
22834 <table><tbody><tr>
22835 <td>foo|bar</td></tr>
22836 <tr><td>x<div>a|b</div></td>
22837 </tbody></table>
22838 !! wikitext
22839 {|
22840 |<nowiki>foo|bar</nowiki>
22841 |-
22842 |x<div><nowiki>a|b</nowiki></div>
22843 |}
22844 !! html/php+tidy
22845 <table>
22846 <tr>
22847 <td>foo|bar</td>
22848 </tr>
22849 <tr>
22850 <td>x
22851 <div>a|b</div>
22852 </td>
22853 </tr>
22854 </table>
22855 !! end
22856
22857 !! test
22858 Tables: 2b. Nested in td
22859 !! options
22860 parsoid=html2wt
22861 !! html/parsoid
22862 <table><tbody><tr>
22863 <td>foo||bar</td>
22864 <td>a<i>b||c</i></td>
22865 <td>a<i><div>b||c</div></i></td>
22866 </tr></tbody></table>
22867 !! wikitext
22868 {|
22869 |<nowiki>foo||bar</nowiki>
22870 |a''<nowiki>b||c</nowiki>''
22871 |a''<div><nowiki>b||c</nowiki></div>''
22872 |}
22873 !! html/php
22874 <table>
22875 <tr>
22876 <td>foo||bar
22877 </td>
22878 <td>a<i>b||c</i>
22879 </td>
22880 <td>a<i><div>b||c</div></i>
22881 </td></tr></table>
22882
22883 !! end
22884
22885 !! test
22886 Tables: 2c. Nested in td -- no escaping needed
22887 !! options
22888 parsoid=html2wt
22889 !! html/*
22890 <table>
22891
22892 <tr>
22893 <td>foo!!bar
22894 </td></tr></table>
22895
22896 !! wikitext
22897 {|
22898
22899 |foo!!bar
22900 |}
22901 !! end
22902
22903 !! test
22904 Tables: 3a. Nested in th
22905 !! options
22906 parsoid=html2wt
22907 !! html/*
22908 <table>
22909
22910 <tr>
22911 <th>foo!bar
22912 </th></tr></table>
22913
22914 !! wikitext
22915 {|
22916
22917 !foo!bar
22918 |}
22919 !! end
22920
22921 !! test
22922 Tables: 3b. Nested in th
22923 !! options
22924 parsoid=html2wt
22925 !! html/parsoid
22926 <table><tbody>
22927 <tr><th>foo!!bar</th>
22928 <th><i>foo|bar</i></th>
22929 <th><i>foo!!bar</i></th>
22930 <th><i><span>foo!!bar</span></i></th>
22931 </tr></tbody></table>
22932 !! wikitext
22933 {|
22934 !<nowiki>foo!!bar</nowiki>
22935 !''<nowiki>foo|bar</nowiki>''
22936 !''<nowiki>foo!!bar</nowiki>''
22937 !''<span><nowiki>foo!!bar</nowiki></span>''
22938 |}
22939 !! html/php
22940 <table>
22941 <tr>
22942 <th>foo!!bar
22943 </th>
22944 <th><i>foo|bar</i>
22945 </th>
22946 <th><i>foo!!bar</i>
22947 </th>
22948 <th><i><span>foo!!bar</span></i>
22949 </th></tr></table>
22950
22951 !! end
22952
22953 !! test
22954 Tables: 3c. Nested in th
22955 !! options
22956 parsoid=html2wt
22957 !! html/parsoid
22958 <table><tbody>
22959 <tr><th>foo||bar</th>
22960 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22961 </tr></tbody></table>
22962 !! wikitext
22963 {|
22964 !<nowiki>foo||bar</nowiki>
22965 !<nowiki>foo||bar</nowiki>
22966 |}
22967 !! html/php
22968 <table>
22969 <tr>
22970 <th>foo||bar
22971 </th>
22972 <th>foo||bar
22973 </th></tr></table>
22974
22975 !! end
22976
22977 !! test
22978 Tables: 4a. Escape -
22979 !! options
22980 parsoid=html2wt
22981 !! html/*
22982 <table>
22983
22984 <tr>
22985 <th>-bar
22986 </th></tr>
22987 <tr>
22988 <td>-bar
22989 </td></tr></table>
22990
22991 !! wikitext
22992 {|
22993
22994 !-bar
22995
22996 |-
22997 |<nowiki>-bar</nowiki>
22998 |}
22999 !! end
23000
23001 !! test
23002 Tables: 4b. Escape +
23003 !! options
23004 parsoid=html2wt
23005 !! html/*
23006 <table>
23007
23008 <tr>
23009 <th>+bar
23010 </th></tr>
23011 <tr>
23012 <td>+bar
23013 </td></tr></table>
23014
23015 !! wikitext
23016 {|
23017
23018 !+bar
23019
23020 |-
23021 |<nowiki>+bar</nowiki>
23022 |}
23023 !! end
23024
23025 !! test
23026 Tables: 4c. No escaping needed
23027 !! options
23028 parsoid=html2wt
23029 !! html/parsoid
23030 <table><tbody>
23031 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23032 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23033 <tr><td>foo
23034 <p>bar|baz
23035 +bar
23036 -bar</p></td></tr>
23037 <tr><td>x
23038 <div>a|b</div></td>
23039 </tbody></table>
23040 !! wikitext
23041 {|
23042 |foo-bar
23043 |foo+bar
23044 |-
23045 |''foo''-bar
23046 |''foo''+bar
23047 |-
23048 |foo
23049 bar|baz
23050 +bar
23051 -bar
23052 |-
23053 |x
23054 <div>a|b</div>
23055 |}
23056 !! html/php
23057 <table>
23058 <tr>
23059 <td>foo-bar
23060 </td>
23061 <td>foo+bar
23062 </td></tr>
23063 <tr>
23064 <td><i>foo</i>-bar
23065 </td>
23066 <td><i>foo</i>+bar
23067 </td></tr>
23068 <tr>
23069 <td>foo
23070 <p>bar|baz
23071 +bar
23072 -bar
23073 </p>
23074 </td></tr>
23075 <tr>
23076 <td>x
23077 <div>a|b</div>
23078 </td></tr></table>
23079
23080 !! end
23081
23082 !! test
23083 Tables: 4d. No escaping needed
23084 !! options
23085 parsoid=html2wt
23086 !! html/parsoid
23087 <table>
23088 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23089 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23090 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23091 </tbody></table>
23092 !! wikitext
23093 {|
23094 |[[Foo]]-bar
23095 ||+1
23096 ||-2
23097 |}
23098 !! html/php
23099 <table>
23100 <tr>
23101 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23102 </td>
23103 <td>+1
23104 </td>
23105 <td>-2
23106 </td></tr></table>
23107
23108 !! end
23109
23110 !! test
23111 T97430: Don't emit empty nowiki pairs around marker meta tags
23112 !! options
23113 parsoid=html2wt
23114 !! html/parsoid
23115 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23116 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23117 !! wikitext
23118 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23119 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23120 !! end
23121
23122 !! test
23123 Unclosed xmlish element in table line shouldn't eat end delimiters
23124 !! options
23125 parsoid=html2wt
23126 !! html/parsoid
23127 <table>
23128 <tbody><tr><td> &lt;foo</td>
23129 <td> bar></td></tr>
23130 </tbody></table>
23131 !! wikitext
23132 {|
23133 | <foo
23134 | bar>
23135 |}
23136 !! html/php
23137 <table>
23138 <tr>
23139 <td> &lt;foo
23140 </td>
23141 <td> bar&gt;
23142 </td></tr></table>
23143
23144 !! end
23145
23146 #### --------------- Links ----------------
23147 #### 1. Quote marks in link text
23148 #### 2. Wikilinks: Escapes needed
23149 #### 3. Wikilinks: No escapes needed
23150 #### 4. Extlinks: Escapes needed
23151 #### 5. Extlinks: No escapes needed
23152 #### --------------------------------------
23153 !! test
23154 Links 1. WikiLinks: No escapes needed
23155 !! options
23156 parsoid=html2wt
23157 !! html/parsoid
23158 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23159 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23160 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23161 !! wikitext
23162 [[Foo|Foo''boo'']]
23163 [[Foo|[Foobar]]]
23164 [[Foo|x [Foobar] x]]
23165 !! html/php
23166 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23167 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23168 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23169 </p>
23170 !! end
23171
23172 !! test
23173 Links 2. WikiLinks: Escapes needed
23174 !! options
23175 parsoid=html2wt
23176 !! html/parsoid
23177 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23178 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23179 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23180 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23181 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23182 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23183 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23184 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23185 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23186 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23187 !! wikitext
23188 [[Foo|<nowiki>Foobar]</nowiki>]]
23189 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23190 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23191 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23192 [[Foo|<nowiki>|Bar</nowiki>]]
23193 [[Foo|<nowiki>]]bar</nowiki>]]
23194 [[Foo|<nowiki>[[bar</nowiki>]]
23195 [[Foo|<nowiki>x [[ y</nowiki>]]
23196 [[Foo|<nowiki>x ]] y</nowiki>]]
23197 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23198 !! html/php
23199 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23200 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23201 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23202 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23203 <a href="/wiki/Foo" title="Foo">|Bar</a>
23204 <a href="/wiki/Foo" title="Foo">]]bar</a>
23205 <a href="/wiki/Foo" title="Foo">[[bar</a>
23206 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23207 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23208 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23209 </p>
23210 !! end
23211
23212 !! test
23213 Links 3. WikiLinks: No escapes needed
23214 !! options
23215 parsoid=html2wt
23216 !! html/parsoid
23217 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23218 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23219 !! wikitext
23220 [[Foo|[Foobar]]
23221 [[Foo|foo|bar]]
23222 !! html/php
23223 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23224 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23225 </p>
23226 !! end
23227
23228 !! test
23229 Links 4. ExtLinks: Escapes needed
23230 !! options
23231 parsoid=html2wt
23232 !! html/parsoid
23233 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23234 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23235 <p>[http://google.com]</p>
23236 <p>[http://google.com google]</p>
23237 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23238 <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>
23239 !! wikitext
23240 [http://google.com <nowiki>[google]</nowiki>]
23241 [http://google.com <nowiki>google]</nowiki>]
23242
23243 <nowiki>[http://google.com]</nowiki>
23244
23245 <nowiki>[http://google.com google]</nowiki>
23246
23247 [http://google.com<nowiki>]</nowiki>
23248
23249 [{{echo|http://google.com}}<nowiki>]</nowiki>
23250 !! html/php
23251 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23252 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23253 </p><p>[http://google.com]
23254 </p><p>[http://google.com google]
23255 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23256 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23257 </p>
23258 !! end
23259
23260 !! test
23261 Links 5. ExtLinks: No escapes needed
23262 !! options
23263 parsoid=html2wt
23264 !! html/parsoid
23265 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23266 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23267 !! wikitext
23268 [http://google.com [google]
23269
23270 [[http://google.com]]
23271 !! html/php
23272 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23273 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23274 </p>
23275 !! end
23276
23277 !! test
23278 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23279 !! options
23280 parsoid=html2wt
23281 !! html/parsoid
23282 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23283 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23284 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23285 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23286 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23287 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23288 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23289 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23290 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23291 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23292 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23293 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23294 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23295 </p>
23296 !! wikitext
23297 x<nowiki/>http://example.com<nowiki/>y
23298 http://example.com<nowiki/>?x
23299 http://example.com<nowiki/>&x
23300 http://example.com<nowiki/>'x
23301 http://example.com<nowiki/>,x
23302 http://example.com<nowiki/>.x
23303 http://example.com<nowiki/>;x
23304 http://example.com<nowiki/>:x
23305 http://example.com<nowiki/>;x
23306 http://example.com<nowiki/>!x
23307 http://example.com<nowiki/>=x
23308 http://example.com<nowiki/>(x)
23309 http://example.com(x<nowiki/>)
23310 !! end
23311
23312 !! test
23313 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23314 !! options
23315 parsoid=html2wt
23316 !! html/parsoid
23317 <p>x
23318 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23319 y
23320 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23321 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23322 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23323 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23324 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23325 </p>
23326 !! wikitext
23327 x
23328 http://example.com
23329 y
23330 "http://example.com"
23331 (http://example.com)
23332 (http://example.com) foo
23333 http://example.com,
23334 http://example.com, foo
23335 !! html/php
23336 <p>x
23337 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23338 y
23339 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23340 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23341 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23342 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23343 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23344 </p>
23345 !! end
23346
23347 !! test
23348 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23349 !! options
23350 parsoid=html2wt
23351 !! html/parsoid
23352 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23353 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23354 !! wikitext
23355 http://example.com.,;:!?\
23356 -http://example.com:
23357 !! html/php
23358 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23359 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23360 </p>
23361 !! end
23362
23363 !! test
23364 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23365 !! options
23366 parsoid=html2wt
23367 !! html/parsoid
23368 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23369 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23370 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23371 !! wikitext
23372 RFC 123<nowiki/>4
23373 RFC 123<nowiki/>y
23374 X<nowiki/>RFC 123<nowiki/>y
23375 !! end
23376
23377 !! test
23378 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23379 !! options
23380 parsoid=html2wt
23381 !! html/parsoid
23382 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23383 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23384 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23385 </p>
23386 !! wikitext
23387 RFC 123?foo
23388 RFC 123&foo
23389 -RFC 123-
23390 !! html/php
23391 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23392 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23393 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23394 </p>
23395 !! end
23396
23397 !! test
23398 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23399 !! options
23400 parsoid=html2wt
23401 !! html/parsoid
23402 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23403 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23404 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23405 !! wikitext
23406 PMID 123<nowiki/>4
23407 PMID 123<nowiki/>y
23408 X<nowiki/>PMID 123<nowiki/>y
23409 !! end
23410
23411 !! test
23412 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23413 !! options
23414 parsoid=html2wt
23415 !! html/parsoid
23416 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23417 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23418 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23419 </p>
23420 !! wikitext
23421 PMID 123?foo
23422 PMID 123&foo
23423 -PMID 123-
23424 !! html/php
23425 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23426 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23427 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23428 </p>
23429 !! end
23430
23431 !! test
23432 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23437 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23438 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23439 </p>
23440 !! wikitext
23441 ISBN 1234567890<nowiki/>1
23442 ISBN 1234567890<nowiki/>x
23443 a<nowiki/>ISBN 1234567890<nowiki/>b
23444 !! end
23445
23446 !! test
23447 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23448 !! options
23449 parsoid=html2wt
23450 !! html/parsoid
23451 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23452 !! wikitext
23453 -ISBN 1234567890's
23454 !! html/php
23455 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23456 </p>
23457 !! end
23458
23459 !! test
23460 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23461 !! options
23462 parsoid=html2wt
23463 !! html/*
23464 <p>this is not a link: http://example.com
23465 </p>
23466 !! wikitext
23467 this is not a link: <nowiki>http://example.com</nowiki>
23468 !! end
23469
23470 !! test
23471 Links 15. Link trails can't become link prefixes.
23472 !! options
23473 language=is
23474 parsoid=html2wt
23475 !! html/parsoid
23476 <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>
23477 !! wikitext
23478 [[Söfnuður]]-[[00]]
23479 !! html/php
23480 <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>
23481 </p>
23482 !! end
23483
23484 #### --------------- Quotes ---------------
23485 #### 1. Quotes inside <b> and <i>
23486 #### 2. Link fragments separated by <i> and <b> tags
23487 #### 3. Link fragments inside <i> and <b>
23488 #### 4. No escaping needed
23489 #### --------------------------------------
23490 !! test
23491 1a. Quotes inside <b> and <i>
23492 !! options
23493 parsoid=html2wt
23494 !! html/*
23495 <p><i>'foo'</i>
23496 <i>''foo''</i>
23497 <i>'''foo'''</i>
23498 <i>foo</i>'s
23499 <b>'foo'</b>
23500 <b>''foo''</b>
23501 <b>'''foo'''</b>
23502 <b>foo'<i>bar'</i>baz</b>
23503 <b>foo</b>'s
23504 '<i>foo</i>
23505 <i>foo</i>'
23506 <i>foo'</i>'
23507 '<i>foo</i>'
23508 '<b>foo</b>
23509 <b>foo</b>'
23510 '<b>foo</b>'
23511 <i>fools'<span> errand</span></i>
23512 <i><span>fool</span>'s errand</i>
23513 '<i>foo</i> bar '<i>baz</i>
23514 a|!*#-:;+-~[]{}b'<i>x</i>
23515 </p>
23516 !! wikitext
23517 ''<nowiki/>'foo'''
23518 ''<nowiki>''foo''</nowiki>''
23519 ''<nowiki>'''foo'''</nowiki>''
23520 ''foo''<nowiki/>'s
23521 '''<nowiki/>'foo''''
23522 '''<nowiki>''foo''</nowiki>'''
23523 '''<nowiki>'''foo'''</nowiki>'''
23524 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23525 '''foo'''<nowiki/>'s
23526 '''foo''
23527 ''foo''<nowiki/>'
23528 ''foo'''<nowiki/>'
23529 '''foo''<nowiki/>'
23530 ''''foo'''
23531 '''foo'''<nowiki/>'
23532 ''''foo'''<nowiki/>'
23533 ''fools'<span> errand</span>''
23534 ''<span>fool</span>'s errand''
23535 '<nowiki/>''foo'' bar '''baz''
23536 a|!*#-:;+-~[]{}b'''x''
23537 !! end
23538
23539 !! test
23540 1b. Quotes inside <b> and <i> with other tags on same line
23541 !! options
23542 parsoid=html2wt
23543 !! html/parsoid
23544 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23545 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23546 <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>
23547 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23548 '<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>
23549 '<i>foo</i> <div title="name">test</div>
23550 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23551 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23552 <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>
23553 </ol>
23554 !! wikitext
23555 '''a'' foo ''[[bar]]''
23556 ''a''' foo ''[[bar]]''
23557 ''a''' foo '''{{echo|[[bar]]}}'''
23558 [[foo]] x'''[[bar]]''
23559 '''foo'' <ref>test</ref>
23560 '''foo'' <div title="name">test</div>
23561 '''foo'' and <br> bar
23562 <references />
23563 !! end
23564
23565 !! test
23566 2. Link fragments separated by <i> and <b> tags
23567 !! options
23568 parsoid=html2wt
23569 !! html/parsoid
23570 <p>[[<i>foo</i>hello]]</p>
23571 <p>[[<b>foo</b>hello]]</p>
23572 !! wikitext
23573 [[''foo''<nowiki>hello]]</nowiki>
23574
23575 [['''foo'''<nowiki>hello]]</nowiki>
23576 !! end
23577
23578 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23579 # this is one of the shortcomings of this format
23580 !! test
23581 3. Link fragments inside <i> and <b>
23582 !! options
23583 parsoid=html2wt
23584 !! html/parsoid
23585 <p><i>[[foo</i>]]</p>
23586 <p><b>[[foo</b>]]</p>
23587 !! wikitext
23588 ''[[foo''<nowiki>]]</nowiki>
23589
23590 '''[[foo'''<nowiki>]]</nowiki>
23591 !! end
23592
23593 !! test
23594 4. No escaping needed
23595 !! options
23596 options=html2wt
23597 !! html/parsoid
23598 <p>'<span><i>bar</i></span>'
23599 '<span><b>bar</b></span>'
23600 'a:b'foo
23601 </p>
23602 !! wikitext
23603 '<span>''bar''</span>'
23604 '<span>'''bar'''</span>'
23605 'a:b'foo
23606 !! end
23607
23608 #### ----------- Paragraphs ---------------
23609 #### 1. No unnecessary escapes
23610 #### --------------------------------------
23611
23612 !! test
23613 1. No unnecessary escapes
23614 !! options
23615 parsoid=html2wt
23616 !! html/parsoid
23617 <p>bar <span>[[foo]]</span>
23618 </p><p>=bar <span>[[foo]]</span>
23619 </p><p>[[bar <span>[[foo]]</span>
23620 </p><p>]]bar <span>[[foo]]</span>
23621 </p><p>=bar <span>foo]]</span>=
23622 </p>
23623 !! wikitext
23624 bar <span><nowiki>[[foo]]</nowiki></span>
23625
23626 =bar <span><nowiki>[[foo]]</nowiki></span>
23627
23628 [[bar <span><nowiki>[[foo]]</nowiki></span>
23629
23630 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23631
23632 =bar <span>foo]]</span><nowiki>=</nowiki>
23633 !!end
23634
23635 #### ----------------------- PRE --------------------------
23636 #### 1. Leading whitespace in SOL context should be escaped
23637 #### ------------------------------------------------------
23638 !! test
23639 1. Leading whitespace in SOL context should be escaped
23640 !! options
23641 parsoid=html2wt
23642 !! html/parsoid
23643 <p> a</p>
23644
23645 <p> a</p>
23646
23647 <p> a(tab)</p>
23648
23649 <p> a
23650 <!--cmt-->
23651 a</p>
23652
23653 <p>a
23654 b</p>
23655
23656 <p>a
23657 b</p>
23658
23659 <p>a
23660 b</p>
23661 !! wikitext
23662 <nowiki> </nowiki>a
23663
23664 <nowiki> </nowiki> a
23665
23666 a(tab)
23667
23668 <nowiki> </nowiki> a
23669 <!--cmt-->
23670 <nowiki> </nowiki>a
23671
23672 a
23673 <nowiki> </nowiki>b
23674
23675 a
23676 b
23677
23678 a
23679 b
23680 !! html/php
23681 <p> a
23682 </p><p> a
23683 </p><p> a(tab)
23684 </p><p> a
23685 a
23686 </p><p>a
23687 b
23688 </p><p>a
23689 b
23690 </p><p>a
23691 b
23692 </p>
23693 !! end
23694
23695 !! test
23696 2. Leading whitespace in non-indent-pre contexts should not be escaped
23697 !! options
23698 parsoid=htm2wt
23699 !! html/parsoid
23700 <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>
23701 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23702 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
23703 b</span></li>
23704 </ol>
23705 !! wikitext
23706 foo <ref>''a''
23707 b</ref>
23708 <references />
23709 !! end
23710
23711 !! test
23712 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23713 !! options
23714 parsoid=html2wt
23715 !! html/parsoid
23716 <blockquote>
23717 <p>
23718 a
23719 <span>b</span>
23720 c</p>
23721 </blockquote>
23722 !! wikitext
23723 <blockquote>
23724 a
23725 <span>b</span>
23726 c
23727 </blockquote>
23728 !! end
23729
23730 !! test
23731 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23732 !! options
23733 options=html2wt
23734 !! html/parsoid
23735 <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>
23736 !! wikitext
23737 [[File:Foobar.jpg|thumb|caption]]
23738 !! end
23739
23740 !! test
23741 5. Nowiki escaping should account for indent-pres
23742 !! options
23743 parsoid=html2wt
23744 !! html/parsoid
23745 <pre>==foo==</pre>
23746 !! wikitext
23747 ==foo==
23748 !! end
23749
23750 !!test
23751 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23752 !! options
23753 parsoid=html2wt
23754 !! html/parsoid
23755 <pre>
23756 * foo
23757 * bar
23758 </pre>
23759 !! wikitext
23760 * foo
23761 * bar
23762 !! end
23763
23764 #### --------------- Behavior Switches --------------------
23765
23766 !! test
23767 1. Valid behavior switches should be escaped
23768 !! options
23769 parsoid=html2wt
23770 !! html/parsoid
23771 __TOC__
23772 <i>__TOC__</i>
23773 !! wikitext
23774 <nowiki>__TOC__</nowiki>
23775 ''<nowiki>__TOC__</nowiki>''
23776 !! end
23777
23778 !! test
23779 2. Invalid behavior switches should not be escaped
23780 !! options
23781 parsoid=html2wt
23782 !! html/parsoid
23783 __TOO__
23784 __|__
23785 !! wikitext
23786 __TOO__
23787 __|__
23788 !! end
23789
23790 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23791 !! test
23792 Behavior switches should be SOL-transparent
23793 !! options
23794 parsoid=html2wt
23795 !! html/parsoid
23796 <meta property="mw:PageProp/toc" />
23797
23798 <!-- this one's bogus -->
23799 <pre>__TOO__</pre>
23800
23801 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23802
23803 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23804 !! wikitext
23805 __TOC__
23806
23807 <!-- this one's bogus -->
23808 __TOO__
23809
23810 __TOC__ foo
23811
23812 __TOC__
23813 bar
23814 !! end
23815
23816 #### --------------- HTML tags ---------------
23817 #### 1. a tags
23818 #### 2. other tags
23819 #### 3. multi-line html tag
23820 #### 4. extension tags
23821 #### -----------------------------------------
23822 !! test
23823 1. a tags
23824 !! options
23825 parsoid=html2wt
23826 !! html/parsoid
23827 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23828 !! wikitext
23829 <a href="http://google.com">google</a>
23830 !! end
23831
23832 !! test
23833 2. other tags
23834 !! options
23835 parsoid=html2wt
23836 !! html/parsoid
23837 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23838 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23839 <li> &lt;td&gt;</li></ul>
23840
23841 !! wikitext
23842 * <nowiki><div>foo</div></nowiki>
23843 * <nowiki><div style="color:red">foo</div></nowiki>
23844 * <nowiki><td></nowiki>
23845 !! end
23846
23847 !! test
23848 3. multi-line html tag
23849 !! options
23850 parsoid=html2wt
23851 !! html/parsoid
23852 <p>&lt;div
23853 &gt;foo&lt;/div
23854 &gt;
23855 </p>
23856 !! wikitext
23857 <nowiki><div
23858 >foo</div
23859 ></nowiki>
23860 !! end
23861
23862 !! test
23863 4. extension tags
23864 !! options
23865 parsoid=html2wt
23866 !! html/parsoid
23867 <p>&lt;ref&gt;foo&lt;/ref&gt;
23868 </p><p>&lt;ref&gt;bar
23869 </p><p>baz&lt;/ref&gt;
23870 </p>
23871 !! wikitext
23872 <nowiki><ref>foo</ref></nowiki>
23873
23874 <nowiki><ref>bar</nowiki>
23875
23876 baz<nowiki></ref></nowiki>
23877 !! end
23878
23879 #### --------------- Others ---------------
23880 !! test
23881 Escaping nowikis
23882 !! options
23883 parsoid=html2wt
23884 !! html/parsoid
23885 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23886 </p>
23887 !! wikitext
23888 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23889 !! end
23890
23891 ## The quote-char in the input is necessary for triggering the bug
23892 !! test
23893 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23894 !! options
23895 parsoid=html2wt
23896 !! html/parsoid
23897 <p>foo's bar :</p>
23898 !! wikitext
23899 foo's bar :
23900 !! end
23901
23902 #----------- End of wikitext escaping tests --------------
23903
23904 !! test
23905
23906 Tag-like HTML structures are passed through as text
23907 !! wikitext
23908 <x y>
23909
23910 <x.y>
23911
23912 <x-y>
23913
23914 1>2
23915
23916 x<y
23917
23918 a>b
23919
23920 1<d e>f
23921 !! html
23922 <p>&lt;x y&gt;
23923 </p><p>&lt;x.y&gt;
23924 </p><p>&lt;x-y&gt;
23925 </p><p>1&gt;2
23926 </p><p>x&lt;y
23927 </p><p>a&gt;b
23928 </p><p>1&lt;d e&gt;f
23929 </p>
23930 !! end
23931
23932 !! test
23933 HTML tag with necessary entities in attributes
23934 !! wikitext
23935 <span title="&amp;amp;">foo</span>
23936 !! html
23937 <p><span title="&amp;amp;">foo</span>
23938 </p>
23939 !! end
23940
23941 !! test
23942 HTML tag with 'unnecessary' entity encoding in attributes
23943 !! wikitext
23944 <span title="&amp;">foo</span>
23945 !! html
23946 <p><span title="&amp;">foo</span>
23947 </p>
23948 !! end
23949
23950 !! test
23951 HTML tag with broken attribute value quoting
23952 !! options
23953 parsoid=wt2html,html2html
23954 !! wikitext
23955 <span title="Hello world>Foo</span>
23956 !! html/php
23957 <p><span title="Hello world">Foo</span>
23958 </p>
23959 !! html/parsoid
23960 <p><span title="Hello world">Foo</span></p>
23961 !! end
23962
23963 !! test
23964 Self-closed tag with broken attribute value quoting
23965 !! options
23966 parsoid=wt2html,html2html
23967 !! wikitext
23968 <div title="Hello world />Foo
23969 !! html/php+tidy
23970 <div title="Hello world"></div>
23971 <p>Foo</p>
23972 !! html/parsoid
23973 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23974 !! end
23975
23976 !! test
23977 Table with broken attribute value quoting
23978 !! options
23979 parsoid=wt2html,html2html
23980 !! wikitext
23981 {|
23982 | title="Hello world|Foo
23983 |}
23984 !! html/php
23985 <table>
23986 <tr>
23987 <td title="Hello world">Foo
23988 </td></tr></table>
23989
23990 !! html/parsoid
23991 <table>
23992 <tr>
23993 <td title="Hello world">Foo
23994 </td></tr></table>
23995
23996 !! end
23997
23998 !! test
23999 Table with broken attribute value quoting on consecutive lines
24000 !! options
24001 parsoid=wt2html,html2html
24002 !! wikitext
24003 {|
24004 | title="Hello world|Foo
24005 | style="color:red|Bar
24006 |}
24007 !! html/php
24008 <table>
24009 <tr>
24010 <td title="Hello world">Foo
24011 </td>
24012 <td style="color:red">Bar
24013 </td></tr></table>
24014
24015 !! html/parsoid
24016 <table><tbody>
24017 <tr>
24018 <td title="Hello world">Foo
24019 </td><td style="color: red">Bar
24020 </td></tr></tbody></table>
24021
24022 !! end
24023
24024 !! test
24025 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24026 !! options
24027 parsoid
24028 !! wikitext
24029 {{}}
24030 !! html
24031 {{}}
24032 !! end
24033
24034 !! test
24035 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24036 !! options
24037 parsoid
24038 !! wikitext
24039 }}{{
24040 !! html
24041 }}{{
24042 !! end
24043
24044 !!test
24045 Accept empty td cell attribute
24046 !! wikitext
24047 {|
24048 | align="center" | foo || |
24049 |}
24050 !! html
24051 <table>
24052 <tr>
24053 <td align="center"> foo </td>
24054 <td>
24055 </td></tr></table>
24056
24057 !!end
24058
24059 !!test
24060 Non-empty attributes in th-cells
24061 !! wikitext
24062 {|
24063 ! Foo !! style="color: red" | Bar
24064 |}
24065 !! html
24066 <table>
24067 <tr>
24068 <th> Foo </th>
24069 <th style="color: red"> Bar
24070 </th></tr></table>
24071
24072 !!end
24073
24074 !!test
24075 Accept empty attributes in th-cells
24076 !! wikitext
24077 {|
24078 !| foo !!| bar
24079 |}
24080 !! html
24081 <table>
24082 <tr>
24083 <th> foo </th>
24084 <th> bar
24085 </th></tr></table>
24086
24087 !!end
24088
24089 !!test
24090 Empty table rows go away
24091 !! wikitext
24092 {|
24093 | Hello
24094 | there
24095 |- class="foo"
24096 |-
24097 |}
24098 !! html
24099 <table>
24100 <tr>
24101 <td> Hello
24102 </td>
24103 <td> there
24104 </td></tr>
24105
24106 </table>
24107
24108 !! end
24109
24110 ###
24111 ### Parsoid-centric tests for testing RTing of inter-element separators
24112 ### Edge cases not tested by existing parser tests and specific to
24113 ### Parsoid-specific serialization strategies.
24114 ###
24115
24116 !!test
24117 RT-ed inter-element separators should be valid separators
24118 !! wikitext
24119 {|
24120 |- [[foo]]
24121 |}
24122 !! html/php
24123 <table>
24124
24125 </table>
24126
24127 !! html/parsoid
24128 <table>
24129 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24130 </tbody></table>
24131 !!end
24132
24133 # Parsoid-only since PHP parser relies on Tidy for correct output
24134 !!test
24135 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24136 !!options
24137 parsoid
24138 !! wikitext
24139 {|
24140 |<small>foo
24141 bar
24142 |}
24143
24144 {|
24145 |<small>foo<small>
24146 |}
24147 !! html
24148 <table>
24149 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24150 <p>bar</p></small></td></tr>
24151 </tbody></table>
24152
24153 <table>
24154 <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>
24155 </tbody></table>
24156 !!end
24157
24158 # Note that the "style" attribute is really a template parameter here.
24159 # The = would have to be {{=}} if you wanted the literal.
24160 !!test
24161 Empty TD followed by TD with tpl-generated attribute
24162 !! wikitext
24163 {|
24164 |-
24165 |
24166 |{{echo|style='color:red'}}|foo
24167 |}
24168 !! html
24169 <table>
24170
24171 <tr>
24172 <td>
24173 </td>
24174 <td>foo
24175 </td></tr></table>
24176
24177 !!end
24178
24179 !!test
24180 Indented table with an empty td
24181 !! wikitext
24182 {|
24183 |-
24184 |
24185 |foo
24186 |}
24187 !! html
24188 <table>
24189
24190 <tr>
24191 <td>
24192 </td>
24193 <td>foo
24194 </td></tr></table>
24195
24196 !!end
24197
24198 ## We have some newline diffs RT-ing this edge case
24199 ## and it is not important enough -- we seem to be emitting
24200 ## at most 2 newlines after a </tr> and this is unrelated to
24201 ## the issue from T85627 that this is testing.
24202 !!test
24203 Indented table with blank lines in between (T85627)
24204 !! options
24205 parsoid=wt2html
24206 !! wikitext
24207 {|
24208 |foo
24209
24210
24211 |}
24212 !! html
24213 <table>
24214
24215 <tr>
24216 <td>foo
24217 </td></tr></table>
24218
24219 !!end
24220
24221 !!test
24222 Indented block & table
24223 !! wikitext
24224 <div>foo</div>
24225 {|
24226 |foo
24227 |}
24228 !! html/php
24229 <div>foo</div>
24230 <table>
24231 <tr>
24232 <td>foo
24233 </td></tr></table>
24234
24235 !! html/parsoid
24236 <div data-parsoid='{"stx":"html"}'>foo</div>
24237 <table><tbody>
24238 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24239 </tbody></table>
24240 !!end
24241
24242 !! test
24243 Indent and comment before table row
24244 !! wikitext
24245 {|
24246 <!--hi-->|-
24247 | there
24248 |}
24249 !! html/php
24250 <table>
24251
24252 <tr>
24253 <td> there
24254 </td></tr></table>
24255
24256 !! html/parsoid
24257 <table>
24258 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24259 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24260 </tbody></table>
24261 !! end
24262
24263 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24264 !!test
24265 Empty TR followed by a template-generated TR
24266 !!options
24267 parsoid
24268 !! wikitext
24269 {|
24270 |-
24271 {{echo|<tr><td>foo</td></tr>}}
24272 |}
24273 !! html
24274 <table>
24275 <tbody>
24276 <tr></tr>
24277 <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}}]}'>
24278 <td>foo</td></tr>
24279 </tbody></table>
24280 !!end
24281
24282 ## PHP and parsoid output differ for this, and since this is primarily
24283 ## for testing Parsoid's serializer, marking this Parsoid only
24284 !!test
24285 Empty TR followed by mixed-ws-comment line should RT correctly
24286 !!options
24287 parsoid
24288 !! wikitext
24289 {|
24290 |-
24291 <!--c-->
24292 |-
24293 <!--c--> <!--d-->
24294 |}
24295 !! html
24296 <table>
24297 <tbody>
24298 <tr></tr>
24299 <!--c-->
24300 <tr>
24301 <!--c--> </tr><!--d-->
24302 </tbody></table>
24303
24304 !!end
24305
24306 !!test
24307 Multi-line image caption generated by templates with/without trailing newlines
24308 !! wikitext
24309 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24310 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24311 !! html/parsoid
24312 <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>
24313 <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>
24314 !!end
24315
24316 !! test
24317 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24318 !! options
24319 parsoid=html2wt
24320 !! html/parsoid
24321 <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>
24322
24323 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24324 !! wikitext
24325 <includeonly>foo</includeonly>
24326 new para
24327
24328 [[Category:Foo]]
24329
24330 = new heading =
24331 !! end
24332
24333 ## PHP emits broken html for this, and since this is primarily
24334 ## a Parsoid serializer test, marking this Parsoid only
24335 !!test
24336 Improperly nested inline or quotes tags with whitespace in between
24337 !! wikitext
24338 <span> <s>x</span> </s>
24339 ''' ''x''' ''
24340 !! html/parsoid
24341 <p><span> <s>x</s></span><s> </s>
24342 <b> <i>x</i></b><i> </i>
24343 </p>
24344 !!end
24345
24346 !!test
24347 Encapsulate protected attributes from wt
24348 !! wikitext
24349 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24350 !! html/parsoid
24351 <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>
24352 </body>
24353 !!end
24354
24355 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24356 ## Having nested or stray pre tags results in the attempt to add duplicates,
24357 ## causing an assertion fail. This test tries to prevent that situation.
24358 !!test
24359 Ensure ParagraphWrapper can deal with stray closing pre tags
24360 !!options
24361 parsoid=wt2html
24362 !! wikitext
24363 plain text</pre>
24364 !! html/parsoid
24365 plain text
24366 !!end
24367
24368 !!test
24369 1. Ensure fostered text content is wrapped in element nodes
24370 !!options
24371 parsoid=wt2html
24372 !! wikitext
24373 <table>hi</table><table>ho</table>
24374 !! html/parsoid
24375 <p>hi</p>
24376 <table></table>
24377 <p>ho</p>
24378 <table></table>
24379 !!end
24380
24381 !!test
24382 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24383 !!options
24384 parsoid=wt2html,wt2wt
24385 !! wikitext
24386 <table>
24387 <tr> || ||
24388 <td> a
24389 </table>
24390 !! html/parsoid
24391 <p> || ||
24392 </p><table>
24393 <tbody><tr><td> a</td></tr>
24394 </tbody></table>
24395 !!end
24396
24397 !!test
24398 Encapsulation properly handles null DSR information from foster box
24399 !!options
24400 parsoid=wt2html,wt2wt
24401 !! wikitext
24402 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24403 !! html/parsoid
24404 <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>
24405 !!end
24406
24407 !!test
24408 1. Encapsulate foster-parented transclusion content
24409 !!options
24410 parsoid=wt2wt,wt2html
24411 !! wikitext
24412 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24413 !! html/parsoid
24414 <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>
24415 <tbody>
24416 <tr>
24417 <td>bar</td>
24418 </tr>
24419 </tbody>
24420 </table>
24421 !!end
24422
24423 !!test
24424 2. Encapsulate foster-parented transclusion content
24425 !!options
24426 parsoid=wt2wt,wt2html
24427 !! wikitext
24428 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24429 !! html/parsoid
24430 <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>
24431 <table>
24432 <tbody>
24433 <tr>
24434 <td>bar</td>
24435 </tr>
24436 </tbody>
24437 </table>
24438 !!end
24439
24440 !!test
24441 3. Encapsulate foster-parented transclusion content
24442 !!options
24443 parsoid=wt2wt,wt2html
24444 !! wikitext
24445 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24446 !! html/parsoid
24447 <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;]}">
24448 <p>foo</p>
24449 </div>
24450 <table>
24451 <tbody>
24452 <tr>
24453 <td>bar</td>
24454 </tr>
24455 </tbody>
24456 </table>
24457 !!end
24458
24459 !!test
24460 4. Encapsulate foster-parented transclusion content
24461 !!options
24462 parsoid=wt2wt,wt2html
24463 !! wikitext
24464 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24465 !! html/parsoid
24466 <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;]}">
24467 <p>foo</p>
24468 </div>
24469 <table>
24470 <tbody>
24471 <tr>
24472 <td>bar</td>
24473 </tr>
24474 </tbody>
24475 </table>
24476 !!end
24477
24478 !!test
24479 5. Encapsulate foster-parented transclusion content
24480 !!options
24481 parsoid=wt2wt,wt2html
24482 !! wikitext
24483 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24484 !! html/parsoid
24485 <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>
24486 <table>
24487 <tbody>
24488 <tr>
24489 <td>
24490 <div>
24491 <p>foo</p>
24492 </div>
24493 </td>
24494 </tr>
24495 </tbody>
24496 </table>
24497 !!end
24498
24499 !!test
24500 6. Encapsulate foster-parented transclusion content
24501 !!options
24502 parsoid=wt2wt,wt2html
24503 !! wikitext
24504 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24505 !! html/parsoid
24506 <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>
24507 <table>
24508 <tbody>
24509 <tr>
24510 <td>
24511 <div>
24512 <p>foo</p>
24513 </div>
24514 </td>
24515 </tr>
24516 </tbody>
24517 </table>
24518 <p>ok</p>
24519 !!end
24520
24521 !!test
24522 7. Encapsulate foster-parented transclusion content
24523 !!options
24524 parsoid=wt2wt,wt2html
24525 !! wikitext
24526 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24527 !! html/parsoid
24528 <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>
24529 <table>
24530 <tbody>
24531 <tr>
24532 <td>bar</td>
24533 </tr>
24534 </tbody>
24535 </table>
24536 !!end
24537
24538 # Note that the wt is broken on purpose: the = should be {{=}} if you
24539 # don't want it to be a template parameter key.
24540 !!test
24541 8. Encapsulate foster-parented transclusion content
24542 !!options
24543 parsoid=wt2wt,wt2html
24544 !! wikitext
24545 {{echo|a
24546 }}{|{{echo|style='color:red'}}
24547 |-
24548 |b
24549 |}
24550 !! html/parsoid
24551 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24552 <span> </span>
24553 <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>
24554 <table>
24555 <tbody>
24556 <tr>
24557 <td>b</td>
24558 </tr>
24559 </tbody>
24560 </table>
24561 !!end
24562
24563 !!test
24564 9. Encapsulate foster-parented transclusion content
24565 !!options
24566 parsoid=wt2wt,wt2html
24567 !! wikitext
24568 <table>{{echo|hi</table>hello}}
24569 !! html/parsoid
24570 <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>
24571 !!end
24572
24573 !!test
24574 Table in fosterable position
24575 !!options
24576 parsoid=wt2html
24577 !! wikitext
24578 {{OpenTable}}
24579 <div>
24580 {|
24581 |}
24582 </div>
24583 |}
24584 !! html/parsoid
24585 <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">
24586 </span>
24587 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24588
24589 <table>
24590 </table>
24591 !!end
24592
24593 # Parsoid only for bug 64747
24594 !! test
24595 Properly encapsulate empty-content transclusions in fosterable positions
24596 !! wikitext
24597 <table>
24598 {{#if:|
24599 <td>foo</td>
24600 }}
24601 </table>
24602 !! html/parsoid
24603 <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"}]]}'>
24604
24605 </table>
24606 !! end
24607
24608 !! test
24609 Always encapsulate foster box when template range is expanded to table
24610 !! options
24611 parsoid=wt2wt
24612 !! wikitext
24613 {|
24614 hello
24615 {{OpenTable}}
24616 |}
24617 !! html/parsoid
24618
24619 !! end
24620
24621 !! test
24622 T115289: Unclosed table
24623 !! wikitext
24624 {{echo|<table>}}<!--c-->[[Category:Two]]
24625 !! html/parsoid
24626 <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>
24627 !! end
24628
24629 !! test
24630 T115289: Don't migrate newlines out of tables with fostered content
24631 !! wikitext
24632 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24633 !! html/parsoid
24634 <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,"dsr":[0,53,7,0]}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24635 !! end
24636
24637 !! test
24638 T73074: More fostering fun
24639 !! wikitext
24640 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24641 !! html/parsoid
24642 <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>
24643 !! end
24644
24645 !!test
24646 Support <object> element with .data attribute
24647 !!options
24648 parsoid=html2wt
24649 !! html/parsoid
24650 <object data="test.swf"></object>
24651 !! wikitext
24652 <object data="test.swf"></object>
24653 !!end
24654
24655 !! test
24656 Don't block XML namespace declaration
24657 !! wikitext
24658 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24659 !! html/php
24660 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24661 </p>
24662 !! html/parsoid
24663 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24664 !! end
24665
24666 # -----------------------------------------------------------------
24667 # The following section of tests are primarily to spec requirements
24668 # around serialization of new/edited content.
24669 #
24670 # All these tests are marked Parsoid html2wt and html2html only
24671 # ----------------------------------------------------------------
24672
24673 # 'mi' is a localinterwiki prefix as well as a language
24674 !! test
24675 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24676 !! options
24677 parsoid=html2wt
24678 !! html/parsoid
24679 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24680 !! wikitext
24681 [[Foo]]
24682 !! end
24683
24684 # See T93839
24685 !! test
24686 New wikilinks should be serialized properly
24687 !! options
24688 parsoid=html2wt
24689 !! html/parsoid
24690 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24691 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24692 !! wikitext
24693 [[Foo]]
24694 [[Foo]]
24695 !! end
24696
24697 !! test
24698 New wiki links (href variations)
24699 !! options
24700 parsoid=html2wt
24701 !! html/parsoid
24702 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24703 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24704 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24705 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24706 !! wikitext
24707 [[Foo_bar]]
24708 [[Foo_bar]]
24709 [[Foo_bar]]
24710 [[Toxine bactérienne]]
24711 !! end
24712
24713 !! test
24714 New wiki links (content string variations)
24715 !! options
24716 parsoid=html2wt
24717 !! html/parsoid
24718 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24719 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24720 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24721 !! wikitext
24722 [[Foo_bar]]
24723 [[Foo bar]]
24724 [[Foo_bar|./Foo_bar]]
24725 !! end
24726
24727 !! test
24728 New category links (href variations)
24729 !! options
24730 parsoid=html2wt
24731 !! html/parsoid
24732 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24733 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24734 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24735 !! wikitext
24736 [[Category:Toxine bactérienne]]
24737 [[Category:Toxine bactérienne]]
24738 [[Category:Toxine bactérienne]]
24739 !! end
24740
24741 !! test
24742 New sol transparent links don't need indent-pre nowiki protection
24743 !! options
24744 parsoid=html2wt
24745 language=de
24746 !! html/parsoid
24747 <link rel="mw:PageProp/redirect" href="./Main_Page">
24748 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24749 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24750 !! wikitext
24751 #WEITERLEITUNG [[Main Page]]
24752 <!-- this is good --> [[Category:Good]]
24753 <!-- this is great --> [[Kategorie:Great]]
24754 !! end
24755
24756 !! test
24757 New interlanguage links (href variations)
24758 !! options
24759 parsoid=html2wt
24760 !! html/parsoid
24761 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24762 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24763 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24764 !! wikitext
24765 [[es:Toxine bactérienne]]
24766 [[es:Toxine_bactérienne]]
24767 [[es:Toxine_bactérienne]]
24768 !! end
24769
24770 !! test
24771 Image: Modifying size of an image (1)
24772 !! options
24773 parsoid={
24774 "modes": ["wt2wt"],
24775 "changes": [
24776 ["img[height]", "attr", "height", "22"],
24777 ["img[width]", "attr", "width", "200"]
24778 ]
24779 }
24780 !! wikitext
24781 [[Image:Foobar.jpg|230x230px]]
24782 !! wikitext/edited
24783 [[Image:Foobar.jpg|200x200px]]
24784 !!end
24785
24786 !! test
24787 Image: Modifying size of an image (2)
24788 !! options
24789 parsoid={
24790 "modes": ["wt2wt"],
24791 "changes": [
24792 ["img[height]", "attr", "height", "100"],
24793 ["img[width]", "attr", "width", "500"]
24794 ]
24795 }
24796 !! wikitext
24797 [[Image:Foobar.jpg|230x230px]]
24798 !! wikitext/edited
24799 [[Image:Foobar.jpg|500x500px]]
24800 !!end
24801
24802 # Change in size is ignored so long as class='mw-default-size'
24803 !! test
24804 Image: Modifying size of an image (3)
24805 !! options
24806 parsoid={
24807 "modes": ["wt2wt"],
24808 "changes": [
24809 ["figure[class]", "removeClass", "mw-default-size"],
24810 ["figure img", "attr", "height", "19"],
24811 ["figure img", "attr", "width", "170"]
24812 ]
24813 }
24814 !! wikitext
24815 [[Image:Foobar.jpg|thumb]]
24816 !! wikitext/edited
24817 [[Image:Foobar.jpg|thumb|170x170px]]
24818 !!end
24819
24820 !! test
24821 Image: Modifying alignment of an image (bug 48665)
24822 !! options
24823 parsoid={
24824 "modes": ["wt2wt"],
24825 "changes": [
24826 ["figure[class]", "removeClass", "mw-halign-right"],
24827 ["figure[class]", "addClass", "mw-halign-left"]
24828 ]
24829 }
24830 !! wikitext
24831 [[Image:Foobar.jpg|thumb|caption|right]]
24832 !! wikitext/edited
24833 [[Image:Foobar.jpg|thumb|caption|left]]
24834 !! end
24835
24836 !! test
24837 Image: Modifying mw-default-size of an frameless image (bug 62805)
24838 !! options
24839 parsoid={
24840 "modes": ["wt2wt"],
24841 "changes": [
24842 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24843 ]
24844 }
24845 !! wikitext
24846 [[Image:Foobar.jpg|frameless|right]]
24847 !! wikitext/edited
24848 [[Image:Foobar.jpg|frameless|right|220x220px]]
24849 !! end
24850
24851 !! test
24852 Image: Modifying valign of an image (bug 49221)
24853 !! options
24854 parsoid={
24855 "modes": ["wt2wt"],
24856 "changes": [
24857 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24858 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24859 ]
24860 }
24861 !! wikitext
24862 [[File:Foobar.jpg|20px|middle]]
24863 !! wikitext/edited
24864 [[File:Foobar.jpg|20px|text-top]]
24865 !! end
24866
24867 !! test
24868 Image: Modifying alt attribute of an image (bug 56400)
24869 !! options
24870 parsoid={
24871 "modes": ["wt2wt"],
24872 "changes": [
24873 ["img[alt]", "attr", "alt", "some alternate edited text"]
24874 ]
24875 }
24876 !! wikitext
24877 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24878 !! wikitext/edited
24879 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24880 !!end
24881
24882 !! test
24883 Image: Modifying caption of an image
24884 !! options
24885 parsoid={
24886 "modes": ["wt2wt"],
24887 "changes": [
24888 ["figcaption", "text", "new caption"]
24889 ]
24890 }
24891 !! wikitext
24892 [[Image:Foobar.jpg|thumb|original caption]]
24893 !! wikitext/edited
24894 [[Image:Foobar.jpg|thumb|new caption]]
24895 !!end
24896
24897 !! test
24898 Image: empty alt attribute (bug 48924)
24899 !! options
24900 parsoid
24901 !! wikitext
24902 [[File:Foobar.jpg|thumb|alt=|bar]]
24903 !! html
24904 <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>
24905 !! end
24906
24907 !! test
24908 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24909 !! options
24910 parsoid=html2wt
24911 language=ar
24912 disabled
24913 !! html/parsoid
24914 <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>
24915 !! wikitext
24916 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24917 !! end
24918
24919 !! test
24920 Image: Block level image should have \n before and after
24921 !! wikitext
24922 123
24923 [[File:Foobar.jpg|right|thumb|150x150px]]
24924 456
24925 !! html/parsoid
24926 <p>123</p>
24927 <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>
24928 <p>456</p>
24929 !!end
24930
24931 !! test
24932 Image: New block level image should have \n before and after (existing content)
24933 !! wikitext
24934 123
24935 [[File:Foobar.jpg|right|thumb|150x150px]]
24936 456
24937 !! html/parsoid
24938 <p>123</p>
24939 <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>
24940 <p>456</p>
24941 !!end
24942
24943 !! test
24944 Image: upright option (parsoid)
24945 !! wikitext
24946 [[File:Foobar.jpg|thumb|upright|caption]]
24947 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24948 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24949 !! html/parsoid
24950 <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>
24951 <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>
24952 <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>
24953 !!end
24954
24955 !! test
24956 Image: upright option is ignored on inline and frame images (parsoid)
24957 !! wikitext
24958 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24959 !! html/parsoid
24960 <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>
24961 !!end
24962
24963 !! test
24964 Image: from basic HTML (1)
24965 !! options
24966 parsoid=html2wt
24967 !! html/parsoid
24968 <span typeof="mw:Image">
24969 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24970 </span>
24971 !! wikitext
24972 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24973 !! end
24974
24975 !! test
24976 Image: from basic HTML (2)
24977 !! options
24978 parsoid=html2wt
24979 !! html/parsoid
24980 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24981 !! wikitext
24982 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24983 !! end
24984
24985 !! test
24986 Image: from basic HTML (3)
24987 !! options
24988 parsoid=html2wt
24989 !! html/parsoid
24990 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24991 !! wikitext
24992 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24993 !! end
24994
24995 !! test
24996 Image: from basic HTML (4)
24997 !! options
24998 parsoid=html2wt
24999 !! html/parsoid
25000 <img src="./File:Foobar.jpg">
25001 !! wikitext
25002 [[File:Foobar.jpg|link=]]
25003 !! end
25004
25005 !! test
25006 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25007 !! options
25008 parsoid=html2wt
25009 !! html/parsoid
25010 <ul>
25011 <li><p>foo</p></li>
25012 </ul>
25013 !! wikitext
25014 * foo
25015 !! end
25016
25017 !! test
25018 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25019 !! options
25020 parsoid=html2wt
25021 !! html/parsoid
25022 <ul> <li>foo</li></ul>
25023 !! wikitext
25024 * foo
25025 !! end
25026
25027 !! test
25028 Don't strip leading whitespace when handling indent-pre suppressing tags
25029 !! options
25030 parsoid=html2wt
25031 !! html/parsoid
25032 <table>
25033 <tr><td> indented row</td></tr>
25034 </table>
25035 <blockquote><p>
25036 <b>This is very bold of you!</b>
25037 </p>
25038 <table><tr><td>
25039 indented cell (no pre-wrapping!)
25040 </td></tr></table>
25041 </blockquote>
25042 <p>foo</p>
25043 <div>bar</div>
25044 !! wikitext
25045 {|
25046 | indented row
25047 |}
25048 <blockquote>
25049 '''This is very bold of you!'''
25050
25051 {|
25052 |
25053 indented cell (no pre-wrapping!)
25054 |}
25055 </blockquote>
25056 foo
25057 <div>bar</div>
25058 !! end
25059
25060 !! test
25061 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25062 !! options
25063 parsoid=html2wt
25064 !! html/parsoid
25065 <p>foo</p>
25066 <span>bar</span>
25067
25068 <span>foo2
25069 </span>bar2
25070
25071 <div>foo</div>
25072 <span>bar</span>
25073
25074 <div>
25075 <span>foo</span>
25076 </div>
25077 !! wikitext
25078 foo
25079
25080 <span>bar</span>
25081
25082 <span>foo2
25083 <nowiki> </nowiki></span>bar2
25084
25085 <div>foo</div>
25086 <nowiki> </nowiki><span>bar</span>
25087
25088 <div>
25089 <nowiki> </nowiki><span>foo</span>
25090 </div>
25091 !! end
25092
25093 !! test
25094 Lists: Dont insert newlines in a serialized list item.
25095 !! options
25096 parsoid=html2wt
25097 !! html/parsoid
25098 <ul><li>a<br>b</li><li>c</li></ul>
25099 !! wikitext
25100 * a<br>b
25101 * c
25102 !! end
25103
25104 !! test
25105 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25106 !! options
25107 parsoid={
25108 "modes": ["html2wt"],
25109 "scrubWikitext": false
25110 }
25111 !! html/parsoid
25112 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25113 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25114
25115 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25116 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25117
25118 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25119
25120 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25121 !! wikitext
25122 == hello there [[Category:A1]] ==
25123
25124 == [[Category:A2]] hi pal ==
25125
25126 == <!--foo--> [[Category:A3]] how goes it ==
25127
25128 == it goes well [[Category:A4]] <!--bar--> ==
25129
25130 ==howdy [[Category:A5]]==
25131
25132 == __TOC__ ok ==
25133 !! end
25134
25135 !! test
25136 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25137 !! options
25138 parsoid={
25139 "modes": ["html2wt"],
25140 "scrubWikitext": true
25141 }
25142 !! html/parsoid
25143 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25144 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25145
25146 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25147 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25148
25149 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25150 !! wikitext
25151 == hello there ==
25152 [[Category:A1]]
25153 [[Category:A2]]
25154
25155 == hi pal ==
25156
25157 <!--foo--> [[Category:A3]]
25158
25159 == how goes it ==
25160
25161 == it goes well ==
25162 [[Category:A4]] <!--bar-->
25163
25164 __TOC__
25165
25166 == ok ==
25167 !! end
25168
25169 !! test
25170 Headings: Don't hoist metas that come from templates
25171 !! options
25172 parsoid={
25173 "modes": ["html2wt"],
25174 "scrubWikitext": true
25175 }
25176 !! html/parsoid
25177 <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>
25178 !! wikitext
25179 == {{echo|foo [[Category:Foo]]}} ==
25180 !! end
25181
25182 !! test
25183 Headings: Category in ref isn't hoisted
25184 !! options
25185 parsoid={
25186 "modes": ["html2wt"],
25187 "scrubWikitext": true
25188 }
25189 !! html/parsoid
25190 <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>
25191
25192 <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>
25193 !! wikitext
25194 == foo <ref>bar
25195 [[Category:Baz]] </ref> ==
25196
25197 <references />
25198 !! end
25199
25200 !! test
25201 Parsoid: Serialize positional parameters with = in them as named parameter
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <p about="#mwt1" typeof="mw:Transclusion"
25206 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25207
25208 <p about="#mwt1" typeof="mw:Transclusion"
25209 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25210
25211 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25212 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25213 <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>
25214 !! wikitext
25215 {{echo|1=f=oo}}
25216
25217 {{echo|1=f=oo|2=bar}}
25218
25219 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25220 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25221 {{echo|<nowiki>f=oo</nowiki>|bar}}
25222 !! end
25223
25224 !! test
25225 Parsoid: Serialize positional parameters with = in extlink as named parameter
25226 !! options
25227 parsoid=html2wt
25228 !! html/parsoid
25229 <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>
25230 !! wikitext
25231 {{echo|1=http://stuff?is=ok}}
25232 !! end
25233
25234 !! test
25235 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25236 !! options
25237 parsoid=html2wt
25238 !! html/parsoid
25239 <div>a<p>b</p></div>
25240 <div>a
25241 <p>b</p></div>
25242 <div>
25243 a
25244 <p>b</p></div>
25245 !! wikitext
25246 <div>a
25247 b
25248 </div>
25249 <div>a
25250 b
25251 </div>
25252 <div>
25253 a
25254
25255 b
25256 </div>
25257 !! end
25258
25259 !! test
25260 Substrings resembling wikitext in hrefs should not get nowiki escapes
25261 !! options
25262 parsoid=html2wt
25263 !! html/parsoid
25264 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25265 !! wikitext
25266 [[Foo''bar''baz]]
25267 !! end
25268
25269 !! test
25270 Enforce single-line context in the serializer
25271 !! options
25272 parsoid=html2wt
25273 !! html/parsoid
25274 <h2>testing
25275 123</h2>
25276
25277 <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">
25278 </span><span about="#mwt1">you</span> </h2>
25279
25280 <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>
25281
25282 <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
25283 there</span></li></ol>
25284
25285 <ul><li>asd
25286 sdf</li></ul>
25287
25288 <ul><li>foo
25289 bar
25290 baz</li>
25291 <li>foo <b>bar</b>
25292 baz</li></ul>
25293
25294 <dl><dt>hi
25295 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25296 ho</dd></dl>
25297
25298 <dl><dd> <table>
25299 <tbody><tr><td> ha
25300 ha
25301 ha</td></tr>
25302 </tbody></table></dd></dl>
25303 !! wikitext
25304 == testing 123 ==
25305
25306 == hi {{bogus|there
25307 you}} ==
25308
25309 == foo <ref>hello
25310 there</ref> ==
25311
25312 <references />
25313
25314 * asd sdf
25315
25316 * foo bar baz
25317 * foo '''bar''' baz
25318
25319 ; hi ho : hi ho
25320
25321 : {|
25322 | ha
25323 ha
25324 ha
25325 |}
25326 !! end
25327
25328 !! test
25329 Serialize new placeholder space without spans
25330 !! options
25331 parsoid=html2wt
25332 !! html/parsoid
25333 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25334
25335 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25336
25337 <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>
25338 !! wikitext
25339 foo : bar
25340
25341 foo : bar
25342
25343 <ref>foo : bar</ref>ok
25344 !! end
25345
25346
25347 #-----------------------
25348 # Tag minimization tests
25349 #-----------------------
25350
25351 !! test
25352 1. I/B quote minimization: wikitext-only tags should be combined
25353 !! options
25354 parsoid=html2wt
25355 !! html/parsoid
25356 <p><i>A</i><i>B</i></p>
25357 <p><b>A</b><b>B</b></p>
25358 <p><i>A</i><b><i>B</i></b></p>
25359 <p><b>A</b><i><b>B</b></i></p>
25360 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25361 <p><i><b>A</b></i><i><b>B</b></i></p>
25362 <p><i><b>A</b></i><b><i>B</i></b></p>
25363 <p><b><i>A</i></b><i><b>B</b></i></p>
25364 !! wikitext
25365 ''AB''
25366
25367 '''AB'''
25368
25369 ''A'''B'''''
25370
25371 '''A''B'''''
25372
25373 '''A''BC''D'''
25374
25375 '''''AB'''''
25376
25377 '''''AB'''''
25378
25379 '''''AB'''''
25380 !! end
25381
25382 !! test
25383 2. I/B quote minimization: wikitext and html tags should not be combined
25384 !! options
25385 parsoid=html2wt
25386 !! html/parsoid
25387 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25388 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25389 !! wikitext
25390 ''A''<i>B</i>
25391
25392 ''A''<nowiki/>'''<i>B</i>'''
25393 !! end
25394
25395 !! test
25396 3. I/B quote minimization: templated content stops minimization
25397 !! options
25398 parsoid=html2wt
25399 !! html/parsoid
25400 <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>
25401 <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>
25402 !! wikitext
25403 ''A''{{echo|''B''}}
25404
25405 ''A''{{echo|'''''B'''''}}
25406 !! end
25407
25408 !! test
25409 4. I/B quote minimization: new content should be mimimized with adjacent old content
25410 !! options
25411 parsoid=html2wt
25412 !! html/parsoid
25413 <p><i>A</i><i>B</i></p>
25414 <p><b>A</b><b>B</b></p>
25415 <p><i>A</i><b><i>B</i></b></p>
25416 !! wikitext
25417 ''AB''
25418
25419 '''AB'''
25420
25421 ''A'''B'''''
25422 !! end
25423
25424 !! test
25425 5a. Merge adjacent quote nodes if they've been edited
25426 !! options
25427 parsoid={
25428 "modes": ["wt2wt", "selser"],
25429 "changes": [
25430 ["p", "contents", "remove", ":contains('b')"]
25431 ]
25432 }
25433 !! wikitext
25434 ''a''b''c''
25435 !! wikitext/edited
25436 ''ac''
25437 !! end
25438
25439 !! test
25440 5b. Merge adjacent quote nodes if they've been edited
25441 !! options
25442 parsoid={
25443 "modes": ["wt2wt", "selser"],
25444 "changes": [
25445 ["#x", "remove"]
25446 ]
25447 }
25448 !! wikitext
25449 ''a''<span id="x">b</span>''c''
25450 !! wikitext/edited
25451 ''ac''
25452 !! end
25453
25454 !! test
25455 1. Merge adjacent link nodes as long as at least one element is new
25456 !! options
25457 parsoid={
25458 "modes": ["html2wt"],
25459 "scrubWikitext": true
25460 }
25461 !! html/parsoid
25462 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25463 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25464 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25465 !! wikitext
25466 [[Football]]
25467 [[Football]]
25468 [[Football|Foot]][[Football|ball]]
25469 !! end
25470
25471 !! test
25472 2. Merge adjacent link nodes and enable additional normalizations
25473 !! options
25474 parsoid={
25475 "modes": ["html2wt"],
25476 "scrubWikitext": true
25477 }
25478 !! html/parsoid
25479 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25480 !! wikitext
25481 [[Football|''Football'']]
25482 !! end
25483
25484 !! test
25485 3. Don't merge adjacent link nodes if scrubWikitext is false
25486 !! options
25487 parsoid={
25488 "modes": ["html2wt"],
25489 "scrubWikitext": false
25490 }
25491 !! html/parsoid
25492 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25493 !! wikitext
25494 [[Football|Foot]][[Football|ball]]
25495 !! end
25496
25497 #------------------------------
25498 # End of tag minimization tests
25499 #------------------------------
25500
25501 !!test
25502 Bug 54262: New entities
25503 !! options
25504 parsoid=html2wt
25505 !! html/parsoid
25506 <span typeof="mw:Entity">&nbsp;</span>
25507 !! wikitext
25508 &nbsp;
25509 !! end
25510
25511 ## Note that there is no wikitext output for 'unknownproperty' ##
25512 ## Unknown magic words are silently dropped ##
25513
25514 !! test
25515 Magic words
25516 !! options
25517 parsoid=html2wt
25518 !! html/parsoid
25519 <meta property='mw:PageProp/toc' />
25520 <meta property='mw:PageProp/notoc' />
25521 <meta property='mw:PageProp/forcetoc' />
25522 <meta property='mw:PageProp/index' />
25523 <meta property='mw:PageProp/noindex' />
25524 <meta property='mw:PageProp/nogallery' />
25525 <meta property='mw:PageProp/noeditsection' />
25526 <meta property='mw:PageProp/notitleconvert' />
25527 <meta property='mw:PageProp/nocontentconvert' />
25528 <meta property='mw:PageProp/unknownproperty' />
25529 !! wikitext
25530 __TOC__
25531 __NOTOC__
25532 __FORCETOC__
25533 __INDEX__
25534 __NOINDEX__
25535 __NOGALLERY__
25536 __NOEDITSECTION__
25537 __NOTITLECONVERT__
25538 __NOCONTENTCONVERT__
25539 !! end
25540
25541 !! test
25542 Consecutive <pre>s should not get merged
25543 !! options
25544 parsoid=html2wt,html2html
25545 !! html/parsoid
25546 <pre>a</pre><pre>b</pre>
25547
25548 <pre>c
25549 </pre><pre>
25550 d</pre>
25551
25552 <pre>e
25553
25554 </pre><pre>
25555
25556 f</pre>
25557 !! wikitext
25558 a
25559
25560 b
25561
25562 c
25563
25564 d
25565
25566 e
25567
25568
25569
25570 f
25571 !! end
25572
25573 !! test
25574 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25575 !! options
25576 parsoid=html2wt
25577 !! html/parsoid
25578 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25579 !! wikitext
25580 [[Special:BookSources/1234567890|ISBN 1234567895]]
25581 !! end
25582
25583 !! test
25584 Edited RFC links not serializable as RFC links should serialize as extlinks
25585 !! options
25586 parsoid=html2wt
25587 !! html/parsoid
25588 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25589 !! wikitext
25590 [//tools.ietf.org/html/rfc123 New RFC]
25591 !! end
25592
25593 !! test
25594 Edited PMID links not serializable as PMID links should serialize as extlinks
25595 !! options
25596 parsoid=html2wt
25597 !! html/parsoid
25598 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25599 !! wikitext
25600 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25601 !! end
25602
25603 !! test
25604 WTS of autolinks with trailing/surrounding context
25605 !! options
25606 parsoid=html2wt
25607 !! html/parsoid
25608 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25609 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25610 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25611 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25612 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25613 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25614 !! wikitext
25615 http://cscott.net'''foo'''
25616
25617 http://cscott.net<b>foo</b>
25618
25619 '''http://cscott.net'''
25620
25621 '''http://cscott.net '''
25622
25623 '''http://cscott.net<nowiki/>x'''
25624
25625 http://cscott.net<nowiki/>x
25626 !! end
25627
25628 !! test
25629 WTS of autolinks with nowikis (round-trip)
25630 !! wikitext
25631 x<nowiki/>http://cscott.net<nowiki/>x
25632 !! html/parsoid
25633 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25634 !! end
25635
25636 # this is the "easy" test because it leaves in place all the
25637 # data-parsoid information indicating this is an autolink
25638 !! test
25639 WTS of autolinks with escapes (editing)
25640 !! options
25641 parsoid={
25642 "modes": ["wt2wt"],
25643 "changes": [
25644 [ "meta", "remove" ]
25645 ]
25646 }
25647 !! wikitext
25648 x<nowiki/>http://cscott.net<nowiki/>x
25649 !! wikitext/edited
25650 x<nowiki/>http://cscott.net<nowiki/>x
25651 !! end
25652
25653 !! test
25654 WTS of edited autolink-like text (T103364)
25655 !! options
25656 parsoid={
25657 "modes": ["wt2wt"],
25658 "changes": [
25659 [ "span[typeof]", "removeAttr", "typeof" ]
25660 ]
25661 }
25662 !! wikitext
25663 Not a link: <nowiki>http://example.com</nowiki>.
25664 !! wikitext/edited
25665 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25666 !! end
25667
25668 !! test
25669 WTS of newly-authored autolink-like text (T103364)
25670 !! options
25671 parsoid=html2wt
25672 !! html/parsoid
25673 <p>http://example.com is not a link.</p>
25674 !! wikitext
25675 <nowiki>http://example.com</nowiki> is not a link.
25676 !! end
25677
25678 !! test
25679 WTS of autolink-like text after an autolink (T108563)
25680 !! options
25681 parsoid=html2wt
25682 !! html/parsoid
25683 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25684 !! wikitext
25685 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25686 !! end
25687
25688 !! test
25689 Magic links inside links (not autolinked)
25690 !! wikitext
25691 [[Foo|http://example.com]]
25692 [[Foo|RFC 1234]]
25693 [[Foo|PMID 1234]]
25694 [[Foo|ISBN 123456789x]]
25695
25696 [http://foo.com http://example.com]
25697 [http://foo.com RFC 1234]
25698 [http://foo.com PMID 1234]
25699 [http://foo.com ISBN 123456789x]
25700 !! html+tidy
25701 <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>
25702 <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>
25703 !! html/parsoid
25704 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25705 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25706 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25707 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25708
25709 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25710 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25711 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25712 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25713 !! end
25714
25715 !! test
25716 Magic links inside image captions (autolinked)
25717 !! wikitext
25718 [[File:Foobar.jpg|thumb|http://example.com]]
25719 [[File:Foobar.jpg|thumb|RFC 1234]]
25720 [[File:Foobar.jpg|thumb|PMID 1234]]
25721 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25722 !! html+tidy
25723 <div class="thumb tright">
25724 <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>
25725 <div class="thumbcaption">
25726 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25727 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25728 </div>
25729 </div>
25730 <div class="thumb tright">
25731 <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>
25732 <div class="thumbcaption">
25733 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25734 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25735 </div>
25736 </div>
25737 <div class="thumb tright">
25738 <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>
25739 <div class="thumbcaption">
25740 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25741 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25742 </div>
25743 </div>
25744 <div class="thumb tright">
25745 <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>
25746 <div class="thumbcaption">
25747 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25748 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25749 </div>
25750 </div>
25751 !! html/parsoid
25752 <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>
25753 <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>
25754 <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>
25755 <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>
25756 !! end
25757
25758 !! test
25759 WTS of magic word text (T109371)
25760 !! options
25761 parsoid=html2wt
25762 !! html/parsoid
25763 <p>RFC 1234</p>
25764 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25765 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25766 !! wikitext
25767 <nowiki>RFC 1234</nowiki>
25768
25769 [http://foo.com RFC 1234]
25770
25771 [[Foo|RFC 1234]]
25772 !! end
25773
25774 !! test
25775 Edited Redirect link should emit a non-piped wikitext link
25776 !! options
25777 parsoid=html2wt
25778 !! html/parsoid
25779 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25780 !! wikitext
25781 #REDIRECT [[Bar]]
25782 !! end
25783
25784 !! test
25785 T75121: Infer extension name from typeOf if data-mw is not present
25786 !! options
25787 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25788 !! html/parsoid
25789 <div typeOf="mw:Extension/foo"></div>
25790 !! wikitext
25791 <foo />
25792 !! end
25793
25794 # Note that the <p> wrapping isn't present in PHP parser output
25795 # The important thing for this test is that P-wrapping doesn't
25796 # interfere with the <nowiki> protection for leading - in <td>
25797 # (which isn't necessary for <th>).
25798 !! test
25799 T88318: p-wrapped dash in table.
25800 !! options
25801 parsoid=html2wt,wt2wt
25802 !! html/parsoid
25803 <table><tbody>
25804 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25805 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25806 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25807 </tbody></table>
25808 !! wikitext
25809 {|
25810 !-
25811 !-
25812 |-
25813 |<nowiki>-</nowiki>
25814 |<nowiki>- </nowiki>
25815 |-
25816 |<small>-</small>
25817 |<br>
25818 -
25819 |<br>
25820 -
25821 |}
25822 !! html/php+tidy
25823 <table>
25824 <tr>
25825 <th>-</th>
25826 <th>-</th>
25827 </tr>
25828 <tr>
25829 <td>-</td>
25830 <td>-</td>
25831 </tr>
25832 <tr>
25833 <td><small>-</small></td>
25834 <td><br />
25835 <p>-</p>
25836 </td>
25837 <td><br />
25838 <p>-</p>
25839 </td>
25840 </tr>
25841 </table>
25842 !! end
25843
25844 !! test
25845 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25846 !! options
25847 parsoid=html2wt
25848 !! html/parsoid
25849 <table id='mwAb'>
25850 <td id='mwAc'>foo</td>
25851 <td id='serialize-this'>bar</td>
25852 </table>
25853 !! wikitext
25854 {|
25855 |foo
25856 | id="serialize-this" |bar
25857 |}
25858 !! end
25859
25860 !! test
25861 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25862 !! options
25863 parsoid=html2wt
25864 !! html/parsoid
25865 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25866 !! wikitext
25867 <div id="hello">ok</div>
25868 !! end
25869
25870 !! test
25871 WTS change modes
25872 !! options
25873 parsoid={
25874 "modes": ["wt2wt"],
25875 "changes": [
25876 [ "#xyz", "before", "<b>before</b> stuff " ],
25877 [ "#xyz", "after", " stuff <i>after</i>" ],
25878 [ "#xyz", "html", "x <b>y</b> z" ]
25879 ]
25880 }
25881 !! wikitext
25882 <span id="xyz">hello</span>
25883 !! wikitext/edited
25884 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25885 !! end
25886
25887 !! test
25888 Never serialize a-tag as html, regardless of what data-parsoid has to say
25889 !! options
25890 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25891 !! html/parsoid
25892 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25893 !! wikitext
25894 [[Foo]]
25895 !! end
25896
25897 ## SSS FIXME: This is broken output nevertheless.
25898 ## What might be a reasonable non-broken output for this?
25899 ## This is an edge case unlikely to be seen in production
25900 ## that I am not wasting more time on this right now.
25901 !! test
25902 Never serialize a-tag as html, no matter what attributes it has
25903 !! options
25904 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25905 !! html/parsoid
25906 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25907 !! wikitext
25908 [http://boo.org http://boohoo.org]
25909 !! end
25910
25911 # Misnested is an indication that selser can reuse the source but these have
25912 # shown to sneak through on occasion. See T101768.
25913 # The original wikitext here is: [http://test.com [[one]] two three]
25914 !! test
25915 Strip span tags added to mark misnested links
25916 !! options
25917 parsoid=html2wt
25918 !! html/parsoid
25919 <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>
25920 !! wikitext
25921 [http://test.com][[one]] two three
25922 !! end
25923
25924 !! test
25925 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25926 !! options
25927 parsoid=html2wt
25928 !! html/parsoid
25929 <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|}"]}'>
25930 <tbody><tr><td>d
25931 </td></tr>
25932 </tbody></table>
25933 !! wikitext
25934 {{echo|a}}
25935 {|{{echo|c
25936 {{!}}d
25937 }}
25938 |}
25939 !! end
25940
25941 ## This test verifies the presence and computation of this attribute indirectly
25942 ## by making an edit and ensuring that the serialization is correct (which it would be
25943 ## only if firstWikitextNode is properly set).
25944 !! test
25945 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25946 !! options
25947 parsoid= {
25948 "modes": ["wt2wt"],
25949 "changes": [
25950 [ "div#x", "remove" ],
25951 [ "div", "before", "<div>new</div>" ]
25952 ]
25953 }
25954 !! wikitext
25955 <div id="x">foo</div>
25956 {|
25957 {{echo|<div>boo</div>
25958 {{!}}b}}
25959 |c
25960 |}
25961 !! wikitext/edited
25962
25963 <div>new</div>
25964 {|
25965 {{echo|<div>boo</div>
25966 {{!}}b}}
25967 |c
25968 |}
25969 !! end
25970
25971 # --------------------------------------------
25972 # Tests spec'ing wikitext serialization norms |
25973 # --------------------------------------------
25974
25975 !! test
25976 1. Categories should always be serialized on their own line
25977 !! options
25978 parsoid=html2wt
25979 !! html/parsoid
25980 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25981 !! wikitext
25982 foo
25983 [[Category:Foo]]
25984 bar
25985 !! end
25986
25987 !! test
25988 2. Categories that are part of templates should not introduce a line break
25989 !! wikitext
25990 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25991 !! html/parsoid
25992 <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>
25993 !! end
25994
25995 # Careful while editing these next 2 tests. There are \u200f characters
25996 # before and after the <link> tags in the HTML and following some
25997 # of the categories in wikitext
25998 # Do not remove these characters in edits.
25999 #
26000 # As part of the serialization, these bidi characters will get stripped.
26001 !! test
26002 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26003 !! options
26004 parsoid={
26005 "modes": ["html2wt"],
26006 "scrubWikitext": true
26007 }
26008 !! html/parsoid
26009 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26010 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26011 !! wikitext
26012 [[קטגוריה:טקסים]]
26013 [[קטגוריה: שיטות משפט]]
26014 !! end
26015
26016 !! test
26017 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26018 !! options
26019 parsoid={
26020 "modes": ["html2wt"],
26021 "scrubWikitext": true
26022 }
26023 !! html/parsoid
26024 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26025 !! wikitext
26026 [[קטגוריה:טקסים]]
26027 ‏y
26028 !! end
26029
26030 !! test
26031 Lists: Add space after bullets
26032 !! options
26033 parsoid=html2wt
26034 !! html/parsoid
26035 <ul>
26036 <li>foo</li>
26037 <li> bar</li>
26038 <li><span> baz</span></li>
26039 </ul>
26040 !! wikitext
26041 * foo
26042 * bar
26043 * <span> baz</span>
26044 !! end
26045
26046 !! test
26047 1. Headings: Add space before/after == (T53744)
26048 !! options
26049 parsoid=html2wt
26050 !! html/parsoid
26051 <h2>foo</h2>
26052 <h2> bar</h2>
26053 <h2>baz </h2>
26054 <h2><span> baz</span></h2>
26055 !! wikitext
26056 == foo ==
26057
26058 == bar ==
26059
26060 == baz ==
26061
26062 == <span> baz</span> ==
26063 !! end
26064
26065 !! test
26066 2. Headings: Add space before/after == even after hoisted content
26067 !! options
26068 parsoid={
26069 "modes": ["html2wt"],
26070 "scrubWikitext": true
26071 }
26072 !! html/parsoid
26073 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26074 !! wikitext
26075 [[Category:A2]]
26076
26077 == ok ==
26078 !! end
26079
26080 !! test
26081 1. Headings: suppress newly created empty headings
26082 !! options
26083 parsoid={
26084 "modes": ["html2wt"],
26085 "scrubWikitext": true
26086 }
26087 !! html/parsoid
26088 <h2></h2>
26089 !! wikitext
26090 !! end
26091
26092 !! test
26093 2. Headings: don't suppress empty headings if scrubWikitext is false
26094 !! options
26095 parsoid=html2wt
26096 !! html/parsoid
26097 <h2></h2>
26098 !! wikitext
26099 ==<nowiki/>==
26100 !! end
26101
26102 !! test
26103 3. Headings: suppress empty headings on edits
26104 !! options
26105 parsoid={
26106 "modes": ["selser"],
26107 "scrubWikitext": true,
26108 "changes": [
26109 [ "#x", "remove"]
26110 ]
26111 }
26112 !! wikitext
26113 ==<span id="x">foo</span>==
26114 !! wikitext/edited
26115 !! end
26116
26117 !! test
26118 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26119 !! options
26120 parsoid={
26121 "modes": ["html2wt"],
26122 "scrubWikitext": true
26123 }
26124 !! html/parsoid
26125 <h2>foo<br/>bar</h2>
26126 <h2>foo <span><br/>bar</span> baz</h2>
26127 !! wikitext
26128 == foo bar ==
26129
26130 == foo <span> bar</span> baz ==
26131 !! end
26132
26133 !! test
26134 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26135 !! options
26136 parsoid={
26137 "modes": ["html2wt"],
26138 "scrubWikitext": false
26139 }
26140 !! html/parsoid
26141 <h2>foo<br/>bar</h2>
26142 !! wikitext
26143 == foo<br> bar ==
26144 !! end
26145
26146 !! test
26147 1. WT Quote Tags: suppress newly created empty style tags
26148 !! options
26149 parsoid={
26150 "modes": ["html2wt"],
26151 "scrubWikitext": true
26152 }
26153 !! html/parsoid
26154 <i></i><b></b>
26155 !! wikitext
26156 !! end
26157
26158 !! test
26159 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26160 !! options
26161 parsoid=html2wt
26162 !! html/parsoid
26163 <i></i><b></b>
26164 !! wikitext
26165 ''<nowiki/>'''''<nowiki/>'''
26166 !! end
26167
26168 !! test
26169 3. WT Quote Tags: suppress empty style tags on edits
26170 !! options
26171 parsoid={
26172 "modes": ["selser"],
26173 "scrubWikitext": true,
26174 "changes": [
26175 [ "#x", "remove"]
26176 ]
26177 }
26178 !! wikitext
26179 '''<span id="x">foo</span>'''
26180 !! wikitext/edited
26181 !! end
26182
26183 !! test
26184 1. Anchors: suppress newly created empty anchors
26185 !! options
26186 parsoid={
26187 "modes": ["html2wt"],
26188 "scrubWikitext": true
26189 }
26190 !! html/parsoid
26191 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26192 !! wikitext
26193 !! end
26194
26195 !! test
26196 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26197 !! options
26198 parsoid={
26199 "modes": ["html2wt"],
26200 "scrubWikitext": false
26201 }
26202 !! html/parsoid
26203 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26204 !! wikitext
26205 [[Test|<nowiki/>]]
26206 !! end
26207
26208 !! test
26209 3. Anchors: suppress empty anchors on edits
26210 !! options
26211 parsoid={
26212 "modes": ["selser"],
26213 "scrubWikitext": true,
26214 "changes": [
26215 [ "#x", "remove"]
26216 ]
26217 }
26218 !! wikitext
26219 [[Test|<span id="x">foo</span>]]
26220 !! wikitext/edited
26221 !! end
26222
26223 !! test
26224 3a. Anchors: do not suppress numbered extlinks
26225 !! options
26226 parsoid={
26227 "modes": ["wt2wt"],
26228 "scrubWikitext": true
26229 }
26230 !! wikitext
26231 [http://foo.com]
26232 !! html/parsoid
26233 <a rel="mw:ExtLink" href="http://foo.com"></a>
26234 !! end
26235
26236 !! test
26237 3b. Anchors: do not suppress numbered extlinks
26238 !! options
26239 parsoid={
26240 "modes": ["wt2wt"],
26241 "scrubWikitext": true,
26242 "changes": [
26243 [ "#x", "remove"]
26244 ]
26245 }
26246 !! wikitext
26247 [http://foo.com <span id="x">foo</span>]
26248 !! wikitext/edited
26249 [http://foo.com]
26250 !! end
26251
26252 !!test
26253 Normalizations should be restricted to edited content
26254 !!options
26255 parsoid={
26256 "modes": ["selser"],
26257 "scrubWikitext": true,
26258 "changes": [
26259 [ "h1", "before", "<i></i>"]
26260 ]
26261 }
26262 !!wikitext
26263 a
26264 = =
26265 b
26266 !!wikitext/edited
26267 a
26268 = =
26269 b
26270 !!end
26271
26272 !! test
26273 1. Multiple normalizations (html2wt)
26274 !! options
26275 parsoid={
26276 "modes": ["html2wt"],
26277 "scrubWikitext": true
26278 }
26279 !! html
26280 <h2><i></i></h2>
26281 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26282 </a><b><i></i></b>x</p>
26283 !! wikitext
26284
26285 [[foo]]
26286 x
26287
26288 !! end
26289
26290 !! test
26291 2. Multiple normalizations (selser)
26292 !! options
26293 parsoid={
26294 "modes": ["selser"],
26295 "scrubWikitext": true,
26296 "changes": [
26297 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26298 ]
26299 }
26300 !! wikitext
26301 <span id="x">foo</span>
26302 !! wikitext/edited
26303 <span id="x">foo</span>
26304
26305 x
26306 !! end
26307
26308 !! test
26309 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26310 !! options
26311 parsoid={
26312 "modes": ["html2wt"],
26313 "scrubWikitext": true
26314 }
26315 !! html/parsoid
26316 <p> hi</p>
26317 <p> hello</p>
26318 !! wikitext
26319 hi
26320
26321 hello
26322 !! end
26323
26324 !! test
26325 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26326 !! options
26327 parsoid=html2wt
26328 !! html/parsoid
26329 <p> hi</p>
26330 <p> hello</p>
26331 !! wikitext
26332 <nowiki> </nowiki>hi
26333
26334 <nowiki> </nowiki> hello
26335 !! end
26336
26337 !! test
26338 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26339 !! options
26340 parsoid={
26341 "modes": ["html2wt"],
26342 "scrubWikitext": true
26343 }
26344 !! html/parsoid
26345 <p>Foo
26346 bar
26347 baz</p>
26348
26349 <table><tr><td>Foo
26350 bar
26351 baz bang</td></tr></table>
26352
26353 <p><!--boo--> foo
26354 bar</p>
26355
26356 <p> foo
26357 bar<span>boo</span></p>
26358 !! wikitext
26359 Foo
26360 bar
26361 baz
26362
26363 {|
26364 |Foo
26365 bar
26366 baz bang
26367 |}
26368
26369 <!--boo-->foo
26370 bar
26371
26372 foo
26373 bar<span>boo</span>
26374 !! end
26375
26376 !! test
26377 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26378 !! options
26379 parsoid={
26380 "modes": ["selser"],
26381 "scrubWikitext": true,
26382 "changes": [
26383 [ "p", "html", " a\n b" ]
26384 ]
26385 }
26386 !! wikitext
26387 xyz
26388 !! wikitext/edited
26389 a
26390 b
26391 !! end
26392
26393 !! test
26394 1. New links that end in spaces
26395 !! options
26396 parsoid={
26397 "modes": ["html2wt"],
26398 "scrubWikitext": false
26399 }
26400 !! html/parsoid
26401 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26402 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26403 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26404 !! wikitext
26405 [[Berlin ]]<nowiki/>is the capital of Germany.
26406
26407 [[Foo ]]'''bar'''
26408
26409 [[Boston ]] is a city.
26410 !! end
26411
26412 !! test
26413 2. New links that end in spaces
26414 !! options
26415 parsoid={
26416 "modes": ["html2wt"],
26417 "scrubWikitext": true
26418 }
26419 !! html/parsoid
26420 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26421 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26422 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26423 !! wikitext
26424 [[Berlin]] is the capital of Germany.
26425
26426 [[Foo]] '''bar'''
26427
26428 [[Boston]] is a city.
26429 !! end
26430
26431 !! test
26432 1. Table cells with escapable prefixes
26433 !! options
26434 parsoid={
26435 "modes": ["html2wt"],
26436 "scrubWikitext": false
26437 }
26438 !! html
26439 <table>
26440 <tr><td>a</td></tr>
26441 <tr><td>-</td></tr>
26442 <tr><td>+</td></tr>
26443 </table>
26444 !! wikitext
26445 {|
26446 |a
26447 |-
26448 |<nowiki>-</nowiki>
26449 |-
26450 |<nowiki>+</nowiki>
26451 |}
26452 !! end
26453
26454 !! test
26455 2. Table cells with escapable prefixes
26456 !! options
26457 parsoid={
26458 "modes": ["html2wt"],
26459 "scrubWikitext": true
26460 }
26461 !! html
26462 <table>
26463 <tr><td>a</td></tr>
26464 <tr><td>-</td></tr>
26465 <tr><td>+</td></tr>
26466 </table>
26467 !! wikitext
26468 {|
26469 |a
26470 |-
26471 | -
26472 |-
26473 | +
26474 |}
26475 !! end
26476
26477 !! test
26478 3a. Table cells with escapable prefixes after edits
26479 !! options
26480 parsoid={
26481 "modes": ["selser"],
26482 "scrubWikitext": true,
26483 "changes": [
26484 [ "table tbody tr:first-child td:first-child", "remove"]
26485 ]
26486 }
26487 !! wikitext
26488 {|
26489 |a||-
26490 |}
26491 !! wikitext/edited
26492 {|
26493 | -
26494 |}
26495 !! end
26496
26497 !! test
26498 3b. Table cells with escapable prefixes after edits
26499 !! options
26500 parsoid={
26501 "modes": ["selser"],
26502 "scrubWikitext": true,
26503 "changes": [
26504 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26505 [ "#x", "remove" ]
26506 ]
26507 }
26508 !! wikitext
26509 {|
26510 |pqr
26511 |<span id="x">foo</span>+
26512 |}
26513 !! wikitext/edited
26514 {|
26515 | -
26516 | +
26517 |}
26518 !! end
26519
26520 # FIXME: This test will fail because
26521 # normalization doesn't realize that the id attribute
26522 # will eliminate the escapable scenario
26523 !! test
26524 4a. Table cells without escapable prefixes after edits
26525 !! options
26526 parsoid={
26527 "modes": ["selser"],
26528 "scrubWikitext": true,
26529 "changes": [
26530 [ "#x", "html", "-" ]
26531 ]
26532 }
26533 !! wikitext
26534 {|
26535 | id="x" |abcd
26536 |}
26537 !! wikitext/edited
26538 {|
26539 | id="x" |-
26540 |}
26541 !! end
26542
26543 ## This tests normalizer's ability to discriminate between
26544 ## cells having identical content.
26545 !! test
26546 4b. Table cells without escapable prefixes after edits
26547 !! options
26548 parsoid={
26549 "modes": ["selser"],
26550 "scrubWikitext": true,
26551 "changes": [
26552 [ "td", "html", "-" ]
26553 ]
26554 }
26555 !! wikitext
26556 {|
26557 |a||b
26558 |}
26559 !! wikitext/edited
26560 {|
26561 | -||-
26562 |}
26563 !! end
26564
26565 ## This tests normalizer's ability to not be tripped by
26566 ## comments (and whitespace)
26567 !! test
26568 4c. Table cells without escapable prefixes after edits
26569 !! options
26570 parsoid={
26571 "modes": ["selser"],
26572 "scrubWikitext": true,
26573 "changes": [
26574 [ "table tbody tr td:first-child", "remove" ]
26575 ]
26576 }
26577 !! wikitext
26578 {|
26579 |-
26580 <!--foo--> |a||-
26581 |}
26582 !! wikitext/edited
26583 {|
26584 |-
26585 <!--foo--> | -
26586 |}
26587 !! end
26588
26589 ## This tests normalizer's ability to handle HTML cells
26590 !! test
26591 4d. Table cells without escapable prefixes after edits
26592 !! options
26593 parsoid={
26594 "modes": ["selser"],
26595 "scrubWikitext": true,
26596 "changes": [
26597 [ "td", "html", "-" ]
26598 ]
26599 }
26600 !! wikitext
26601 <table>
26602 <tr><td>a</td></tr>
26603 </table>
26604 !! wikitext/edited
26605 <table>
26606 <tr><td>-</td></tr>
26607 </table>
26608 !! end
26609
26610 ## T111151 Remove font elements without attributes
26611 !! test
26612 5a. font tags without attributes should be dropped in scrubWikitext mode
26613 !! options
26614 parsoid={
26615 "modes": ["html2wt"],
26616 "scrubWikitext": true
26617 }
26618 !! html
26619 <font>foo</font>
26620 <font><font>bar</font></font>
26621 <font class="x">boo</font>
26622 !! wikitext
26623 foo
26624 bar
26625 <font class="x">boo</font>
26626 !! end
26627
26628 !! test
26629 5b. font tags should not be dropped without scrubWikitext being enabled
26630 !! options
26631 parsoid={
26632 "modes": ["html2wt"],
26633 "scrubWikitext": false
26634 }
26635 !! html
26636 <font>foo</font>
26637 !! wikitext
26638 <font>foo</font>
26639 !! end
26640
26641 !! test
26642 Escape nowiki DOM elements
26643 !! options
26644 parsoid=html2wt
26645 !! html/parsoid
26646 <nowiki><i>foo</i></nowiki>
26647 !! wikitext
26648 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26649 !! end
26650
26651 # This is meant to be an interim fix while we go about figuring out
26652 # how to not introduce these trailing <nowiki/>s in the first place.
26653 !! test
26654 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26655 !! options
26656 parsoid=html2wt
26657 !! html/parsoid
26658 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26659 y</p>
26660 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"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>
26661 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"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>
26662 !! wikitext
26663 x
26664 y
26665
26666 {{echo|
26667 1 = <nowiki/>}}
26668
26669 {{echo|
26670 1 = <nowiki/>
26671 }}
26672 !! end
26673
26674 # ---------------------------------------------------
26675 # End of tests spec'ing wikitext serialization norms |
26676 # ---------------------------------------------------
26677
26678 # T104032
26679 !! test
26680 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26681 !! options
26682 parsoid=html2wt
26683 !! html/parsoid
26684 a<p>b</p>
26685 <b>c</b><p>d</p>
26686 <table><tr>
26687 <td>a<p>b</p></td>
26688 <td><b>c</b><p>d</p></td>
26689 </tr></table>
26690 !! wikitext
26691 a
26692
26693 b
26694
26695 '''c'''
26696
26697 d
26698 {|
26699 |a
26700 b
26701 |'''c'''
26702 d
26703 |}
26704 !! end
26705
26706 # -----------------------------------------------------------------
26707 # End of section for Parsoid-only html2wt tests for serialization
26708 # of new content
26709 # -----------------------------------------------------------------
26710
26711 # -----------------------------------------------------------------
26712 # The following section of tests are primarily to spec behavior of
26713 # the selective serializer. All these tests have manual selser
26714 # changes. The automated selser changes for all tests handle the
26715 # wide variation of changes, but these tests here capture specs
26716 # deterministically.
26717 # ----------------------------------------------------------------
26718
26719 ## T90517
26720 !! test
26721 Selser: New comments should not be lost
26722 !! options
26723 parsoid={
26724 "modes": ["selser"],
26725 "changes": [
26726 [ "#a", "after", "<!--c1-->" ],
26727 [ "#b", "before", "<!--c2-->" ]
26728 ]
26729 }
26730 !! wikitext
26731 <span id="a">a</span>
26732
26733 <span id="b">b</span>
26734 !! wikitext/edited
26735 <span id="a">a</span><!--c1-->
26736
26737 <!--c2--><span id="b">b</span>
26738 !! end
26739
26740 ## T89383
26741 !! test
26742 Selser: Check for validity of DSR before using it
26743 !! options
26744 parsoid={
26745 "modes": ["selser"],
26746 "changes": [
26747 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26748 ]
26749 }
26750 !! wikitext
26751 <span id="a">a</span>
26752 !! wikitext/edited
26753 {{DISPLAYTITLE:foo}}
26754 <span id="a">a</span>
26755 !! end
26756
26757 !! test
26758 1. DOMDiff: Changes to <ref> content should be looked up using id
26759 !! options
26760 parsoid={
26761 "modes": ["selser"],
26762 "changes": [
26763 ["#X", "after", "bar"],
26764 ["#Y", "after", "baz"]
26765 ]
26766 }
26767 !! wikitext
26768 X <ref><span id="X">foo</span></ref>
26769 Y <ref name="a" />
26770 <references>
26771 <ref name="a"><span id="Y">foo</span></ref>
26772 </references>
26773 !! wikitext/edited
26774 X <ref><span id="X">foo</span>bar</ref>
26775 Y <ref name="a" />
26776 <references>
26777 <ref name="a"><span id="Y">foo</span>baz</ref>
26778 </references>
26779 !! end
26780
26781 !! test
26782 2. DOMDiff: Changes to <ref> content should be looked up using id
26783 !! options
26784 parsoid={
26785 "modes": ["selser"],
26786 "changes": [
26787 ["#Z", "after", "bar"]
26788 ]
26789 }
26790 !! wikitext
26791 A <ref>foo bar for a</ref>
26792 B <ref group="X" name="b" />
26793
26794 <references />
26795
26796 <references group="X">
26797 <ref name="b"><span id="Z">foo</span></ref>
26798 </references>
26799 !! wikitext/edited
26800 A <ref>foo bar for a</ref>
26801 B <ref group="X" name="b" />
26802
26803 <references />
26804
26805 <references group="X">
26806 <ref name="b"><span id="Z">foo</span>bar</ref>
26807 </references>
26808 !! end
26809
26810 !! test
26811 Empty LI (T49673)
26812 !! wikitext
26813 * a
26814 *
26815 *
26816 * b
26817 !! html/php+tidy
26818 <ul>
26819 <li>a</li>
26820 <li class="mw-empty-li"></li>
26821 <li class="mw-empty-li"></li>
26822 <li>b</li>
26823 </ul>
26824 !! end