Merge "Make Special:MediaStatistics show a total count of file sizes"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # (ignored by Parsoid, since it emits <link>s)
19 # subpage enable subpages (disabled by default)
20 # noxml don't check for XML well-formedness
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 !! end
1339
1340 !! test
1341 Isolated close tags should be treated as literal text (bug 52760)
1342 !! options
1343 parsoid=wt2html
1344 !! wikitext
1345 </b>
1346
1347 <s.foo>s</s>
1348 !! html/php+tidy
1349 <p>&lt;s.foo&gt;s</p>
1350 !! html/parsoid
1351 <p>&lt;s.foo&gt;s</p>
1352 !! end
1353
1354 ###
1355 ### Special characters
1356 ###
1357
1358 !! test
1359 Bare pipe character (bug 52363)
1360 !! wikitext
1361 |
1362 !! html
1363 <p>|
1364 </p>
1365 !! end
1366
1367 !! test
1368 Bare pipe character from a template (bug 52363)
1369 !! wikitext
1370 {{pipe}}
1371 !! html
1372 <p>|
1373 </p>
1374 !! end
1375
1376 ###
1377 ### <nowiki> test cases
1378 ###
1379
1380 !! test
1381 <nowiki> unordered list
1382 !! wikitext
1383 <nowiki>* This is not an unordered list item.</nowiki>
1384 !! html/php
1385 <p>* This is not an unordered list item.
1386 </p>
1387 !! html/parsoid
1388 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1389 !! end
1390
1391 !! test
1392 <nowiki> spacing
1393 !! wikitext
1394 <nowiki>Lorem ipsum dolor
1395
1396 sed abit.
1397 sed nullum.
1398
1399 :and a colon
1400 </nowiki>
1401 !! html/php
1402 <p>Lorem ipsum dolor
1403
1404 sed abit.
1405 sed nullum.
1406
1407 :and a colon
1408
1409 </p>
1410 !! html/parsoid
1411 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1412
1413 sed abit.
1414 sed nullum.
1415
1416 :and a colon
1417 </span></p>
1418 !! end
1419
1420 !! test
1421 nowiki 3
1422 !! wikitext
1423 :There is not nowiki.
1424 :There is <nowiki>nowiki</nowiki>.
1425
1426 #There is not nowiki.
1427 #There is <nowiki>nowiki</nowiki>.
1428
1429 *There is not nowiki.
1430 *There is <nowiki>nowiki</nowiki>.
1431 !! html/php
1432 <dl><dd>There is not nowiki.</dd>
1433 <dd>There is nowiki.</dd></dl>
1434 <ol><li>There is not nowiki.</li>
1435 <li>There is nowiki.</li></ol>
1436 <ul><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ul>
1438
1439 !! html/parsoid
1440 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1441 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1442
1443 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1444 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1445
1446 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1448 !! end
1449
1450 !! test
1451 Entities inside <nowiki>
1452 !! wikitext
1453 <nowiki>&lt;</nowiki>
1454 !! html
1455 <p>&lt;
1456 </p>
1457 !! end
1458
1459 !! test
1460 Entities inside template parameters
1461 !! wikitext
1462 {{echo|&ndash;}}
1463 !! html/php+tidy
1464 <p>–</p>
1465 !! html/parsoid
1466 <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>
1467 !! end
1468
1469 !! test
1470 Properly escape nowiki when combined with other wiki markup
1471 !! options
1472 parsoid=html2wt
1473 !! html/parsoid
1474 <p>* &lt;/nowiki&gt; tag</p>
1475 !! wikitext
1476 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1477 !! end
1478
1479 !! test
1480 T93824: Put escaped HTML tags inside nowiki
1481 !! options
1482 parsoid=html2wt
1483 !! html/parsoid
1484 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1485 !! wikitext
1486 <nowiki><h2>foo</h2></nowiki>
1487 !! end
1488
1489 !! test
1490 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1491 !! options
1492 parsoid=html2wt
1493 !! html/parsoid
1494 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1496 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1497 !! wikitext
1498 This text: L'[[Foo]]
1499 This text: L<nowiki>''</nowiki>[[Foo]]
1500 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1501 !! end
1502
1503 # This test fails because wikitext whitespace is not normalized before comparing.
1504 !! test
1505 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1506 !! options
1507 parsoid=html2wt
1508 !! html/parsoid
1509 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1510 </p>
1511 !! wikitext
1512 This text : L<nowiki>''</nowiki>[[Foo]]
1513 !! end
1514
1515 # This test and the next one are html2wt only as they test that incorrect wikitext
1516 # passed in template arguments gets escaped or wrapped in nowikis where required.
1517 !! test
1518 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1519 !! options
1520 parsoid=html2wt
1521 !! html/parsoid
1522 <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>
1523 <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>
1524 !! wikitext
1525 {{echo|foo{{!}}bar}}
1526 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1527 !! end
1528
1529 !! test
1530 T53961: Output correct nowikis in template arguments
1531 !! options
1532 parsoid=html2wt
1533 !! html/parsoid
1534 <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>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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 }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1539 !! wikitext
1540 {{echo|a [ b}}
1541 {{echo|a <nowiki>}}</nowiki> b}}
1542 {{echo|<nowiki>a [[ b</nowiki>}}
1543 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1544 {{echo|a <nowiki>}</nowiki>}}
1545 !! end
1546
1547 !! test
1548 Cases where "!!" needs nowiki protection
1549 !! options
1550 parsoid=html2wt
1551 !! html/parsoid
1552 <table>
1553 <tr><th>this needs protection !! here</th></tr>
1554 </table>
1555
1556 <table>
1557 <tr><th>this does not need
1558 protection !! here</th></tr>
1559 </table>
1560 !! wikitext
1561 {|
1562 !<nowiki>this needs protection !! here</nowiki>
1563 |}
1564
1565 {|
1566 !this does not need
1567 protection !! here
1568 |}
1569 !! end
1570
1571 ###
1572 ### Comments
1573 ###
1574 !! test
1575 Comments and Indent-Pre
1576 !! wikitext
1577 <!-- comment 1 --> asdf
1578
1579 <!-- comment 1 --> asdf
1580 <!-- comment 2 -->
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->xyz
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 --> xyz
1587 !! html
1588 <pre>asdf
1589 </pre>
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <p>xyz
1595 </p>
1596 <pre>asdf
1597 xyz
1598 </pre>
1599 !! end
1600
1601 !! test
1602 Comment test 2a
1603 !! wikitext
1604 asdf
1605 <!-- comment 1 -->
1606 jkl
1607 !! html
1608 <p>asdf
1609 jkl
1610 </p>
1611 !! end
1612
1613 !! test
1614 Comment test 2b
1615 !! wikitext
1616 asdf
1617 <!-- comment 1 -->
1618
1619 jkl
1620 !! html
1621 <p>asdf
1622 </p><p>jkl
1623 </p>
1624 !! end
1625
1626 !! test
1627 Comment test 3
1628 !! wikitext
1629 asdf
1630 <!-- comment 1 -->
1631 <!-- comment 2 -->
1632 jkl
1633 !! html
1634 <p>asdf
1635 jkl
1636 </p>
1637 !! end
1638
1639 !! test
1640 Comment test 4
1641 !! wikitext
1642 asdf<!-- comment 1 -->jkl
1643 !! html
1644 <p>asdfjkl
1645 </p>
1646 !! end
1647
1648 !! test
1649 Comment spacing
1650 !! wikitext
1651 a
1652 <!-- foo --> b <!-- bar -->
1653 c
1654 !! html
1655 <p>a
1656 </p>
1657 <pre> b
1658 </pre>
1659 <p>c
1660 </p>
1661 !! end
1662
1663 !! test
1664 Comment whitespace
1665 !! wikitext
1666 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1667 !! html
1668
1669 !! end
1670
1671 !! test
1672 Comment semantics and delimiters
1673 !! wikitext
1674 <!-- --><!----><!-----><!------>
1675 !! html/php
1676
1677 !! html/parsoid
1678 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1679 !! end
1680
1681 !! test
1682 Comment semantics and delimiters, redux
1683 !! wikitext
1684 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1685 -- foo -- funky huh? ... -->
1686 !! html/php
1687
1688 !! html/parsoid
1689 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1690 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1691 !! end
1692
1693 !! test
1694 Comment semantics and delimiters: directors cut
1695 !! wikitext
1696 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1697 everything starting with < followed by !-- until the first -- and > we see,
1698 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1699 -->-->
1700 !! html/php
1701 <p>--&gt;
1702 </p>
1703 !! html/parsoid
1704 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1705 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1706 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1707 --><p>--></p>
1708 !! end
1709
1710 !! test
1711 Comment semantics: nesting
1712 !! wikitext
1713 <!--<!-- no, we're not going to do anything fancy here -->-->
1714 !! html/php
1715 <p>--&gt;
1716 </p>
1717 !! html/parsoid
1718 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1719 !! end
1720
1721 # Parsoid closes the unclosed comment, even if it means a slight
1722 # round-trip diff.
1723 !! test
1724 Comment semantics: unclosed comment at end
1725 !! options
1726 parsoid=wt2html,html2html
1727 !! wikitext
1728 <!--This comment will run out to the end of the document
1729 !! html/php
1730
1731 !! html/parsoid
1732 <!--This comment will run out to the end of the document-->
1733 !! end
1734
1735 !! test
1736 Comment semantics: normalize comments to play nice with XML and browsers
1737 !! wikitext
1738 <!-- Browsers --!> think this is closed -->
1739 <!--> This would normally be text -->
1740 <!---> As would this -->
1741 <!-- XML doesn't like trailing dashes -------->
1742 <!-- Nor doubled hyphens -- anywhere in the data -->
1743 But this is not a comment.
1744 !! html/php
1745 <p>But this is not a comment.
1746 </p>
1747 !! html/parsoid
1748 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1749 <!--&#x3E; This would normally be text -->
1750 <!--&#x2D;&#x3E; As would this -->
1751 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1752 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1753 <p>But this is not a comment.</p>
1754 !! end
1755
1756 !! test
1757 Comment semantics: round-trip even text which contains encoded -->
1758 !! wikitext
1759 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1760 !! html/parsoid
1761 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1762 !! end
1763
1764 !! test
1765 Comment in template title
1766 !! wikitext
1767 {{f<!---->oo}}
1768 !! html
1769 <p>FOO
1770 </p>
1771 !! end
1772
1773 !! test
1774 Comment on its own line post-expand
1775 !! wikitext
1776 a
1777 {{blank}}<!---->
1778 b
1779 !! html
1780 <p>a
1781 </p><p>b
1782 </p>
1783 !! end
1784
1785 !! test
1786 Comment on its own line post-expand with non-significant whitespace
1787 !! wikitext
1788 a
1789 {{blank}} <!---->
1790 b
1791 !! html
1792 <p>a
1793 </p><p>b
1794 </p>
1795 !! end
1796
1797 !! test
1798 Multiple comments should still parse as SOL-transparent
1799 !! options
1800 parsoid=wt2html,wt2wt
1801 !! wikitext
1802 <!--c1-->*a
1803 <!--c2--><!--c3--><!--c4-->*b
1804 !! html/php
1805 <ul><li>a</li>
1806 <li>b</li></ul>
1807
1808 !! html/parsoid
1809 <!--c1--><ul>
1810 <li>a
1811 </li>
1812 <!--c2--><!--c3--><!--c4-->
1813 <li>b
1814 </li>
1815 </ul>
1816 !! end
1817
1818 ###
1819 ### paragraph wrapping tests
1820 ###
1821 !! test
1822 No block tags
1823 !! wikitext
1824 a
1825
1826 b
1827 !! html
1828 <p>a
1829 </p><p>b
1830 </p>
1831 !! end
1832
1833 !! test
1834 Block tag on one line (<div>)
1835 !! wikitext
1836 a <div>foo</div>
1837
1838 b
1839 !! html
1840 a <div>foo</div>
1841 <p>b
1842 </p>
1843 !! html+tidy
1844 <p>a</p>
1845 <div>foo</div>
1846 <p>b</p>
1847 !! end
1848
1849 !! test
1850 Block tag on one line (<blockquote>)
1851 !! wikitext
1852 a <blockquote>foo</blockquote>
1853
1854 b
1855 !! html
1856 a <blockquote>foo</blockquote>
1857 <p>b
1858 </p>
1859 !! html+tidy
1860 <p>a</p>
1861 <blockquote>
1862 <p>foo</p>
1863 </blockquote>
1864 <p>b</p>
1865 !! end
1866
1867 !! test
1868 Block tag on both lines (<div>)
1869 !! wikitext
1870 a <div>foo</div>
1871
1872 b <div>foo</div>
1873 !! html
1874 a <div>foo</div>
1875 b <div>foo</div>
1876
1877 !! html+tidy
1878 <p>a</p>
1879 <div>foo</div>
1880 <p>b</p>
1881 <div>foo</div>
1882 !! end
1883
1884 !! test
1885 Block tag on both lines (<blockquote>)
1886 !! wikitext
1887 a <blockquote>foo</blockquote>
1888
1889 b <blockquote>foo</blockquote>
1890 !! html
1891 a <blockquote>foo</blockquote>
1892 b <blockquote>foo</blockquote>
1893
1894 !! html+tidy
1895 <p>a</p>
1896 <blockquote>
1897 <p>foo</p>
1898 </blockquote>
1899 <p>b</p>
1900 <blockquote>
1901 <p>foo</p>
1902 </blockquote>
1903 !! end
1904
1905 !! test
1906 Multiple lines without block tags
1907 !! wikitext
1908 <div>foo</div> a
1909 b
1910 c
1911 d<!--foo--> e
1912 x <div>foo</div> z
1913 !! html
1914 <div>foo</div> a
1915 <p>b
1916 c
1917 d e
1918 </p>
1919 x <div>foo</div> z
1920
1921 !! html+tidy
1922 <div>foo</div>
1923 <p>a</p>
1924 <p>b c d e</p>
1925 <p>x</p>
1926 <div>foo</div>
1927 <p>z</p>
1928 !! end
1929
1930 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1931 # So, we have a separate section for Parsoid. We don't want
1932 # to mimic this stripping behavior in Parsoid. It affects
1933 # editing experience and also requires us to maintain additional
1934 # info for RT-ing.
1935 !! test
1936 Empty lines between lines with block tags
1937 !! wikitext
1938 <div></div>
1939
1940
1941 <div></div>a
1942
1943 b
1944 <div>a</div>b
1945
1946 <div>b</div>d
1947
1948
1949 <div>e</div>
1950 !! html
1951 <div></div>
1952 <p><br />
1953 </p>
1954 <div></div>a
1955 <p>b
1956 </p>
1957 <div>a</div>b
1958 <div>b</div>d
1959 <p><br />
1960 </p>
1961 <div>e</div>
1962
1963 !! html+tidy
1964 <p><br /></p>
1965 <p>a</p>
1966 <p>b</p>
1967 <div>a</div>
1968 <p>b</p>
1969 <div>b</div>
1970 <p>d</p>
1971 <p><br /></p>
1972 <div>e</div>
1973 !! html/parsoid
1974 <div data-parsoid='{"stx":"html"}'></div>
1975
1976 <p><br /></p>
1977 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1978
1979 <p>b</p>
1980 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1981
1982 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1983
1984 <p><br /></p>
1985 <div data-parsoid='{"stx":"html"}'>e</div>
1986 !! end
1987
1988 ## PHP parser emits output which is broken
1989 !! test
1990 Unclosed HTML p-tags should be handled properly
1991 !! wikitext
1992 <div><p>foo</div>
1993 a
1994
1995 b
1996 !! html/php+tidy
1997 <div>
1998 <p>foo</p>
1999 </div>
2000 <p>a</p>
2001 <p>b</p>
2002 !! html/parsoid
2003 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2004 <p>a</p>
2005 <p>b</p>
2006 !! end
2007
2008 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2009 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2010 ## them for now.
2011 !! test
2012 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2013 !! options
2014 parsoid=wt2html
2015 !! wikitext
2016 a [[Category:A1]] [[Category:A2]]
2017 [[Category:A3]]
2018 [[Category:A4]]
2019 !! html/parsoid
2020 <p>a</p>
2021 <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"/>
2022 !! end
2023
2024 !! test
2025 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2026 !! options
2027 parsoid=wt2html
2028 !! wikitext
2029 [[Category:A1]]a
2030 !! html/parsoid
2031 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2032 !! end
2033
2034 ###
2035 ### Preformatted text
2036 ###
2037 !! test
2038 Preformatted text
2039 !! wikitext
2040 This is some
2041 Preformatted text
2042 With ''italic''
2043 And '''bold'''
2044 And a [[Main Page|link]]
2045 !! html
2046 <pre>This is some
2047 Preformatted text
2048 With <i>italic</i>
2049 And <b>bold</b>
2050 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2051 </pre>
2052 !! end
2053
2054 !! test
2055 Tabs don't trigger preformatted text
2056 !! wikitext
2057 This is not
2058 preformatted text.
2059 This is preformatted text.
2060 So is this.
2061 !! html/php
2062 <p> This is not
2063 preformatted text.
2064 </p>
2065 <pre>This is preformatted text.
2066 So is this.
2067 </pre>
2068 !! html/parsoid
2069 <p> This is not
2070 preformatted text.</p>
2071 <pre>This is preformatted text.
2072 So is this.</pre>
2073 !! end
2074
2075 !! test
2076 Space before tab needs nowiki pre protection
2077 !! options
2078 parsoid=html2wt
2079 !! html/parsoid
2080 <p> a</p>
2081 !! wikitext
2082 <nowiki> </nowiki> a
2083 !! end
2084
2085 !! test
2086 Ident preformatting with inline content
2087 !! wikitext
2088 a
2089 ''b''
2090 !! html
2091 <pre>a
2092 <i>b</i>
2093 </pre>
2094 !! end
2095
2096 !! test
2097 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2098 !! wikitext
2099 <pre><nowiki>
2100 <b>
2101 <cite>
2102 <em>
2103 </nowiki></pre>
2104 !! html
2105 <pre>
2106 &lt;b&gt;
2107 &lt;cite&gt;
2108 &lt;em&gt;
2109 </pre>
2110
2111 !! end
2112
2113 !! test
2114 Regression with preformatted in <center>
2115 !! wikitext
2116 <center>
2117 Blah
2118 </center>
2119 !! html
2120 <center>
2121 <pre>Blah
2122 </pre>
2123 </center>
2124
2125 !! end
2126
2127 !! test
2128 Bug 52763: Preformatted in <blockquote>
2129 !! wikitext
2130 <blockquote>
2131 Blah
2132 {|
2133 |
2134 indented cell (no pre-wrapping!)
2135 |}
2136 </blockquote>
2137 !! html
2138 <blockquote>
2139 <p> Blah
2140 </p>
2141 <table>
2142 <tr>
2143 <td>
2144 <p> indented cell (no pre-wrapping!)
2145 </p>
2146 </td></tr></table>
2147 </blockquote>
2148
2149 !! end
2150
2151 !! test
2152 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2153 !! wikitext
2154 <blockquote>
2155 Foo
2156
2157 Bar
2158 </blockquote>
2159 !! html
2160 <blockquote>
2161 <p>Foo
2162 </p><p>Bar
2163 </p>
2164 </blockquote>
2165
2166 !! end
2167
2168 !! test
2169 Bug 15491: <ins>/<del> in blockquote
2170 !! wikitext
2171 <blockquote>
2172 Foo <del>bar</del> <ins>baz</ins> quux
2173 </blockquote>
2174 !! html
2175 <blockquote>
2176 <p>Foo <del>bar</del> <ins>baz</ins> quux
2177 </p>
2178 </blockquote>
2179
2180 !! end
2181
2182 # Note that the p-wrapping is newline sensitive, which could be
2183 # considered a bug: tidy will wrap only the 'Foo' in the example
2184 # below in a <p> tag. (see comment 23-25 of bug #6200)
2185 !! test
2186 Bug 15491: <ins>/<del> in blockquote (2)
2187 !! wikitext
2188 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2189 </blockquote>
2190 !! html
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193
2194 !! html+tidy
2195 <blockquote>
2196 <p>Foo</p>
2197 <del>bar</del> <ins>baz</ins> quux</blockquote>
2198 !! end
2199
2200 !! test
2201 <pre> with attributes (bug 3202)
2202 !! wikitext
2203 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2204 !! html
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206
2207 !! end
2208
2209 !! test
2210 <pre> with width attribute (bug 3202)
2211 !! wikitext
2212 <pre width="8">Narrow screen goodies</pre>
2213 !! html
2214 <pre width="8">Narrow screen goodies</pre>
2215
2216 !! end
2217
2218 !! test
2219 <pre> with forbidden attribute (bug 3202)
2220 !! wikitext
2221 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2222 !! html
2223 <pre width="8">Narrow screen goodies</pre>
2224
2225 !! end
2226
2227 !! test
2228 Entities inside <pre>
2229 !! wikitext
2230 <pre>&lt;</pre>
2231 !! html
2232 <pre>&lt;</pre>
2233
2234 !! end
2235
2236 !! test
2237 <pre> with forbidden attribute values (bug 3202)
2238 !! wikitext
2239 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2240 !! html
2241 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2242
2243 !! end
2244
2245 !! test
2246 <nowiki> inside <pre> (bug 13238)
2247 !! wikitext
2248 <pre>
2249 <nowiki>
2250 </pre>
2251 <pre>
2252 <nowiki></nowiki>
2253 </pre>
2254 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2255 !! html
2256 <pre>
2257 &lt;nowiki&gt;
2258 </pre>
2259 <pre>
2260
2261 </pre>
2262 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2263
2264 !! end
2265
2266 !! test
2267 <nowiki> and <pre> preference (first one wins)
2268 !! wikitext
2269 <pre>
2270 <nowiki>
2271 </pre>
2272 </nowiki>
2273 </pre>
2274
2275 <nowiki>
2276 <pre>
2277 <nowiki>
2278 </pre>
2279 </nowiki>
2280 </pre>
2281
2282 !! html/php
2283 <pre>
2284 &lt;nowiki&gt;
2285 </pre>
2286 <p>&lt;/nowiki&gt;
2287 &lt;/pre&gt;
2288 </p><p>
2289 &lt;pre&gt;
2290 &lt;nowiki&gt;
2291 &lt;/pre&gt;
2292
2293 &lt;/pre&gt;
2294 </p>
2295 !! html/parsoid
2296 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2297 </pre>
2298 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2299 &lt;/pre></p>
2300
2301 <p><span typeof="mw:Nowiki">
2302 &lt;pre>
2303 &lt;nowiki>
2304 &lt;/pre>
2305 </span>
2306 &lt;/pre></p>
2307 !! end
2308
2309 !! test
2310 </pre> inside nowiki
2311 !! wikitext
2312 <nowiki></pre></nowiki>
2313 !! html
2314 <p>&lt;/pre&gt;
2315 </p>
2316 !! end
2317
2318 # Parsoid doesn't strip empty tags, like Tidy does.
2319 !! test
2320 Empty pre; pre inside other HTML tags (bug 54946)
2321 !! options
2322 parsoid=wt2html,wt2wt
2323 !! wikitext
2324 a
2325
2326 <div><pre>
2327 foo
2328 </pre></div>
2329 <pre></pre>
2330 !! html/php
2331 <p>a
2332 </p>
2333 <div><pre>
2334 foo
2335 </pre></div>
2336 <pre></pre>
2337
2338 !! html/php+tidy
2339 <p>a</p>
2340 <div>
2341 <pre>
2342 foo
2343 </pre></div>
2344 !! html/parsoid
2345 <p>a</p>
2346
2347 <div><pre>foo
2348 </pre></div>
2349 <pre></pre>
2350 !! end
2351
2352 !! test
2353 HTML pre followed by indent-pre
2354 !! wikitext
2355 <pre>foo</pre>
2356 bar
2357 !! html
2358 <pre>foo</pre>
2359 <pre>bar
2360 </pre>
2361 !! end
2362
2363 # Note that tidy removes the empty <p> tags from the start and end.
2364 # Parsoid does not, by design.
2365 !!test
2366 Block tag pre
2367 !! wikitext
2368 <p><pre>foo</pre></p>
2369 !! html/php+tidy
2370 <pre>
2371 foo
2372 </pre>
2373 !! html/parsoid
2374 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2375 !!end
2376
2377 !!test
2378 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2379 !! wikitext
2380 {{echo|}}
2381 !! html
2382
2383 !!end
2384
2385 !!test
2386 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2387 !! wikitext
2388 {{echo|
2389 foo}}
2390 !! html
2391 <p>foo
2392 </p>
2393 !!end
2394
2395 !! test
2396 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2397 !! wikitext
2398 {{echo|a
2399 b}}
2400 !! html
2401 <pre>a
2402 </pre>
2403 <p>b
2404 </p>
2405 !!end
2406
2407 !! test
2408 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2409 !! wikitext
2410 {{echo|a
2411 b
2412 c
2413 d
2414 e
2415 }}
2416 !! html
2417 <pre>a
2418 </pre>
2419 <p>b
2420 c
2421 </p>
2422 <pre>d
2423 </pre>
2424 <p>e
2425 </p>
2426 !!end
2427
2428 !!test
2429 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2430 !! wikitext
2431 {{echo| foo}}
2432
2433 {{echo| foo}}{{echo| bar}}
2434
2435 {{echo| foo}}
2436 {{echo| bar}}
2437
2438 {{echo|<!--cmt--> foo}}
2439
2440 <!--cmt-->{{echo| foo}}
2441
2442 {{echo|{{echo| }}bar}}
2443 !! html
2444 <pre>foo
2445 </pre>
2446 <pre>foo bar
2447 </pre>
2448 <pre>foo
2449 bar
2450 </pre>
2451 <pre>foo
2452 </pre>
2453 <pre>foo
2454 </pre>
2455 <pre>bar
2456 </pre>
2457 !!end
2458
2459 !! test
2460 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2461 !! wikitext
2462 {{echo| }}a
2463
2464 {{echo|
2465 }}a
2466
2467 {{echo|
2468 b}}
2469
2470 {{echo|a
2471 }}b
2472
2473 {{echo|a
2474 }} b
2475 !! html
2476 <pre>a
2477 </pre>
2478 <p><br />
2479 </p>
2480 <pre>a
2481 </pre>
2482 <p><br />
2483 </p>
2484 <pre>b
2485 </pre>
2486 <p>a
2487 </p>
2488 <pre>b
2489 </pre>
2490 <p>a
2491 </p>
2492 <pre>b
2493 </pre>
2494 !!end
2495
2496 !! test
2497 Pres with newline attributes
2498 !! wikitext
2499 <pre class="one
2500 two">hi</pre>
2501 !! html/php
2502 <pre class="one two">hi</pre>
2503
2504 !! html/parsoid
2505 <pre class="one
2506 two" data-parsoid='{"stx":"html"}'>hi</pre>
2507 !! end
2508
2509 !! test
2510 Things that look like <pre> tags aren't treated as such
2511 !! wikitext
2512 Barack Obama <President> of the United States
2513 <President></President>
2514 !! html
2515 <p>Barack Obama &lt;President&gt; of the United States
2516 &lt;President&gt;&lt;/President&gt;
2517 </p>
2518 !! end
2519
2520 ## PHP parser discards the "<pre " string
2521 !! test
2522 Handle broken pre-like tags (bug 64025)
2523 !! options
2524 parsoid=wt2html
2525 !! wikitext
2526 {{echo|<pre <pre>x</pre>}}
2527
2528 <table><pre </table>
2529 !! html/php
2530 <pre>x</pre>
2531 <table><pre></pre></table>
2532
2533 !! html/parsoid
2534 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2535
2536
2537 <p>&lt;pre </p>
2538
2539 <table></table>
2540 !! end
2541
2542 !! test
2543 Parsoid: handle pre with space after attribute
2544 !! options
2545 parsoid=wt2html
2546 !! wikitext
2547 <pre style="width:50%;" >{{echo|foo}}</pre>
2548 !! html/php
2549 <pre style="width:50%;">{{echo|foo}}</pre>
2550
2551 !! html/parsoid
2552 <pre style="width:50%;">{{echo|foo}}</pre>
2553 !! end
2554
2555 # TODO / maybe: fix wt2wt for this
2556 !! test
2557 Parsoid: Don't paragraph-wrap fosterable content
2558 !! options
2559 parsoid=wt2html
2560 !! wikitext
2561 {|
2562 <td></td>
2563 <td></td>
2564
2565
2566
2567 |}
2568 !! html
2569 <table>
2570
2571 <tbody>
2572 <tr>
2573 <td></td>
2574
2575 <td></td></tr>
2576
2577
2578
2579 </tbody></table>
2580 !! end
2581
2582 !! test
2583 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2584 !! options
2585 parsoid=wt2html
2586 !! wikitext
2587 {|
2588 <td>
2589 <td>
2590 </td>
2591
2592
2593
2594 |}
2595 !! html
2596 <table>
2597
2598 <tbody>
2599 <tr>
2600 <td></td>
2601
2602 <td>
2603 </td></tr>
2604
2605
2606
2607 </tbody></table>
2608 !! end
2609
2610
2611 #--------------------------------------------------------------------
2612 # Transclusion parameter whitespace stripping tests
2613 # Behavior is different for positional and named parameters
2614 #--------------------------------------------------------------------
2615 !! test
2616 Templates: Strip leading and trailing whitespace from named-param values
2617 !! wikitext
2618 {{echo|1= a }}
2619
2620 {{echo|1= {{echo|b}} }}
2621
2622 {{echo| 1 =
2623 c }}
2624
2625 {{echo| 1 =
2626 * d
2627 }}
2628 !! html
2629 <p>a
2630 </p><p>b
2631 </p><p>c
2632 </p>
2633 <ul><li> d</li></ul>
2634
2635 !! end
2636
2637 !! test
2638 Templates: Don't strip whitespace from positional-param values
2639 !! wikitext
2640 {{echo|a }}
2641
2642 {{echo|{{echo|b}} }}
2643
2644 {{echo| c
2645 }}
2646
2647 {{echo| {{echo|d}}
2648 }}
2649
2650 {{echo|
2651 e}}
2652
2653 {{echo|
2654 * f}}
2655
2656 {{echo|
2657 }}g
2658 !! html
2659 <p>a
2660 </p><p>b
2661 </p>
2662 <pre>c
2663 </pre>
2664 <p><br />
2665 </p>
2666 <pre>d
2667 </pre>
2668 <p><br />
2669 </p>
2670 <pre>e
2671 </pre>
2672 <p><br />
2673 </p>
2674 <ul><li> f</li></ul>
2675 <p><br />
2676 </p>
2677 <pre>g
2678 </pre>
2679 !! end
2680
2681 !! test
2682 Templates: Handle empty comment-and-ws-only lines correctly
2683 !! wikitext
2684 {{echo|foo
2685 <!--should be ignored-->
2686 <!--should be ignored as well-->
2687 bar}}
2688 !! html
2689 <p>foo
2690 bar
2691 </p>
2692 !! end
2693
2694 !! test
2695 Templates: Handle comments in the target
2696 !! wikitext
2697 {{echo
2698 <!-- should be ignored -->
2699 |foo}}
2700
2701 {{echo<!-- should be ignored -->
2702 |foo}}
2703
2704 {{echo<!-- should be ignored -->|foo}}
2705
2706 {{<!-- should be ignored -->echo|foo}}
2707 !!html/parsoid
2708 <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>
2709
2710 <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>
2711
2712 <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>
2713
2714 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2715 !!end
2716
2717 !! test
2718 Templates: Handle comments in parameter names (bug 67657)
2719 !! wikitext
2720 {{echo|1
2721 <!-- should be ignored -->
2722 =foo}}
2723
2724 {{echo|
2725 <!-- should be ignored -->
2726 1 = foo}}
2727
2728 {{echo|1<!-- should be ignored --> = foo}}
2729
2730 {{echo|<!-- should be ignored -->1 = foo}}
2731 !!html/parsoid
2732 <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>
2733
2734 <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>
2735
2736 <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>
2737
2738 <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>
2739 !!end
2740
2741 !! test
2742 Templates: Other wikitext in parameter names (bug 67657)
2743 !! wikitext
2744 {{echo|''1''=foo}}
2745 !!html/parsoid
2746 <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>
2747 !!html/php
2748 <p>{{{1}}}
2749 </p>
2750 !!end
2751
2752 #--------------------------------------------------------------------
2753 # Transclusion parameter escaping tests
2754 #--------------------------------------------------------------------
2755 !! test
2756 Templates: Parsoid parameter escaping test 1
2757 !! wikitext
2758 {{echo|[foo]|{{echo|[bar]}}}}
2759 !! html/php+tidy
2760 <p>[foo]</p>
2761 !! html/parsoid
2762 <p about="#mwt1" typeof="mw:Transclusion"
2763 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2764 !! end
2765
2766 !! test
2767 Parsoid: Pipes in external links in template parameter
2768 !! wikitext
2769 {{echo|[{{echo|http://example.com}} link]}}
2770 !! html/php+tidy
2771 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2772 !! html/parsoid
2773 <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>
2774 !! end
2775
2776 !! test
2777 Parsoid: pipe in transclusion parameter
2778 !! wikitext
2779 {{echo|http://foo.com/a&#124;b}}
2780 !! html/php+tidy
2781 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2782 !! html/parsoid
2783 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2784 typeof="mw:Transclusion"
2785 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>
2786 !! end
2787
2788 !! test
2789 Parsoid: Pipe in external link target and content in template parameter
2790 !! options
2791 parsoid=html2wt,wt2wt
2792 !! wikitext
2793 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2794 !! html/php+tidy
2795 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2796 !! html/parsoid
2797 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2798 typeof="mw:Transclusion"
2799 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2800 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2801 !! end
2802
2803 !! test
2804 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2805 !! options
2806 parsoid
2807 !! wikitext
2808 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2809 !! html
2810 <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>
2811 !! end
2812
2813 !! test
2814 Templates: Don't escape already nowiki-escaped text in template parameters
2815 !! options
2816 parsoid=html2wt,wt2wt
2817 !! wikitext
2818 {{echo|foo<nowiki>|</nowiki>bar}}
2819 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2820 {{echo|<nowiki></nowiki>}}
2821 !! html/php+tidy
2822 <p>foo|bar &lt;div&gt;</p>
2823 !! html/parsoid
2824 <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>
2825 <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>
2826 <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>
2827 </p>
2828 !! end
2829
2830 ## Bug 52824
2831 !! test
2832 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2833 !! options
2834 parsoid=html2wt,wt2wt
2835 !! wikitext
2836 {{echo|{{echo|1=bar}}}}
2837 !! html/php+tidy
2838 <p>bar</p>
2839 !! html/parsoid
2840 <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>
2841 !! end
2842
2843 ## Bug 56733
2844 !! test
2845 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2846 !! wikitext
2847 {{echo|a : b}}
2848 !! html/php+tidy
2849 <p>a&#160;: b</p>
2850 !! html/parsoid
2851 <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>
2852 !! end
2853
2854 ## Bug T73412
2855 !! test
2856 Templates: Preserve blank parameter names
2857 !! wikitext
2858 {{echo|=foo}}
2859 !! html/php+tidy
2860 <p>{{{1}}}</p>
2861 !! html/parsoid
2862 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2863 !! end
2864
2865 !! test
2866 Templates: Preserve blank parameter names in other positions
2867 !! wikitext
2868 {{blank_param|bar|=foo}}
2869 !! html/php+tidy
2870 <p>bar foo</p>
2871 !! html/parsoid
2872 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2873 foo</p>
2874 !! end
2875
2876 ###
2877 ### Parsoid-centric tests for testing RT edge cases for pre
2878 ###
2879
2880 !!test
2881 1a. Indent-Pre and Comments
2882 !! wikitext
2883 a
2884 <!--a-->
2885 c
2886 !! html
2887 <pre>a
2888 </pre>
2889 <p>c
2890 </p>
2891 !!end
2892
2893 !!test
2894 1b. Indent-Pre and Comments
2895 !! wikitext
2896 a
2897 <!--a-->
2898 c
2899 !! html
2900 <pre>a
2901 </pre>
2902 <p>c
2903 </p>
2904 !!end
2905
2906 !!test
2907 1c. Indent-Pre and Comments
2908 !! wikitext
2909 <!--a--> a
2910
2911 <!--a--> a
2912 !! html
2913 <pre> a
2914 </pre>
2915 <pre> a
2916 </pre>
2917 !!end
2918
2919 !!test
2920 1d. Indent-Pre and Comments
2921 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2922 !! wikitext
2923 <!--a--> a
2924
2925 <!--b-->b
2926 !! html
2927 <pre>a
2928 </pre>
2929 <pre>b
2930 </pre>
2931 !!end
2932
2933 !!test
2934 2a. Indent-Pre and tables
2935 !! wikitext
2936 {|
2937 |-
2938 !h1!!h2
2939 |foo||bar
2940 |}
2941 !! html
2942 <table>
2943
2944 <tr>
2945 <th>h1</th>
2946 <th>h2
2947 </th>
2948 <td>foo</td>
2949 <td>bar
2950 </td></tr></table>
2951
2952 !!end
2953
2954 !!test
2955 2b. Indent-Pre and tables
2956 !! wikitext
2957 {|
2958 |-
2959 |foo
2960 |}
2961 !! html
2962 <table>
2963
2964 <tr>
2965 <td>foo
2966 </td></tr></table>
2967
2968 !!end
2969
2970 !!test
2971 2c. Indent-Pre and tables (bug 42252)
2972 !! wikitext
2973 {|
2974 |+ foo
2975 ! | bar
2976 |}
2977 !! html
2978 <table>
2979 <caption> foo
2980 </caption>
2981 <tr>
2982 <th> bar
2983 </th></tr></table>
2984
2985 !!end
2986
2987 !!test
2988 2d. Indent-Pre and tables
2989 !! wikitext
2990 a
2991 {|
2992 | b
2993 |}
2994 !! html/php
2995 <pre>a
2996 </pre>
2997 <table>
2998 <tr>
2999 <td> b
3000 </td></tr></table>
3001
3002 !! html/parsoid
3003 <pre>a</pre>
3004 <table>
3005 <tbody><tr><td> b</td></tr>
3006 </tbody></table>
3007 !!end
3008
3009 !!test
3010 2e. Indent-Pre and table-line syntax
3011 !! wikitext
3012 a
3013 | b
3014 | c
3015 !! html/php
3016 <pre>a
3017 | b
3018 | c
3019 </pre>
3020 !!end
3021
3022 !!test
3023 2f. Indent-pre started by table-line syntax
3024 !! wikitext
3025 a
3026 | b
3027 | c
3028 !! html/php
3029 <p>a
3030 </p>
3031 <pre>| b
3032 | c
3033 </pre>
3034 !! html/parsoid
3035 <p>a</p>
3036 <pre>
3037 | b
3038 | c</pre>
3039 !!end
3040
3041 !!test
3042 3a. Indent-Pre and block tags (single-line html)
3043 !! wikitext
3044 a <p> foo </p>
3045 b <div> foo </div>
3046 c <blockquote> foo </blockquote>
3047 <span> foo </span>
3048 !! html
3049 a <p> foo </p>
3050 b <div> foo </div>
3051 c <blockquote> foo </blockquote>
3052 <pre><span> foo </span>
3053 </pre>
3054 !! html/parsoid
3055 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3056 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3057 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3058 <pre><span> foo </span>
3059 </pre>
3060 !! html+tidy
3061 <p>a</p>
3062 <p>foo</p>
3063 <p>b</p>
3064 <div>foo</div>
3065 <p>c</p>
3066 <blockquote>
3067 <p>foo</p>
3068 </blockquote>
3069 <pre>
3070 <span> foo </span>
3071 </pre>
3072 !! end
3073
3074 !!test
3075 3b. Indent-Pre and block tags (multi-line html)
3076 !! wikitext
3077 a <span>foo</span>
3078 b <div> foo </div>
3079 !! html
3080 <pre>a <span>foo</span>
3081 </pre>
3082 b <div> foo </div>
3083
3084 !! html/parsoid
3085 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3086 b <div data-parsoid='{"stx":"html"}'> foo </div>
3087 !! html+tidy
3088 <pre>
3089 a <span>foo</span>
3090 </pre>
3091 <p>b</p>
3092 <div>foo</div>
3093 !!end
3094
3095 !!test
3096 3c. Indent-Pre and block tags (pre-content on separate line)
3097 !! wikitext
3098 <p>
3099 foo
3100 </p>
3101
3102 <div>
3103 foo
3104 </div>
3105
3106 <center>
3107 foo
3108 </center>
3109
3110 <blockquote>
3111 foo
3112 </blockquote>
3113
3114 <blockquote>
3115 <pre>
3116 foo
3117 </pre>
3118 </blockquote>
3119
3120 <table><tr><td>
3121 foo
3122 </td></tr></table>
3123
3124 <ul><li>
3125 foo
3126 </li></ul>
3127
3128 !! html
3129 <p>
3130 foo
3131 </p>
3132 <div>
3133 <pre>foo
3134 </pre>
3135 </div>
3136 <center>
3137 <pre>foo
3138 </pre>
3139 </center>
3140 <blockquote>
3141 <p> foo
3142 </p>
3143 </blockquote>
3144 <blockquote>
3145 <pre>
3146 foo
3147 </pre>
3148 </blockquote>
3149 <table><tr><td>
3150 <pre>foo
3151 </pre>
3152 </td></tr></table>
3153 <ul><li>
3154 foo
3155 </li></ul>
3156
3157 !!end
3158
3159 !!test
3160 4. Indent-Pre and extension tags
3161 !! wikitext
3162 a <gallery>
3163 File:foobar.jpg
3164 </gallery>
3165 !! html
3166 a <ul class="gallery mw-gallery-traditional">
3167 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3168 <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>
3169 <div class="gallerytext">
3170 </div>
3171 </div></li>
3172 </ul>
3173
3174 !! html+tidy
3175 <p>a</p>
3176 <ul class="gallery mw-gallery-traditional">
3177 <li class="gallerybox" style="width: 155px">
3178 <div style="width: 155px">
3179 <div class="thumb" style="width: 150px;">
3180 <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>
3181 </div>
3182 <div class="gallerytext"></div>
3183 </div>
3184 </li>
3185 </ul>
3186 !!end
3187
3188 !! test
3189 Table wikitext syntax outside wiki-tables
3190 !! wikitext
3191 a
3192 ! not a table heading
3193 |- not a table row
3194 | not a table cell
3195 | class="foo bar" | baz
3196 b
3197 |}
3198 |-
3199 c
3200 !! html
3201 <p>a
3202 ! not a table heading
3203 |- not a table row
3204 | not a table cell
3205 | class="foo bar" | baz
3206 b
3207 |}
3208 |-
3209 c
3210 </p>
3211 !! end
3212
3213 !!test
3214 Render paragraphs when indent-pre is suppressed in blocklevels
3215 !! wikitext
3216 <blockquote>
3217 foo
3218
3219 bar
3220 </blockquote>
3221 !! html
3222 <blockquote>
3223 <p> foo
3224 </p><p> bar
3225 </p>
3226 </blockquote>
3227
3228 !!end
3229
3230 !!test
3231 4. Multiple spaces at start-of-line
3232 !! wikitext
3233 <p> foo </p>
3234 foo
3235 {|
3236 |foo
3237 |}
3238 !! html
3239 <p> foo </p>
3240 <pre> foo
3241 </pre>
3242 <table>
3243 <tr>
3244 <td>foo
3245 </td></tr></table>
3246
3247 !!end
3248
3249 ## NOTE: the leading white-space chars on empty line are significant
3250 !! test
3251 5a. White-space in indent-pre
3252 !! wikitext
3253 a<br />
3254
3255 b
3256 !! html
3257 <pre>a<br />
3258
3259 b
3260 </pre>
3261 !! end
3262
3263 ## NOTE: the leading white-space chars on empty line are significant
3264 !! test
3265 5b. White-space in indent-pre
3266 !! wikitext
3267 a
3268
3269 b
3270
3271
3272 c
3273 !! html
3274 <pre>a
3275
3276 b
3277
3278
3279 c
3280 </pre>
3281 !! end
3282
3283 !! test
3284 5c. White-space in indent-pre
3285 !! wikitext
3286 ''a''
3287 ''b''
3288 ''c''
3289 !! html
3290 <pre><i>a</i>
3291 <i>b</i>
3292 <i>c</i>
3293 </pre>
3294 !! end
3295
3296 !! test
3297 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3298 !! wikitext
3299 a
3300
3301 <!-- continue -->
3302 b
3303
3304 c
3305
3306 d
3307 !! html
3308 <pre>a
3309
3310 b
3311 </pre>
3312 <pre>c
3313
3314 </pre>
3315 <p>d
3316 </p>
3317 !! end
3318
3319 !! test
3320 7a. Indent-pre and category links
3321 !! options
3322 parsoid=wt2html,wt2wt
3323 !! wikitext
3324 [[Category:foo]] <!-- No pre-wrapping -->
3325 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3326 !! html/php+tidy
3327 !! html/parsoid
3328 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3329 <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 -->
3330 !! end
3331
3332 !! test
3333 7b. Indent-pre and category links
3334 !! options
3335 parsoid=wt2html,wt2wt
3336 !! wikitext
3337 [[Category:foo]] a
3338 [[Category:foo]] {{echo|b}}
3339 !! html
3340 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3341 <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>
3342 !! end
3343
3344 !! test
3345 Indent-Pre: Newlines in comments shouldn't affect sol state
3346 !! wikitext
3347 a <!--
3348 foo
3349 --> b
3350 !! html/php+tidy
3351 <p>a b</p>
3352 !! html/parsoid
3353 <p>a <!--
3354 foo
3355 --> b</p>
3356 !! end
3357
3358 ###
3359 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3360 ###
3361
3362 !!test
3363 HTML-pre: 1. embedded newlines
3364 !! wikitext
3365 <pre>foo</pre>
3366
3367 <pre>
3368 foo
3369 </pre>
3370
3371 <pre>
3372
3373 foo
3374 </pre>
3375
3376 <pre>
3377
3378
3379 foo
3380 </pre>
3381 !! html/php+tidy
3382 <pre>
3383 foo
3384 </pre>
3385 <pre>
3386 foo
3387 </pre>
3388 <pre>
3389
3390 foo
3391 </pre>
3392 <pre>
3393
3394
3395 foo
3396 </pre>
3397 !! html/parsoid
3398 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3399
3400 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3401 foo
3402 </pre>
3403
3404 <pre data-parsoid='{"stx":"html"}'>
3405
3406 foo
3407 </pre>
3408
3409 <pre data-parsoid='{"stx":"html"}'>
3410
3411
3412 foo
3413 </pre>
3414 !!end
3415
3416 !! test
3417 HTML-pre: big spaces
3418 !! wikitext
3419 <pre>
3420
3421
3422
3423
3424 haha
3425
3426
3427
3428
3429 haha
3430
3431
3432
3433
3434 </pre>
3435 !! html/php+tidy
3436 <pre>
3437
3438
3439
3440
3441 haha
3442
3443
3444
3445
3446 haha
3447
3448
3449
3450
3451 </pre>
3452 !! html/parsoid
3453 <pre data-parsoid='{"stx":"html"}'>
3454
3455
3456
3457
3458 haha
3459
3460
3461
3462
3463 haha
3464
3465
3466
3467
3468 </pre>
3469 !! end
3470
3471 !!test
3472 HTML-pre: 2: indented text
3473 !! wikitext
3474 <pre>
3475 foo
3476 </pre>
3477 !! html
3478 <pre>
3479 foo
3480 </pre>
3481
3482 !!end
3483
3484 !!test
3485 HTML-pre: 3: other wikitext
3486 !! wikitext
3487 <pre>
3488 * foo
3489 # bar
3490 = no-h =
3491 '' no-italic ''
3492 [[ NoLink ]]
3493 </pre>
3494 !! html/php
3495 <pre>
3496 * foo
3497 # bar
3498 = no-h =
3499 '' no-italic ''
3500 [[ NoLink ]]
3501 </pre>
3502
3503 !! html/parsoid
3504 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3505 # bar
3506 = no-h =
3507 '' no-italic ''
3508 [[ NoLink ]]
3509 </pre>
3510 !!end
3511
3512 ###
3513 ### Definition lists
3514 ###
3515 !! test
3516 Simple definition
3517 !! wikitext
3518 ; name : Definition
3519 !! html
3520 <dl><dt> name&#160;</dt>
3521 <dd> Definition</dd></dl>
3522
3523 !! end
3524
3525 !! test
3526 Definition list for indentation only
3527 !! wikitext
3528 : Indented text
3529 !! html
3530 <dl><dd> Indented text</dd></dl>
3531
3532 !! end
3533
3534 !! test
3535 Definition list with no space
3536 !! wikitext
3537 ;name:Definition
3538 !! html
3539 <dl><dt>name</dt>
3540 <dd>Definition</dd></dl>
3541
3542 !!end
3543
3544 !! test
3545 Definition list with URL link
3546 !! wikitext
3547 ; http://example.com/ : definition
3548 !! html
3549 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3550 <dd> definition</dd></dl>
3551
3552 !! end
3553
3554 !! test
3555 Definition list with bracketed URL link
3556 !! wikitext
3557 ;[http://www.example.com/ Example]:Something about it
3558 !! html
3559 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3560 <dd>Something about it</dd></dl>
3561
3562 !! end
3563
3564 !! test
3565 Definition list with wikilink containing colon
3566 !! wikitext
3567 ; [[Help:FAQ]]: The least-read page on Wikipedia
3568 !! html
3569 <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>
3570 <dd> The least-read page on Wikipedia</dd></dl>
3571
3572 !! end
3573
3574 # At Brion's and JeLuF's insistence... :)
3575 !! test
3576 Definition list with news link containing colon
3577 !! wikitext
3578 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3579 !! html/php
3580 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3581 <dd> This isn't even a real newsgroup!</dd></dl>
3582
3583 !! html/parsoid
3584 <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>
3585 !! end
3586
3587 !! test
3588 Malformed definition list with colon
3589 !! wikitext
3590 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3591 !! html
3592 <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>
3593
3594 !! end
3595
3596 !! test
3597 Definition lists: colon in external link text
3598 !! wikitext
3599 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3600 !! html
3601 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3602 <dd> OK, I made that up</dd></dl>
3603
3604 !! end
3605
3606 !! test
3607 Definition lists: colon in HTML attribute
3608 !! wikitext
3609 ;<b style="display: inline">bold</b>
3610 !! html
3611 <dl><dt><b style="display: inline">bold</b></dt></dl>
3612
3613 !! end
3614
3615 !! test
3616 Definition lists: self-closed tag
3617 !! wikitext
3618 ;one<br/>two : two-line fun
3619 !! html
3620 <dl><dt>one<br />two&#160;</dt>
3621 <dd> two-line fun</dd></dl>
3622
3623 !! end
3624
3625 !! test
3626 Bug 11748: Literal closing tags
3627 !! wikitext
3628 <dl>
3629 <dt>test 1</dt>
3630 <dd>test test test test test</dd>
3631 <dt>test 2</dt>
3632 <dd>test test test test test</dd>
3633 </dl>
3634 !! html
3635 <dl>
3636 <dt>test 1</dt>
3637 <dd>test test test test test</dd>
3638 <dt>test 2</dt>
3639 <dd>test test test test test</dd>
3640 </dl>
3641
3642 !! end
3643
3644 !! test
3645 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3646 !! wikitext
3647 <ul><li>
3648 ; term : description
3649 * unordered
3650 </li></ul>
3651 !! html
3652 <ul><li>
3653 <dl><dt> term&#160;</dt>
3654 <dd> description</dd></dl>
3655 <ul><li> unordered</li></ul>
3656 </li></ul>
3657
3658 !! end
3659
3660 !! test
3661
3662 Definition list with empty definition and following paragraph
3663 !! wikitext
3664 ; term:
3665 Paragraph text
3666 !! html
3667 <dl><dt> term</dt>
3668 <dd></dd></dl>
3669 <p>Paragraph text
3670 </p>
3671 !! end
3672
3673 !! test
3674 Nested definition lists using html syntax
3675 !! wikitext
3676 <dl><dt>x</dt>
3677 <dd>a</dd>
3678 <dd>b</dd></dl>
3679
3680 !! end
3681
3682 !! test
3683 Definition Lists: No nesting: Multiple dd's
3684 !! wikitext
3685 ;x
3686 :a
3687 :b
3688 !! html
3689 <dl><dt>x</dt>
3690 <dd>a</dd>
3691 <dd>b</dd></dl>
3692
3693 !! end
3694
3695 !! test
3696 Definition Lists: Indentation: Regular
3697 !! wikitext
3698 :i1
3699 ::i2
3700 :::i3
3701 !! html
3702 <dl><dd>i1
3703 <dl><dd>i2
3704 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3705
3706 !! end
3707
3708 !! test
3709 Definition Lists: Indentation: Missing 1st level
3710 !! wikitext
3711 ::i2
3712 :::i3
3713 !! html
3714 <dl><dd><dl><dd>i2
3715 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3716
3717 !! end
3718
3719 !! test
3720 Definition Lists: Indentation: Multi-level indent
3721 !! wikitext
3722 :::i3
3723 !! html
3724 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3725
3726 !! end
3727
3728 !! test
3729 Definition Lists: Hacky use to indent tables
3730 !! wikitext
3731 ::{|
3732 |foo
3733 |bar
3734 |}
3735 this text
3736 should be left alone
3737 !! html
3738 <dl><dd><dl><dd><table>
3739 <tr>
3740 <td>foo
3741 </td>
3742 <td>bar
3743 </td></tr></table></dd></dl></dd></dl>
3744 <p>this text
3745 should be left alone
3746 </p>
3747 !! end
3748
3749 !! test
3750 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3751 !! wikitext
3752 <!-- foo -->
3753 ::{|
3754 |foo
3755 |bar
3756 |}<!-- bar -->
3757 this text
3758 should be left alone
3759 !! html/parsoid
3760 <!-- foo -->
3761 <dl><dd><dl><dd><table><tr>
3762 <td>foo</td>
3763 <td>bar</td>
3764 </tr></table><!-- bar --></dd></dl></dd></dl>
3765 <p>this text
3766 should be left alone</p>
3767 !! end
3768
3769 !! test
3770 Definition Lists: Hacky use to indent tables, with comment before table
3771 !! wikitext
3772 ::<!-- foo -->{|
3773 |foo
3774 |}
3775 !! html/parsoid
3776 <dl><dd><dl><dd><!-- foo --><table><tr>
3777 <td>foo</td>
3778 </tr></table></dd></dl></dd></dl>
3779 !! end
3780
3781 # The trailing whitespace in this test is to catch a regression in
3782 # Parsoid after T54473.
3783 !! test
3784 Definition Lists: Hacky use to indent tables (WS-insensitive)
3785 !! wikitext
3786 : {|
3787 |a
3788 |}
3789 !! html/php
3790 <dl><dd><table>
3791 <tr>
3792 <td>a
3793 </td></tr></table></dd></dl>
3794
3795 !! html/parsoid
3796 <dl><dd> <table>
3797 <tbody><tr><td>a</td></tr>
3798 </tbody></table> </dd></dl>
3799 !! end
3800
3801 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3802 ## as an empty dt item. It also ignores all but the last ";" when followed
3803 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3804 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3805 ## ";"s.
3806 ##
3807 ## Ex: ";;t2 ::d2" is transformed into:
3808 ##
3809 ## <dl>
3810 ## <dt>t2 </dt>
3811 ## <dd>
3812 ## <dl>
3813 ## <dt></dt>
3814 ## <dd>d2</dd>
3815 ## </dl>
3816 ## </dd>
3817 ## </dl>
3818 ##
3819 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3820 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3821 ##
3822 ## <dl>
3823 ## <dt>
3824 ## <dl>
3825 ## <dt>t2 </dt>
3826 ## <dd>:d2</dd>
3827 ## </dl>
3828 ## </dt>
3829 ## </dl>
3830 ##
3831 ## All Parsoid only definition list tests have this difference.
3832 ##
3833 ## See also: https://phabricator.wikimedia.org/T8569
3834 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3835
3836 !! test
3837 Table / list interaction: indented table with lists in table contents
3838 !! wikitext
3839 :{|
3840 |-
3841 | a
3842 * b
3843 |-
3844 | c
3845 * d
3846 |}
3847 !! html
3848 <dl><dd><table>
3849
3850 <tr>
3851 <td> a
3852 <ul><li> b</li></ul>
3853 </td></tr>
3854 <tr>
3855 <td> c
3856 <ul><li> d</li></ul>
3857 </td></tr></table></dd></dl>
3858
3859 !! end
3860
3861 !!test
3862 Table / list interaction: lists nested in tables nested in indented lists
3863 !! wikitext
3864 :{|
3865 |
3866 :a
3867 :b
3868 |
3869 *c
3870 *d
3871 |}
3872
3873 *e
3874 *f
3875 !! html
3876 <dl><dd><table>
3877 <tr>
3878 <td>
3879 <dl><dd>a</dd>
3880 <dd>b</dd></dl>
3881 </td>
3882 <td>
3883 <ul><li>c</li>
3884 <li>d</li></ul>
3885 </td></tr></table></dd></dl>
3886 <ul><li>e</li>
3887 <li>f</li></ul>
3888
3889 !!end
3890
3891 !! test
3892 Definition Lists: Nesting: Multi-level (Parsoid only)
3893 !! options
3894 parsoid
3895 !! wikitext
3896 ;t1 :d1
3897 ;;t2 ::d2
3898 ;;;t3 :::d3
3899 !! html
3900 <dl>
3901 <dt>t1 </dt>
3902 <dd>d1</dd>
3903 <dt>
3904 <dl>
3905 <dt>t2 </dt>
3906 <dd>:d2</dd>
3907 <dt>
3908 <dl>
3909 <dt>t3 </dt>
3910 <dd>::d3</dd>
3911 </dl>
3912 </dt>
3913 </dl>
3914 </dt>
3915 </dl>
3916
3917
3918 !! end
3919
3920
3921 !! test
3922 Definition Lists: Nesting: Test 2 (Parsoid only)
3923 !! wikitext
3924 ;t1
3925 ::d2
3926 !! html/php+tidy
3927 <dl>
3928 <dt>t1</dt>
3929 <dd>
3930 <dl>
3931 <dd>d2</dd>
3932 </dl>
3933 </dd>
3934 </dl>
3935 !! html/parsoid
3936 <dl>
3937 <dt>t1</dt>
3938 <dd>
3939 <dl>
3940 <dd>d2</dd>
3941 </dl>
3942 </dd>
3943 </dl>
3944
3945 !! end
3946
3947
3948 !! test
3949 Definition Lists: Nesting: Test 3 (Parsoid only)
3950 !! wikitext
3951 :;t1
3952 ::::d2
3953 !! html/php+tidy
3954 <dl>
3955 <dd>
3956 <dl>
3957 <dt>t1</dt>
3958 <dd>
3959 <dl>
3960 <dd>
3961 <dl>
3962 <dd>d2</dd>
3963 </dl>
3964 </dd>
3965 </dl>
3966 </dd>
3967 </dl>
3968 </dd>
3969 </dl>
3970 !! html/parsoid
3971 <dl>
3972 <dd>
3973 <dl>
3974 <dt>t1</dt>
3975 <dd>
3976 <dl>
3977 <dd>
3978 <dl>
3979 <dd>d2</dd>
3980 </dl>
3981 </dd>
3982 </dl>
3983 </dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987
3988 !! end
3989
3990
3991 !! test
3992 Definition Lists: Nesting: Test 4
3993 !! wikitext
3994 ::;t3
3995 :::d3
3996 !! html
3997 <dl><dd><dl><dd><dl><dt>t3</dt>
3998 <dd>d3</dd></dl></dd></dl></dd></dl>
3999
4000 !! end
4001
4002
4003 ## The Parsoid team believes the following three test exposes a
4004 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4005 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4006 ## It also exposes a "misfeature" in tidy, which doesn't like
4007 ## <dl> tags with a single <dt> child; it converts the <dt> into
4008 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4009 !! test
4010 Definition Lists: Mixed Lists: Test 1
4011 !! wikitext
4012 :;* foo
4013 ::* bar
4014 :; baz
4015 !! html/php
4016 <dl><dd><dl><dt><ul><li> foo</li>
4017 <li> bar</li></ul></dt></dl>
4018 <dl><dt> baz</dt></dl></dd></dl>
4019
4020 !! html/php+tidy
4021 <dl>
4022 <dd>
4023 <dl>
4024 <dd>
4025 <ul>
4026 <li>foo</li>
4027 <li>bar</li>
4028 </ul>
4029 </dd>
4030 </dl>
4031 <dl>
4032 <dt>baz</dt>
4033 </dl>
4034 </dd>
4035 </dl>
4036 !! html/parsoid
4037 <dl>
4038 <dd><dl>
4039 <dt><ul>
4040 <li> foo
4041 </li>
4042 </ul></dt>
4043 <dd><ul>
4044 <li> bar
4045 </li>
4046 </ul></dd>
4047 <dt> baz</dt>
4048 </dl></dd>
4049 </dl>
4050 !! end
4051
4052 !! test
4053 Definition Lists: Mixed Lists: Test 2
4054 !! wikitext
4055 *: d1
4056 *: d2
4057 !! html
4058 <ul><li><dl><dd> d1</dd>
4059 <dd> d2</dd></dl></li></ul>
4060
4061 !! end
4062
4063
4064 !! test
4065 Definition Lists: Mixed Lists: Test 3
4066 !! wikitext
4067 *::: d1
4068 *::: d2
4069 !! html
4070 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4071 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4072
4073 !! end
4074
4075
4076 !! test
4077 Definition Lists: Mixed Lists: Test 4
4078 !! wikitext
4079 *;d1 :d2
4080 *;d3 :d4
4081 !! html
4082 <ul><li><dl><dt>d1&#160;</dt>
4083 <dd>d2</dd>
4084 <dt>d3&#160;</dt>
4085 <dd>d4</dd></dl></li></ul>
4086
4087 !! end
4088
4089
4090 !! test
4091 Definition Lists: Mixed Lists: Test 5
4092 !! wikitext
4093 *:d1
4094 *:: d2
4095 !! html
4096 <ul><li><dl><dd>d1
4097 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4098
4099 !! end
4100
4101
4102 !! test
4103 Definition Lists: Mixed Lists: Test 6
4104 !! wikitext
4105 #*:d1
4106 #*::: d3
4107 !! html
4108 <ol><li><ul><li><dl><dd>d1
4109 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4110
4111 !! end
4112
4113
4114 !! test
4115 Definition Lists: Mixed Lists: Test 7
4116 !! wikitext
4117 :* d1
4118 :* d2
4119 !! html
4120 <dl><dd><ul><li> d1</li>
4121 <li> d2</li></ul></dd></dl>
4122
4123 !! end
4124
4125
4126 !! test
4127 Definition Lists: Mixed Lists: Test 8
4128 !! wikitext
4129 :* d1
4130 ::* d2
4131 !! html
4132 <dl><dd><ul><li> d1</li></ul>
4133 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4134
4135 !! end
4136
4137
4138 !! test
4139 Definition Lists: Mixed Lists: Test 9
4140 !! wikitext
4141 *;foo :bar
4142 !! html
4143 <ul><li><dl><dt>foo&#160;</dt>
4144 <dd>bar</dd></dl></li></ul>
4145
4146 !! end
4147
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 10
4151 !! wikitext
4152 *#;foo :bar
4153 !! html
4154 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4155 <dd>bar</dd></dl></li></ol></li></ul>
4156
4157 !! end
4158
4159 # The Parsoid team disagrees with the PHP parser's seemingly-random
4160 # rules regarding dd/dt on the next two tests. Parsoid is more
4161 # consistent, and recognizes the shared nesting and keeps the
4162 # still-open tags around until the nesting is complete.
4163 # (And tidy again converts <dt> to <dd> before 'bar'.)
4164
4165 !! test
4166 Definition Lists: Mixed Lists: Test 11
4167 !! wikitext
4168 *#*#;*;;foo :bar
4169 *#*#;boo :baz
4170 !! html/php
4171 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4172 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4173 <dl><dt>boo&#160;</dt>
4174 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4175
4176 !! html/php+tidy
4177 <ul>
4178 <li>
4179 <ol>
4180 <li>
4181 <ul>
4182 <li>
4183 <ol>
4184 <li>
4185 <dl>
4186 <dt>foo&#160;</dt>
4187 <dd>
4188 <ul>
4189 <li>
4190 <dl>
4191 <dd>
4192 <dl>
4193 <dt>bar</dt>
4194 </dl>
4195 </dd>
4196 </dl>
4197 </li>
4198 </ul>
4199 </dd>
4200 </dl>
4201 <dl>
4202 <dt>boo&#160;</dt>
4203 <dd>baz</dd>
4204 </dl>
4205 </li>
4206 </ol>
4207 </li>
4208 </ul>
4209 </li>
4210 </ol>
4211 </li>
4212 </ul>
4213 !! html/parsoid
4214 <ul>
4215 <li>
4216 <ol>
4217 <li>
4218 <ul>
4219 <li>
4220 <ol>
4221 <li>
4222 <dl>
4223 <dt>
4224 <ul>
4225 <li>
4226 <dl>
4227 <dt>
4228 <dl>
4229 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4230 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4231 </dl></dt>
4232 </dl></li>
4233 </ul></dt>
4234 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4235 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4236 </dl></li>
4237 </ol></li>
4238 </ul></li>
4239 </ol></li>
4240 </ul>
4241 !! end
4242
4243
4244 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4245 # From whitelist:
4246 # * The test is wrong, there are two colons where there should be :;
4247 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4248 !! test
4249 Definition Lists: Weird Ones: Test 1
4250 !! wikitext
4251 *#;*::;; foo : bar (who uses this?)
4252 !! html/php
4253 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4254 <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>
4255
4256 !! html/php+tidy
4257 <ul>
4258 <li>
4259 <ol>
4260 <li>
4261 <dl>
4262 <dt>foo&#160;</dt>
4263 <dd>
4264 <ul>
4265 <li>
4266 <dl>
4267 <dd>
4268 <dl>
4269 <dd>
4270 <dl>
4271 <dd>
4272 <dl>
4273 <dt>bar (who uses this?)</dt>
4274 </dl>
4275 </dd>
4276 </dl>
4277 </dd>
4278 </dl>
4279 </dd>
4280 </dl>
4281 </li>
4282 </ul>
4283 </dd>
4284 </dl>
4285 </li>
4286 </ol>
4287 </li>
4288 </ul>
4289 !! html/parsoid
4290 <ul>
4291 <li>
4292 <ol>
4293 <li>
4294 <dl>
4295 <dt>
4296 <ul>
4297 <li>
4298 <dl>
4299 <dd>
4300 <dl>
4301 <dd>
4302 <dl>
4303 <dt>
4304 <dl>
4305 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4306 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4307 </dl></dt>
4308 </dl></dd>
4309 </dl></dd>
4310 </dl></li>
4311 </ul></dt>
4312 </dl></li>
4313 </ol></li>
4314 </ul>
4315 !! end
4316
4317 !! test
4318 Definition Lists: colons occurring in tags
4319 !! wikitext
4320 ;a:b
4321 ;'''a:b'''
4322 ;<i>a:b</i>
4323 ;<span>a:b</span>
4324 ;<div>a:b</div>
4325 ;<div>a
4326 :b</div>
4327 ;{{echo|a:b}}
4328 ;{{echo|''a:b''}}
4329 ;;;''a:b''
4330 !! html+tidy
4331 <dl>
4332 <dt>a</dt>
4333 <dd>b</dd>
4334 <dt><b>a:b</b></dt>
4335 <dt><i>a:b</i></dt>
4336 <dt><span>a:b</span></dt>
4337 <dd>
4338 <div>a:b</div>
4339 </dd>
4340 <dd>
4341 <div>a
4342 <dl>
4343 <dd>b</dd>
4344 </dl>
4345 </div>
4346 </dd>
4347 <dt>a</dt>
4348 <dd>b</dd>
4349 <dt><i>a:b</i></dt>
4350 </dl>
4351 <dl>
4352 <dd>
4353 <dl>
4354 <dd>
4355 <dl>
4356 <dt><i>a:b</i></dt>
4357 </dl>
4358 </dd>
4359 </dl>
4360 </dd>
4361 </dl>
4362 !! html/parsoid
4363 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4364 <dt><b>a:b</b></dt>
4365 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4366 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4367 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4368 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4369 <dd>b</dd>
4370 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4371 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4372 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4373 !! end
4374
4375 !! test
4376 Definition Lists: colons and tables 1
4377 !! wikitext
4378 :{|
4379 | x
4380 |}
4381 :{|
4382 | y
4383 |}
4384 !! html
4385 <dl><dd><table>
4386 <tr>
4387 <td> x
4388 </td></tr></table></dd></dl>
4389 <dl><dd><table>
4390 <tr>
4391 <td> y
4392 </td></tr></table></dd></dl>
4393
4394 !! end
4395
4396 # Parsoid's output (as documented below) differs from php's in this case.
4397 # This is probably a bug. If we fixup parsoid to match php's output, the
4398 # above test should pass and the below test case can be removed. It is
4399 # unclear which output is more desirable.
4400
4401 !! test
4402 Definition Lists: colons and tables 2
4403 !! wikitext
4404 :{|
4405 | x
4406 |}
4407 :{|
4408 | y
4409 |}
4410 !! html/parsoid
4411 <dl><dd><table>
4412 <tr>
4413 <td> x
4414 </td></tr></table></dd>
4415 <dd><table>
4416 <tr>
4417 <td> y
4418 </td></tr></table></dd></dl>
4419 !! end
4420
4421 !! test
4422 Definition Lists: template interaction
4423 !! wikitext
4424 ::{{definition_list}}
4425
4426 :one
4427 ::{{definition_list}}
4428 :::two
4429 :::three
4430 ::four
4431 !! html/parsoid
4432 <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">
4433 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4434
4435 <dl><dd data-parsoid='{}'>one
4436 <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">
4437 </span><dd about="#mwt2">two
4438 <dl><dd>two</dd>
4439 <dd>three</dd></dl></dd>
4440 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4441 !! end
4442
4443
4444 ###
4445 ### External links
4446 ###
4447 !! test
4448 External links: non-bracketed
4449 !! wikitext
4450 Non-bracketed: http://example.com
4451 !! html
4452 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4453 </p>
4454 !! end
4455
4456 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4457 !! test
4458 External links: numbered
4459 !! wikitext
4460 Numbered: [http://example.com]
4461 Numbered: [http://example.net]
4462 Numbered: [http://example.com]
4463 !! html/php
4464 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4466 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4467 </p>
4468 !! html/parsoid
4469 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4470 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4471 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4472 !!end
4473
4474 !! test
4475 External links: specified text
4476 !! wikitext
4477 Specified text: [http://example.com link]
4478 !! html
4479 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4480 </p>
4481 !!end
4482
4483 !! test
4484 External links: trail
4485 !! wikitext
4486 Linktrails should not work for external links: [http://example.com link]s
4487 !! html
4488 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4489 </p>
4490 !! end
4491
4492 !! test
4493 External links: dollar sign in URL
4494 !! wikitext
4495 http://example.com/1$2345
4496 !! html
4497 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4498 </p>
4499 !! end
4500
4501 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4502 !! test
4503 External links: dollar sign in URL (autonumber)
4504 !! wikitext
4505 [http://example.com/1$2345]
4506 !! html/php
4507 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4508 </p>
4509 !! html/parsoid
4510 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4511 !!end
4512
4513 !! test
4514 External links: open square bracket forbidden in URL (bug 4377)
4515 !! options
4516 parsoid=wt2html,wt2wt,html2html
4517 !! wikitext
4518 http://example.com/1[2345
4519 !! html/php
4520 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4521 </p>
4522 !! html/parsoid
4523 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4524 !! end
4525
4526 !! test
4527 External links: open square bracket forbidden in URL (named) (bug 4377)
4528 !! options
4529 parsoid=wt2html,html2html
4530 !! wikitext
4531 [http://example.com/1[2345]
4532 !! html/php
4533 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4534 </p>
4535 !! html/parsoid
4536 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4537 !!end
4538
4539 # parsoid adds a space before the link name
4540 !! test
4541 External links: open square bracket forbidden in URL (named) (bug 4377)
4542 Parsoid variant.
4543 !! wikitext
4544 [http://example.com/1 [2345]
4545 !! html
4546 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4547 </p>
4548 !!end
4549
4550 !! test
4551 External links: nowiki in URL link text (bug 6230)
4552 !! wikitext
4553 [http://example.com/ <nowiki>''example site''</nowiki>]
4554 !! html
4555 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4556 </p>
4557 !! end
4558
4559 !! test
4560 External links: newline forbidden in text (bug 6230 regression check)
4561 !! wikitext
4562 [http://example.com/ first
4563 second]
4564 !! html
4565 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4566 second]
4567 </p>
4568 !!end
4569
4570 !! test
4571 External links: Pipe char between url and text
4572 !! wikitext
4573 [http://example.com | link]
4574 !! html
4575 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4576 </p>
4577 !!end
4578
4579 !! test
4580 External links: protocol-relative URL in brackets
4581 !! wikitext
4582 [//example.com/ Test]
4583 !! html
4584 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4585 </p>
4586 !! end
4587
4588 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4589 !! test
4590 External links: protocol-relative URL in brackets without text
4591 !! wikitext
4592 [//example.com]
4593 !! html/php
4594 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4595 </p>
4596 !! html/parsoid
4597 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4598 !! end
4599
4600 !! test
4601 External links: protocol-relative URL in free text is left alone
4602 !! wikitext
4603 //example.com/Foo
4604 !! html
4605 <p>//example.com/Foo
4606 </p>
4607 !!end
4608
4609 !! test
4610 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4611 !! wikitext
4612 foo//example.com/Foo
4613 !! html
4614 <p>foo//example.com/Foo
4615 </p>
4616 !! end
4617
4618 !! test
4619 External links: with no contents
4620 !! wikitext
4621 [http://en.wikipedia.org/wiki/Foo]
4622
4623 [[wikipedia:Foo|Bar]]
4624
4625 [[wikipedia:Foo|<span>Bar</span>]]
4626 !! html/php
4627 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4628 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4629 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4630 </p>
4631 !! html/parsoid
4632 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4633 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4634 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4635 !! end
4636
4637 !! test
4638 External links: Free with trailing punctuation
4639 !! wikitext
4640 http://example.com,
4641 http://example.com;
4642 http://example.com\
4643 http://example.com.
4644 http://example.com:
4645 http://example.com!
4646 http://example.com?
4647 http://example.com)
4648 http://example.com/url_with_(brackets)
4649 (http://example.com/url_without_brackets)
4650 http://example.com/url_with_entity&amp;
4651 http://example.com/url_with_entity&#x26;
4652 http://example.com/url_with_entity&#038;
4653 http://example.com/url_with_entity&nbsp;
4654 http://example.com/url_with_entity&#xA0;
4655 http://example.com/url_with_entity&#160;
4656 http://example.com/url_with_entity&lt;
4657 http://example.com/url_with_entity&#x3C;
4658 http://example.com/url_with_entity&#60;
4659 !! html/php
4660 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4661 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4664 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4665 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4667 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4668 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4669 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4670 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4671 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4672 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4673 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4674 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4679 </p>
4680 !! html/parsoid
4681 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4682 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4683 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4684 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4685 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4686 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4687 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4688 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4689 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4690 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4691 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4694 <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>
4695 <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>
4696 <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>
4697 <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>
4698 <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>
4699 <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>
4700 !! end
4701
4702 !! test
4703 External links: tricky Parsoid html2html case
4704 !! options
4705 parsoid=wt2html,wt2wt,html2html
4706 !! wikitext
4707 http://example.com/url_with_entity&amp;amp;
4708 !! html/php
4709 <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>;
4710 </p>
4711 !! html/parsoid
4712 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4713 !! end
4714
4715 !! test
4716 External links: Free with trailing quotes (T113666)
4717 !! wikitext
4718 '''News:''' Stuff here
4719
4720 news:'a'b''c''d e
4721 !! html/php
4722 <p><b>News:</b> Stuff here
4723 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4724 </p>
4725 !! html/parsoid
4726 <p><b>News:</b> Stuff here</p>
4727 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4728 !! end
4729
4730 !! test
4731 External links: Lone protocols are never linked (T105697)
4732 !! wikitext
4733 http://
4734 http://;
4735 (http://)
4736 bitcoin:
4737 bitcoin:;
4738 (bitcoin:)
4739 !! html
4740 <p>http://
4741 http://;
4742 (http://)
4743 bitcoin:
4744 bitcoin:;
4745 (bitcoin:)
4746 </p>
4747 !! end
4748
4749 !! test
4750 External links: No preceding word characters allowed (bug 65278)
4751 !! wikitext
4752 NOPEhttp://example.com
4753 N0http://example.com
4754 ok:http://example.com
4755 ok-http://example.com
4756 !! html
4757 <p>NOPEhttp://example.com
4758 N0http://example.com
4759 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4760 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4761 </p>
4762 !! end
4763
4764 !! test
4765 External image
4766 !! wikitext
4767 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4768 !! html
4769 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4770 </p>
4771 !! end
4772
4773 !! test
4774 External image from https
4775 !! wikitext
4776 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4777 !! html
4778 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4779 </p>
4780 !! end
4781
4782 !! test
4783 External image (when not allowed)
4784 !! options
4785 wgAllowExternalImages=0
4786 !! wikitext
4787 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4788 !! html
4789 <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>
4790 </p>
4791 !! end
4792
4793 !! test
4794 Link to non-http image, no img tag
4795 !! wikitext
4796 Link to non-http image, no img tag: ftp://example.com/test.jpg
4797 !! html
4798 <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>
4799 </p>
4800 !! end
4801
4802 !! test
4803 External links: terminating separator
4804 !! wikitext
4805 Terminating separator: http://example.com/thing,
4806 !! html
4807 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4808 </p>
4809 !! end
4810
4811 !! test
4812 External links: intervening separator
4813 !! wikitext
4814 Intervening separator: http://example.com/1,2,3
4815 !! html
4816 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: old bug with URL in query
4822 !! wikitext
4823 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4824 !! html
4825 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4826 </p>
4827 !! end
4828
4829 !! test
4830 External links: old URL-in-URL bug, mixed protocols
4831 !! wikitext
4832 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4833 !! html
4834 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4835 </p>
4836 !!end
4837
4838 !! test
4839 External links: URL in text
4840 !! wikitext
4841 URL in text: [http://example.com http://example.com]
4842 !! html
4843 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: Clickable images
4849 !! wikitext
4850 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4851 !! html/php
4852 <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>
4853 </p>
4854 !! html/parsoid
4855 <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>
4856 !! end
4857
4858 !! test
4859 External links: raw ampersand
4860 !! wikitext
4861 Old &amp; use: http://x&y
4862 !! html
4863 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4864 </p>
4865 !! end
4866
4867 !! test
4868 External links: encoded ampersand
4869 !! wikitext
4870 Old &amp; use: http://x&amp;y
4871 !! html/php
4872 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4873 </p>
4874 !! html/parsoid
4875 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4876 !! end
4877
4878 !! test
4879 External links: encoded equals (bug 6102)
4880 !! wikitext
4881 http://example.com/?foo&#61;bar
4882 !! html/php
4883 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4884 </p>
4885 !! html/parsoid
4886 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4887 !! end
4888
4889 ##
4890 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4891 ## does it number them. As discussed in bug 53505, we can identify
4892 ## autonumbered links via CSS.
4893 ##
4894
4895 !! test
4896 External links: [raw ampersand]
4897 !! wikitext
4898 Old &amp; use: [http://x&y]
4899 !! html/php
4900 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4901 </p>
4902 !! html/parsoid
4903 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4904 !! end
4905
4906 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4907 # mode will return the [raw ampersand] wikitext
4908 !! test
4909 External links: [encoded ampersand]
4910 !! options
4911 parsoid=wt2html,wt2wt,html2html
4912 !! wikitext
4913 Old &amp; use: [http://x&amp;y]
4914 !! html/php
4915 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4916 </p>
4917 !! html/parsoid
4918 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4919 !! end
4920
4921 !! test
4922 External links: [raw equals]
4923 !! wikitext
4924 [http://example.com/?foo=bar]
4925 !! html/php
4926 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4927 </p>
4928 !! html/parsoid
4929 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4930 !! end
4931
4932 # note that parsoid html is identical to [raw equals] case; so html2wt
4933 # mode will return the [raw equals] wikitext
4934 !! test
4935 External links: [encoded equals] (bug 6102)
4936 !! options
4937 parsoid=wt2html,wt2wt,html2html
4938 !! wikitext
4939 [http://example.com/?foo&#61;bar]
4940 !! html/php
4941 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4942 </p>
4943 !! html/parsoid
4944 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4945 !! end
4946
4947 # xxx parsoid strips the IDN character, so the round-trip tests will
4948 # obviously fail and are disabled. --cscott
4949 !! test
4950 External links: [IDN ignored character reference in hostname; strip it right off]
4951 !! options
4952 parsoid=wt2html,wt2wt,html2html
4953 !! wikitext
4954 [http://e&zwnj;xample.com/]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4960 !! end
4961
4962 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4963 # Where an external link could easily circumvent the sanitization of the text of
4964 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4965 # test demands a higher standard. That's a bit strange.
4966 #
4967 # Example:
4968 #
4969 # http://e‌xample.com -> [http://example.com|http://example.com]
4970 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4971 #
4972 # The first example is sanitized, but the second is not. Any security benefits
4973 # from this production are trivial to circumvent. Either remove this test and
4974 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4975 # the test accordingly.
4976 #
4977 # All our love,
4978 # The Parsoid team.
4979 # xxx parsoid strips the IDN character, so the round-trip tests will
4980 # obviously fail and are disabled. --cscott
4981 !! test
4982 External links: IDN ignored character reference in hostname; strip it right off
4983 !! options
4984 parsoid=wt2html,html2html
4985 !! wikitext
4986 http://e&zwnj;xample.com/
4987 !! html/php
4988 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4989 </p>
4990 !! html/parsoid
4991 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4992 !! end
4993
4994 !! test
4995 External links: www.jpeg.org (bug 554)
4996 !! wikitext
4997 http://www.jpeg.org
4998 !! html
4999 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5000 </p>
5001 !! end
5002
5003 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5004 !! test
5005 External links: URL within URL (original bug 2)
5006 !! wikitext
5007 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5008 !! html/php
5009 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5010 </p>
5011 !! html/parsoid
5012 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5013 !! end
5014
5015 !! test
5016 BUG 361: URL inside bracketed URL
5017 !! wikitext
5018 [http://www.example.com/foo http://www.example.com/bar]
5019 !! html
5020 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5021 </p>
5022 !! end
5023
5024 !! test
5025 BUG 361: URL within URL, not bracketed
5026 !! wikitext
5027 http://www.example.com/foo?=http://www.example.com/bar
5028 !! html
5029 <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>
5030 </p>
5031 !! end
5032
5033 !! test
5034 BUG 289: ">"-token in URL-tail
5035 !! wikitext
5036 http://www.example.com/<hello>
5037 !! html
5038 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5039 </p>
5040 !!end
5041
5042 !! test
5043 BUG 289: literal ">"-token in URL-tail
5044 !! wikitext
5045 http://www.example.com/<b>html</b>
5046 !! html/php
5047 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5048 </p>
5049 !! html/parsoid
5050 <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>
5051 !! end
5052
5053 !! test
5054 BUG 289: ">"-token in bracketed URL
5055 !! wikitext
5056 [http://www.example.com/<hello> stuff]
5057 !! html
5058 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5059 </p>
5060 !!end
5061
5062 !! test
5063 BUG 289: literal ">"-token in bracketed URL
5064 !! wikitext
5065 [http://www.example.com/<b>html</b> stuff]
5066 !! html
5067 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5068 </p>
5069 !!end
5070
5071 !! test
5072 BUG 289: literal double quote at end of URL
5073 !! wikitext
5074 http://www.example.com/"hello"
5075 !! html
5076 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5077 </p>
5078 !!end
5079
5080 !! test
5081 BUG 289: literal double quote in bracketed URL
5082 !! wikitext
5083 [http://www.example.com/"hello" stuff]
5084 !! html
5085 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5086 </p>
5087 !!end
5088
5089 !! test
5090 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5091 !! wikitext
5092 [http://www.example.com test]
5093 !! html
5094 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5095 </p>
5096 !! end
5097
5098 !! test
5099 External links: link text with spaces
5100 !! wikitext
5101 [http://www.example.com a b c]
5102 [http://www.example.com ''a'' ''b'']
5103 !! html
5104 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5105 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5106 </p>
5107 !! end
5108
5109 !! test
5110 External links: wiki links within external link (Bug 3695)
5111 !! options
5112 parsoid=wt2html,html2html
5113 !! wikitext
5114 [http://example.com [[wikilink]] embedded in ext link]
5115 !! html/php
5116 <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>
5117 </p>
5118 !! html/parsoid
5119 <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>
5120 !! end
5121
5122 !! test
5123 BUG 787: Links with one slash after the url protocol are invalid
5124 !! wikitext
5125 http:/example.com
5126
5127 [http:/example.com title]
5128 !! html
5129 <p>http:/example.com
5130 </p><p>[http:/example.com title]
5131 </p>
5132 !! end
5133
5134 !! test
5135 Bracketed external links with template-generated invalid target
5136 !! wikitext
5137 [{{echo|http:/example.com}} title]
5138 !! html
5139 <p>[http:/example.com title]
5140 </p>
5141 !! end
5142
5143 !! test
5144 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5145 !! wikitext
5146 ''[http://example.com text'']
5147 [http://example.com '''text]'''
5148 ''Something [http://example.com in italic'']
5149 ''Something [http://example.com mixed''''', even bold]'''
5150 '''''Now [http://example.com both''''']
5151 !! html
5152 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5153 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5154 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5155 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5156 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5157 </p>
5158 !! end
5159
5160
5161 !! test
5162 Bug 4781: %26 in URL
5163 !! wikitext
5164 http://www.example.com/?title=AT%26T
5165 !! html/php
5166 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5167 </p>
5168 !! html/parsoid
5169 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5170 !! end
5171
5172 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5173 # % is actually legal in HTML5. Any change in output would need testing though.
5174 !! test
5175 Bug 4781, 5267: %25 in URL
5176 !! wikitext
5177 http://www.example.com/?title=100%25_Bran
5178 !! html/php
5179 <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>
5180 </p>
5181 !! html/parsoid
5182 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5183 !! end
5184
5185 !! test
5186 Bug 4781, 5267: %28, %29 in URL
5187 !! wikitext
5188 http://www.example.com/?title=Ben-Hur_%281959_film%29
5189 !! html/php
5190 <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>
5191 </p>
5192 !! html/parsoid
5193 <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>
5194 !! end
5195
5196
5197 !! test
5198 Bug 4781: %26 in autonumber URL
5199 !! wikitext
5200 [http://www.example.com/?title=AT%26T]
5201 !! html/php
5202 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5203 </p>
5204 !! html/parsoid
5205 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5206 !! end
5207
5208 !! test
5209 Bug 4781, 5267: %26 in autonumber URL
5210 !! wikitext
5211 [http://www.example.com/?title=100%25_Bran]
5212 !! html/php
5213 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5214 </p>
5215 !! html/parsoid
5216 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5217 !! end
5218
5219 !! test
5220 Bug 4781, 5267: %28, %29 in autonumber URL
5221 !! wikitext
5222 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5223 !! html/php
5224 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5225 </p>
5226 !! html/parsoid
5227 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5228 !! end
5229
5230
5231 !! test
5232 Bug 4781: %26 in bracketed URL
5233 !! wikitext
5234 [http://www.example.com/?title=AT%26T link]
5235 !! html/php
5236 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5237 </p>
5238 !! html/parsoid
5239 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5240 !! end
5241
5242 !! test
5243 Bug 4781, 5267: %25 in bracketed URL
5244 !! wikitext
5245 [http://www.example.com/?title=100%25_Bran link]
5246 !! html
5247 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5248 </p>
5249 !! end
5250
5251 !! test
5252 Bug 4781, 5267: %28, %29 in bracketed URL
5253 !! wikitext
5254 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5255 !! html/php
5256 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5257 </p>
5258 !! html/parsoid
5259 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5260 !! end
5261
5262 !! test
5263 External link containing a period in the anchor. (bug 63947)
5264 !! wikitext
5265 [//foo.org/bar#baz. bang]
5266
5267 [//foo.org/bar. bang]
5268 !! html/php
5269 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5270 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5271 </p>
5272 !! html/parsoid
5273 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5274 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5275 !! end
5276
5277 !! test
5278 External link containing a single quote. (bug 63947)
5279 !! wikitext
5280 [//foo.org/bar'baz]
5281
5282 [//foo.org/bar'baz bang]
5283 !! html/php
5284 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5285 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5286 </p>
5287 !! html/parsoid
5288 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5289 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5290 !! end
5291
5292 !! test
5293 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5294 !! wikitext
5295 Some [http://example.com/ pretty ''italics'' and stuff]!
5296 !! html
5297 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5298 </p>
5299 !! end
5300
5301 !! test
5302 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5303 !! wikitext
5304 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5305 !! html
5306 <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>
5307 </p>
5308 !! end
5309
5310 !! test
5311 External link containing double-single-quotes with no space separating the url from text in italics
5312 !! wikitext
5313 [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]].]
5314 !! html/php
5315 <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>
5316 </p>
5317 !! html/php+tidy
5318 <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>
5319 !! html/parsoid
5320 <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>
5321 !! end
5322
5323 !! test
5324 External link with comments in link text
5325 !! wikitext
5326 [http://www.google.com Google <!-- comment -->]
5327 !! html/php
5328 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5329 </p>
5330 !! html/parsoid
5331 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5332 !! end
5333
5334 !! test
5335 External link to bare IPv4 address
5336 !! wikitext
5337 [http://192.168.0.1 Link]
5338 !! html/php
5339 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5340 </p>
5341 !! html/parsoid
5342 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5343 !! end
5344
5345 !! test
5346 URL-encoding in URL functions (single parameter)
5347 !! wikitext
5348 {{localurl:Some page|amp=&}}
5349 !! html
5350 <p>/index.php?title=Some_page&amp;amp=&amp;
5351 </p>
5352 !! end
5353
5354 !! test
5355 URL-encoding in URL functions (multiple parameters)
5356 !! wikitext
5357 {{localurl:Some page|q=?&amp=&}}
5358 !! html
5359 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5360 </p>
5361 !! end
5362
5363 !! test
5364 Brackets in urls
5365 !! wikitext
5366 http://example.com/index.php?foozoid%5B%5D=bar
5367
5368 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5369 !! html/php
5370 <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>
5371 </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>
5372 </p>
5373 !! html/parsoid
5374 <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>
5375
5376 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5377 !! end
5378
5379 !! test
5380 IPv6 urls, autolink format (T23261)
5381 !! wikitext
5382 http://[2404:130:0:1000::187:2]/index.php
5383
5384 Examples from RFC 2373, section 2.2:
5385 * http://[1080::8:800:200C:417A]/unicast
5386 * http://[FF01::101]/multicast
5387 * http://[::1]/loopback
5388 * http://[::]/unspecified
5389 * http://[::13.1.68.3]/ipv4compat
5390 * http://[::FFFF:129.144.52.38]/ipv4compat
5391
5392 Examples from RFC 2732, section 2:
5393 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5394 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5395 * http://[3ffe:2a00:100:7031::1]
5396 * http://[1080::8:800:200C:417A]/foo
5397 * http://[::192.9.5.5]/ipng
5398 * http://[::FFFF:129.144.52.38]:80/index.html
5399 * http://[2010:836B:4179::836B:4179]
5400
5401 !! html/php
5402 <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>
5403 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5404 </p>
5405 <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>
5406 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5407 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5408 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5409 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5410 <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>
5411 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5412 </p>
5413 <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>
5414 <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>
5415 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5416 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5418 <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>
5419 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5420
5421 !! html/parsoid
5422 <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>
5423
5424 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5425 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5426 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5427 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5428 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5429 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5430 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5431
5432 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5433 <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>
5434 <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>
5435 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5438 <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>
5439 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5440 !! end
5441
5442 !! test
5443 IPv6 urls, bracketed format (T23261)
5444 !! wikitext
5445 [http://[2404:130:0:1000::187:2]/index.php test]
5446
5447 Examples from RFC 2373, section 2.2:
5448 * [http://[1080::8:800:200C:417A] unicast]
5449 * [http://[FF01::101] multicast]
5450 * [http://[::1]/ loopback]
5451 * [http://[::] unspecified]
5452 * [http://[::13.1.68.3] ipv4compat]
5453 * [http://[::FFFF:129.144.52.38] ipv4compat]
5454
5455 Examples from RFC 2732, section 2:
5456 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5457 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5458 * [http://[3ffe:2a00:100:7031::1] 3]
5459 * [http://[1080::8:800:200C:417A]/foo 4]
5460 * [http://[::192.9.5.5]/ipng 5]
5461 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5462 * [http://[2010:836B:4179::836B:4179] 7]
5463
5464 !! html/php
5465 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5466 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5467 </p>
5468 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5469 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5470 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5471 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5472 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5473 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5474 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5475 </p>
5476 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5483
5484 !! html/parsoid
5485 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5486
5487 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5488 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5489 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5490 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5491 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5492 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5493 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5494
5495 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5496 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5503 !! end
5504
5505 !! test
5506 Non-extlinks in brackets
5507 !! wikitext
5508 [foo]
5509 [foo bar]
5510 [foo ''bar'']
5511 [fool's] errand
5512 [fool's errand]
5513 [{{echo|foo}}]
5514 [{{echo|foo}} bar]
5515 [{{echo|foo}} ''bar'']
5516 [{{echo|foo}}l's] errand
5517 [{{echo|foo}}l's errand]
5518 [url={{echo|foo}}]
5519 [url=http://example.com]
5520 [http:// bare protocols don't count]
5521 !! html/php
5522 <p>[foo]
5523 [foo bar]
5524 [foo <i>bar</i>]
5525 [fool's] errand
5526 [fool's errand]
5527 [foo]
5528 [foo bar]
5529 [foo <i>bar</i>]
5530 [fool's] errand
5531 [fool's errand]
5532 [url=foo]
5533 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5534 [http:// bare protocols don't count]
5535 </p>
5536 !! html/parsoid
5537 <p>[foo]
5538 [foo bar]
5539 [foo <i>bar</i>]
5540 [fool's] errand
5541 [fool's errand]
5542 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5543 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5544 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5545 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5546 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5547 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5548 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5549 [http:// bare protocols don't count]</p>
5550 !! end
5551
5552 !! test
5553 Percent encoding in external links
5554 !! wikitext
5555 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5556 !! html/php
5557 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5558 </p>
5559 !! html/parsoid
5560 <p><a rel="mw:ExtLink"
5561 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5562 !! end
5563
5564 !! test
5565 Use url link syntax for links where the content is equal the link target
5566 !! wikitext
5567 http://example.com
5568 !! html/php
5569 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5570 </p>
5571 !! html/parsoid
5572 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5573 !! end
5574
5575 !! test
5576 Parenthesis in external links, especially URL links
5577 !! wikitext
5578 http://example.com)
5579
5580 http://example.com/test)
5581
5582 http://example.com/(test)
5583
5584 http://example.com/((test)
5585
5586 (http://example.com/(test))
5587
5588 (http://example.com/(test)))))
5589
5590 http://example.com/a)b
5591
5592 [http://example.com) foo]
5593 !! html/php
5594 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5595 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5596 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5597 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5598 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5599 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5600 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5601 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5602 </p>
5603 !! html/parsoid
5604 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5605 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5606 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5607 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5608 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5609 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5610 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5611 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5612 !! end
5613
5614 !! test
5615 Parenthesis in external links, w/ transclusion or comment
5616 !! wikitext
5617 (http://example.com/{{echo|hi}})
5618
5619 (http://example.com<!-- hi -->)
5620 !! html/php
5621 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5622 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5623 </p>
5624 !! html/parsoid
5625 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5626
5627 <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>
5628 !! end
5629
5630 !! test
5631 Serialize <a> tags with invalid link targets as plain text
5632 !! options
5633 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5634 !! html/parsoid
5635 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5636 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5637 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5638 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5639 !! wikitext
5640 text
5641 <nowiki>*</nowiki>text
5642 <nowiki>[[foo]]</nowiki>
5643 <nowiki>*a [[foo]]</nowiki>
5644 !! end
5645
5646 !! test
5647 mw:ExtLink -vs- mw:WikiLink (T94723)
5648 !! options
5649 parsoid=html2wt
5650 !! html/parsoid
5651 <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>
5652 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5653 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5654 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5655 <p>
5656 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5657 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5658 </p>
5659 !! wikitext
5660 [[Foo|Bar]]
5661 [[Foo|Bar]]
5662 [[wikipedia:Foo|Bar]]
5663 [[wikipedia:Foo|Bar]]
5664
5665 [[wikipedia:European_Robin|European Robin]]
5666 [[wikipedia:European_Robin|European Robin]]
5667 !! end
5668
5669 !! test
5670 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5671 !! options
5672 parsoid=wt2wt
5673 !! wikitext
5674 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5675 !! html/parsoid
5676 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5677 !! end
5678
5679
5680 ###
5681 ### Quotes
5682 ###
5683
5684 !! test
5685 Quotes
5686 !! wikitext
5687 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5688
5689 Normal text. '''''Bold italic text.''''' Normal text.
5690 !! html
5691 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5692 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5693 </p>
5694 !! end
5695
5696
5697 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5698 # parser strips. The wikitext contains just the first half of the bold
5699 # quote pair.
5700 !! test
5701 Unclosed and unmatched quotes
5702 !! wikitext
5703 '''''Bold italic text '''with bold deactivated''' in between.'''''
5704
5705 '''''Bold italic text ''with italic deactivated'' in between.'''''
5706
5707 '''Bold text..
5708
5709 ..spanning two paragraphs (should not work).'''
5710
5711 '''Bold tag left open
5712
5713 ''Italic tag left open
5714
5715 Normal text.
5716
5717 <!-- Unmatching number of opening, closing tags: -->
5718 '''This year''''s election ''should'' beat '''last year''''s.
5719
5720 ''Tom'''s car is bigger than ''Susan'''s.
5721
5722 Plain ''italic'''s plain
5723 !! html/php
5724 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5725 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5726 </p><p><b>Bold text..</b>
5727 </p><p>..spanning two paragraphs (should not work).
5728 </p><p><b>Bold tag left open</b>
5729 </p><p><i>Italic tag left open</i>
5730 </p><p>Normal text.
5731 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5732 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5733 </p><p>Plain <i>italic'</i>s plain
5734 </p>
5735 !! html/parsoid
5736 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5737 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5738 </p><p><b>Bold text..</b>
5739 </p><p>..spanning two paragraphs (should not work).<b></b>
5740 </p><p><b>Bold tag left open</b>
5741 </p><p><i>Italic tag left open</i>
5742 </p><p>Normal text.
5743 </p>
5744 <!-- Unmatching number of opening, closing tags: -->
5745 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5746 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5747 </p><p>Plain <i>italic'</i>s plain
5748 </p>
5749 !! end
5750
5751 ###
5752 ### Tables
5753 ###
5754 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5755 ###
5756
5757 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5758 # is the bare minimum required by the spec, see:
5759 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5760 # Parsoid team replies: empty table tags are legal in HTML5
5761 !! test
5762 A table with no data.
5763 !! options
5764 parsoid=wt2html
5765 !! wikitext
5766 {||}
5767 !! html/php
5768
5769 !! html/parsoid
5770 <table></table>
5771
5772 !! end
5773
5774 !! test
5775 A table with stray table end tags on start tag line (wt2html)
5776 !! options
5777 parsoid=wt2html
5778 !! wikitext
5779 {|style="color: red;"|}
5780
5781 {|style="color: red;" |}
5782 |foo
5783 |}
5784
5785 {|style="color: red;"|} id="foo"
5786 |foo
5787 |}
5788
5789 {|style="color: red;" |} id="foo"
5790 |foo
5791 |}
5792 !! html
5793 <table style="color: red;"></table>
5794
5795 <table style="color: red;">
5796 <tbody><tr>
5797 <td>foo</td>
5798 </tr></tbody>
5799 </table>
5800
5801 <table style="color: red;" id="foo">
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 !! end
5814
5815 !! test
5816 A table with no data (take 2)
5817 !! wikitext
5818 {|
5819 |}
5820 !! html/parsoid
5821 <table></table>
5822 !! end
5823
5824 # A table with nothing but a caption is invalid XHTML, we might want to render
5825 # this as <p>caption</p>
5826 # Parsoid team replies: table with only a caption is legal in HTML5
5827 !! test
5828 A table with nothing but a caption
5829 !! wikitext
5830 {|
5831 |+ caption
5832 |}
5833 !! html/php
5834 <table>
5835 <caption> caption
5836 </caption><tr><td></td></tr></table>
5837
5838 !! html/parsoid
5839 <table><caption> caption</caption></table>
5840 !! end
5841
5842 !! test
5843 A table with caption with default-spaced attributes and a table row
5844 !! wikitext
5845 {|
5846 |+ style="color: red;" | caption1
5847 |-
5848 | foo
5849 |}
5850 !! html
5851 <table>
5852 <caption style="color: red;"> caption1
5853 </caption>
5854 <tr>
5855 <td> foo
5856 </td></tr></table>
5857
5858 !! end
5859
5860 !! test
5861 A table with captions with non-default spaced attributes and a table row
5862 !! wikitext
5863 {|
5864 |+style="color: red;"|caption2
5865 |+ style="color: red;"| caption3
5866 |-
5867 | foo
5868 |}
5869 !! html
5870 <table>
5871 <caption style="color: red;">caption2
5872 </caption>
5873 <caption style="color: red;"> caption3
5874 </caption>
5875 <tr>
5876 <td> foo
5877 </td></tr></table>
5878
5879 !! end
5880
5881 !! test
5882 Table td-cell syntax variations
5883 !! wikitext
5884 {|
5885 | foo bar foo | baz
5886 | foo bar foo || baz
5887 | style='color:red;' | baz
5888 | style='color:red;' || baz
5889 |}
5890 !! html
5891 <table>
5892 <tr>
5893 <td> baz
5894 </td>
5895 <td> foo bar foo </td>
5896 <td> baz
5897 </td>
5898 <td style="color:red;"> baz
5899 </td>
5900 <td> style='color:red;' </td>
5901 <td> baz
5902 </td></tr></table>
5903
5904 !! end
5905
5906 !! test
5907 Simple table
5908 !! wikitext
5909 {|
5910 | 1 || 2
5911 |-
5912 | 3 || 4
5913 |}
5914 !! html
5915 <table>
5916 <tr>
5917 <td> 1 </td>
5918 <td> 2
5919 </td></tr>
5920 <tr>
5921 <td> 3 </td>
5922 <td> 4
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Simple table but with multiple dashes for row wikitext
5929 !! wikitext
5930 {|
5931 | foo
5932 |-----
5933 | bar
5934 |}
5935 !! html
5936 <table>
5937 <tr>
5938 <td> foo
5939 </td></tr>
5940 <tr>
5941 <td> bar
5942 </td></tr></table>
5943
5944 !! end
5945
5946 !! test
5947 Multiplication table
5948 !! wikitext
5949 {| border="1" cellpadding="2"
5950 |+Multiplication table
5951 |-
5952 ! &times; !! 1 !! 2 !! 3
5953 |-
5954 ! 1
5955 | 1 || 2 || 3
5956 |-
5957 ! 2
5958 | 2 || 4 || 6
5959 |-
5960 ! 3
5961 | 3 || 6 || 9
5962 |-
5963 ! 4
5964 | 4 || 8 || 12
5965 |-
5966 ! 5
5967 | 5 || 10 || 15
5968 |}
5969 !! html
5970 <table border="1" cellpadding="2">
5971 <caption>Multiplication table
5972 </caption>
5973 <tr>
5974 <th> &#215; </th>
5975 <th> 1 </th>
5976 <th> 2 </th>
5977 <th> 3
5978 </th></tr>
5979 <tr>
5980 <th> 1
5981 </th>
5982 <td> 1 </td>
5983 <td> 2 </td>
5984 <td> 3
5985 </td></tr>
5986 <tr>
5987 <th> 2
5988 </th>
5989 <td> 2 </td>
5990 <td> 4 </td>
5991 <td> 6
5992 </td></tr>
5993 <tr>
5994 <th> 3
5995 </th>
5996 <td> 3 </td>
5997 <td> 6 </td>
5998 <td> 9
5999 </td></tr>
6000 <tr>
6001 <th> 4
6002 </th>
6003 <td> 4 </td>
6004 <td> 8 </td>
6005 <td> 12
6006 </td></tr>
6007 <tr>
6008 <th> 5
6009 </th>
6010 <td> 5 </td>
6011 <td> 10 </td>
6012 <td> 15
6013 </td></tr></table>
6014
6015 !! end
6016
6017 !! test
6018 Accept "||" in table headings
6019 !! wikitext
6020 {|
6021 !h1 || h2
6022 |}
6023 !! html
6024 <table>
6025 <tr>
6026 <th>h1 </th>
6027 <th> h2
6028 </th></tr></table>
6029
6030 !! end
6031
6032 !! test
6033 Accept "!!" in table data
6034 !! wikitext
6035 {|
6036 | Foo!! ||
6037 |}
6038 !! html
6039 <table>
6040 <tr>
6041 <td> Foo!! </td>
6042 <td>
6043 </td></tr></table>
6044
6045 !! html/parsoid
6046 <table>
6047 <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>
6048 </tbody></table>
6049 !! end
6050
6051 !! test
6052 Accept "||" in indented table headings
6053 !! wikitext
6054 :{|
6055 !h1 || h2
6056 |}
6057 !! html
6058 <dl><dd><table>
6059 <tr>
6060 <th>h1 </th>
6061 <th> h2
6062 </th></tr></table></dd></dl>
6063
6064 !! end
6065
6066 !! test
6067 Accept "!!" in templates
6068 !! wikitext
6069 {|
6070 !a {{echo|b!!c}}
6071 |}
6072 !! html/php
6073 <table>
6074 <tr>
6075 <th>a b</th>
6076 <th>c
6077 </th></tr></table>
6078
6079 !! html/parsoid
6080 <table>
6081 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6082 !! end
6083
6084 !! test
6085 Accept "!!" in table headings after newline
6086 !! wikitext
6087 {|
6088 !a
6089 b!!c
6090 |}
6091 !! html/php
6092 <table>
6093 <tr>
6094 <th>a
6095 <p>b!!c
6096 </p>
6097 </th></tr></table>
6098
6099 !! html/parsoid
6100 <table>
6101 <tbody><tr><th>a
6102 <p>b!!c</p></th></tr>
6103 </tbody></table>
6104 !! end
6105
6106 !! test
6107 Accept "!!" in table data of mixed wikitext / html syntax
6108 !! wikitext
6109 {|
6110 !a
6111 <tr><td>b!!c</td></tr>
6112 |}
6113 !! html+tidy
6114 <table>
6115 <tr>
6116 <th>a</th>
6117 </tr>
6118 <tr>
6119 <td>b!!c</td>
6120 </tr>
6121 </table>
6122 !! html/parsoid
6123 <table>
6124 <tbody><tr><th>a</th></tr>
6125 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6126 </tbody></table>
6127 !! end
6128
6129 !! test
6130 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6131 !! wikitext
6132 {|
6133 !| h1
6134 || a
6135 |}
6136 !! html
6137 <table>
6138 <tr>
6139 <th> h1
6140 </th>
6141 <td> a
6142 </td></tr></table>
6143
6144 !! end
6145
6146 !!test
6147 Accept "| !" at start of line in tables (ignore !-attribute)
6148 !! wikitext
6149 {|
6150 |-
6151 | !style="color:red" | bar
6152 |}
6153 !! html
6154 <table>
6155
6156 <tr>
6157 <td> bar
6158 </td></tr></table>
6159
6160 !!end
6161
6162 !!test
6163 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 +/-
6164 !! wikitext
6165 {|
6166 |-
6167 |style='color:red;'|+1
6168 |style='color:blue;'|-1
6169 |-
6170 | 1 || 2 || 3
6171 | 1 ||+2 ||-3
6172 |-
6173 | +1
6174 | -1
6175 |}
6176 !! html
6177 <table>
6178
6179 <tr>
6180 <td style="color:red;">+1
6181 </td>
6182 <td style="color:blue;">-1
6183 </td></tr>
6184 <tr>
6185 <td> 1 </td>
6186 <td> 2 </td>
6187 <td> 3
6188 </td>
6189 <td> 1 </td>
6190 <td>+2 </td>
6191 <td>-3
6192 </td></tr>
6193 <tr>
6194 <td> +1
6195 </td>
6196 <td> -1
6197 </td></tr></table>
6198
6199 !!end
6200
6201 !! test
6202 Table rowspan
6203 !! wikitext
6204 {| border=1
6205 | Cell 1, row 1
6206 |rowspan=2| Cell 2, row 1 (and 2)
6207 | Cell 3, row 1
6208 |-
6209 | Cell 1, row 2
6210 | Cell 3, row 2
6211 |}
6212 !! html
6213 <table border="1">
6214 <tr>
6215 <td> Cell 1, row 1
6216 </td>
6217 <td rowspan="2"> Cell 2, row 1 (and 2)
6218 </td>
6219 <td> Cell 3, row 1
6220 </td></tr>
6221 <tr>
6222 <td> Cell 1, row 2
6223 </td>
6224 <td> Cell 3, row 2
6225 </td></tr></table>
6226
6227 !! end
6228
6229 !! test
6230 Nested table
6231 !! wikitext
6232 {| border=1
6233 | &alpha;
6234 |
6235 {| bgcolor=#ABCDEF border=2
6236 |nested
6237 |-
6238 |table
6239 |}
6240 |the original table again
6241 |}
6242 !! html
6243 <table border="1">
6244 <tr>
6245 <td> &#945;
6246 </td>
6247 <td>
6248 <table bgcolor="#ABCDEF" border="2">
6249 <tr>
6250 <td>nested
6251 </td></tr>
6252 <tr>
6253 <td>table
6254 </td></tr></table>
6255 </td>
6256 <td>the original table again
6257 </td></tr></table>
6258
6259 !! end
6260
6261 !! test
6262 Invalid attributes in table cell (bug 1830)
6263 !! wikitext
6264 {|
6265 |Cell:|broken
6266 |}
6267 !! html
6268 <table>
6269 <tr>
6270 <td>broken
6271 </td></tr></table>
6272
6273 !! end
6274
6275 !! test
6276 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6277 !! wikitext
6278 {|
6279 | title="foo" |bar
6280 | title="foo<nowiki>|</nowiki>" |bar
6281 | title="foo<nowiki>|</nowiki>" bar
6282 |}
6283 !! html/php
6284 <table>
6285 <tr>
6286 <td title="foo">bar
6287 </td>
6288 <td title="foo&#124;">bar
6289 </td>
6290 <td> title="foo|" bar
6291 </td></tr></table>
6292
6293 !! html/parsoid
6294 <table>
6295 <tbody><tr><td title="foo">bar</td>
6296 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6297 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6298 </tbody></table>
6299 !! end
6300
6301 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6302 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6303 # *2wt modes will fail.
6304 !! test
6305 Table security: embedded pipes
6306 !! options
6307 parsoid=wt2html,html2html
6308 !! wikitext
6309 {|
6310 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6311 !! html/php
6312 <table>
6313 <tr>
6314 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6315 <td>]" onmouseover="alert(document.cookie)"&gt;test
6316 </td>
6317 </tr>
6318 </table>
6319
6320 !! html/parsoid
6321 <table><tbody>
6322 <tr>
6323 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6324 !! end
6325
6326 # FIXME: The output seems broken. Filed as T110268.
6327 !! test
6328 ! and || in td attributes should not be parsed as <th>/<td>
6329 !! options
6330 parsoid=wt2html
6331 !! wikitext
6332 {|
6333 | style="color: red !important;" data-contrived="put this here ||" | foo
6334 |}
6335 !! html/php
6336 <table>
6337 <tr>
6338 <td> style="color: red !important;" data-contrived="put this here </td>
6339 <td> foo
6340 </td></tr></table>
6341
6342 !! html/parsoid
6343 <table>
6344 <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>
6345 </tbody></table>
6346 !! end
6347
6348 !! test
6349 Indented table markup mixed with indented pre content (proposed in bug 6200)
6350 !! wikitext
6351 <table>
6352 <tr>
6353 <td>
6354 Text that should be rendered preformatted
6355 </td>
6356 </tr>
6357 </table>
6358 !! html
6359 <table>
6360 <tr>
6361 <td>
6362 <pre>Text that should be rendered preformatted
6363 </pre>
6364 </td>
6365 </tr>
6366 </table>
6367
6368 !! end
6369
6370 !! test
6371 1. Template-generated table cell attributes and cell content
6372 !! wikitext
6373 {|
6374 |{{table_attribs}}
6375 | {{table_attribs}}
6376 || {{table_attribs_5}}
6377 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6378 |align=center {{table_attribs}}
6379 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6380 |}
6381 !! html
6382 <table>
6383 <tr>
6384 <td style="color:red;">Foo
6385 </td>
6386 <td style="color:red;">Foo
6387 </td>
6388 <td> style="color:red;"</td>
6389 <td>Bar
6390 </td>
6391 <td style="color:red;">Foo
6392 </td>
6393 <td align="center" style="color:red;">Foo
6394 </td>
6395 <td align="center" style="color:red;">Foo
6396 </td></tr></table>
6397
6398 !! end
6399
6400 !! test
6401 2. Template-generated table cell attributes and cell content
6402 !! wikitext
6403 {|
6404 |{{table_attribs_2}}
6405 |}
6406 !! html/php
6407 <table>
6408 <tr>
6409 <td style="color:red;">Foo
6410 </td>
6411 <td>Bar</td>
6412 <td>Baz
6413 </td></tr></table>
6414
6415 !! html/parsoid
6416 <table>
6417 <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>
6418 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6419 </tbody></table>
6420 !! end
6421
6422 !! test
6423 3. Template-generated table cell attributes and cell content
6424 !! wikitext
6425 {|
6426 !align=center {{table_header_cells}}
6427 |-
6428 |align=center {{table_cells}}
6429 |}
6430 !! html/php
6431 <table>
6432 <tr>
6433 <th align="center" style="color:red;">Foo</th>
6434 <th style="color:red;"><i>Bar</i></th>
6435 <th style="color:brown;"><i>Foo</i> and Baz
6436 </th></tr>
6437 <tr>
6438 <td align="center" style="color:red;">Foo</td>
6439 <td style="color:red;"><i>Bar</i></td>
6440 <td style="color:brown;"><i>Foo</i> and Baz
6441 </td></tr></table>
6442
6443 !! html/parsoid
6444 <table>
6445 <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>
6446 <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>
6447 </tbody></table>
6448 !! end
6449
6450 !! test
6451 4. Template-generated table cell attributes and cell content inside a templated table
6452 !! wikitext
6453 {{tbl-start}}
6454 !align=center {{table_header_cells}}
6455 |-
6456 |align=center {{table_cells}}
6457 {{tbl-end}}
6458 !! html/php
6459 <table>
6460 <tr>
6461 <th align="center" style="color:red;">Foo</th>
6462 <th style="color:red;"><i>Bar</i></th>
6463 <th style="color:brown;"><i>Foo</i> and Baz
6464 </th></tr>
6465 <tr>
6466 <td align="center" style="color:red;">Foo</td>
6467 <td style="color:red;"><i>Bar</i></td>
6468 <td style="color:brown;"><i>Foo</i> and Baz
6469 </td></tr></table>
6470
6471 !! html/parsoid
6472 <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}}]}'>
6473 <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>
6474 <tr>
6475 <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>
6476 </tbody></table>
6477 !! end
6478
6479 ## Edge case fix to prevent future regressions
6480 !! test
6481 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6482 !! wikitext
6483 {|
6484 |{{table_attribs_7}}
6485 |}
6486 <references />
6487 !! html/parsoid
6488 <table>
6489 <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>
6490 </tbody></table>
6491 <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>
6492 !! end
6493
6494 !! test
6495 Table with row followed by newlines and table heading
6496 !! wikitext
6497 {|
6498 |-
6499
6500 ! foo
6501 |}
6502 !! html
6503 <table>
6504
6505
6506 <tr>
6507 <th> foo
6508 </th></tr></table>
6509
6510 !! end
6511
6512 !! test
6513 Table with empty line following the start tag
6514 !! wikitext
6515 {|
6516
6517 |-
6518 | foo
6519 |}
6520 !! html
6521 <table>
6522
6523
6524 <tr>
6525 <td> foo
6526 </td></tr></table>
6527
6528 !! end
6529
6530 # FIXME: Preserve the attribute properly (with an empty string as value) in
6531 # the PHP parser. Parsoid implements the behavior below.
6532 !! test
6533 Table attributes with empty value
6534 !! wikitext
6535 {|
6536 | style=| hello
6537 |}
6538 !! html/parsoid
6539 <table>
6540 <tbody>
6541 <tr>
6542 <td style=""> hello
6543 </td></tr></tbody></table>
6544
6545 !! end
6546
6547 !! test
6548 Wikitext table with a lot of comments
6549 !! wikitext
6550 {|
6551 <!-- c0 -->
6552 | foo
6553 <!-- c1 -->
6554 |-<!-- c2 -->
6555 <!-- c3 -->
6556 |<!-- c4 -->
6557 <!-- c5 -->
6558 |}
6559 !! html
6560 <table>
6561 <tr>
6562 <td> foo
6563 </td></tr>
6564 <tr>
6565 <td>
6566 </td></tr></table>
6567
6568 !! end
6569
6570 !! test
6571 Wikitext table comments represented in parsoid dom
6572 !! wikitext
6573 {|<!--c1--><!--c2-->
6574 |-<!--c3-->
6575 | x
6576 |}
6577 !! html/php+tidy
6578 <table>
6579 <tr>
6580 <td>x</td>
6581 </tr>
6582 </table>
6583 !! html/parsoid
6584 <table><!--c1--><!--c2-->
6585 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6586 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6587 </tbody></table>
6588 !! end
6589
6590 !! test
6591 Wikitext table with double-line table cell
6592 !! wikitext
6593 {|
6594 |a
6595 b
6596 |}
6597 !! html
6598 <table>
6599 <tr>
6600 <td>a
6601 <p>b
6602 </p>
6603 </td></tr></table>
6604
6605 !! end
6606
6607 !! test
6608 Table cell with a single comment
6609 !! wikitext
6610 {|
6611 | <!-- c1 -->
6612 | a
6613 |}
6614 !! html
6615 <table>
6616 <tr>
6617 <td>
6618 </td>
6619 <td> a
6620 </td></tr></table>
6621
6622 !! end
6623
6624 !! test
6625 Table-cell after a comment-only-empty-line
6626 !! wikitext
6627 {|
6628 |a
6629 <!--c1-->
6630 <!--c2-->| b
6631 |}
6632 !! html
6633 <table>
6634 <tr>
6635 <td>a
6636 </td>
6637 <td> b
6638 </td></tr></table>
6639
6640 !! html/parsoid
6641 <table>
6642 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6643 <!--c1-->
6644 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6645 </tbody></table>
6646
6647 !! end
6648
6649 !! test
6650 Build table with {{!}}
6651 !! wikitext
6652 {{{!}} class="wikitable"
6653 ! header
6654 ! second header
6655 {{!}}- style="color:red;"
6656 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6657 {{!}}}
6658 !! html
6659 <table class="wikitable">
6660 <tr>
6661 <th> header
6662 </th>
6663 <th> second header
6664 </th></tr>
6665 <tr style="color:red;">
6666 <td> data </td>
6667 <td style="color:red;"> second data
6668 </td></tr></table>
6669
6670 !! end
6671
6672 !! test
6673 Build table with pipe as data
6674 !! wikitext
6675 {| class="wikitable"
6676 ! header
6677 ! second header
6678 |- style="color:red;"
6679 | data || style="color:red;" | second data
6680 |-
6681 | style="color:red;" | data with | || style="color:red;" | second data with |
6682 |-
6683 || data with | ||| second data with |
6684 |}
6685 !! html
6686 <table class="wikitable">
6687 <tr>
6688 <th> header
6689 </th>
6690 <th> second header
6691 </th></tr>
6692 <tr style="color:red;">
6693 <td> data </td>
6694 <td style="color:red;"> second data
6695 </td></tr>
6696 <tr>
6697 <td style="color:red;"> data with | </td>
6698 <td style="color:red;"> second data with |
6699 </td></tr>
6700 <tr>
6701 <td> data with | </td>
6702 <td> second data with |
6703 </td></tr></table>
6704
6705 !! end
6706
6707 !! test
6708 Build table with wikilink
6709 !! wikitext
6710 {| class="wikitable"
6711 ! header || second header
6712 |- style="color:red;"
6713 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6714 |-
6715 | data || second data [[Main Page|link|text with pipe]]
6716 |}
6717 !! html
6718 <table class="wikitable">
6719 <tr>
6720 <th> header </th>
6721 <th> second header
6722 </th></tr>
6723 <tr style="color:red;">
6724 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6725 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6726 </td></tr>
6727 <tr>
6728 <td> data </td>
6729 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6730 </td></tr></table>
6731
6732 !! end
6733
6734 # The expected HTML structure in this test is debatable. The PHP parser does
6735 # not parse this kind of table at all. The main focus for Parsoid is on
6736 # round-tripping, so this output is ok for now. TODO: revisit!
6737 !! test
6738 Wikitext table with html-syntax row
6739 !! wikitext
6740 {|
6741 |-
6742 <td>foo</td>
6743 |}
6744 !! html/parsoid
6745 <table>
6746 <tbody>
6747 <tr>
6748 <td>foo</td></tr></tbody></table>
6749 !! end
6750
6751 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6752 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6753 ## PHP parser, which tidy then compounds by fostering the content
6754 ## entirely out of the table. Parsoid recognizes the table context
6755 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6756 ## depends on PHP's treatment of broken table markup!
6757 !! test
6758 Implicit <td> after a |-
6759 !! options
6760 parsoid=wt2html,html2html
6761 !! wikitext
6762 {|
6763 |-
6764 a
6765 |}
6766 !! html/php
6767 <table>
6768
6769 a
6770 </table>
6771
6772 !! html/php+tidy
6773 <p>a</p>
6774 !! html/parsoid
6775 <table>
6776 <tr><td>a</td></tr>
6777 </table>
6778 !! end
6779
6780 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6781 !! test
6782 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6783 !! options
6784 parsoid=wt2html,html2html
6785 !! wikitext
6786 {|
6787 |-
6788 |
6789 a
6790 |-
6791 b
6792 |}
6793 !! html/php
6794 <table>
6795
6796 <tr>
6797 <td>
6798 <pre>a
6799 </pre>
6800 </td></tr>
6801 b
6802 </table>
6803
6804 !! html/php+tidy
6805 <p>b</p>
6806 <table>
6807 <tr>
6808 <td>
6809 <pre>
6810 a
6811 </pre></td>
6812 </tr>
6813 </table>
6814 !! html/parsoid
6815 <table>
6816 <tbody>
6817 <tr><td><pre>a</pre></td></tr>
6818 <tr><td> b</td></tr>
6819 </tbody>
6820 </table>
6821 !! end
6822
6823 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6824 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6825 !! test
6826 Lists should be recognized in an implicit <td> context
6827 !! options
6828 parsoid=wt2html,html2html
6829 !! wikitext
6830 {|
6831 |-
6832 *a
6833 |}
6834 !! html/php
6835 <table>
6836
6837 <ul><li>a</li></ul>
6838 </table>
6839
6840 !! html/php+tidy
6841 <ul>
6842 <li>a</li>
6843 </ul>
6844 !! html/parsoid
6845 <table>
6846 <tr>
6847 <td><ul>
6848 <li>a</li>
6849 </ul></td>
6850 </tr>
6851 </table>
6852 !! end
6853
6854 !! test
6855 Table cells not properly parsed in an implicit-td context
6856 !! wikitext
6857 {|
6858 |-
6859 {{table_attribs_4}} || a || b
6860 |}
6861 !! html/php+tidy
6862 <table>
6863 <tr>
6864 <td style="background-color:#DC241f;" width="10px"></td>
6865 <td>a</td>
6866 <td>b</td>
6867 </tr>
6868 </table>
6869 !! html/parsoid
6870 <table>
6871 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6872 <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>
6873 </tbody></table>
6874 !! end
6875
6876 !! test
6877 Parsoid: Round-trip tables directly followed by content (bug 51219)
6878 !! options
6879 parsoid=wt2html,wt2wt
6880 !! wikitext
6881 {|
6882 |foo
6883 |} bar
6884
6885 {|
6886 |baz
6887 |}<b>quux</b>
6888 !! html+tidy
6889 <table>
6890 <tr>
6891 <td>foo</td>
6892 </tr>
6893 </table>
6894 <p>bar</p>
6895 <table>
6896 <tr>
6897 <td>baz</td>
6898 </tr>
6899 </table>
6900 <p><b>quux</b></p>
6901 !! end
6902
6903 !! test
6904 Parsoid: Default to a newline after tables in new content (bug 51219)
6905 !! options
6906 parsoid=html2wt
6907 !! html/parsoid
6908 <table><tbody>
6909 <tr><td>foo</td></tr></tbody></table> bar
6910 <table><tbody>
6911 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6912 !! wikitext
6913 {|
6914 |foo
6915 |}
6916 <nowiki> </nowiki>bar
6917 {|
6918 |baz
6919 |}
6920 '''quux'''
6921 !! end
6922
6923 !! test
6924 Parsoid: newline inducing block nodes don't suppress <nowiki>
6925 !! options
6926 parsoid=html2wt
6927 !! html/parsoid
6928 a<h1>foo</h1>
6929 !! wikitext
6930 <nowiki> </nowiki>a
6931
6932 = foo =
6933 !! end
6934
6935 !! test
6936 Parsoid: Row-syntax table headings followed by comment & table cells
6937 !! options
6938 parsoid=wt2html,wt2wt
6939 !! wikitext
6940 {|
6941 ! foo || bar
6942 <!-- foo --> || baz || quux
6943 |}
6944 !! html/php
6945 <table>
6946 <tr>
6947 <th> foo </th>
6948 <th> bar
6949 </th>
6950 <td> baz </td>
6951 <td> quux
6952 </td></tr></table>
6953
6954 !! html/parsoid
6955 <table>
6956 <tbody><tr><th> foo </th><th> bar
6957 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6958 </tbody></table>
6959 !! end
6960
6961 !!test
6962 Parsoid: Recover better from broken table attributes
6963 !!options
6964 parsoid=wt2html
6965 !!wikitext
6966 {| class="foo
6967 | class="bar" |
6968 foo
6969 |}
6970 !!html/php+tidy
6971 <table class="foo">
6972 <tr>
6973 <td class="bar">
6974 <p>foo</p>
6975 </td>
6976 </tr>
6977 </table>
6978 !!html/parsoid
6979 <table class="foo">
6980 <tr>
6981 <td class="bar">
6982 <p>foo</p></td></tr>
6983 </tbody></table>
6984 !!end
6985
6986 !! test
6987 Tables: Digest broken attributes on table and tr tag
6988 !! options
6989 parsoid=wt2html
6990 !! wikitext
6991 {| || |} ++
6992 |- || || ++ --
6993 |- > [
6994 |}
6995 !! html
6996 <table>
6997 <tbody>
6998 <tr></tr>
6999 <tr></tr>
7000 </tbody></table>
7001 !! end
7002
7003 !! test
7004 Strip unsupported table tags
7005 !! options
7006 parsoid=html2wt
7007 !! html/parsoid
7008 <table>
7009 <thead>
7010 <tr>
7011 <th>Month</th>
7012 <th>Savings</th>
7013 </tr>
7014 </thead>
7015 <tbody>
7016 <tr>
7017 <td>January</td>
7018 <td>$100</td>
7019 </tr>
7020 <tr>
7021 <td>February</td>
7022 <td>$80</td>
7023 </tr>
7024 </tbody>
7025 <tfoot>
7026 <tr>
7027 <td>Sum</td>
7028 <td>$180</td>
7029 </tr>
7030 </tfoot>
7031 </table>
7032 !! wikitext
7033 {|
7034
7035 !Month
7036 !Savings
7037
7038 |January
7039 |$100
7040
7041 |-
7042 |February
7043 |$80
7044
7045 |Sum
7046 |$180
7047
7048 |}
7049 !! end
7050
7051 !!test
7052 Testing serialization after deletion of table cells
7053 !!options
7054 parsoid={
7055 "modes": ["wt2wt", "selser"],
7056 "changes": [
7057 ["#x", "remove"]
7058 ]
7059 }
7060 !!wikitext
7061 {|
7062 !h1 !!h2 !!h3
7063 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7064 |}
7065 !! wikitext/edited
7066 {|
7067 !h1 !!h2 !!h3
7068 |c2 |||c3
7069 |}
7070 !!end
7071
7072 ###
7073 ### Internal links
7074 ###
7075 !! test
7076 Plain link, capitalized
7077 !! wikitext
7078 [[Main Page]]
7079 !! html
7080 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7081 </p>
7082 !! end
7083
7084 !! test
7085 Plain link, uncapitalized
7086 !! wikitext
7087 [[main Page]]
7088 !! html
7089 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7090 </p>
7091 !! end
7092
7093 !! test
7094 Piped link
7095 !! wikitext
7096 [[Main Page|The Main Page]]
7097 !! html
7098 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7099 </p>
7100 !! end
7101
7102 !! test
7103 Piped link with comment in link text
7104 !! wikitext
7105 [[Main Page|The Main<!--front--> Page]]
7106 !! html
7107 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7108 </p>
7109 !! end
7110
7111 !! test
7112 Piped link with multiple pipe characters in link text
7113 !! wikitext
7114 [[Main Page||The|Main|Page|]]
7115 !! html/php
7116 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7117 </p>
7118 !! html/parsoid
7119 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7120 !! end
7121
7122 !! test
7123 Broken link
7124 !! wikitext
7125 [[Zigzagzogzagzig]]
7126 !! html
7127 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7128 </p>
7129 !! end
7130
7131 !! test
7132 Broken link with fragment
7133 !! wikitext
7134 [[Zigzagzogzagzig#zug]]
7135 !! html
7136 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7137 </p>
7138 !! end
7139
7140 !! test
7141 Special page link with fragment
7142 !! wikitext
7143 [[Special:Version#anchor]]
7144 !! html
7145 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7146 </p>
7147 !! end
7148
7149 !! test
7150 Nonexistent special page link with fragment
7151 !! wikitext
7152 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7153 !! html
7154 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7155 </p>
7156 !! end
7157
7158 !! test
7159 Link with prefix
7160 !! wikitext
7161 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7162 !! html
7163 <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>
7164 </p>
7165 !! end
7166
7167 !! test
7168 Link with suffix
7169 !! wikitext
7170 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7171 !! html
7172 <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>!!!
7173 </p>
7174 !! end
7175
7176 !! article
7177 prefixed article
7178 !! text
7179 Some text
7180 !! endarticle
7181
7182 !! test
7183 Bug 43661: Piped links with identical prefixes
7184 !! wikitext
7185 [[prefixed article|prefixed articles with spaces]]
7186
7187 [[prefixed article|prefixed articlesaoeu]]
7188
7189 [[Main Page|Main Page test]]
7190 !! html
7191 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7192 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7193 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7194 </p>
7195 !! end
7196
7197
7198 !! test
7199 Link with HTML entity in suffix / tail
7200 !! wikitext
7201 [[Main Page]]&quot;, [[Main Page]]&#97;
7202 !! html/php
7203 <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;
7204 </p>
7205 !! html/parsoid
7206 <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>
7207 !! end
7208
7209 !! test
7210 Link with 3 brackets
7211 !! wikitext
7212 [[[Main Page]]]
7213 Foo [[[Main Page]]]
7214 !! html
7215 <p>[[[Main Page]]]
7216 Foo [[[Main Page]]]
7217 </p>
7218 !! end
7219
7220 !! test
7221 Link with 4 brackets
7222 !! wikitext
7223 [[[[Main Page]]]]
7224 !! html
7225 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7226 </p>
7227 !! end
7228
7229 !! test
7230 Piped link with 3 brackets
7231 !! wikitext
7232 [[[main page|the main page]]]
7233 !! html
7234 <p>[[[main page|the main page]]]
7235 </p>
7236 !! end
7237
7238 !! test
7239 Piped link with extlink-like text
7240 !! wikitext
7241 [[Main Page|[bar]]]
7242 [[Main Page|This is a [bar]]]
7243 !! html/php
7244 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7245 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7246 </p>
7247 !! html/parsoid
7248 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7249 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7250 !! end
7251
7252 !! test
7253 Link with multiple pipes
7254 !! wikitext
7255 [[Main Page|The|Main|Page]]
7256 !! html
7257 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7258 </p>
7259 !! end
7260
7261 # Note that parsoid does not munge anchor text; all non-space
7262 # characters are valid in HTML5 ids.
7263 !! test
7264 Anchor containing a #. (bug 63430)
7265 !! wikitext
7266 [[Main Page#And#Link]]
7267 !! html/php
7268 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7269 </p>
7270 !! html/parsoid
7271 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7272 !! end
7273
7274 !! test
7275 Link to namespaces
7276 !! wikitext
7277 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7278 !! html
7279 <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>
7280 </p>
7281 !! end
7282
7283 !! test
7284 Link with space in namespace
7285 !! wikitext
7286 [[User talk:Foo bar]]
7287 !! html
7288 <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>
7289 </p>
7290 !! end
7291
7292 !! article
7293 MemoryAlpha:AlphaTest
7294 !! text
7295 This is an article in the MemoryAlpha namespace
7296 (which shadows the memoryalpha interwiki link).
7297 !! endarticle
7298
7299 !! test
7300 Namespace takes precedence over interwiki link (bug 51680)
7301 !! wikitext
7302 [[MemoryAlpha:AlphaTest]]
7303 !! html
7304 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7305 </p>
7306 !! end
7307
7308 # The previous test doesn't work correctly in html2*, due to not recognizing the
7309 # link as an internal one. This one checks for the correct behavior.
7310 !! test
7311 Link to namespace preferred over interwiki with correct rel attribute
7312 !! options
7313 parsoid=html2wt,html2html
7314 !! html/parsoid
7315 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7316 !! wikitext
7317 [[MemoryAlpha:AlphaTest]]
7318 !! end
7319
7320 !! test
7321 Piped link to namespace
7322 !! wikitext
7323 [[Meta:Disclaimers|The disclaimers]]
7324 !! html
7325 <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>
7326 </p>
7327 !! end
7328
7329 !! test
7330 Link containing }
7331 !! wikitext
7332 [[Usually caused by a typo (oops}]]
7333 !! html
7334 <p>[[Usually caused by a typo (oops}]]
7335 </p>
7336 !! end
7337
7338 !! article
7339 7% Solution
7340 !! text
7341 Just a test of an article title containing a percent.
7342 !! endarticle
7343
7344 !! test
7345 Link containing % (not as a hex sequence)
7346 !! wikitext
7347 [[7% Solution]]
7348 !! html/php
7349 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7350 </p>
7351 !! html/parsoid
7352 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7353 !! end
7354
7355 # note that the parsoid HTML is identical to the previous test output,
7356 # so the previous test ensures that the html2wt mode will generate the
7357 # "not as a hex sequence" wikitext.
7358 !! test
7359 Link containing % as a single hex sequence interpreted to char
7360 !! options
7361 parsoid=wt2wt,wt2html,html2html
7362 !! wikitext
7363 [[7%25 Solution]]
7364 !! html/php
7365 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7366 </p>
7367 !! html/parsoid
7368 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7369 !!end
7370
7371 !! test
7372 Link containing % as a double hex sequence interpreted to hex sequence
7373 !! wikitext
7374 [[7%2525 Solution]]
7375 !! html
7376 <p>[[7%2525 Solution]]
7377 </p>
7378 !!end
7379
7380 # note that parsoid does not munge anchor text; all non-space
7381 # characters are valid in HTML5 anchors.
7382 !! test
7383 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7384 Example for such a section: == < ==
7385 !! wikitext
7386 [[%23%3c]][[%23%3e]]
7387 !! html/php
7388 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7389 </p>
7390 !! html/parsoid
7391 <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>
7392 !! end
7393
7394 !! test
7395 Link containing "<#" and ">#" as a hex sequences
7396 !! wikitext
7397 [[%3c%23]][[%3e%23]]
7398 !! html
7399 <p>[[%3c%23]][[%3e%23]]
7400 </p>
7401 !! end
7402
7403 !! test
7404 Link containing an equals sign
7405 !! wikitext
7406 [[Special:BookSources/isbn=4-00-026157-6]]
7407 !! html/php
7408 <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>
7409 </p>
7410 !! html/parsoid
7411 <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>
7412 !! end
7413
7414 !! article
7415 Foo~bar
7416 !! text
7417 Just a test of an article title containing a tilde.
7418 !! endarticle
7419
7420 # note that links containing signatures, like [[Foo~~~~]], are
7421 # massaged by the pre-save transform (PST) and so the tildes are never
7422 # seen by the parser.
7423 !! test
7424 Link containing a tilde
7425 !! wikitext
7426 [[Foo~bar]]
7427 !! html/php
7428 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7429 </p>
7430 !! html/parsoid
7431 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7432 !! end
7433
7434 !! test
7435 Link containing double-single-quotes '' (bug 4598)
7436 !! wikitext
7437 [[Lista d''e paise d''o munno]]
7438 !! html/php
7439 <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>
7440 </p>
7441 !! html/parsoid
7442 <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>
7443 !! end
7444
7445 !! test
7446 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7447 !! wikitext
7448 Some [[Link|pretty ''italics'' and stuff]]!
7449 !! html/php
7450 <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>!
7451 </p>
7452 !! html/parsoid
7453 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7454 !! end
7455
7456 !! test
7457 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7458 !! wikitext
7459 ''Some [[Link|pretty ''italics'' and stuff]]!''
7460 !! html
7461 <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>
7462 </p>
7463 !! end
7464
7465 !! test
7466 Link with double quotes in title part (literal) and alternate part (interpreted)
7467 !! wikitext
7468 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7469
7470 [[''Pentecoste'']]
7471
7472 [[''Pentecoste''|Pentecoste]]
7473
7474 [[''Pentecoste''|''Pentecoste'']]
7475 !! html/php
7476 <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>
7477 </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>
7478 </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>
7479 </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>
7480 </p>
7481 !! html/parsoid
7482 <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>
7483 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7484 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7485 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7486 !! end
7487
7488 !! test
7489 Broken image links with HTML captions (bug 39700)
7490 !! wikitext
7491 [[File:Nonexistent|<script></script>]]
7492 [[File:Nonexistent|100x100px|<script></script>]]
7493 [[File:Nonexistent|&lt;]]
7494 [[File:Nonexistent|a<i>b</i>c]]
7495 !! html/php
7496 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7497 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7498 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7499 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7500 </p>
7501 !! html/parsoid
7502 <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>
7503 <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>
7504 <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>
7505 <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>
7506 !! end
7507
7508 !! test
7509 Plain link to URL
7510 !! wikitext
7511 [[http://www.example.com]]
7512 !! html/php
7513 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7514 </p>
7515 !! html/parsoid
7516 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7517 !! end
7518
7519 !! test
7520 Plain link to URL with link text
7521 !! wikitext
7522 [[http://www.example.com Link text]]
7523 !! html
7524 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7525 </p>
7526 !! end
7527
7528 !! test
7529 Plain link to protocol-relative URL
7530 !! wikitext
7531 [[//www.example.com]]
7532 !! html/php
7533 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7534 </p>
7535 !! html/parsoid
7536 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7537 !! end
7538
7539 !! test
7540 Plain link to protocol-relative URL with link text
7541 !! wikitext
7542 [[//www.example.com Link text]]
7543 !! html
7544 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7545 </p>
7546 !! end
7547
7548 !! test
7549 Plain link to page with question mark in title
7550 !! wikitext
7551 [[A?b]]
7552
7553 [[A?b|Baz]]
7554 !! html
7555 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7556 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7557 </p>
7558 !! end
7559
7560
7561 # I'm fairly sure the expected result here is wrong.
7562 # We want these to be URL links, not pseudo-pages with URLs for titles....
7563 # However the current output is also pretty screwy.
7564 #
7565 # ----
7566 # I'm changing it to match the current output--it arguably makes more
7567 # sense in the light of the test above. Old expected result was:
7568 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7569 #</p>
7570 # But I think this test is bordering on "garbage in, garbage out" anyway.
7571 # -- wtm
7572 !! test
7573 Piped link to URL
7574 !! wikitext
7575 Piped link to URL: [[http://www.example.com|an example URL]]
7576 !! html/php
7577 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7578 </p>
7579 !! html/parsoid
7580 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7581 !! end
7582
7583 !! test
7584 BUG 2: [[page|http://url/]] should link to page, not http://url/
7585 !! wikitext
7586 [[Main Page|http://url/]]
7587 !! html/php
7588 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7589 </p>
7590 !! html/parsoid
7591 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7592 !! end
7593
7594 # Parsoid does not mark self-links, by design.
7595 !! test
7596 BUG 337: Escaped self-links should be bold
7597 !! options
7598 title=[[Bug462]]
7599 !! wikitext
7600 [[Bu&#103;462]] [[Bug462]]
7601 !! html/php
7602 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7603 </p>
7604 !! html/php+tidy
7605 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7606 !! html/parsoid
7607 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7608 !! end
7609
7610 !! test
7611 Self-link to section should not be bold
7612 !! options
7613 title=[[Main Page]]
7614 !! wikitext
7615 [[Main Page#section]]
7616 !! html
7617 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7618 </p>
7619 !! end
7620
7621 !! article
7622 00
7623 !! text
7624 This is 00.
7625 !! endarticle
7626
7627 !!test
7628 Self-link to numeric title
7629 !!options
7630 title=[[0]]
7631 !! wikitext
7632 [[0]]
7633 !! html
7634 <p><strong class="selflink">0</strong>
7635 </p>
7636 !!end
7637
7638 !!test
7639 Link to numeric-equivalent title
7640 !!options
7641 title=[[0]]
7642 !! wikitext
7643 [[00]]
7644 !! html
7645 <p><a href="/wiki/00" title="00">00</a>
7646 </p>
7647 !!end
7648
7649 !! test
7650 <nowiki> inside a link
7651 !! wikitext
7652 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7653 !! html
7654 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7655 </p>
7656 !! end
7657
7658 !! test
7659 Non-breaking spaces in title
7660 !! wikitext
7661 [[&nbsp; Main &nbsp; Page &nbsp;]]
7662 !! html
7663 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7664 </p>
7665 !!end
7666
7667 !! test
7668 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7669 !! options
7670 language=ca
7671 !! wikitext
7672 '''[[Main Page]]'''
7673 !! html
7674 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7675 </p>
7676 !! end
7677
7678 !! test
7679 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7680 !! options
7681 language=ca
7682 !! wikitext
7683 ''[[Main Page]]''
7684 !! html
7685 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7686 </p>
7687 !! end
7688
7689 !! test
7690 Internal link with en linktrail: no apostrophes (bug 27473)
7691 !! options
7692 language=en
7693 !! wikitext
7694 [[Something]]'nice
7695 !! html
7696 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7697 </p>
7698 !! end
7699
7700 !! test
7701 Internal link with ca linktrail with apostrophes (bug 27473)
7702 !! options
7703 language=ca
7704 !! wikitext
7705 [[Something]]'nice
7706 !! html
7707 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Internal link with kaa linktrail with apostrophes (bug 27473)
7713 !! options
7714 language=kaa
7715 !! wikitext
7716 [[Something]]'nice
7717 !! html
7718 <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>
7719 </p>
7720 !! end
7721
7722 !! test
7723 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7724 !! wikitext
7725 [[User:Foo/Test/63636:Bar|Test]]
7726 !! html/php
7727 <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>
7728 </p>
7729 !! html/parsoid
7730 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7731 !! end
7732
7733 !! test
7734 Purely hash wikilink
7735 !! options
7736 title=[[User:test/123]]
7737 !! wikitext
7738 [[#a|b]]
7739 !! html/php
7740 <p><a href="#a">b</a>
7741 </p>
7742 !! html/parsoid
7743 <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>
7744 !! end
7745
7746 !! test
7747 1. Interaction of linktrail and template encapsulation
7748 !! options
7749 parsoid
7750 !! wikitext
7751 {{echo|[[Foo]]}}l
7752 !! html
7753 <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>
7754 !! end
7755
7756 !! test
7757 2. Interaction of linktrail and template encapsulation
7758 !! options
7759 parsoid
7760 !! wikitext
7761 {{echo|Some [[Fool]]}}s
7762 !! html
7763 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7764 !! end
7765
7766 !! test
7767 3. Interaction of linktrail and template encapsulation
7768 !! options
7769 parsoid
7770 !! wikitext
7771 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7772 !! html
7773 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7774 !! end
7775
7776 !! article
7777 Söfnuður
7778 !! text
7779 Test.
7780 !! endarticle
7781
7782 !! test
7783 Internal link with is link prefix
7784 !! options
7785 language=is
7786 !! wikitext
7787 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7788 !! html
7789 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7790 </p>
7791 !! end
7792
7793 !! article
7794 Mótmælendatrú
7795 !! text
7796 Test.
7797 !! endarticle
7798
7799 !! test
7800 Internal link with is link trail and link prefix
7801 !! options
7802 language=is
7803 !! wikitext
7804 [[mótmælendatrú|xxx]]ar
7805 [[mótmælendatrú]]ar
7806 mótmælenda[[söfnuður]]
7807 mótmælenda[[söfnuður|söfnuðir]]
7808 mótmælenda[[söfnuður|söfnuðir]]xxx
7809 !! html
7810 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7811 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7812 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7813 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7814 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7815 </p>
7816 !! end
7817
7818 !! test
7819 Parsoid link trail escaping
7820 !! options
7821 parsoid=html2wt,html2html
7822 !! html/parsoid
7823 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7824 !! wikitext
7825 [[apple]]<nowiki/>s
7826 !! end
7827
7828 !! test
7829 Parsoid link prefix escaping
7830 !! options
7831 language=is
7832 parsoid=html2wt,html2html
7833 !! html/parsoid
7834 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7835 !! wikitext
7836 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7837 !! end
7838
7839 !! test
7840 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7841 !! wikitext
7842 [[Foo| bar]]
7843
7844 [[Foo| ''bar'']]
7845
7846 [http://wp.org foo]
7847
7848 [http://wp.org ''foo'']
7849 !! html
7850 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7851 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7852 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7853 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7854 </p>
7855 !! end
7856
7857 !! test
7858 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7859 !! options
7860 parsoid
7861 !! wikitext
7862 [[Foo|{{echo|a}} b {{echo|c}}]]
7863 !! html
7864 <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>
7865 !! end
7866
7867 !! test
7868 Link with angle bracket after anchor
7869 !! wikitext
7870 [[Foo#<bar>]]
7871 !! html/php
7872 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7873 </p>
7874 !! html/parsoid
7875 <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>
7876 !! end
7877
7878 ###
7879 ### Interwiki links (see maintenance/interwiki.sql)
7880 ###
7881
7882 !! test
7883 Inline interwiki link
7884 !! options
7885 parsoid=wt2html,wt2wt,html2html
7886 !! wikitext
7887 [[MeatBall:SoftSecurity]]
7888 !! html/php
7889 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7890 </p>
7891 !! html/parsoid
7892 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7893 !! end
7894
7895 !! test
7896 Inline interwiki link with empty title (bug 2372)
7897 !! options
7898 parsoid=wt2html,wt2wt,html2html
7899 !! wikitext
7900 [[MeatBall:]]
7901 !! html/php
7902 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7903 </p>
7904 !! html/parsoid
7905 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7906 !! end
7907
7908 !! test
7909 Interwiki link encoding conversion (bug 1636)
7910 !! wikitext
7911 *[[Wikipedia:ro:Olteni&#0355;a]]
7912 *[[Wikipedia:ro:Olteni&#355;a]]
7913 !! html
7914 <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>
7915 <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>
7916
7917 !! html+tidy
7918 <ul>
7919 <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>
7920 <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>
7921 </ul>
7922 !! end
7923
7924 !! test
7925 Interwiki link with fragment (bug 2130)
7926 !! wikitext
7927 [[MeatBall:SoftSecurity#foo]]
7928 !! html
7929 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7930 </p>
7931 !! end
7932
7933 # Ideally the wikipedia: prefix here should be proto-relative too
7934 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7935 # define the 'en' prefix, and originally the test used 'wikipedia',
7936 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7937 # article.
7938 !! test
7939 Different interwiki prefixes mapping to the same URL
7940 !! wikitext
7941 [[:en:Foo]]
7942
7943 [[:en:Foo|Foo]]
7944
7945 [[wikipedia:Foo]]
7946
7947 [[:wikipedia:Foo|Foo]]
7948
7949 [[wikipedia:en:Foo]]
7950
7951 [[:wikipedia:en:Foo]]
7952
7953 [[ wikiPEdia :Foo]]
7954 !! html/parsoid
7955 <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>
7956
7957 <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>
7958
7959 <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>
7960
7961 <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>
7962
7963 <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>
7964
7965 <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>
7966
7967 <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>
7968 !! end
7969
7970 !! test
7971 Interwiki links that cannot be represented in wiki syntax
7972 !! wikitext
7973 [[meatball:ok]]
7974 [[meatball:ok#foo|ok with fragment]]
7975 [[meatball:ok_as_well?|ok ending with ? mark]]
7976 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7977 [http://de.wikipedia.org/wiki/#foo is just fragment]
7978
7979 !! html/php
7980 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7981 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7982 <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>
7983 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7984 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7985 </p>
7986 !! html/parsoid
7987 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7988 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7989 <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>
7990 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7991 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7992 !! end
7993
7994 !! test
7995 Interwiki links: trail
7996 !! wikitext
7997 [[wikipedia:Foo|Ba]]r
7998 !! html/php
7999 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8000 </p>
8001 !! html/parsoid
8002 <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>
8003 !! end
8004
8005 !! test
8006 Local interwiki link
8007 !! options
8008 parsoid=wt2html,wt2wt,html2html
8009 !! wikitext
8010 [[local:Template:Foo]]
8011 !! html/php
8012 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8013 </p>
8014 !! html/parsoid
8015 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8016 !! end
8017
8018 # Parsoid does not mark self-links, by design.
8019 !! test
8020 Local interwiki link: self-link to current page
8021 !! options
8022 title=[[Main Page]]
8023 parsoid=wt2html,wt2wt,html2html
8024 !! wikitext
8025 [[local:Main Page]]
8026 !! html/php
8027 <p><strong class="selflink">local:Main Page</strong>
8028 </p>
8029 !! html/parsoid
8030 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8031 !! end
8032
8033 !! test
8034 Local interwiki link: prefix only (bug 64167)
8035 !! options
8036 parsoid=wt2html,wt2wt,html2html
8037 !! wikitext
8038 [[local:]]
8039 !! html/php
8040 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8041 </p>
8042 !! html/parsoid
8043 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8044 !! end
8045
8046 !! test
8047 Local interwiki link: with additional interwiki prefix (bug 61357)
8048 !! options
8049 parsoid=wt2html,wt2wt,html2html
8050 !! wikitext
8051 [[local:meatball:Hello]]
8052 !! html/php
8053 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8054 </p>
8055 !! html/parsoid
8056 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8057 !! end
8058
8059 !! test
8060 Multiple local interwiki link prefixes
8061 !! wikitext
8062 [[local:local:local:local:mi:local:Foo]]
8063 !! options
8064 parsoid=wt2html,wt2wt,html2html
8065 !! html/php
8066 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8067 </p>
8068 !! html/parsoid
8069 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8070 !! end
8071
8072 ###
8073 ### Interlanguage links
8074 ### Language links (so that searching for '### language' matches..)
8075 ###
8076
8077 !! test
8078 Interlanguage link
8079 !! options
8080 parsoid=wt2html,wt2wt,html2html
8081 !! wikitext
8082 Blah blah blah
8083 [[zh:Chinese]]
8084 !! html/php
8085 <p>Blah blah blah
8086 </p>
8087 !! html/parsoid
8088 <p>Blah blah blah</p>
8089 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8090 !! end
8091
8092 !! test
8093 Interlanguage link with spacing
8094 !! options
8095 parsoid=wt2html,wt2wt,html2html
8096 !! wikitext
8097 Blah blah blah
8098 [[ zh : Chinese ]]
8099 !! html/php
8100 <p>Blah blah blah
8101 </p>
8102 !! html/parsoid
8103 <p>Blah blah blah</p>
8104 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8105 !! end
8106
8107 !! test
8108 Double interlanguage link
8109 !! options
8110 parsoid=wt2html,wt2wt,html2html
8111 !! wikitext
8112 Blah blah blah
8113 [[es:Spanish]]
8114 [[zh:Chinese]]
8115 !! html/php
8116 <p>Blah blah blah
8117 </p>
8118 !! html/parsoid
8119 <p>Blah blah blah</p>
8120 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8121 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8122 !! end
8123
8124 !! test
8125 Interlanguage link variations
8126 !! options
8127 parsoid=wt2html,wt2wt,html2html
8128 !! wikitext
8129 Blah blah blah
8130 [[ es :Spanish]]
8131 [[ ZH :Chinese]]
8132 [[es:Foo_bar]]
8133 !! html/php
8134 <p>Blah blah blah
8135 </p>
8136 !! html/parsoid
8137 <p>Blah blah blah</p>
8138 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8139 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8140 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8141 !! end
8142
8143 !! test
8144 Space and question mark encoding in interlanguage links (T95473)
8145 !! options
8146 parsoid=wt2html,wt2wt,html2html
8147 !! wikitext
8148 Blah blah blah
8149 [[es:Foo bar?]]
8150 !! html/php
8151 <p>Blah blah blah
8152 </p>
8153 !! html/parsoid
8154 <p>Blah blah blah</p>
8155 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8156 !! end
8157
8158 !! test
8159 Interlanguage link, with prefix links
8160 !! options
8161 language=ln
8162 !! wikitext
8163 Blah blah blah
8164 [[zh:Chinese]]
8165 !! html/php
8166 <p>Blah blah blah
8167 </p>
8168 !! html/parsoid
8169 <p>Blah blah blah</p>
8170 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8171 !! end
8172
8173 !! test
8174 Double interlanguage link, with prefix links (bug 8897)
8175 !! options
8176 language=ln
8177 !! wikitext
8178 Blah blah blah
8179 [[es:Spanish]]
8180 [[zh:Chinese]]
8181 !! html/php
8182 <p>Blah blah blah
8183 </p>
8184 !! html/parsoid
8185 <p>Blah blah blah</p>
8186 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8187 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8188 !! end
8189
8190 !! test
8191 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8192 !! wikitext
8193 Blah blah blah
8194 [[mul:Article]]
8195 !! html/php
8196 <p>Blah blah blah
8197 </p>
8198 !! html/parsoid
8199 <p>Blah blah blah</p>
8200 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8201 !! end
8202
8203 !! test
8204 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8205 !! options
8206 language=ln
8207 !! wikitext
8208 [[WW&nbsp;II]]
8209 !! html
8210 <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>
8211 </p>
8212 !! end
8213
8214 !! test
8215 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8216 !! options
8217 parsoid=html2wt
8218 !! html/parsoid
8219 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8220 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8221 !! wikitext
8222 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8223
8224 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8225 !! end
8226
8227 !! test
8228 Parsoid: handle constructor well
8229 !! wikitext
8230 [[constructor]]
8231
8232 [[constructor:foo]]
8233 !! html/php
8234 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8235 </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>
8236 </p>
8237 !! html/parsoid
8238 <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>
8239
8240 <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>
8241 !! end
8242
8243 !! article
8244 ko:
8245 !! text
8246 Test.
8247 !! endarticle
8248
8249 # Note that `ko` isn't a known interlanguage prefix
8250 !! test
8251 Parsoid: recognize interlanguage links without a target page
8252 !! options
8253 ill
8254 !! wikitext
8255 [[es:]]
8256
8257 [[ko:]]
8258 !! html/php
8259 es:
8260 !! html/parsoid
8261 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8262
8263 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8264 !! end
8265
8266 # Note that `ko` isn't a known interwiki prefix
8267 !! test
8268 Parsoid: recognize interwiki links without a target page
8269 !! options
8270 parsoid=wt2html,wt2wt,html2html
8271 !! wikitext
8272 [[:es:]]
8273
8274 [[:ko:]]
8275 !! html/php
8276 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8277 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8278 </p>
8279 !! html/parsoid
8280 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8281 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8282 !! end
8283
8284 !! test
8285 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8286 !! wikitext
8287 [[mi:Foo]]
8288 !! html/php
8289 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8290 </p>
8291 !! html/parsoid
8292 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8293 !! end
8294
8295 !! test
8296 Interlanguage link with preceding local interwiki link (bug 68085)
8297 !! options
8298 parsoid=wt2html,wt2wt,html2html
8299 !! wikitext
8300 Blah blah blah
8301 [[local:es:Spanish]]
8302 !! html/php
8303 <p>Blah blah blah
8304 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8305 </p>
8306 !! html/parsoid
8307 <p>Blah blah blah
8308 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8309 !! end
8310
8311 !! test
8312 Looks like an interlanguage link, but is actually a local interwiki
8313 !! options
8314 parsoid=wt2html,wt2wt,html2html
8315 !! wikitext
8316 Blah blah blah
8317 [[mi:Template:Foo]]
8318 !! html/php
8319 <p>Blah blah blah
8320 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8321 </p>
8322 !! html/parsoid
8323 <p>Blah blah blah
8324 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8325 !! end
8326
8327 ###
8328 ### Redirects, Parsoid-only
8329 ###
8330
8331 !! test
8332 1. Simple redirect to page
8333 !! wikitext
8334 #REDIRECT [[Main Page]]
8335 !! html/parsoid
8336 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8337 !! end
8338
8339 !! test
8340 2. Other redirect variants
8341 !! wikitext
8342 #REDIRECT [[Main_Page]]
8343 !! html/parsoid
8344 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8345 !! end
8346
8347 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8348 # This tests the Parsoid bail-out code.
8349 !! test
8350 3. Other redirect variants
8351 !! wikitext
8352 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8353 !! html/parsoid
8354 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8355 !! end
8356
8357 !! test
8358 4. Redirect to a templated destination
8359 !! wikitext
8360 #REDIRECT [[{{echo|Foo}}bar]]
8361 !! html/parsoid
8362 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8363 !! end
8364
8365 !! test
8366 Empty redirect
8367 !! options
8368 parsoid=wt2html,wt2wt
8369 !! wikitext
8370 #REDIRECT [[]]
8371 !! html/parsoid
8372 <ol>
8373 <li>REDIRECT [[]]</li></ol>
8374 !! end
8375
8376 !! test
8377 Optional colon in #REDIRECT
8378 !! options
8379 # the colon is archaic syntax. we support it for wt2html, but we
8380 # don't care that it roundtrips back to the modern syntax.
8381 parsoid=wt2html,html2html
8382 !! wikitext
8383 #REDIRECT:[[Main Page]]
8384 !! html/parsoid
8385 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8386 !! end
8387
8388 !! test
8389 Whitespace in #REDIRECT with optional colon
8390 !! options
8391 # the colon and gratuitous whitespace is archaic syntax. we support
8392 # it for wt2html, but we don't care that it roundtrips back to the
8393 # modern syntax (without extra whitespace)
8394 parsoid=wt2html,html2html
8395 !! wikitext
8396
8397 #REDIRECT
8398 :
8399 [[Main Page]]
8400 !! html/parsoid
8401 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8402 !! end
8403
8404 !! test
8405 Piped link in #REDIRECT
8406 !! options
8407 # content after piped link is ignored. we support this syntax,
8408 # but don't care that the piped link is lost when we roundtrip this.
8409 parsoid=wt2html
8410 !! wikitext
8411 #REDIRECT [[Main Page|bar]]
8412 !! html/parsoid
8413 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8414 !! end
8415
8416 !! test
8417 Redirect to category (T104502)
8418 !! options
8419 parsoid=wt2html,wt2wt
8420 !! wikitext
8421 #REDIRECT [[Category:Foo]]
8422 !! html/parsoid
8423 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8424 !! end
8425
8426 !! test
8427 Redirect to category with URL encoding (T104502)
8428 !! options
8429 parsoid=wt2html
8430 !! wikitext
8431 #REDIRECT [[Category%3AFoo]]
8432 !! html/parsoid
8433 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8434 !! end
8435
8436 !! test
8437 Redirect to category page
8438 !! wikitext
8439 #REDIRECT [[:Category:Foo]]
8440 !! html/parsoid
8441 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8442 !! end
8443
8444 !! test
8445 Redirect to image page (1)
8446 !! wikitext
8447 #REDIRECT [[File:Wiki.png]]
8448 !! html/parsoid
8449 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8450 !! end
8451
8452 !! test
8453 Redirect to image page (2)
8454 !! wikitext
8455 #REDIRECT [[Image:Wiki.png]]
8456 !! html/parsoid
8457 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8458 !! end
8459
8460 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8461 # Next test confirms this.
8462 !! test
8463 Redirect to language (1) (T104918)
8464 !! options
8465 parsoid=wt2html,wt2wt,html2html
8466 !! wikitext
8467 #REDIRECT [[en:File:Wiki.png]]
8468 !! html/parsoid
8469 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8470 !! end
8471
8472 !! test
8473 Redirect to language (2) (T104918)
8474 !! wikitext
8475 #REDIRECT [[:en:File:Wiki.png]]
8476 !! html/parsoid
8477 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8478 !! end
8479
8480 !! test
8481 Redirect to interwiki (T104918)
8482 !! wikitext
8483 #REDIRECT [[meatball:File:Wiki.png]]
8484 !! html/parsoid
8485 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8486 !! end
8487
8488 !! test
8489 Non-English #REDIRECT
8490 !! options
8491 language=is
8492 !! wikitext
8493 #TILVÍSUN [[Main Page]]
8494 !! html/parsoid
8495 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8496 !! end
8497
8498 !! test
8499 Redirect syntax under text isn't considered a redirect
8500 !! wikitext
8501 some text
8502 #redirect [[Main Page]]
8503 !! html/parsoid
8504 <p>some text</p>
8505 <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>
8506 !! end
8507
8508 # FIXME: Should hoist the redirect to the top of the page and ensure there
8509 # is only one.
8510 !! test
8511 New redirect
8512 !! options
8513 parsoid=html2wt
8514 !! html/parsoid
8515 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8516 !! wikitext
8517 Foo
8518 #REDIRECT [[Foo]]
8519 !! end
8520
8521 ##
8522 ## XHTML tidiness
8523 ###
8524
8525 !! test
8526 <br> to <br />
8527 !! wikitext
8528 1<br>2<br />3
8529 !! html
8530 <p>1<br />2<br />3
8531 </p>
8532 !! end
8533
8534 !! test
8535 Broken br tag sanitization
8536 !! wikitext
8537 </br>
8538 !! html/php
8539 <p>&lt;/br&gt;
8540 </p>
8541 !! end
8542
8543 # TODO: Fix html2html mode (bug 51055)!
8544 !! test
8545 Parsoid: Broken br tag recognition
8546 !! options
8547 parsoid=wt2html
8548 !! wikitext
8549 </br>
8550
8551 <br/ >
8552 !! html+tidy
8553 <p><br /></p>
8554 <p><br /></p>
8555 !! end
8556
8557 !! test
8558 Incorrecly removing closing slashes from correctly formed XHTML
8559 !! wikitext
8560 <br style="clear:both;" />
8561 !! html
8562 <p><br style="clear:both;" />
8563 </p>
8564 !! end
8565
8566 !! test
8567 Failing to transform badly formed HTML into correct XHTML
8568 !! wikitext
8569 <br style="clear: left;">
8570 <br style="clear: right;">
8571 <br style="clear: both;">
8572 !! html
8573 <p><br style="clear: left;" />
8574 <br style="clear: right;" />
8575 <br style="clear: both;" />
8576 </p>
8577 !!end
8578
8579 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8580 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8581 !! test
8582 Handling html with a div self-closing tag
8583 !! wikitext
8584 <div title />
8585 <div title/>
8586 <div title/ >
8587 <div title=bar />
8588 <div title=bar/>
8589 <div title=bar/ >
8590 !! html/php
8591 <p>&lt;div title /&gt;
8592 &lt;div title/&gt;
8593 </p>
8594 <div>
8595 <p>&lt;div title=bar /&gt;
8596 &lt;div title=bar/&gt;
8597 </p>
8598 <div title="bar/"></div>
8599 </div>
8600
8601 !! html/parsoid
8602 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8603 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8604 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8605 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8606 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8607 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8608 !! end
8609
8610 !! test
8611 Handling html with a br self-closing tag
8612 !! wikitext
8613 <br title />
8614 <br title/>
8615 <br title/ >
8616 <br title=bar />
8617 <br title=bar/>
8618 <br title=bar/ >
8619 !! html/php
8620 <p><br title="" />
8621 <br title="" />
8622 <br />
8623 <br title="bar" />
8624 <br title="bar" />
8625 <br title="bar/" />
8626 </p>
8627 !! html/parsoid
8628 <p><br title="" />
8629 <br title="" />
8630 <br title="" />
8631 <br title="bar" />
8632 <br title="bar" />
8633 <br title="bar/" />
8634 </p>
8635 !! end
8636
8637 !! test
8638 Horizontal ruler (should it add that extra space?)
8639 !! wikitext
8640 <hr>
8641 <hr >
8642 foo <hr
8643 > bar
8644 !! html+tidy
8645 <hr />
8646 <hr />
8647 <p>foo</p>
8648 <hr />
8649 <p>bar</p>
8650 !! end
8651
8652 !! test
8653 Horizontal ruler -- 4+ dashes render hr
8654 !! wikitext
8655 ----
8656 !! html
8657 <hr />
8658
8659 !! end
8660
8661 !! test
8662 Horizontal ruler -- eats additional dashes on the same line
8663 !! wikitext
8664 ---------
8665 !! html
8666 <hr />
8667
8668 !! end
8669
8670 !! test
8671 Horizontal ruler -- does not collapse dashes on consecutive lines
8672 !! wikitext
8673 ----
8674 ----
8675 !! html
8676 <hr />
8677 <hr />
8678
8679 !! end
8680
8681 !! test
8682 Horizontal ruler -- <4 dashes render as plain text
8683 !! wikitext
8684 ---
8685 !! html
8686 <p>---
8687 </p>
8688 !! end
8689
8690 !! test
8691 Horizontal ruler -- Supports content following dashes on same line
8692 !! wikitext
8693 ---- Foo
8694 !! html
8695 <hr /> Foo
8696
8697 !! html+tidy
8698 <hr />
8699 <p>Foo</p>
8700 !! end
8701
8702 ###
8703 ### Block-level elements
8704 ###
8705 !! test
8706 Common list
8707 !! wikitext
8708 *Common list
8709 * item 2
8710 *item 3
8711 !! html
8712 <ul><li>Common list</li>
8713 <li> item 2</li>
8714 <li>item 3</li></ul>
8715
8716 !! end
8717
8718 !! test
8719 Numbered list
8720 !! wikitext
8721 #Numbered list
8722 #item 2
8723 # item 3
8724 !! html
8725 <ol><li>Numbered list</li>
8726 <li>item 2</li>
8727 <li> item 3</li></ol>
8728
8729 !! end
8730
8731 !! test
8732 Mixed list
8733 !! wikitext
8734 *Mixed list
8735 *# with numbers
8736 ** and bullets
8737 *# and numbers
8738 *bullets again
8739 **bullet level 2
8740 ***bullet level 3
8741 ***#Number on level 4
8742 **bullet level 2
8743 **#Number on level 3
8744 **#Number on level 3
8745 *#number level 2
8746 *Level 1
8747 *** Level 3
8748 #** Level 3, but ordered
8749 !! html
8750 <ul><li>Mixed list
8751 <ol><li> with numbers</li></ol>
8752 <ul><li> and bullets</li></ul>
8753 <ol><li> and numbers</li></ol></li>
8754 <li>bullets again
8755 <ul><li>bullet level 2
8756 <ul><li>bullet level 3
8757 <ol><li>Number on level 4</li></ol></li></ul></li>
8758 <li>bullet level 2
8759 <ol><li>Number on level 3</li>
8760 <li>Number on level 3</li></ol></li></ul>
8761 <ol><li>number level 2</li></ol></li>
8762 <li>Level 1
8763 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8764 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8765
8766 !! end
8767
8768 !! test
8769 Nested lists 1
8770 !! wikitext
8771 *foo
8772 **bar
8773 !! html
8774 <ul><li>foo
8775 <ul><li>bar</li></ul></li></ul>
8776
8777 !! end
8778
8779 !! test
8780 Nested lists 2
8781 !! wikitext
8782 **foo
8783 *bar
8784 !! html
8785 <ul><li><ul><li>foo</li></ul></li>
8786 <li>bar</li></ul>
8787
8788 !! end
8789
8790 !! test
8791 Nested lists 3 (first element empty)
8792 !! wikitext
8793 *
8794 **bar
8795 !! html
8796 <ul><li>
8797 <ul><li>bar</li></ul></li></ul>
8798
8799 !! end
8800
8801 !! test
8802 Nested lists 4 (first element empty)
8803 !! wikitext
8804 **
8805 *bar
8806 !! html
8807 <ul><li><ul><li></li></ul></li>
8808 <li>bar</li></ul>
8809
8810 !! end
8811
8812 !! test
8813 Nested lists 5 (both elements empty)
8814 !! wikitext
8815 **
8816 *
8817 !! html
8818 <ul><li><ul><li></li></ul></li>
8819 <li></li></ul>
8820
8821 !! end
8822
8823 !! test
8824 Nested lists 6 (both elements empty)
8825 !! wikitext
8826 *
8827 **
8828 !! html
8829 <ul><li>
8830 <ul><li></li></ul></li></ul>
8831
8832 !! end
8833
8834 !! test
8835 Nested lists 7 (skip initial nesting levels)
8836 !! wikitext
8837 *** foo
8838 !! html
8839 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8840
8841 !! end
8842
8843 !! test
8844 Nested lists 8 (multiple nesting transitions)
8845 !! wikitext
8846 * foo
8847 *** bar
8848 ** baz
8849 * boo
8850 !! html
8851 <ul><li> foo
8852 <ul><li><ul><li> bar</li></ul></li>
8853 <li> baz</li></ul></li>
8854 <li> boo</li></ul>
8855
8856 !! end
8857
8858 !! test
8859 Nested lists 9 (extension interaction)
8860 !! options
8861 parsoid
8862 !! wikitext
8863 *<references />
8864 !! html/parsoid
8865 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8866 !! end
8867
8868 !! test
8869 1. Lists with start-of-line-transparent tokens before bullets: Comments
8870 !! wikitext
8871 *foo
8872 *<!--cmt-->bar
8873 <!--cmt-->*baz
8874 !! html
8875 <ul><li>foo</li>
8876 <li>bar</li>
8877 <li>baz</li></ul>
8878
8879 !! end
8880
8881 !! test
8882 2. Lists with start-of-line-transparent tokens before bullets: Template close
8883 !! wikitext
8884 *foo {{echo|bar
8885 }}*baz
8886 !! html
8887 <ul><li>foo bar</li>
8888 <li>baz</li></ul>
8889
8890 !! end
8891
8892 !! test
8893 List items are not parsed correctly following a <pre> block (bug 785)
8894 !! wikitext
8895 * <pre>foo</pre>
8896 * <pre>bar</pre>
8897 * zar
8898 !! html/php
8899 <ul><li> <pre>foo</pre></li>
8900 <li> <pre>bar</pre></li>
8901 <li> zar</li></ul>
8902
8903 !! html/parsoid
8904 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8905 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8906 <li> zar</li></ul>
8907 !! end
8908
8909 !! test
8910 List items from template
8911 !! wikitext
8912
8913 {{inner list}}
8914 * item 2
8915
8916 * item 0
8917 {{inner list}}
8918 * item 2
8919
8920 * item 0
8921 * notSOL{{inner list}}
8922 * item 2
8923 !! html
8924 <ul><li> item 1</li>
8925 <li> item 2</li></ul>
8926 <ul><li> item 0</li>
8927 <li> item 1</li>
8928 <li> item 2</li></ul>
8929 <ul><li> item 0</li>
8930 <li> notSOL</li>
8931 <li> item 1</li>
8932 <li> item 2</li></ul>
8933
8934 !! end
8935
8936 !! test
8937 List interrupted by empty line or heading
8938 !! wikitext
8939 * foo
8940
8941 ** bar
8942 == A heading ==
8943 * Another list item
8944 !! html
8945 <ul><li> foo</li></ul>
8946 <ul><li><ul><li> bar</li></ul></li></ul>
8947 <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>
8948 <ul><li> Another list item</li></ul>
8949
8950 !!end
8951
8952 !!test
8953 Multiple list tags generated by templates
8954 !! wikitext
8955 {{echo|<li>}}a
8956 {{echo|<li>}}b
8957 {{echo|<li>}}c
8958 !! html
8959 <li>a
8960 <li>b
8961 <li>c</li>
8962 </li>
8963 </li>
8964
8965 !! html+tidy
8966 <ul>
8967 <li>a</li>
8968 <li>b</li>
8969 <li>c</li>
8970 </ul>
8971 !!end
8972
8973 !!test
8974 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8975 !! wikitext
8976 *a
8977 <!--This line will NOT split the list-->
8978 *b
8979 <!--This line will NOT split the list either-->
8980 *c
8981 <!--foo--> <!----> <!--This line NOT split the list either-->
8982 *d
8983 !! html
8984 <ul><li>a</li>
8985 <li>b</li>
8986 <li>c</li>
8987 <li>d</li></ul>
8988
8989 !!end
8990
8991 !!test
8992 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8993 !! wikitext
8994 *a
8995 <!--This line will NOT split the list-->
8996 *b
8997 <!--This line will NOT split the list either-->
8998 *c
8999 <!--foo--> <!----> <!--This line NOT split the list
9000 either-->
9001 *d
9002 !! html
9003 <ul><li>a</li>
9004 <li>b</li>
9005 <li>c</li>
9006 <li>d</li></ul>
9007
9008 !!end
9009
9010 !!test
9011 Test the li-hack
9012 (The PHP parser relies on Tidy for the hack)
9013 !!options
9014 parsoid=wt2html,wt2wt
9015 !! wikitext
9016 * foo
9017 * <li>li-hack
9018 * {{echo|<li>templated li-hack}}
9019 * <!--foo--> <li> unsupported li-hack with preceding comments
9020
9021 <ul>
9022 <li><li>not a li-hack
9023 </li>
9024 </ul>
9025 !! html+tidy
9026 <ul>
9027 <li>foo</li>
9028 <li>li-hack</li>
9029 <li>templated li-hack</li>
9030 <li>unsupported li-hack with preceding comments</li>
9031 </ul>
9032 <ul>
9033 <li>not a li-hack</li>
9034 </ul>
9035 !!end
9036
9037 !! test
9038 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9039 !! options
9040 parsoid
9041 !! wikitext
9042 # foo
9043 ## bar
9044 * foo
9045 ** bar
9046 : foo
9047 :: bar
9048 !! html
9049 <ol>
9050 <li> foo<ol>
9051 <li> bar</li>
9052 </ol></li>
9053 </ol><ul>
9054 <li> foo<ul>
9055 <li> bar</li>
9056 </ul></li>
9057 </ul><dl>
9058 <dd> foo<dl>
9059 <dd> bar</dd>
9060 </dl></dd>
9061 </dl>
9062 !! end
9063
9064 !! test
9065 Parsoid: Test of whitespace serialization with Templated bullets
9066 !! options
9067 parsoid
9068 !! wikitext
9069 * {{bullet}}
9070 !! html
9071 <ul>
9072 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9073 </ul>
9074 !! end
9075
9076 # ------------------------------------------------------------------------
9077 # The next set of tests are about Parsoid's ability to handle badly nested
9078 # tags (parse, minimize scope of fixup, and roundtrip back)
9079 # ------------------------------------------------------------------------
9080
9081 !! test
9082 Unbalanced closing block tags break a list
9083 (php parser relies on Tidy to fix up)
9084 !! wikitext
9085 <div>
9086 *a</div><div>
9087 *b</div>
9088 !! html+tidy
9089 <div>
9090 <ul>
9091 <li>a</li>
9092 </ul>
9093 </div>
9094 <div>
9095 <ul>
9096 <li>b</li>
9097 </ul>
9098 </div>
9099 !! end
9100
9101 # Parsoid fails this test, but it might be tricky to support properly.
9102 # See bug 68395.
9103 !! test
9104 Unbalanced closing non-block tags don't break a list
9105 (php parser relies on Tidy to fix up)
9106 !! wikitext
9107 <span>
9108 *a</span><span>
9109 *b</span>
9110 !! html/php+tidy
9111 <ul>
9112 <li><span>a</span></li>
9113 <li><span>b</span></li>
9114 </ul>
9115 !! html/parsoid
9116 <span>
9117 <ul>
9118 <li>a<span></span>
9119 </li>
9120 <li>b
9121 </li>
9122 </ul>
9123 </span>
9124 !! end
9125
9126 !! test
9127 Unclosed formatting tags that straddle lists are closed and reopened
9128 (php parser relies on Tidy to fix up)
9129 !! options
9130 parsoid=wt2html,wt2wt,html2html
9131 !! wikitext
9132 # <s> a
9133 # b </s>
9134 !! html/php+tidy
9135 <ol>
9136 <li><s>a</s></li>
9137 <li><s>b</s></li>
9138 </ol>
9139 !! html/parsoid
9140 <ol><li> <s> a</s></li>
9141 <li><s> b </s></li></ol>
9142 !! end
9143
9144 # See bug 68395.
9145 !!test
9146 1. List embedded in a formatting tag
9147 !! wikitext
9148 <small>
9149 * foo
9150 </small>
9151 !! html/php+tidy
9152 <ul>
9153 <li><small>foo</small></li>
9154 </ul>
9155 !! html/parsoid
9156 <small>
9157 <ul>
9158 <li> foo</li>
9159 </ul>
9160 </small>
9161 !!end
9162
9163 ## Ugly Parsoid output here
9164 ## Not sure what the right output is.
9165 !!test
9166 2. List embedded in a formatting tag
9167 !! wikitext
9168 <small>
9169 *a
9170 *b</small>
9171 !! html/php+tidy
9172 <ul>
9173 <li><small>a</small></li>
9174 <li><small>b</small></li>
9175 </ul>
9176 !! html/parsoid
9177 <small></small>
9178 <ul><small>
9179 <li>a</li>
9180 </small>
9181 <li><small>b</small></li>
9182 </ul>
9183 !!end
9184
9185 # Ugly Parsoid and PHP parser output here
9186 # Not sure if we want to make this a test!
9187 #
9188 ## !!test
9189 ## 3. Unclosed formatting tags in list elements
9190 ## !! wikitext
9191 ## *<small>a
9192 ## *<small>b
9193 ## !! html/php+tidy
9194 ## <ul>
9195 ## <li><small>a</small></li>
9196 ## <li><small><small>b</small></small></li>
9197 ## </ul>
9198 ## !! html/parsoid
9199 ## <ul>
9200 ## <li><small>a</small></li>
9201 ## <small>
9202 ## <li><small>b</small></li>
9203 ## </small></ul>
9204 ## !!end
9205
9206 # This is a bug in the PHP parser + tidy combination.
9207 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9208 # and then fostered out of the table by tidy.)
9209 # We believe the Parsoid output to be correct.
9210 !! test
9211 Table with missing opening <tr> tag
9212 !! options
9213 parsoid=wt2html,wt2wt
9214 !! wikitext
9215 <table>
9216 <td>foo</td>
9217 </tr>
9218 </table>
9219 !! html+tidy
9220 <table>
9221 <tr>
9222 <td>foo</td>
9223 </tr>
9224 </table>
9225 !! end
9226
9227 ###
9228 ### Magic Words
9229 ###
9230
9231 # Note that the current date is hard-coded as
9232 # 1970-01-01T00:02:03Z (a Thursday)
9233 # when running parser tests. The timezone is also fixed to GMT, so
9234 # local date will be identical to current date.
9235
9236 !! test
9237 Magic Word: {{CURRENTDAY}}
9238 !! wikitext
9239 {{CURRENTDAY}}
9240 !! html
9241 <p>1
9242 </p>
9243 !! end
9244
9245 !! test
9246 Magic Word: {{CURRENTDAY2}}
9247 !! wikitext
9248 {{CURRENTDAY2}}
9249 !! html
9250 <p>01
9251 </p>
9252 !! end
9253
9254 !! test
9255 Magic Word: {{CURRENTDAYNAME}}
9256 !! wikitext
9257 {{CURRENTDAYNAME}}
9258 !! html
9259 <p>Thursday
9260 </p>
9261 !! end
9262
9263 !! test
9264 Magic Word: {{CURRENTDOW}}
9265 !! wikitext
9266 {{CURRENTDOW}}
9267 !! html
9268 <p>4
9269 </p>
9270 !! end
9271
9272 !! test
9273 Magic Word: {{CURRENTMONTH}}
9274 !! wikitext
9275 {{CURRENTMONTH}}
9276 !! html
9277 <p>01
9278 </p>
9279 !! end
9280
9281 !! test
9282 Magic Word: {{CURRENTMONTH1}}
9283 !! wikitext
9284 {{CURRENTMONTH1}}
9285 !! html
9286 <p>1
9287 </p>
9288 !! end
9289
9290 !! test
9291 Magic Word: {{CURRENTMONTHABBREV}}
9292 !! wikitext
9293 {{CURRENTMONTHABBREV}}
9294 !! html
9295 <p>Jan
9296 </p>
9297 !! end
9298
9299 !! test
9300 Magic Word: {{CURRENTMONTHNAME}}
9301 !! wikitext
9302 {{CURRENTMONTHNAME}}
9303 !! html
9304 <p>January
9305 </p>
9306 !! end
9307
9308 !! test
9309 Magic Word: {{CURRENTMONTHNAMEGEN}}
9310 !! wikitext
9311 {{CURRENTMONTHNAMEGEN}}
9312 !! html
9313 <p>January
9314 </p>
9315 !! end
9316
9317 !! test
9318 Magic Word: {{CURRENTTIME}}
9319 !! wikitext
9320 {{CURRENTTIME}}
9321 !! html
9322 <p>00:02
9323 </p>
9324 !! end
9325
9326 !! test
9327 Magic Word: {{CURRENTHOUR}}
9328 !! wikitext
9329 {{CURRENTHOUR}}
9330 !! html
9331 <p>00
9332 </p>
9333 !! end
9334
9335 !! test
9336 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9337 !! wikitext
9338 {{CURRENTWEEK}}
9339 !! html
9340 <p>1
9341 </p>
9342 !! end
9343
9344 !! test
9345 Magic Word: {{CURRENTYEAR}}
9346 !! wikitext
9347 {{CURRENTYEAR}}
9348 !! html
9349 <p>1970
9350 </p>
9351 !! end
9352
9353 !! test
9354 Magic Word: {{CURRENTTIMESTAMP}}
9355 !! wikitext
9356 {{CURRENTTIMESTAMP}}
9357 !! html
9358 <p>19700101000203
9359 </p>
9360 !! end
9361
9362 !! test
9363 Magic Words LOCAL (UTC)
9364 !! wikitext
9365 * {{LOCALMONTH}}
9366 * {{LOCALMONTH1}}
9367 * {{LOCALMONTHNAME}}
9368 * {{LOCALMONTHNAMEGEN}}
9369 * {{LOCALMONTHABBREV}}
9370 * {{LOCALDAY}}
9371 * {{LOCALDAY2}}
9372 * {{LOCALDAYNAME}}
9373 * {{LOCALYEAR}}
9374 * {{LOCALTIME}}
9375 * {{LOCALHOUR}}
9376 * {{LOCALWEEK}}
9377 * {{LOCALDOW}}
9378 * {{LOCALTIMESTAMP}}
9379 !! html
9380 <ul><li> 01</li>
9381 <li> 1</li>
9382 <li> January</li>
9383 <li> January</li>
9384 <li> Jan</li>
9385 <li> 1</li>
9386 <li> 01</li>
9387 <li> Thursday</li>
9388 <li> 1970</li>
9389 <li> 00:02</li>
9390 <li> 00</li>
9391 <li> 1</li>
9392 <li> 4</li>
9393 <li> 19700101000203</li></ul>
9394
9395 !! end
9396
9397 !! test
9398 Magic Word: {{FULLPAGENAME}}
9399 !! options
9400 title=[[User:Ævar Arnfjörð Bjarmason]]
9401 !! wikitext
9402 {{FULLPAGENAME}}
9403 !! html
9404 <p>User:Ævar Arnfjörð Bjarmason
9405 </p>
9406 !! end
9407
9408 !! test
9409 Magic Word: {{FULLPAGENAMEE}}
9410 !! options
9411 title=[[User:Ævar Arnfjörð Bjarmason]]
9412 !! wikitext
9413 {{FULLPAGENAMEE}}
9414 !! html
9415 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9416 </p>
9417 !! end
9418
9419 !! test
9420 Magic Word: {{TALKSPACE}}
9421 !! options
9422 title=[[User:Ævar Arnfjörð Bjarmason]]
9423 !! wikitext
9424 {{TALKSPACE}}
9425 !! html
9426 <p>User talk
9427 </p>
9428 !! end
9429
9430 !! test
9431 Magic Word: {{TALKSPACE}}, same namespace
9432 !! options
9433 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9434 !! wikitext
9435 {{TALKSPACE}}
9436 !! html
9437 <p>User talk
9438 </p>
9439 !! end
9440
9441 !! test
9442 Magic Word: {{TALKSPACE}}, main namespace
9443 !! options
9444 title=[[Parser Test]]
9445 !! wikitext
9446 {{TALKSPACE}}
9447 !! html
9448 <p>Talk
9449 </p>
9450 !! end
9451
9452 !! test
9453 Magic Word: {{TALKSPACEE}}
9454 !! options
9455 title=[[User:Ævar Arnfjörð Bjarmason]]
9456 !! wikitext
9457 {{TALKSPACEE}}
9458 !! html
9459 <p>User_talk
9460 </p>
9461 !! end
9462
9463 !! test
9464 Magic Word: {{SUBJECTSPACE}}
9465 !! options
9466 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9467 !! wikitext
9468 {{SUBJECTSPACE}}
9469 !! html
9470 <p>User
9471 </p>
9472 !! end
9473
9474 !! test
9475 Magic Word: {{SUBJECTSPACE}}, same namespace
9476 !! options
9477 title=[[User:Ævar Arnfjörð Bjarmason]]
9478 !! wikitext
9479 {{SUBJECTSPACE}}
9480 !! html
9481 <p>User
9482 </p>
9483 !! end
9484
9485 !! test
9486 Magic Word: {{SUBJECTSPACE}}, main namespace
9487 !! options
9488 title=[[Parser Test]]
9489 !! wikitext
9490 {{SUBJECTSPACE}}
9491 !! html
9492
9493 !! end
9494
9495 !! test
9496 Magic Word: {{SUBJECTSPACEE}}
9497 !! options
9498 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9499 !! wikitext
9500 {{SUBJECTSPACEE}}
9501 !! html
9502 <p>User
9503 </p>
9504 !! end
9505
9506 !! test
9507 Magic Word: {{NAMESPACE}}
9508 !! options
9509 title=[[User:Ævar Arnfjörð Bjarmason]]
9510 !! wikitext
9511 {{NAMESPACE}}
9512 !! html
9513 <p>User
9514 </p>
9515 !! end
9516
9517 !! test
9518 Magic Word: {{NAMESPACEE}}
9519 !! options
9520 title=[[User:Ævar Arnfjörð Bjarmason]]
9521 !! wikitext
9522 {{NAMESPACEE}}
9523 !! html
9524 <p>User
9525 </p>
9526 !! end
9527
9528 !! test
9529 Magic Word: {{NAMESPACENUMBER}}
9530 !! options
9531 title=[[User:Ævar Arnfjörð Bjarmason]]
9532 !! wikitext
9533 {{NAMESPACENUMBER}}
9534 !! html
9535 <p>2
9536 </p>
9537 !! end
9538
9539 !! test
9540 Magic Word: {{SUBPAGENAME}}
9541 !! options
9542 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9543 !! wikitext
9544 {{SUBPAGENAME}}
9545 !! html
9546 <p>sub ö
9547 </p>
9548 !! end
9549
9550 !! test
9551 Magic Word: {{SUBPAGENAMEE}}
9552 !! options
9553 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9554 !! wikitext
9555 {{SUBPAGENAMEE}}
9556 !! html
9557 <p>sub_%C3%B6
9558 </p>
9559 !! end
9560
9561 !! test
9562 Magic Word: {{ROOTPAGENAME}}
9563 !! options
9564 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9565 !! wikitext
9566 {{ROOTPAGENAME}}
9567 !! html
9568 <p>Ævar Arnfjörð Bjarmason
9569 </p>
9570 !! end
9571
9572 !! test
9573 Magic Word: {{ROOTPAGENAMEE}}
9574 !! options
9575 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9576 !! wikitext
9577 {{ROOTPAGENAMEE}}
9578 !! html
9579 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9580 </p>
9581 !! end
9582
9583 !! test
9584 Magic Word: {{BASEPAGENAME}}
9585 !! options
9586 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9587 !! wikitext
9588 {{BASEPAGENAME}}
9589 !! html
9590 <p>Ævar Arnfjörð Bjarmason
9591 </p>
9592 !! end
9593
9594 !! test
9595 Magic Word: {{BASEPAGENAMEE}}
9596 !! options
9597 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9598 !! wikitext
9599 {{BASEPAGENAMEE}}
9600 !! html
9601 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9602 </p>
9603 !! end
9604
9605 !! test
9606 Magic Word: {{TALKPAGENAME}}
9607 !! options
9608 title=[[User:Ævar Arnfjörð Bjarmason]]
9609 !! wikitext
9610 {{TALKPAGENAME}}
9611 !! html
9612 <p>User talk:Ævar Arnfjörð Bjarmason
9613 </p>
9614 !! end
9615
9616 !! test
9617 Magic Word: {{TALKPAGENAMEE}}
9618 !! options
9619 title=[[User:Ævar Arnfjörð Bjarmason]]
9620 !! wikitext
9621 {{TALKPAGENAMEE}}
9622 !! html
9623 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9624 </p>
9625 !! end
9626
9627 !! test
9628 Magic Word: {{SUBJECTPAGENAME}}
9629 !! options
9630 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9631 !! wikitext
9632 {{SUBJECTPAGENAME}}
9633 !! html
9634 <p>User:Ævar Arnfjörð Bjarmason
9635 </p>
9636 !! end
9637
9638 !! test
9639 Magic Word: {{SUBJECTPAGENAMEE}}
9640 !! options
9641 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9642 !! wikitext
9643 {{SUBJECTPAGENAMEE}}
9644 !! html
9645 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{NUMBEROFFILES}}
9651 !! wikitext
9652 {{NUMBEROFFILES}}
9653 !! html
9654 <p>5
9655 </p>
9656 !! end
9657
9658 !! test
9659 Magic Word: {{PAGENAME}}
9660 !! options
9661 title=[[User:Ævar Arnfjörð Bjarmason]]
9662 !! wikitext
9663 {{PAGENAME}}
9664 !! html
9665 <p>Ævar Arnfjörð Bjarmason
9666 </p>
9667 !! end
9668
9669 !! test
9670 Magic Word: {{PAGENAME}} with metacharacters
9671 !! options
9672 title=[['foo & bar = baz']]
9673 !! wikitext
9674 ''{{PAGENAME}}''
9675 !! html/php
9676 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9677 </p>
9678 !! html+tidy
9679 <p><i>'foo &amp; bar = baz'</i></p>
9680 !! end
9681
9682 !! test
9683 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9684 !! options
9685 title=[[*RFC 1234 http://example.com/]]
9686 !! wikitext
9687 {{PAGENAME}}
9688 !! html/php
9689 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9690 </p>
9691 !! html+tidy
9692 <p>*RFC 1234 http://example.com/</p>
9693 !! end
9694
9695 !! test
9696 Magic Word: {{PAGENAMEE}}
9697 !! options
9698 title=[[User:Ævar Arnfjörð Bjarmason]]
9699 !! wikitext
9700 {{PAGENAMEE}}
9701 !! html
9702 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9703 </p>
9704 !! end
9705
9706 !! test
9707 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9708 !! options
9709 title=[[*RFC 1234 http://example.com/]]
9710 !! wikitext
9711 {{PAGENAMEE}}
9712 !! html/php
9713 <p>&#42;RFC_1234_http&#58;//example.com/
9714 </p>
9715 !! html+tidy
9716 <p>*RFC_1234_http://example.com/</p>
9717 !! end
9718
9719 !! test
9720 Magic Word: {{REVISIONID}}
9721 !! wikitext
9722 {{REVISIONID}}
9723 !! html
9724 <p>1337
9725 </p>
9726 !! end
9727
9728 !! test
9729 Magic Word: {{SCRIPTPATH}}
9730 !! wikitext
9731 {{SCRIPTPATH}}
9732 !! html
9733 <p>/
9734 </p>
9735 !! end
9736
9737 !! test
9738 Magic Word: {{STYLEPATH}}
9739 !! wikitext
9740 {{STYLEPATH}}
9741 !! html
9742 <p>/skins
9743 </p>
9744 !! end
9745
9746 !! test
9747 Magic Word: {{SERVER}}
9748 !! wikitext
9749 {{SERVER}}
9750 !! html
9751 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9752 </p>
9753 !! end
9754
9755 !! test
9756 Magic Word: {{SERVERNAME}}
9757 !! wikitext
9758 {{SERVERNAME}}
9759 !! html
9760 <p>example.org
9761 </p>
9762 !! end
9763
9764 !! test
9765 Magic Word: {{SITENAME}}
9766 !! wikitext
9767 {{SITENAME}}
9768 !! html
9769 <p>MediaWiki
9770 </p>
9771 !! end
9772
9773 !! test
9774 Case-sensitive magic words, when cased differently, should just be template transclusions
9775 !! wikitext
9776 {{CurrentMonth}}
9777 {{currentday}}
9778 {{cURreNTweEK}}
9779 {{currentHour}}
9780 !! html
9781 <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>
9782 <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>
9783 <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>
9784 <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>
9785 </p>
9786 !! end
9787
9788 !! test
9789 Case-insensitive magic words should still work with weird casing.
9790 !! wikitext
9791 {{sErVeRNaMe}}
9792 {{LCFirst:AOEU}}
9793 {{ucFIRST:aoeu}}
9794 {{SERver}}
9795 !! html
9796 <p>example.org
9797 aOEU
9798 Aoeu
9799 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9800 </p>
9801 !! end
9802
9803 # From plwiki:PLOS_ONE
9804 !! test
9805 Parsoid: Page property magic word with magic word contents
9806 !! wikitext
9807 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9808 !! html/parsoid
9809 <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>"}]]}'/>
9810 !! end
9811
9812 !! test
9813 Parsoid: Template-generated DISPLAYTITLE
9814 !! wikitext
9815 {{{{echo|DISPLAYTITLE}}:Foo}}
9816 !! html/parsoid
9817 <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}}]}'/>
9818 !! end
9819
9820 !! test
9821 Namespace 1 {{ns:1}}
9822 !! wikitext
9823 {{ns:1}}
9824 !! html
9825 <p>Talk
9826 </p>
9827 !! end
9828
9829 !! test
9830 Namespace 1 {{ns:01}}
9831 !! wikitext
9832 {{ns:01}}
9833 !! html
9834 <p>Talk
9835 </p>
9836 !! end
9837
9838 !! test
9839 Namespace 0 {{ns:0}} (bug 4783)
9840 !! wikitext
9841 {{ns:0}}
9842 !! html
9843
9844 !! end
9845
9846 !! test
9847 Namespace 0 {{ns:00}} (bug 4783)
9848 !! wikitext
9849 {{ns:00}}
9850 !! html
9851
9852 !! end
9853
9854 !! test
9855 Namespace -1 {{ns:-1}}
9856 !! wikitext
9857 {{ns:-1}}
9858 !! html
9859 <p>Special
9860 </p>
9861 !! end
9862
9863 !! test
9864 Namespace User {{ns:User}}
9865 !! wikitext
9866 {{ns:User}}
9867 !! html
9868 <p>User
9869 </p>
9870 !! end
9871
9872 !! test
9873 Namespace User talk {{ns:User_talk}}
9874 !! wikitext
9875 {{ns:User_talk}}
9876 !! html
9877 <p>User talk
9878 </p>
9879 !! end
9880
9881 !! test
9882 Namespace User talk {{ns:uSeR tAlK}}
9883 !! wikitext
9884 {{ns:uSeR tAlK}}
9885 !! html
9886 <p>User talk
9887 </p>
9888 !! end
9889
9890 !! test
9891 Namespace File {{ns:File}}
9892 !! wikitext
9893 {{ns:File}}
9894 !! html
9895 <p>File
9896 </p>
9897 !! end
9898
9899 !! test
9900 Namespace File {{ns:Image}}
9901 !! wikitext
9902 {{ns:Image}}
9903 !! html
9904 <p>File
9905 </p>
9906 !! end
9907
9908 !! test
9909 Namespace (lang=de) Benutzer {{ns:User}}
9910 !! options
9911 language=de
9912 !! wikitext
9913 {{ns:User}}
9914 !! html
9915 <p>Benutzer
9916 </p>
9917 !! end
9918
9919 !! test
9920 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9921 !! options
9922 language=de
9923 !! wikitext
9924 {{ns:3}}
9925 !! html
9926 <p>Benutzer Diskussion
9927 </p>
9928 !! end
9929
9930
9931 !! test
9932 Urlencode
9933 !! wikitext
9934 {{urlencode:hi world?!}}
9935 {{urlencode:hi world?!|WIKI}}
9936 {{urlencode:hi world?!|PATH}}
9937 {{urlencode:hi world?!|QUERY}}
9938 !! html
9939 <p>hi+world%3F%21
9940 hi_world%3F!
9941 hi%20world%3F%21
9942 hi+world%3F%21
9943 </p>
9944 !! end
9945
9946 !! test
9947 Magic Word: prioritize type info over data-parsoid
9948 !! options
9949 parsoid=html2wt
9950 !! html/parsoid
9951 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9952 !! wikitext
9953 __FORCETOC__
9954 !! end
9955
9956 !! test
9957 Magic Word: serialize on separate line (parsoid)
9958 !! options
9959 parsoid=wt2wt,html2wt
9960 !! wikitext
9961 foo
9962 __NOTOC__
9963 bar
9964 !! html/parsoid
9965 foo<meta property="mw:PageProp/notoc"/>bar
9966 !! end
9967
9968 !! test
9969 Magic Word: rt non-english wikis
9970 !! options
9971 parsoid=wt2wt
9972 language=de
9973 !! wikitext
9974 __NOEDITSECTION__
9975 !! html/parsoid
9976 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9977 !! end
9978
9979 !!test
9980 __proto__ is treated as normal wikitext (T105997)
9981 !!wikitext
9982 __proto__
9983 !!html
9984 <p>__proto__
9985 </p>
9986 !!end
9987
9988 ###
9989 ### Magic links
9990 ###
9991 !! test
9992 Magic links: internal link to RFC (bug 479)
9993 !! wikitext
9994 [[RFC 123]]
9995 !! html/php
9996 <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>
9997 </p>
9998 !! html/parsoid
9999 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10000 !! end
10001
10002 !! test
10003 Magic links: RFC (bug 479)
10004 !! wikitext
10005 RFC 822
10006 !! html/php
10007 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10008 </p>
10009 !! html/parsoid
10010 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10011 !! end
10012
10013 !! test
10014 Magic links: RFC (bug 65278)
10015 !! wikitext
10016 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10017 !! html/php
10018 <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.
10019 </p>
10020 !! html/parsoid
10021 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10022 !! end
10023
10024 !! test
10025 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10026 !! wikitext
10027 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10028 RFC
10029 822
10030 !! html/php
10031 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10032 RFC
10033 822
10034 </p>
10035 !! html/parsoid
10036 <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>
10037 RFC
10038 822</p>
10039 !! end
10040
10041 !! test
10042 Magic links: ISBN (bug 1937)
10043 !! wikitext
10044 ISBN 0-306-40615-2
10045 !! html/php
10046 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10047 </p>
10048 !! html/parsoid
10049 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10050 !! end
10051
10052 !! test
10053 Magic links: ISBN (bug 65278)
10054 !! wikitext
10055 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10056 !! html/php
10057 <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.
10058 </p>
10059 !! html/parsoid
10060 <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>
10061 !! end
10062
10063 !! test
10064 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10065 !! wikitext
10066 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10067 ISBN
10068 9780316098113
10069 ISBN 978
10070 0316098113
10071 !! html/php
10072 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10073 ISBN
10074 9780316098113
10075 ISBN 978
10076 0316098113
10077 </p>
10078 !! html/parsoid
10079 <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>
10080 ISBN
10081 9780316098113
10082 ISBN 978
10083 0316098113</p>
10084 !! end
10085
10086 !! test
10087 Magic links: PMID incorrectly converts space to underscore
10088 !! wikitext
10089 PMID 1234
10090 !! html/php
10091 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10092 </p>
10093 !! html/parsoid
10094 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10095 !! end
10096
10097 !! test
10098 Magic links: PMID (bug 65278)
10099 !! wikitext
10100 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10101 !! html/php
10102 <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.
10103 </p>
10104 !! html/parsoid
10105 <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>
10106 !! end
10107
10108 !! test
10109 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10110 !! wikitext
10111 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10112 PMID
10113 1234
10114 !! html/php
10115 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10116 PMID
10117 1234
10118 </p>
10119 !! html/parsoid
10120 <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>
10121 PMID
10122 1234</p>
10123 !! end
10124
10125 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10126 # since these are ExtLinkText, not MagicLinkText
10127 !! test
10128 Magic links: use appropriate serialization for "almost" magic links.
10129 !! wikitext
10130 X[[Special:BookSources/0978739256|foo]]
10131
10132 X[//tools.ietf.org/html/rfc1234 foo]
10133 !! html/php
10134 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10135 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10136 </p>
10137 !! html/parsoid
10138 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10139 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10140 !! end
10141
10142 ###
10143 ### Templates
10144 ####
10145
10146 !! test
10147 Nonexistent template
10148 !! wikitext
10149 {{thistemplatedoesnotexist}}
10150 !! html
10151 <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>
10152 </p>
10153 !! end
10154
10155 !! test
10156 Template with invalid target containing tags
10157 !! wikitext
10158 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10159 !! html
10160 <p>{{a<b>b</b>|foo|a=b|a = b}}
10161 </p>
10162 !! end
10163
10164 !! test
10165 Template with invalid target containing unclosed tag
10166 !! wikitext
10167 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10168 !! html
10169 <p>{{a<b>|foo|a=b|a = b}}</b>
10170 </p>
10171 !! end
10172
10173 !! test
10174 Template with invalid target containing wikilink
10175 !! wikitext
10176 {{[[Main Page]]}}
10177 !! html/php
10178 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10179 </p>
10180 !! html/parsoid
10181 <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>
10182 !! end
10183
10184 !! test
10185 Template with just whitespace in it, bug #68421
10186 !! wikitext
10187 {{echo|{{ }}}}
10188 !! html/parsoid
10189 <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>
10190 !! end
10191
10192 !! article
10193 Template:test
10194 !! text
10195 This is a test template
10196 !! endarticle
10197
10198 !! test
10199 Simple template
10200 !! wikitext
10201 {{test}}
10202 !! html
10203 <p>This is a test template
10204 </p>
10205 !! end
10206
10207 !! test
10208 Template with explicit namespace
10209 !! wikitext
10210 {{Template:test}}
10211 !! html
10212 <p>This is a test template
10213 </p>
10214 !! end
10215
10216
10217 !! article
10218 Template:paramtest
10219 !! text
10220 This is a test template with parameter {{{param}}}
10221 !! endarticle
10222
10223 !! test
10224 Template parameter
10225 !! wikitext
10226 {{paramtest|param=foo}}
10227 !! html
10228 <p>This is a test template with parameter foo
10229 </p>
10230 !! end
10231
10232 !! article
10233 Template:paramtestnum
10234 !! text
10235 [[{{{1}}}|{{{2}}}]]
10236 !! endarticle
10237
10238 !! test
10239 Template unnamed parameter
10240 !! wikitext
10241 {{paramtestnum|Main Page|the main page}}
10242 !! html
10243 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10244 </p>
10245 !! end
10246
10247 !! article
10248 Template:templatesimple
10249 !! text
10250 (test)
10251 !! endarticle
10252
10253 !! article
10254 Template:templateredirect
10255 !! text
10256 #redirect [[Template:templatesimple]]
10257 !! endarticle
10258
10259 !! article
10260 Template:templateasargtestnum
10261 !! text
10262 {{{{{1}}}}}
10263 !! endarticle
10264
10265 !! article
10266 Template:templateasargtest
10267 !! text
10268 {{template{{{templ}}}}}
10269 !! endarticle
10270
10271 !! article
10272 Template:templateasargtest2
10273 !! text
10274 {{{{{templ}}}}}
10275 !! endarticle
10276
10277 !! test
10278 Template with template name as unnamed argument
10279 !! wikitext
10280 {{templateasargtestnum|templatesimple}}
10281 !! html
10282 <p>(test)
10283 </p>
10284 !! end
10285
10286 !! test
10287 Template with template name as argument
10288 !! wikitext
10289 {{templateasargtest|templ=simple}}
10290 !! html
10291 <p>(test)
10292 </p>
10293 !! end
10294
10295 !! test
10296 Template with template name as argument (2)
10297 !! wikitext
10298 {{templateasargtest2|templ=templatesimple}}
10299 !! html
10300 <p>(test)
10301 </p>
10302 !! end
10303
10304 !! article
10305 Template:templateasargtestdefault
10306 !! text
10307 {{{{{templ|templatesimple}}}}}
10308 !! endarticle
10309
10310 !! article
10311 Template:templa
10312 !! text
10313 '''templ'''
10314 !! endarticle
10315
10316 !! test
10317 Template with default value
10318 !! wikitext
10319 {{templateasargtestdefault}}
10320 !! html
10321 <p>(test)
10322 </p>
10323 !! end
10324
10325 !! test
10326 Template with default value (value set)
10327 !! wikitext
10328 {{templateasargtestdefault|templ=templa}}
10329 !! html
10330 <p><b>templ</b>
10331 </p>
10332 !! end
10333
10334 !! test
10335 Template redirect
10336 !! wikitext
10337 {{templateredirect}}
10338 !! html/php
10339 <p>(test)
10340 </p>
10341 !! html/parsoid
10342 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10343 !! end
10344
10345 !! test
10346 Template with argument in separate line
10347 !! wikitext
10348 {{ templateasargtest |
10349 templ = simple }}
10350 !! html
10351 <p>(test)
10352 </p>
10353 !! end
10354
10355 !! test
10356 Template with complex template as argument
10357 !! wikitext
10358 {{paramtest|
10359 param ={{ templateasargtest |
10360 templ = simple }}}}
10361 !! html
10362 <p>This is a test template with parameter (test)
10363 </p>
10364 !! end
10365
10366 !! test
10367 Template with thumb image (with link in description)
10368 !! wikitext
10369 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10370 !! html/php
10371 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>
10372
10373 !! html+tidy
10374 <p>This is a test template with parameter</p>
10375 <div class="thumb tright">
10376 <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>
10377 <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>
10378 </div>
10379 </div>
10380 !! html/parsoid
10381 <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>
10382 !! end
10383
10384 !! article
10385 Template:complextemplate
10386 !! text
10387 {{{1}}} {{paramtest|
10388 param ={{{param}}}}}
10389 !! endarticle
10390
10391 !! test
10392 Template with complex arguments
10393 !! wikitext
10394 {{complextemplate|
10395 param ={{ templateasargtest |
10396 templ = simple }}|[[Template:complextemplate|link]]}}
10397 !! html
10398 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10399 </p>
10400 !! end
10401
10402 !! test
10403 BUG 553: link with two variables in a piped link
10404 !! wikitext
10405 {|
10406 |[[{{{1}}}|{{{2}}}]]
10407 |}
10408 !! html/php
10409 <table>
10410 <tr>
10411 <td>[[{{{1}}}|{{{2}}}]]
10412 </td></tr></table>
10413
10414 !! html/parsoid
10415 <table>
10416 <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>
10417 !! end
10418
10419 # See: T2553
10420 !! test
10421 Abort table cell attribute parsing on wikilink
10422 !! wikitext
10423 {|
10424 | testing [[one|two]] | three || four
10425 | testing one two | three || four
10426 |}
10427 !! html/php
10428 <table>
10429 <tr>
10430 <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>
10431 <td> four
10432 </td>
10433 <td> three </td>
10434 <td> four
10435 </td></tr></table>
10436
10437 !! html/parsoid
10438 <table>
10439 <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>
10440 <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>
10441 </tbody></table>
10442 !! end
10443
10444 !! test
10445 Don't abort table cell attribute parsing if wikilink is found in template arg
10446 !! wikitext
10447 {|
10448 | Test {{#tag:ref|One two "[[three]]" four}}
10449 |}
10450 !! html/parsoid
10451 <table>
10452 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10453 </tbody></table>
10454 !! end
10455
10456 !! test
10457 Magic variable as template parameter
10458 !! wikitext
10459 {{paramtest|param={{SITENAME}}}}
10460 !! html
10461 <p>This is a test template with parameter MediaWiki
10462 </p>
10463 !! end
10464
10465 !! article
10466 Template:linktest
10467 !! text
10468 [[{{{param}}}|link]]
10469 !! endarticle
10470
10471 !! test
10472 Template parameter as link source
10473 !! wikitext
10474 {{linktest|param=Main Page}}
10475 !! html
10476 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10477 </p>
10478 !! end
10479
10480 !!article
10481 Template:paramtest2
10482 !! text
10483 including another template, {{paramtest|param={{{arg}}}}}
10484 !! endarticle
10485
10486 !! test
10487 Template passing argument to another template
10488 !! wikitext
10489 {{paramtest2|arg='hmm'}}
10490 !! html
10491 <p>including another template, This is a test template with parameter 'hmm'
10492 </p>
10493 !! end
10494
10495 !! article
10496 Template:Linktest2
10497 !! text
10498 Main Page
10499 !! endarticle
10500
10501 !! test
10502 Template as link source
10503 !! wikitext
10504 [[{{linktest2}}]]
10505
10506 [[{{linktest2}}|Main Page]]
10507
10508 [[{{linktest2}}]]Page
10509 !! html
10510 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10511 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10512 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10513 </p>
10514 !! end
10515
10516
10517 !! article
10518 Template:loop1
10519 !! text
10520 {{loop2}}
10521 !! endarticle
10522
10523 !! article
10524 Template:loop2
10525 !! text
10526 {{loop1}}
10527 !! endarticle
10528
10529 !! test
10530 Template infinite loop
10531 !! wikitext
10532 {{loop1}}
10533 !! html
10534 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10535 </p>
10536 !! end
10537
10538 !! test
10539 Template from main namespace
10540 !! wikitext
10541 {{:Main Page}}
10542 !! html
10543 <p>blah blah
10544 </p>
10545 !! end
10546
10547 !! article
10548 Template:table
10549 !! text
10550 {|
10551 | 1 || 2
10552 |-
10553 | 3 || 4
10554 |}
10555 !! endarticle
10556
10557 !! test
10558 BUG 529: Template with table, not included at beginning of line
10559 !! wikitext
10560 foo {{table}}
10561 !! html
10562 <p>foo
10563 </p>
10564 <table>
10565 <tr>
10566 <td> 1 </td>
10567 <td> 2
10568 </td></tr>
10569 <tr>
10570 <td> 3 </td>
10571 <td> 4
10572 </td></tr></table>
10573
10574 !! end
10575
10576 !! test
10577 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10578 !! wikitext
10579 foo
10580 {{table}}
10581 !! html
10582 <p>foo
10583 </p>
10584 <table>
10585 <tr>
10586 <td> 1 </td>
10587 <td> 2
10588 </td></tr>
10589 <tr>
10590 <td> 3 </td>
10591 <td> 4
10592 </td></tr></table>
10593
10594 !! end
10595
10596 !! test
10597 BUG 41: Template parameters shown as broken links
10598 !! wikitext
10599 {{{parameter}}}
10600 !! html
10601 <p>{{{parameter}}}
10602 </p>
10603 !! end
10604
10605 !! test
10606 Template with targets containing wikilinks
10607 !! wikitext
10608 {{[[foo]]}}
10609
10610 {{[[{{echo|foo}}]]}}
10611
10612 {{{{echo|[[foo}}]]}}
10613 !! html
10614 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10615 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10616 </p><p>{{[[foo}}]]
10617 </p>
10618 !! end
10619
10620 !! article
10621 Template:''
10622 !! text
10623 bar
10624 !! endarticle
10625
10626 !! test
10627 Templates: Double quotes as template target
10628 !! wikitext
10629 foo {{''}} baz
10630 !! html/php
10631 <p>foo bar baz
10632 </p>
10633 !! html/parsoid
10634 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10635 </p>
10636 !! end
10637
10638 !! article
10639 Template:MSGNW test
10640 !! text
10641 ''None'' of '''this''' should be
10642 * interpreted
10643 but rather passed unmodified
10644 {{test}}
10645 <gallery>
10646 File:Foobar.jpg
10647 </gallery>
10648 <!-- comment -->
10649 !! endarticle
10650
10651 # hmm, fix this or just deprecate msgnw and document its behavior?
10652 !! test
10653 msgnw keyword
10654 !! wikitext
10655 {{msgnw:MSGNW test}}
10656 !! html/php
10657 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10658 &#42; interpreted
10659 &#32;but rather passed unmodified
10660 &#123;&#123;test&#125;&#125;
10661 &#60;gallery&#62;
10662 File:Foobar.jpg
10663 &#60;/gallery&#62;
10664 &#60;!-- comment --&#62;
10665 </p>
10666 !! end
10667
10668 !! test
10669 int keyword
10670 !! wikitext
10671 {{int:youhavenewmessages|lots of money|not!}}
10672 !! html
10673 <p>You have lots of money (not!).
10674 </p>
10675 !! end
10676
10677 !! test
10678 int keyword - non-existing message
10679 !! wikitext
10680 {{int:var}}
10681 !! html
10682 <p>&lt;var&gt;
10683 </p>
10684 !! end
10685
10686 !! article
10687 Template:Includes
10688 !! text
10689 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10690 !! endarticle
10691
10692 !! test
10693 <includeonly> and <noinclude> being included
10694 !! wikitext
10695 {{Includes}}
10696 !! html
10697 <p>Foobar
10698 </p>
10699 !! end
10700
10701 !! article
10702 Template:Includes2
10703 !! text
10704 <onlyinclude>Foo</onlyinclude>bar
10705 !! endarticle
10706
10707 !! test
10708 <onlyinclude> being included
10709 !! wikitext
10710 {{Includes2}}
10711 !! html
10712 <p>Foo
10713 </p>
10714 !! end
10715
10716
10717 !! article
10718 Template:Includes3
10719 !! text
10720 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10721 !! endarticle
10722
10723 !! test
10724 <onlyinclude> and <includeonly> being included
10725 !! wikitext
10726 {{Includes3}}
10727 !! html
10728 <p>Foo
10729 </p>
10730 !! end
10731
10732 !! test
10733 <includeonly> and <noinclude> on a page
10734 !! wikitext
10735 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10736 !! html
10737 <p>Foozar
10738 </p>
10739 !! end
10740
10741 !! test
10742 Un-closed <noinclude>
10743 !! wikitext
10744 <noinclude>
10745 !! html
10746 !! end
10747
10748 !! test
10749 <onlyinclude> on a page
10750 !! wikitext
10751 <onlyinclude>Foo</onlyinclude>bar
10752 !! html
10753 <p>Foobar
10754 </p>
10755 !! end
10756
10757 !! test
10758 Un-closed <onlyinclude>
10759 !! wikitext
10760 <onlyinclude>
10761 !! html
10762 !! end
10763
10764 !!test
10765 Self-closed noinclude, includeonly, onlyinclude tags
10766 !! wikitext
10767 <noinclude />
10768 <includeonly />
10769 <onlyinclude />
10770 !! html
10771 <p><br />
10772 </p>
10773 !!end
10774
10775 !!test
10776 Unbalanced includeonly and noinclude tags
10777 !! wikitext
10778 {|
10779 |a</noinclude>
10780 |b</noinclude></noinclude>
10781 |c</noinclude></includeonly>
10782 |d</includeonly></includeonly>
10783 |}
10784 !! html
10785 <table>
10786 <tr>
10787 <td>a
10788 </td>
10789 <td>b
10790 </td>
10791 <td>c&lt;/includeonly&gt;
10792 </td>
10793 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10794 </td></tr></table>
10795
10796 !!end
10797
10798 !! article
10799 Template:Includeonly section
10800 !! text
10801 <includeonly>
10802 ==Includeonly section==
10803 </includeonly>
10804 ==Section T-1==
10805 !!endarticle
10806
10807 !! test
10808 Bug 6563: Edit link generation for section shown by <includeonly>
10809 !! wikitext
10810 {{includeonly section}}
10811 !! html
10812 <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>
10813 <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>
10814
10815 !! end
10816
10817 # Uses same input as the contents of [[Template:Includeonly section]]
10818 !! test
10819 Bug 6563: Section extraction for section shown by <includeonly>
10820 !! options
10821 section=T-2
10822 !! wikitext
10823 <includeonly>
10824 ==Includeonly section==
10825 </includeonly>
10826 ==Section T-2==
10827 !! html
10828 ==Section T-2==
10829 !! end
10830
10831 !! test
10832 Bug 6563: Edit link generation for section suppressed by <includeonly>
10833 !! wikitext
10834 <includeonly>
10835 ==Includeonly section==
10836 </includeonly>
10837 ==Section 1==
10838 !! html
10839 <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>
10840
10841 !! end
10842
10843 !! test
10844 Bug 6563: Section extraction for section suppressed by <includeonly>
10845 !! options
10846 section=1
10847 !! wikitext
10848 <includeonly>
10849 ==Includeonly section==
10850 </includeonly>
10851 ==Section 1==
10852 !! html
10853 ==Section 1==
10854 !! end
10855
10856 !! test
10857 Un-closed <includeonly>
10858 !! wikitext
10859 <includeonly>
10860 !! html
10861 !! end
10862
10863 !! test
10864 Includes and comments at SOL
10865 !! wikitext
10866 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10867
10868 <noinclude>
10869 some
10870 </noinclude>* stuff
10871 * here
10872
10873 <includeonly>can have stuff</includeonly>=== here ===
10874
10875 !! html/php
10876 <h2><span class="mw-headline" id="hu">hu</span></h2>
10877 <p>some
10878 </p>
10879 <ul><li> stuff</li>
10880 <li> here</li></ul>
10881 <h3><span class="mw-headline" id="here">here</span></h3>
10882
10883 !! html/parsoid
10884 <!-- 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>
10885
10886 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10887 <p>some</p>
10888 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10889 <li> here</li></ul>
10890
10891 <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>
10892
10893 !! end
10894
10895 # TODO: test with DOM fragment reuse!
10896 !! test
10897 Parsoid: DOM fragment reuse
10898 !! options
10899 parsoid=wt2wt,wt2html
10900 !! wikitext
10901 a{{echo|b<table></table>c}}d
10902
10903 a{{echo|b
10904 <table></table>
10905 c}}d
10906
10907 {{echo|a
10908
10909 <table></table>
10910
10911 b}}
10912 !! html
10913 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10914
10915 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10916 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10917 </span><p about="#mwt2">cd</p>
10918
10919 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10920
10921 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10922
10923 </span><p about="#mwt3">b</p>
10924 !! end
10925
10926 !! test
10927 Parsoid: Merge double tds (T52603)
10928 !! options
10929 parsoid
10930 !! wikitext
10931 {|
10932 |{{echo|{{!}} foo}}
10933 |}
10934 !! html
10935 <table><tbody>
10936 <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>
10937 </tbody></table>
10938 !! end
10939
10940 !! test
10941 Parsoid: Merge double tds in nested transclusion content (T52603)
10942 !! options
10943 parsoid
10944 !! wikitext
10945 {{echo|<div>}}
10946 {|
10947 |{{echo|{{!}} foo}}
10948 |}
10949 {{echo|</div>}}
10950 !! html
10951 <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}}]}'>
10952 <table><tbody>
10953 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10954 </tbody></table>
10955 </div>
10956 !! end
10957
10958 ###
10959 ### <includeonly> and <noinclude> in attributes
10960 ###
10961 !!test
10962 0. includeonly around the entire attribute
10963 !! wikitext
10964 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10965 !! html
10966 <p><span id="v2">bar</span>
10967 </p>
10968 !!end
10969
10970 !!test
10971 1. includeonly in html attr key
10972 !! wikitext
10973 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10974 !! html
10975 <p><span id="foo">bar</span>
10976 </p>
10977 !!end
10978
10979 !!test
10980 2. includeonly in html attr value
10981 !! wikitext
10982 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10983 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10984 !! html
10985 <p><span id="v1">bar</span>
10986 <span id="v1">bar</span>
10987 </p>
10988 !!end
10989
10990 !!test
10991 3. includeonly in part of an attr value
10992 !! wikitext
10993 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10994 !! html
10995 <p><span style="color:red;">bar</span>
10996 </p>
10997 !!end
10998
10999 !!test
11000 4. includeonly in table attributes
11001 !! wikitext
11002 {|
11003 |- <noinclude>
11004 |-
11005 |a
11006 </noinclude>
11007 |- <includeonly>
11008 |-
11009 |b
11010 </includeonly>
11011 |}
11012 !! html
11013 <table>
11014
11015
11016 <tr>
11017 <td>a
11018 </td></tr>
11019 </table>
11020
11021 !!end
11022
11023 ###
11024 ### Token Stream Patcher tests
11025 ###
11026 ### These tests won't always pass wt2wt and other modes because
11027 ### on serialization, the table will be output on a new line.
11028 ### For now, we are blacklisting them, and using this to test selser.
11029 ###
11030
11031 !!test
11032 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11033 !!options
11034 parsoid=wt2html,wt2wt
11035 !!wikitext
11036 {{echo|}}{| width = '100%'
11037 |foo
11038 |}
11039 !!html/parsoid
11040 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11041 <tbody><tr><td>foo</td></tr>
11042 </tbody></table>
11043 !!end
11044
11045 !!test
11046 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11047 !!options
11048 parsoid=wt2html,wt2wt
11049 !!wikitext
11050 <includeonly>a</includeonly>{| {{{b}}}
11051 |c
11052 |}
11053 !!html/parsoid
11054 <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}}}":""}}'>
11055 <tbody><tr><td>c</td></tr>
11056 </tbody></table>
11057
11058 !!end
11059
11060 ###
11061 ### Testing parsing of templates where a template arg
11062 ### has the same name as the template itself.
11063 ###
11064
11065 !! article
11066 Template:quote
11067 !! text
11068 {{{quote|{{{1}}}}}}
11069 !! endarticle
11070
11071 !!test
11072 Templates: Template Name/Arg clash: 1. Use of positional param
11073 !! wikitext
11074 {{quote|foo}}
11075 !! html
11076 <p>foo
11077 </p>
11078 !!end
11079
11080 !!test
11081 Templates: Template Name/Arg clash: 2. Use of named param
11082 !! wikitext
11083 {{quote|quote=foo}}
11084 !! html
11085 <p>foo
11086 </p>
11087 !!end
11088
11089 !!test
11090 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11091 !! wikitext
11092 {{quote|quote}}
11093 !! html
11094 <p>quote
11095 </p>
11096 !!end
11097
11098 ###
11099 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11100 ###
11101
11102 !!test
11103 Templates: 1. Simple use
11104 !! wikitext
11105 {{echo|Foo}}
11106 !! html
11107 <p>Foo
11108 </p>
11109 !!end
11110
11111 !!test
11112 Templates: 2. Inside a block tag
11113 !! wikitext
11114 <div>{{echo|Foo}}</div>
11115 <blockquote>{{echo|Foo}}</blockquote>
11116 !! html
11117 <div>Foo</div>
11118 <blockquote>Foo</blockquote>
11119
11120 !! html+tidy
11121 <div>Foo</div>
11122 <blockquote>
11123 <p>Foo</p>
11124 </blockquote>
11125 !!end
11126
11127 !!test
11128 Templates: P-wrapping: 1a. Templates on consecutive lines
11129 !! wikitext
11130 {{echo|Foo}}
11131 {{echo|bar}}
11132 !! html
11133 <p>Foo
11134 bar
11135 </p>
11136 !!end
11137
11138 !!test
11139 Templates: P-wrapping: 1b. Templates on consecutive lines
11140 !! wikitext
11141 Foo
11142
11143 {{echo|bar}}
11144 {{echo|baz}}
11145 !! html
11146 <p>Foo
11147 </p><p>bar
11148 baz
11149 </p>
11150 !!end
11151
11152 !!test
11153 Templates: P-wrapping: 1c. Templates on consecutive lines
11154 !! wikitext
11155 {{echo|Foo}}
11156 {{echo|bar}} <div>baz</div>
11157 !! html
11158 <p>Foo
11159 </p>
11160 bar <div>baz</div>
11161
11162 !! html+tidy
11163 <p>Foo</p>
11164 <p>bar</p>
11165 <div>baz</div>
11166 !! end
11167
11168 !!test
11169 Templates: P-wrapping: 1d. Template preceded by comment-only line
11170 !!options
11171 parsoid
11172 !! wikitext
11173 <!-- foo -->
11174 {{echo|Bar}}
11175 !! html
11176 <!-- foo -->
11177
11178 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11179 !!end
11180
11181 !!test
11182 Templates: Inline Text: 1. Multiple template uses
11183 !! wikitext
11184 {{echo|Foo}}bar{{echo|baz}}
11185 !! html
11186 <p>Foobarbaz
11187 </p>
11188 !!end
11189
11190 !!test
11191 Templates: Inline Text: 2. Back-to-back template uses
11192 !! wikitext
11193 {{echo|Foo}}{{echo|bar}}
11194 !! html
11195 <p>Foobar
11196 </p>
11197 !!end
11198
11199 !!test
11200 Templates: Block Tags: 1. Multiple template uses
11201 !! wikitext
11202 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11203 !! html
11204 <div>Foo</div><div>bar</div><div>baz</div>
11205
11206 !!end
11207
11208 !!test
11209 Templates: Block Tags: 2. Back-to-back template uses
11210 !! wikitext
11211 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11212 !! html
11213 <div>Foo</div><div>bar</div>
11214
11215 !!end
11216
11217 # This is an edge case relating to paragraph wrapping.
11218 !!test
11219 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11220 !! wikitext
11221 {{echo|a
11222 b</p>}}
11223 !! html/parsoid
11224 <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
11225 b</p>
11226 !!end
11227
11228 !!test
11229 Templates: Links: 1. Simple example
11230 !! wikitext
11231 {{echo|[[Foo|bar]]}}
11232 !! html
11233 <p><a href="/wiki/Foo" title="Foo">bar</a>
11234 </p>
11235 !!end
11236
11237 !!test
11238 Templates: Links: 2. Generation of link href
11239 !! wikitext
11240 [[{{echo|Foo}}|bar]]
11241 !! html
11242 <p><a href="/wiki/Foo" title="Foo">bar</a>
11243 </p>
11244 !!end
11245
11246 !!test
11247 Templates: Links: 3. Generation of part of a link href
11248 !! wikitext
11249 [[Fo{{echo|o}}|bar]]
11250
11251 [[Foo{{echo|bar}}]]
11252
11253 [[Foo{{echo|bar}}baz]]
11254
11255 [[Foo{{echo|bar}}|bar]]
11256
11257 [[:Foo{{echo|bar}}]]
11258
11259 [[:Foo{{echo|bar}}|bar]]
11260 !! html
11261 <p><a href="/wiki/Foo" title="Foo">bar</a>
11262 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11263 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11264 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11265 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11266 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11267 </p>
11268 !!end
11269
11270 !!test
11271 Templates: Links: 4. Multiple templates generating link href
11272 !! wikitext
11273 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11274 !! html
11275 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11276 </p>
11277 !!end
11278
11279 !!test
11280 Templates: Links: 5. Generation of link text
11281 !! wikitext
11282 [[Foo|{{echo|bar}}]]
11283 !! html
11284 <p><a href="/wiki/Foo" title="Foo">bar</a>
11285 </p>
11286 !!end
11287
11288 !!test
11289 Templates: Links: 5. Nested templates (only outermost template should be marked)
11290 !! wikitext
11291 {{echo|[[{{echo|Foo}}|bar]]}}
11292 !! html
11293 <p><a href="/wiki/Foo" title="Foo">bar</a>
11294 </p>
11295 !!end
11296
11297 !!test
11298 Templates: HTML Tag: 1. Generation of HTML attr. key
11299 !! wikitext
11300 <div {{echo|style}}="color:red;">foo</div>
11301 !! html
11302 <div style="color:red;">foo</div>
11303
11304 !!end
11305
11306 !!test
11307 Templates: HTML Tag: 2. Generation of HTML attr. value
11308 !! wikitext
11309 <div style={{echo|'color:red;'}}>foo</div>
11310 !! html
11311 <div style="color:red;">foo</div>
11312
11313 !!end
11314
11315 !!test
11316 Templates: HTML Tag: 3. Generation of HTML attr key and value
11317 !! wikitext
11318 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11319 !! html
11320 <div style="color:red;">foo</div>
11321
11322 !!end
11323
11324 !!test
11325 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11326 !! wikitext
11327 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11328 !! html
11329 <div title="This is a long title with just one piece templated">foo</div>
11330
11331 !!end
11332
11333 !!test
11334 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11335 !! wikitext
11336 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11337 !! html
11338 <div title="This is a long title with just one piece templated">foo</div>
11339
11340 !!end
11341
11342 !!test
11343 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11344 !! wikitext
11345 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11346 !! html
11347 <div title="This is a long title with just one piece templated">foo</div>
11348
11349 !!end
11350
11351 # SSS FIXME: While it is great we added support for all this,
11352 # do we want to make this part of the spec? Maybe we want to
11353 # deprecate this kind of usage in the future?
11354 !!test
11355 Templates: HTML Tag: 7. Generation of partial attribute key string
11356 !! wikitext
11357 <div st{{echo|yle}}="color:red;">foo</div>
11358 !! html
11359 <div style="color:red;">foo</div>
11360
11361 !!end
11362
11363 !! test
11364 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11365 !! wikitext
11366 <div {{echo|1=id="v1"}}>bar</div>
11367 !! html
11368 <div id="v1">bar</div>
11369
11370 !!end
11371
11372 !! test
11373 Templates: HTML Tag: 9. Multiple template-generated attributes
11374 !! wikitext
11375 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11376 !! html
11377 <div id="v1" title="foo">bar</div>
11378
11379 !!end
11380
11381 !! test
11382 Templates: Support for templates generating attributes and content
11383 !! wikitext
11384 {| {{mixed_attr_content_template}}
11385 |-
11386 |bar
11387 |}
11388 !! html/php
11389 <table style="color:red;" title="T48811">
11390
11391 <tr>
11392 <td>foo
11393 </td></tr>
11394 <tr>
11395 <td>bar
11396 </td></tr></table>
11397
11398 !! html/parsoid
11399 <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|}"]}'>
11400 <tbody><tr>
11401 <td>foo</td></tr>
11402 <tr>
11403 <td>bar</td></tr>
11404 </tbody></table>
11405 !!end
11406
11407 !! test
11408 1. Entities and nowikis inside templated attributes should be handled correctly
11409 !! wikitext
11410 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11411 !! html/php
11412 <div style="background:#f9f9f9;">foo</div>
11413
11414 !! html/parsoid
11415 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11416 !! end
11417
11418 !! test
11419 2. Entities and nowikis inside templated attributes should be handled correctly
11420 !! wikitext
11421 {|
11422 |{{table_attribs_3}}
11423 |}
11424 !! html/php
11425 <table>
11426 <tr>
11427 <td style="background:#f9f9f9;">Foo
11428 </td></tr></table>
11429
11430 !! html/parsoid
11431 <table>
11432 <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>
11433 </tbody></table>
11434 !! end
11435
11436 !! test
11437 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11438 !! wikitext
11439 {{tbl-start}}
11440 |{{table_attribs_3}}
11441 {{tbl-end}}
11442 !! html/php
11443 <table>
11444 <tr>
11445 <td style="background:#f9f9f9;">Foo
11446 </td></tr></table>
11447
11448 !! html/parsoid
11449 <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}}]}'>
11450 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11451 </tbody></table>
11452 !! end
11453
11454 # T107622
11455 !! test
11456 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11457 !! wikitext
11458 {|
11459 | {{table_attribs_6}} hi
11460 |}
11461 !! html/php
11462 <table>
11463 <tr>
11464 <td style="background: red;"> hi
11465 </td></tr></table>
11466
11467 !! html/parsoid
11468 <table>
11469 <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>
11470 </tbody></table>
11471 !! end
11472
11473 !!test
11474 Templates: HTML Tables: 1. Generating start of a HTML table
11475 !! wikitext
11476 {{echo|<table><tr><td>foo</td>}}</tr></table>
11477 !! html
11478 <table><tr><td>foo</td></tr></table>
11479
11480 !!end
11481
11482 !!test
11483 Templates: HTML Tables: 2a. Generating middle of a HTML table
11484 !! wikitext
11485 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11486 !! html
11487 <table><tr><td>foo</td></tr></table>
11488
11489 !!end
11490
11491 !!test
11492 Templates: HTML Tables: 2b. Generating middle of a HTML table
11493 !! wikitext
11494 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11495 !! html
11496 <table><tr><td>foo</td></tr></table>
11497
11498 !!end
11499
11500 !!test
11501 Templates: HTML Tables: 3. Generating end of a HTML table
11502 !! wikitext
11503 <table><tr>{{echo|<td>foo</td></tr></table>}}
11504 !! html
11505 <table><tr><td>foo</td></tr></table>
11506
11507 !!end
11508
11509 !!test
11510 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11511 !! wikitext
11512 {{echo|<table>}}<tr><td>foo</td></tr></table>
11513 !! html
11514 <table><tr><td>foo</td></tr></table>
11515
11516 !!end
11517
11518 !!test
11519 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11520 !! wikitext
11521 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11522 !! html
11523 <table><tr><td>foo</td></tr></table>
11524
11525 !!end
11526
11527 !!test
11528 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11529 !! wikitext
11530 <table><tr>{{echo|<td>}}foo</td></tr></table>
11531 !! html
11532 <table><tr><td>foo</td></tr></table>
11533
11534 !!end
11535
11536 !!test
11537 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11538 !! wikitext
11539 <table><tr><td>foo{{echo|</td>}}</tr></table>
11540 !! html
11541 <table><tr><td>foo</td></tr></table>
11542
11543 !!end
11544
11545 !!test
11546 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11547 !! wikitext
11548 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11549 !! html
11550 <table><tr><td>foo</td></tr></table>
11551
11552 !!end
11553
11554 !!test
11555 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11556 !! wikitext
11557 <table><tr><td>foo</td></tr>{{echo|</table>}}
11558 !! html
11559 <table><tr><td>foo</td></tr></table>
11560
11561 !!end
11562
11563 !!test
11564 Templates: HTML Tables: 5. Proper fostering of categories from inside
11565 !!options
11566 parsoid=wt2html,wt2wt
11567 !! wikitext
11568 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11569 <!--Two categories (Bug 50330)-->
11570 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11571 !! html
11572 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11573 <!--Two categories (Bug 50330)-->
11574 <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>
11575 !!end
11576
11577 !!test
11578 Templates: Wiki Tables: 1a. Fostering of entire template content
11579 !! wikitext
11580 {|
11581 {{echo|a}}
11582 |}
11583 !! html
11584 <table>
11585 a
11586 <tr><td></td></tr></table>
11587
11588 !! html+tidy
11589 <p>a</p>
11590 <table>
11591 <tr>
11592 <td></td>
11593 </tr>
11594 </table>
11595 !! end
11596
11597 !!test
11598 Templates: Wiki Tables: 1b. Fostering of entire template content
11599 !! wikitext
11600 {|
11601 {{echo|<div>}}
11602 foo
11603 {{echo|</div>}}
11604 |}
11605 !! html
11606 <table>
11607 <div>
11608 <p>foo
11609 </p>
11610 </div>
11611 <tr><td></td></tr></table>
11612
11613 !! html+tidy
11614 <div>
11615 <p>foo</p>
11616 </div>
11617 <table>
11618 <tr>
11619 <td></td>
11620 </tr>
11621 </table>
11622 !! end
11623
11624 !!test
11625 Templates: Wiki Tables: 2. Fostering of partial template content
11626 !! wikitext
11627 {|
11628 {{echo|a
11629 <div>b</div>}}
11630 |}
11631 !! html
11632 <table>
11633 a
11634 <div>b</div>
11635 <tr><td></td></tr></table>
11636
11637 !! html+tidy
11638 <p>a</p>
11639 <div>b</div>
11640 <table>
11641 <tr>
11642 <td></td>
11643 </tr>
11644 </table>
11645 !! end
11646
11647 !!test
11648 Templates: Wiki Tables: 3. td-content via multiple templates
11649 !! wikitext
11650 {|
11651 {{echo|{{pipe}}a}}{{echo|b}}
11652 |}
11653 !! html
11654 <table>
11655 <tr>
11656 <td>ab
11657 </td></tr></table>
11658
11659 !!end
11660
11661 !!test
11662 Templates: Wiki Tables: 4. Templated tags, no content
11663 !! wikitext
11664 {{tbl-start}}
11665 {{tbl-end}}
11666 !! html
11667 <table>
11668 <tr><td></td></tr></table>
11669
11670 !!end
11671
11672 !!test
11673 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11674 !! wikitext
11675 {{tbl-start}}
11676 |foo
11677 {{tbl-end}}
11678 !! html
11679 <table>
11680 <tr>
11681 <td>foo
11682 </td></tr></table>
11683
11684 !!end
11685
11686 !!test
11687 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11688 !! wikitext
11689 {{tbl-start}}
11690 {{!}}foo
11691 {{tbl-end}}
11692 !! html
11693 <table>
11694 <tr>
11695 <td>foo
11696 </td></tr></table>
11697
11698 !!end
11699
11700 ## This test case is very specific to Parsoid's internals
11701 ## and is hence only tested for Parsoid's code. Parsoid uses
11702 ## a <meta> marker tag for <ref> tags and they are expanded
11703 ## much later. We are verifying that this <meta> tag usage
11704 ## doesn't prevent foster parenting.
11705 !!test
11706 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11707 !!wikitext
11708 {{PartialTable}}<ref>foo</ref>
11709 |}
11710
11711 <references />
11712 !!html/parsoid
11713 <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">
11714 <tbody>
11715 </tbody></table>
11716
11717 <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>
11718 !!end
11719
11720 !! test
11721 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11722 !! wikitext
11723 {{echo|
11724 {{{!}}
11725 {{!}}-}}
11726 <onlyinclude>
11727 |foo
11728 </onlyinclude>
11729 {{!}}}
11730 !! html/parsoid
11731 <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{{!}}}"]}'>
11732 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11733 <tbody><tr>
11734
11735 <td>foo
11736 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11737 </tbody></table>
11738 !! end
11739
11740 !!test
11741 Templates: Lists: Multi-line list-items via templates
11742 !! wikitext
11743 *{{echo|a {{nonexistent|
11744 unused}}}}
11745 *{{echo|b {{nonexistent|
11746 unused}}}}
11747 !! html
11748 <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>
11749 <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>
11750
11751 !!end
11752
11753 !!test
11754 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11755 !! wikitext
11756 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11757 !! html
11758 <p><i>ab</i>c<i>d</i>e
11759 </p>
11760 !!end
11761
11762 !!test
11763 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11764 (PHP parser generates misnested html)
11765 !! wikitext
11766 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11767 !! html/parsoid
11768 <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>
11769 !!end
11770
11771 !!test
11772 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11773 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11774 !! options
11775 parsoid=wt2html,wt2wt
11776 !! wikitext
11777 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11778 !! html
11779 <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>
11780 <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>
11781 <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>
11782 !!end
11783
11784 !!test
11785 Templates: Ugly nesting: 4. Divs opened/closed across templates
11786 !! wikitext
11787 a<div>b{{echo|c</div>d}}e
11788 !! html
11789 a<div>bc</div>de
11790
11791 !! html+tidy
11792 <p>a</p>
11793 <div>bc</div>
11794 <p>de</p>
11795 !! end
11796
11797 !!test
11798 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11799 (Parsoid-centric)
11800 !! options
11801 parsoid
11802 !! wikitext
11803 {|
11804 |{{echo|foo</table>}}
11805 |bar
11806 |}
11807 !! html
11808 <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|}"]}'>
11809
11810 <tbody>
11811 <tr>
11812 <td>foo</td></tr></tbody></table><span about="#mwt1">
11813 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11814 |}</span>
11815 !!end
11816
11817 !!test
11818 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11819 (Parsoid-centric)
11820 !! options
11821 parsoid
11822 !! wikitext
11823 <table>
11824 <tr>
11825 <td>
11826 <table>
11827 <tr>
11828 <td>1. {{echo|foo </table>}}</td>
11829 <td> bar </td>
11830 <td>2. {{echo|baz </table>}}</td>
11831 </tr>
11832 <tr>
11833 <td>abc</td>
11834 </tr>
11835 </table>
11836 </td>
11837 </tr>
11838 <tr>
11839 <td>xyz</td>
11840 </tr>
11841 </table>
11842 !! html
11843 <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>"]}'>
11844 <tbody><tr>
11845 <td>
11846 <table>
11847 <tbody><tr>
11848 <td>1. foo </td></tr></tbody></table></td>
11849 <td> bar </td>
11850 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11851 </span><span about="#mwt2">
11852 </span><span about="#mwt2">
11853 </span><span about="#mwt2">abc</span><span about="#mwt2">
11854 </span><span about="#mwt2">
11855 </span><span about="#mwt2">
11856 </span><span about="#mwt2">
11857 </span><span about="#mwt2">
11858 </span><span about="#mwt2">
11859 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11860 </span><span about="#mwt2">
11861 </span>
11862 !!end
11863
11864 !! test
11865 Templates: Ugly templates: 3. newline-only template parameter
11866 !! wikitext
11867 foo {{echo|
11868 }}
11869 !! html
11870 <p>foo
11871 </p>
11872 !! end
11873
11874 # This looks like a bug: a single newline triggers p/br for some reason.
11875 !! test
11876 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11877 !! wikitext
11878 {{echo|
11879 }}
11880 !! html
11881 <p><br />
11882 </p>
11883 !! end
11884
11885 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11886 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11887 !! test
11888 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11889 !! wikitext
11890 {{echo|<table>}}
11891 {{echo|<div>foo}}
11892 {{echo|</table>}}
11893 !! html/parsoid
11894 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11895 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11896 </table>
11897 !! end
11898
11899 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11900 # that are "identical" and generate nesting cycles in the algorithm
11901 !! test
11902 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11903 !! wikitext
11904 {{echo|<table><tr><td><table>}}
11905 {{echo|<div>}}
11906 {{echo|</div>}}
11907 !! html/parsoid
11908 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11909 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11910 </table></td></tr></tbody></table>
11911 !! end
11912
11913 !! test
11914 Templates: Parameters substituted at the top-level
11915 !! wikitext
11916 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
11917 !! html/php
11918 <p><i>who</i> me? <b>never!</b>
11919 </p>
11920 !! html/parsoid
11921 <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>
11922 !! end
11923
11924 !!test
11925 Parser Functions: 1. Simple example
11926 !! wikitext
11927 {{uc:foo}}
11928 !! html
11929 <p>FOO
11930 </p>
11931 !!end
11932
11933 !!test
11934 Parser Functions: 2. Nested use (only outermost should be marked up)
11935 !! wikitext
11936 {{uc:{{lc:FOO}}}}
11937 !! html
11938 <p>FOO
11939 </p>
11940 !!end
11941
11942 ###
11943 ### Pre-save transform tests
11944 ###
11945 !! test
11946 pre-save transform: subst:
11947 !! options
11948 pst
11949 !! wikitext
11950 {{subst:test}}
11951 !! html/php
11952 This is a test template
11953 !! end
11954
11955 !! test
11956 pre-save transform: normal template
11957 !! options
11958 pst
11959 !! wikitext
11960 {{test}}
11961 !! html/php
11962 {{test}}
11963 !! end
11964
11965 !! test
11966 pre-save transform: nonexistent template
11967 !! options
11968 pst
11969 !! wikitext
11970 {{thistemplatedoesnotexist}}
11971 !! html/php
11972 {{thistemplatedoesnotexist}}
11973 !! end
11974
11975 !! test
11976 pre-save transform: subst magic variables
11977 !! options
11978 pst
11979 !! wikitext
11980 {{subst:SITENAME}}
11981 !! html/php
11982 MediaWiki
11983 !! end
11984
11985 # This is bug 89, which I fixed. -- wtm
11986 !! test
11987 pre-save transform: subst: templates with parameters
11988 !! options
11989 pst
11990 !! wikitext
11991 {{subst:paramtest|param="something else"}}
11992 !! html/php
11993 This is a test template with parameter "something else"
11994 !! end
11995
11996 !! article
11997 Template:nowikitest
11998 !! text
11999 <nowiki>'''not wiki'''</nowiki>
12000 !! endarticle
12001
12002 !! test
12003 pre-save transform: nowiki in subst (bug 1188)
12004 !! options
12005 pst
12006 !! wikitext
12007 {{subst:nowikitest}}
12008 !! html/php
12009 <nowiki>'''not wiki'''</nowiki>
12010 !! end
12011
12012 !! article
12013 Template:commenttest
12014 !! text
12015 This template has <!-- a comment --> in it.
12016 !! endarticle
12017
12018 !! test
12019 pre-save transform: comment in subst (bug 1936)
12020 !! options
12021 pst
12022 !! wikitext
12023 {{subst:commenttest}}
12024 !! html/php
12025 This template has <!-- a comment --> in it.
12026 !! end
12027
12028 !! test
12029 pre-save transform: unclosed tag
12030 !! options
12031 pst noxml
12032 !! wikitext
12033 <nowiki>'''not wiki'''
12034 !! html/php
12035 <nowiki>'''not wiki'''
12036 !! end
12037
12038 !! test
12039 pre-save transform: mixed tag case
12040 !! options
12041 pst noxml
12042 !! wikitext
12043 <NOwiki>'''not wiki'''</noWIKI>
12044 !! html/php
12045 <NOwiki>'''not wiki'''</noWIKI>
12046 !! end
12047
12048 !! test
12049 pre-save transform: unclosed comment in <nowiki>
12050 !! options
12051 pst noxml
12052 !! wikitext
12053 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12054 !! html/php
12055 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12056 !!end
12057
12058 # Leading @ in this template definition works around a limitation
12059 # in parsoid's parserTests which otherwise strips the <span> from the
12060 # result (confusing it for a template wrapper)
12061 !! article
12062 Template:dangerous
12063 !!text
12064 @<span onmouseover="alert('crap')">Oh no</span>
12065 !!endarticle
12066
12067 !!test
12068 (confirming safety of fix for subst bug 1936)
12069 !! wikitext
12070 {{Template:dangerous}}
12071 !! html
12072 <p>@<span>Oh no</span>
12073 </p>
12074 !! end
12075
12076 !! test
12077 pre-save transform: comment containing gallery (bug 5024)
12078 !! options
12079 pst
12080 !! wikitext
12081 <!-- <gallery>data</gallery> -->
12082 !! html/php
12083 <!-- <gallery>data</gallery> -->
12084 !!end
12085
12086 !! test
12087 pre-save transform: comment containing extension
12088 !! options
12089 pst
12090 !! wikitext
12091 <!-- <tag>data</tag> -->
12092 !! html/php
12093 <!-- <tag>data</tag> -->
12094 !!end
12095
12096 !! test
12097 pre-save transform: comment containing nowiki
12098 !! options
12099 pst
12100 !! wikitext
12101 <!-- <nowiki>data</nowiki> -->
12102 !! html/php
12103 <!-- <nowiki>data</nowiki> -->
12104 !!end
12105
12106 !! test
12107 pre-save transform: <noinclude> in subst (bug 3298)
12108 !! options
12109 pst
12110 !! wikitext
12111 {{subst:Includes}}
12112 !! html/php
12113 Foobar
12114 !! end
12115
12116 !! test
12117 pre-save transform: <onlyinclude> in subst (bug 3298)
12118 !! options
12119 pst
12120 !! wikitext
12121 {{subst:Includes2}}
12122 !! html/php
12123 Foo
12124 !! end
12125
12126 !! article
12127 Template:SubstTest
12128 !!text
12129 {{<includeonly>subst:</includeonly>Includes}}
12130 !! endarticle
12131
12132 !! article
12133 Template:SafeSubstTest
12134 !! text
12135 {{<includeonly>safesubst:</includeonly>Includes}}
12136 !! endarticle
12137
12138 !! test
12139 bug 22297: safesubst: works during PST
12140 !! options
12141 pst
12142 !! wikitext
12143 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12144 !! html/php
12145 FoobarFoobar
12146 !! end
12147
12148 !! test
12149 bug 22297: safesubst: works during normal parse
12150 !! wikitext
12151 {{SafeSubstTest}}
12152 !! html
12153 <p>Foobar
12154 </p>
12155 !! end
12156
12157 !! test
12158 subst: does not work during normal parse
12159 !! wikitext
12160 {{SubstTest}}
12161 !! html
12162 <p>{{subst:Includes}}
12163 </p>
12164 !! end
12165
12166 !! test
12167 pre-save transform: context links ("pipe trick")
12168 !! options
12169 pst
12170 !! wikitext
12171 [[Article (context)|]]
12172 [[Bar:Article|]]
12173 [[:Bar:Article|]]
12174 [[Bar:Article (context)|]]
12175 [[:Bar:Article (context)|]]
12176 [[|Article]]
12177 [[|Article (context)]]
12178 [[Bar:X (Y) Z|]]
12179 [[:Bar:X (Y) Z|]]
12180 !! html/php
12181 [[Article (context)|Article]]
12182 [[Bar:Article|Article]]
12183 [[:Bar:Article|Article]]
12184 [[Bar:Article (context)|Article]]
12185 [[:Bar:Article (context)|Article]]
12186 [[Article]]
12187 [[Article (context)]]
12188 [[Bar:X (Y) Z|X (Y) Z]]
12189 [[:Bar:X (Y) Z|X (Y) Z]]
12190 !! end
12191
12192 !! test
12193 pre-save transform: context links ("pipe trick") with interwiki prefix
12194 !! options
12195 pst
12196 !! wikitext
12197 [[interwiki:Article|]]
12198 [[:interwiki:Article|]]
12199 [[interwiki:Bar:Article|]]
12200 [[:interwiki:Bar:Article|]]
12201 !! html/php
12202 [[interwiki:Article|Article]]
12203 [[:interwiki:Article|Article]]
12204 [[interwiki:Bar:Article|Bar:Article]]
12205 [[:interwiki:Bar:Article|Bar:Article]]
12206 !! end
12207
12208 !! test
12209 pre-save transform: context links ("pipe trick") with parens in title
12210 !! options
12211 pst title=[[Somearticle (context)]]
12212 !! wikitext
12213 [[|Article]]
12214 !! html/php
12215 [[Article (context)|Article]]
12216 !! end
12217
12218 !! test
12219 pre-save transform: context links ("pipe trick") with comma in title
12220 !! options
12221 pst title=[[Someplace, Somewhere]]
12222 !! wikitext
12223 [[|Otherplace]]
12224 [[Otherplace, Elsewhere|]]
12225 [[Otherplace, Elsewhere, Anywhere|]]
12226 !! html/php
12227 [[Otherplace, Somewhere|Otherplace]]
12228 [[Otherplace, Elsewhere|Otherplace]]
12229 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12230 !! end
12231
12232 !! test
12233 pre-save transform: context links ("pipe trick") with parens and comma
12234 !! options
12235 pst title=[[Someplace (IGNORED), Somewhere]]
12236 !! wikitext
12237 [[|Otherplace]]
12238 [[Otherplace (place), Elsewhere|]]
12239 !! html/php
12240 [[Otherplace, Somewhere|Otherplace]]
12241 [[Otherplace (place), Elsewhere|Otherplace]]
12242 !! end
12243
12244 !! test
12245 pre-save transform: context links ("pipe trick") with comma and parens
12246 !! options
12247 pst title=[[Who, me? (context)]]
12248 !! wikitext
12249 [[|Yes, you.]]
12250 [[Me, Myself, and I (1937 song)|]]
12251 !! html/php
12252 [[Yes, you. (context)|Yes, you.]]
12253 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12254 !! end
12255
12256 !! test
12257 pre-save transform: context links ("pipe trick") with namespace
12258 !! options
12259 pst title=[[Ns:Somearticle]]
12260 !! wikitext
12261 [[|Article]]
12262 !! html/php
12263 [[Ns:Article|Article]]
12264 !! end
12265
12266 !! test
12267 pre-save transform: context links ("pipe trick") with namespace and parens
12268 !! options
12269 pst title=[[Ns:Somearticle (context)]]
12270 !! wikitext
12271 [[|Article]]
12272 !! html/php
12273 [[Ns:Article (context)|Article]]
12274 !! end
12275
12276 !! test
12277 pre-save transform: context links ("pipe trick") with namespace and comma
12278 !! options
12279 pst title=[[Ns:Somearticle, Context, Whatever]]
12280 !! wikitext
12281 [[|Article]]
12282 !! html/php
12283 [[Ns:Article, Context, Whatever|Article]]
12284 !! end
12285
12286 !! test
12287 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12288 !! options
12289 pst title=[[Ns:Somearticle, Context (context)]]
12290 !! wikitext
12291 [[|Article]]
12292 !! html/php
12293 [[Ns:Article (context)|Article]]
12294 !! end
12295
12296 !! test
12297 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12298 !! options
12299 pst title=[[Ns:Somearticle (IGNORED), Context]]
12300 !! wikitext
12301 [[|Article]]
12302 !! html/php
12303 [[Ns:Article, Context|Article]]
12304 !! end
12305
12306 !! test
12307 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12308 !! options
12309 pst
12310 !! wikitext
12311 [[Article(context)|]]
12312 [[Bar:Article(context)|]]
12313 [[:Bar:Article(context)|]]
12314 [[|Article(context)]]
12315 [[Bar:X(Y)Z|]]
12316 [[:Bar:X(Y)Z|]]
12317 !! html/php
12318 [[Article(context)|Article]]
12319 [[Bar:Article(context)|Article]]
12320 [[:Bar:Article(context)|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 full-width parens and space (Japanese and Chinese style, bug 30149)
12328 !! options
12329 pst
12330 !! wikitext
12331 [[Article (context)|]]
12332 [[Bar:Article (context)|]]
12333 [[:Bar:Article (context)|]]
12334 [[|Article (context)]]
12335 [[Bar:X (Y) Z|]]
12336 [[:Bar:X (Y) Z|]]
12337 !! html/php
12338 [[Article (context)|Article]]
12339 [[Bar:Article (context)|Article]]
12340 [[:Bar:Article (context)|Article]]
12341 [[Article (context)]]
12342 [[Bar:X (Y) Z|X (Y) Z]]
12343 [[:Bar:X (Y) Z|X (Y) Z]]
12344 !! end
12345
12346 !! test
12347 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12348 !! options
12349 pst
12350 !! wikitext
12351 [[Article(context)|]]
12352 [[Bar:Article(context)|]]
12353 [[:Bar:Article(context)|]]
12354 [[|Article(context)]]
12355 [[Bar:X(Y)Z|]]
12356 [[:Bar:X(Y)Z|]]
12357 !! html/php
12358 [[Article(context)|Article]]
12359 [[Bar:Article(context)|Article]]
12360 [[:Bar:Article(context)|Article]]
12361 [[Article(context)]]
12362 [[Bar:X(Y)Z|X(Y)Z]]
12363 [[:Bar:X(Y)Z|X(Y)Z]]
12364 !! end
12365
12366 !! test
12367 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12368 !! options
12369 pst
12370 !! wikitext
12371 [[Article (context), context|]]
12372 [[Article (context),context|]]
12373 [[Bar:Article (context), context|]]
12374 [[Bar:Article (context),context|]]
12375 [[:Bar:Article (context), context|]]
12376 [[:Bar:Article (context),context|]]
12377 !! html/php
12378 [[Article (context), context|Article]]
12379 [[Article (context),context|Article]]
12380 [[Bar:Article (context), context|Article]]
12381 [[Bar:Article (context),context|Article]]
12382 [[:Bar:Article (context), context|Article]]
12383 [[:Bar:Article (context),context|Article]]
12384 !! end
12385
12386 !! test
12387 pre-save transform: trim trailing empty lines
12388 !! options
12389 pst
12390 !! wikitext
12391 Empty lines are trimmed
12392
12393
12394
12395
12396 !! html/php
12397 Empty lines are trimmed
12398 !! end
12399
12400 !! test
12401 pre-save transform: Signature expansion
12402 !! options
12403 pst
12404 !! wikitext
12405 * ~~~
12406 * <noinclude>~~~</noinclude>
12407 * <includeonly>~~~</includeonly>
12408 * <onlyinclude>~~~</onlyinclude>
12409 !! html/php
12410 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12411 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12412 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12413 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12414 !! end
12415
12416
12417 !! test
12418 pre-save transform: Signature expansion in nowiki tags (bug 93)
12419 !! options
12420 pst disabled
12421 !! wikitext
12422 Shall not expand:
12423
12424 <nowiki>~~~~</nowiki>
12425
12426 <includeonly><nowiki>~~~~</nowiki></includeonly>
12427
12428 <noinclude><nowiki>~~~~</nowiki></noinclude>
12429
12430 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12431
12432 {{subst:Foo}} shall be converted to FOO
12433
12434 As well as inside noinclude/onlyinclude
12435 <noinclude>{{subst:Foo}}</noinclude>
12436 <onlyinclude>{{subst:Foo}}</onlyinclude>
12437
12438 But not inside includeonly
12439 <includeonly>{{subst:Foo}}</includeonly>
12440 !! html/php
12441 Shall not expand:
12442
12443 <nowiki>~~~~</nowiki>
12444
12445 <includeonly><nowiki>~~~~</nowiki></includeonly>
12446
12447 <noinclude><nowiki>~~~~</nowiki></noinclude>
12448
12449 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12450
12451 FOO shall be converted to FOO
12452
12453 As well as inside noinclude/onlyinclude
12454 <noinclude>FOO</noinclude>
12455 <onlyinclude>FOO</onlyinclude>
12456
12457 But not inside includeonly
12458 <includeonly>{{subst:Foo}}</includeonly>
12459 !! end
12460
12461 !! test
12462 Parsoid: Recognize nowiki with trailing space in tags
12463 !! options
12464 parsoid=wt2html
12465 !! wikitext
12466 <nowiki ><div>[[foo]]</nowiki >
12467
12468 a<nowiki / >b
12469
12470 c<nowiki />d
12471
12472 e<nowiki/ >f
12473 !! html
12474 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12475 <p>ab</p>
12476 <p>cd</p>
12477 <p>ef</p>
12478 !! end
12479
12480 !! test
12481 Parsoid: Recognize nowiki with odd capitalization
12482 !! options
12483 parsoid=wt2html
12484 !! wikitext
12485 <noWikI ><div>[[foo]]</Nowiki >
12486 !! html
12487 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12488 !! end
12489
12490
12491 !! test
12492 Parsoid: Escape nowiki with trailing space in tags
12493 !! options
12494 parsoid=html2wt
12495 !! html/parsoid
12496 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12497 <p>a&lt;nowiki /&gt;b</p>
12498 <p>c&lt;nowiki/ &gt;d</p>
12499 !! wikitext
12500 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12501
12502 a&lt;nowiki /&gt;b
12503
12504 c&lt;nowiki/ &gt;d
12505 !! end
12506
12507 !! test
12508 Parsoid: Escape weird noWikI capitalizations
12509 !! options
12510 parsoid=html2wt
12511 !! html/parsoid
12512 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12513 !! wikitext
12514 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12515 !! end
12516
12517 ###
12518 ### Message transform tests
12519 ###
12520 !! test
12521 message transform: magic variables
12522 !! options
12523 msg
12524 !! wikitext
12525 {{SITENAME}}
12526 !! html
12527 MediaWiki
12528 !! end
12529
12530 !! test
12531 message transform: should not transform wiki markup
12532 !! options
12533 msg
12534 !! wikitext
12535 ''test''
12536 !! html
12537 ''test''
12538 !! end
12539
12540 !! test
12541 message transform: <noinclude> in transcluded template (bug 4926)
12542 !! options
12543 msg
12544 !! wikitext
12545 {{Includes}}
12546 !! html
12547 Foobar
12548 !! end
12549
12550 !! test
12551 message transform: <onlyinclude> in transcluded template (bug 4926)
12552 !! options
12553 msg
12554 !! wikitext
12555 {{Includes2}}
12556 !! html
12557 Foo
12558 !! end
12559
12560 !! test
12561 {{#special:}} page name, known
12562 !! options
12563 msg
12564 !! wikitext
12565 {{#special:Recentchanges}}
12566 !! html
12567 Special:RecentChanges
12568 !! end
12569
12570 !! test
12571 {{#special:}} page name with subpage, known
12572 !! options
12573 msg
12574 !! wikitext
12575 {{#special:Recentchanges/param}}
12576 !! html
12577 Special:RecentChanges/param
12578 !! end
12579
12580 !! test
12581 {{#special:}} page name, unknown
12582 !! options
12583 msg
12584 !! wikitext
12585 {{#special:foobar nonexistent}}
12586 !! html
12587 Special:Foobar nonexistent
12588 !! end
12589
12590 !! test
12591 {{#speciale:}} page name, known
12592 !! options
12593 msg
12594 !! wikitext
12595 {{#speciale:Recentchanges}}
12596 !! html
12597 Special:RecentChanges
12598 !! end
12599
12600 !! test
12601 {{#speciale:}} page name with subpage, known
12602 !! options
12603 msg
12604 !! wikitext
12605 {{#speciale:Recentchanges/param}}
12606 !! html
12607 Special:RecentChanges/param
12608 !! end
12609
12610 !! test
12611 {{#speciale:}} page name, unknown
12612 !! options
12613 msg
12614 !! wikitext
12615 {{#speciale:foobar nonexistent}}
12616 !! html
12617 Special:Foobar_nonexistent
12618 !! end
12619
12620 ###
12621 ### Images
12622 ###
12623 ### For Parsoid-specific tests, see
12624 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12625
12626 !! test
12627 Simple image
12628 !! options
12629 parsoid=wt2html,wt2wt,html2html
12630 !! wikitext
12631 [[Image:foobar.jpg]]
12632 !! html/php
12633 <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>
12634 </p>
12635 !! html/parsoid
12636 <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>
12637 !! end
12638
12639 !! test
12640 Simple image (using File: namespace, now canonical)
12641 !! wikitext
12642 [[File:Foobar.jpg]]
12643 !! html/php
12644 <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>
12645 </p>
12646 !! html/parsoid
12647 <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>
12648 !! end
12649
12650 !! test
12651 Right-aligned image
12652 !! wikitext
12653 [[File:Foobar.jpg|right]]
12654 !! html/php
12655 <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>
12656
12657 !! html/parsoid
12658 <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>
12659 !! end
12660
12661 !! test
12662 Image with caption
12663 !! wikitext
12664 [[File:Foobar.jpg|right|Caption text]]
12665 !! html/php
12666 <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>
12667
12668 !! html/parsoid
12669 <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>
12670 !! end
12671
12672 !! test
12673 Image with caption, bug 53312 #1
12674 !! wikitext
12675 [[File:Foobar.jpg|right|Caption page stuff]]
12676 !! html/php
12677 <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>
12678
12679 !! html/parsoid
12680 <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>
12681 !! end
12682
12683 !! test
12684 Image with caption, bug 53312 #2
12685 !! wikitext
12686 [[File:Foobar.jpg|right|Caption page=]]
12687 !! html/php
12688 <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>
12689
12690 !! html/parsoid
12691 <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>
12692 !! end
12693
12694 !! test
12695 Image with caption, bug 53312 #3
12696 !! wikitext
12697 [[File:Foobar.jpg|right|Caption page=stuff]]
12698 !! html/php
12699 <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>
12700
12701 !! html/parsoid
12702 <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>
12703 !! end
12704
12705 !! test
12706 Allow empty links in image captions (Bug 60753)
12707 !! options
12708 thumbsize=220
12709 !! wikitext
12710 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12711 [[]]
12712 [[Link2]]
12713 ]]
12714 !! html/php
12715 <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>
12716
12717 !! html/parsoid
12718 <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>
12719 [[]]
12720 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12721 </figcaption></figure>
12722 !! end
12723
12724 !! test
12725 Titles in unlinked images (T23454)
12726 !! wikitext
12727 [[File:Foobar.jpg|link=|stuff]]
12728 !! html/php
12729 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12730 </p>
12731 !! end
12732
12733 !! test
12734 Link with empty target
12735 !! wikitext
12736 [[]]
12737 !! html
12738 <p>[[]]
12739 </p>
12740 !! end
12741
12742 !! test
12743 Image with link trail
12744 !! wikitext
12745 Linktrails should not work for images: [[File:Foobar.jpg]]s
12746 !! html/php
12747 <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
12748 </p>
12749 !! html/parsoid
12750 <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>
12751 !! end
12752
12753 !! test
12754 Image with empty attribute
12755 !! options
12756 parsoid=wt2html,wt2wt,html2html
12757 !! wikitext
12758 [[File:Foobar.jpg|right||Caption text]]
12759 !! html/php
12760 <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>
12761
12762 !! html/parsoid
12763 <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>
12764 !! end
12765
12766 !! test
12767 1. Block image with individual attributes from templates
12768 !! wikitext
12769 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12770 !! html/php
12771 <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>
12772
12773 !! html/parsoid
12774 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12775 !! end
12776
12777 !! test
12778 2. Block Image with individual attributes from templates
12779 !! wikitext
12780 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12781 !! html/php
12782 <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>
12783
12784 !! html/parsoid
12785 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12786 !! end
12787
12788 !! test
12789 3. Inline image with individual attributes from templates
12790 !! wikitext
12791 [[File:Foobar.jpg|{{echo|50px}}]]
12792 !! html/php
12793 <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>
12794 </p>
12795 !! html/parsoid
12796 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12797 !! end
12798
12799 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12800 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12801 !! test
12802 Image with multiple attributes from the same template
12803 !! wikitext
12804 [[File:Foobar.jpg|{{image_attribs}}]]
12805 !! html/php
12806 <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>
12807
12808 !! html/parsoid
12809 <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>
12810 !! end
12811
12812 !! test
12813 Image with link tails
12814 !! options
12815 thumbsize=220
12816 !! wikitext
12817 123[[File:Foobar.jpg]]456
12818 123[[File:Foobar.jpg|right]]456
12819 123[[File:Foobar.jpg|thumb]]456
12820 !! html/php
12821 <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
12822 </p>
12823 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
12824 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
12825
12826 !! html/php+tidy
12827 <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>
12828 <p>123</p>
12829 <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>
12830 <p>456 123</p>
12831 <div class="thumb tright">
12832 <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>
12833 <div class="thumbcaption">
12834 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12835 </div>
12836 </div>
12837 </div>
12838 <p>456</p>
12839 !! html/parsoid
12840 <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>
12841 <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>
12842 <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>
12843 !! end
12844
12845 !! test
12846 Image with multiple captions -- only last one is accepted
12847 !! wikitext
12848 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12849 !! html/php
12850 <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>
12851
12852 !! html/parsoid
12853 <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>
12854 !! end
12855
12856 !! test
12857 Image with multiple widths -- use last
12858 !! wikitext
12859 [[File:Foobar.jpg|200px|300px|caption]]
12860 !! html/php
12861 <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>
12862 </p>
12863 !! html/parsoid
12864 <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>
12865 !! end
12866
12867 !! test
12868 Image with multiple alignments -- use first (bug 48664)
12869 !! options
12870 thumbsize=220
12871 !! wikitext
12872 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12873
12874 [[File:Foobar.jpg|middle|text-top|caption]]
12875 !! html/php
12876 <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>
12877 <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>
12878 </p>
12879 !! html/parsoid
12880 <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>
12881 <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>
12882 !! end
12883
12884 !! test
12885 Image with width attribute at different positions
12886 !! wikitext
12887 [[File:Foobar.jpg|200px|right|Caption]]
12888 [[File:Foobar.jpg|right|200px|Caption]]
12889 [[File:Foobar.jpg|right|Caption|200px]]
12890 !! html/php
12891 <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>
12892 <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>
12893 <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>
12894
12895 !! html/parsoid
12896 <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>
12897 <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>
12898 <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>
12899 !! end
12900
12901 # a sad bit of backward-compatibility
12902 !! test
12903 Image with size specified with pxpx (bug 13500, 51628)
12904 !! options
12905 parsoid=wt2html,wt2wt,html2html
12906 !! wikitext
12907 [[File:Foobar.jpg|20pxpx]]
12908 [[File:Foobar.jpg|200x20pxpx]]
12909 !! html/php
12910 <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>
12911 <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>
12912 </p>
12913 !! html/parsoid
12914 <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>
12915 !! end
12916
12917 !! test
12918 Image with link parameter, wiki target
12919 !! wikitext
12920 [[File:Foobar.jpg|link=Main Page]]
12921 !! html/php
12922 <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>
12923 </p>
12924 !! html/parsoid
12925 <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>
12926 !! end
12927
12928 # parsoid bug 49293 (part 1)
12929 !! test
12930 Image with link parameter, URL target
12931 !! wikitext
12932 [[File:Foobar.jpg|link=http://example.com/]]
12933 !! html/php
12934 <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>
12935 </p>
12936 !! html/parsoid
12937 <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>
12938 !! end
12939
12940 # parsoid bug 49293 (part 2)
12941 !! test
12942 Image with link parameter, protocol-less URL target
12943 !! wikitext
12944 [[File:Foobar.jpg|link=//example.com/]]
12945 !! html/php
12946 <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>
12947 </p>
12948 !! html/parsoid
12949 <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>
12950 !! end
12951
12952 !! test
12953 Escaping non-block captions (T107435)
12954 !! options
12955 parsoid={
12956 "modes": ["wt2wt"],
12957 "changes": [
12958 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12959 ]
12960 }
12961 !! wikitext
12962 [[Image:Foobar.jpg|caption]]
12963 !! wikitext/edited
12964 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12965 !! end
12966
12967 # wgExternalLinkTarget not supported by Parsoid
12968 !! test
12969 Image with link parameter, wgExternalLinkTarget
12970 !! wikitext
12971 [[Image:foobar.jpg|link=http://example.com/]]
12972 !! config
12973 wgExternalLinkTarget='foobar'
12974 !! html/php
12975 <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>
12976 </p>
12977 !! end
12978
12979 !! test
12980 Image with link parameter, wgNoFollowLinks set to false
12981 !! wikitext
12982 [[Image:foobar.jpg|link=http://example.com/]]
12983 !! config
12984 wgNoFollowLinks=false
12985 !! html
12986 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12987 </p>
12988 !! end
12989
12990 !! test
12991 Image with link parameter, wgNoFollowDomainExceptions
12992 !! wikitext
12993 [[Image:foobar.jpg|link=http://example.com/]]
12994 !! config
12995 wgNoFollowDomainExceptions='example.com'
12996 !! html
12997 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12998 </p>
12999 !! end
13000
13001 # wgExternalLinkTarget not supported by Parsoid
13002 !! test
13003 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13004 !! wikitext
13005 [[Image:foobar.jpg|link=http://example.com/|Title]]
13006 !! config
13007 wgExternalLinkTarget='foobar'
13008 !! html/php
13009 <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>
13010 </p>
13011 !! end
13012
13013 !! test
13014 Image with empty link parameter
13015 !! wikitext
13016 [[File:Foobar.jpg|link=]]
13017 !! html/php
13018 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13019 </p>
13020 !! html/parsoid
13021 <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>
13022 !! end
13023
13024 !! test
13025 Image with link parameter (wiki target) and unnamed parameter
13026 !! wikitext
13027 [[File:Foobar.jpg|link=Main_Page|Title]]
13028 !! html/php
13029 <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>
13030 </p>
13031 !! html/parsoid
13032 <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>
13033 !! end
13034
13035 !! test
13036 Image with link parameter (URL target) and unnamed parameter
13037 !! wikitext
13038 [[File:Foobar.jpg|link=http://example.com/|Title]]
13039 !! html/php
13040 <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>
13041 </p>
13042 !! html/parsoid
13043 <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>
13044 !! end
13045
13046 !! test
13047 Thumbnail image with link parameter
13048 !! options
13049 thumbsize=220
13050 parsoid=wt2html,wt2wt,html2html
13051 !! wikitext
13052 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13053 !! html/php
13054 <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>
13055
13056 !! html/parsoid
13057 <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>
13058 !! end
13059
13060 !! test
13061 Manually-specified thumbnail image
13062 !! options
13063 thumbsize=220
13064 !! wikitext
13065 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13066 !! html/php
13067 <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>
13068
13069 !! html/parsoid
13070 <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>
13071 !! end
13072
13073 !! test
13074 Manually-specified thumbnail image with explicit link to wiki page
13075 !! options
13076 thumbsize=220
13077 parsoid=wt2html,wt2wt,html2html
13078 !! wikitext
13079 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13080 !! html/php
13081 <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>
13082
13083 !! html/parsoid
13084 <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>
13085 !! end
13086
13087 !! test
13088 Manually-specified thumbnail image with explicit link to url
13089 !! options
13090 thumbsize=220
13091 parsoid=wt2html,wt2wt,html2html
13092 !! wikitext
13093 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13094 !! html/php
13095 <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>
13096
13097 !! html/parsoid
13098 <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>
13099 !! end
13100
13101 !! test
13102 Manually-specified thumbnail image with explicit no link
13103 !! options
13104 thumbsize=220
13105 parsoid=wt2html,wt2wt,html2html
13106 !! wikitext
13107 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13108 !! html/php
13109 <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>
13110
13111 !! html/parsoid
13112 <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>
13113 !! end
13114
13115 !! test
13116 Manually-specified thumbnail image with explicit link and alt text
13117 !! options
13118 thumbsize=220
13119 parsoid=wt2html,wt2wt,html2html
13120 !! wikitext
13121 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13122 !! html/php
13123 <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>
13124
13125 !! html/parsoid
13126 <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>
13127 !! end
13128
13129 !! test
13130 Image with frame and link
13131 !! options
13132 parsoid=wt2html,wt2wt,html2html
13133 !! wikitext
13134 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13135 !! html/php
13136 <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>
13137
13138 !! html/parsoid
13139 <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>
13140 !! end
13141
13142 !! test
13143 Image with frame and link and explicit alt
13144 !! options
13145 parsoid=wt2html,wt2wt,html2html
13146 !! wikitext
13147 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13148 !! html/php
13149 <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>
13150
13151 !! html/parsoid
13152 <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>
13153 !! end
13154
13155 !! test
13156 Image with wiki markup in implicit alt
13157 !! wikitext
13158 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13159
13160 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13161 !! html/php
13162 <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>
13163 </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>
13164 </p>
13165 !! html/parsoid
13166 <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>
13167 <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>
13168 !! end
13169
13170 !! test
13171 Alt image option should handle most kinds of wikitext without barfing
13172 !! wikitext
13173 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13174 !! html/php
13175 <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>
13176
13177 !! html/parsoid
13178 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13179 !! end
13180
13181 ###################
13182 # Conflicting image format options.
13183 # First option specified should 'win'.
13184 # All three cases in each test should be identical.
13185
13186 !! test
13187 Image with 'frameless' first.
13188 !! options
13189 parsoid=wt2html,wt2wt,html2html
13190 !! wikitext
13191 [[File:Foobar.jpg|frameless|caption]]
13192
13193 [[File:Foobar.jpg|frameless|frame|caption]]
13194
13195 [[File:Foobar.jpg|frameless|thumb|caption]]
13196 !! html/php
13197 <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>
13198 </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>
13199 </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>
13200 </p>
13201 !! html/parsoid
13202 <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>
13203 <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>
13204 <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>
13205 !! end
13206
13207 !! test
13208 Image with 'frame' first.
13209 !! options
13210 parsoid=wt2html,wt2wt,html2html
13211 !! wikitext
13212 [[File:Foobar.jpg|frame|caption]]
13213 [[File:Foobar.jpg|frame|frameless|caption]]
13214 [[File:Foobar.jpg|frame|thumb|caption]]
13215 !! html/php
13216 <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>
13217 <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>
13218 <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>
13219
13220 !! html/parsoid
13221 <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>
13222 <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>
13223 <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>
13224 !! end
13225
13226 !! test
13227 Image with 'thumb' first.
13228 !! options
13229 parsoid=wt2html,wt2wt,html2html
13230 !! wikitext
13231 [[File:Foobar.jpg|thumb|caption]]
13232 [[File:Foobar.jpg|thumb|frameless|caption]]
13233 [[File:Foobar.jpg|thumb|frame|caption]]
13234 !! html/php
13235 <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>
13236 <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>
13237 <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>
13238
13239 !! html/parsoid
13240 <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>
13241 <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>
13242 <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>
13243 !! end
13244
13245 ###################
13246 # Image sizing.
13247 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13248 # and https://phabricator.wikimedia.org/T64258
13249 # Foobar has actual size of 1941x220
13250 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13251 # a scalable format.
13252 # 2. Framed images always ignore size options; always render at default size.
13253 # 3. "Unspecified format" and border are the only types which can be
13254 # enlarged.
13255
13256 !! test
13257 Image: "unspecified format" and border enlarge
13258 !! options
13259 parsoid=wt2html,wt2wt,html2html
13260 !! wikitext
13261 [[File:Foobar.jpg|2000px]]
13262
13263 [[File:Foobar.jpg|border|2000px]]
13264 !! html/php
13265 <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>
13266 </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>
13267 </p>
13268 !! html/parsoid
13269 <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>
13270 <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>
13271 !! end
13272
13273 !! test
13274 Image: "unspecified format" and border reduce
13275 !! options
13276 parsoid=wt2html,wt2wt,html2html
13277 !! wikitext
13278 [[File:Foobar.jpg|1000px]]
13279
13280 [[File:Foobar.jpg|border|1000px]]
13281 !! html/php
13282 <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>
13283 </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>
13284 </p>
13285 !! html/parsoid
13286 <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>
13287 <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>
13288 !! end
13289
13290 !! test
13291 Image: thumbs reduce
13292 !! options
13293 parsoid=wt2html,wt2wt,html2html
13294 !! wikitext
13295 [[File:Foobar.jpg|thumb|50px]]
13296 !! html/php
13297 <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>
13298
13299 !! html/parsoid
13300 <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>
13301 !! end
13302
13303 !! test
13304 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13305 !! options
13306 parsoid=wt2html,wt2wt,html2html
13307 !! wikitext
13308 [[File:Foobar.jpg|thumb|2000px]]
13309
13310 [[File:Foobar.svg|thumb|2000px]]
13311 !! html/php
13312 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13313 <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>
13314
13315 !! html/parsoid
13316 <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>
13317 <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>
13318 !! end
13319
13320 !! test
13321 Image: frameless can reduce in size
13322 !! options
13323 parsoid=wt2html,wt2wt,html2html
13324 !! wikitext
13325 [[File:Foobar.jpg|frameless|50px]]
13326 !! html/php
13327 <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>
13328 </p>
13329 !! html/parsoid
13330 <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>
13331 !! end
13332
13333 !! test
13334 Image: bitmap frameless can't be enlarged past original size, but vector can
13335 !! options
13336 parsoid=wt2html,wt2wt,html2html
13337 !! wikitext
13338 [[File:Foobar.jpg|frameless|2000px]]
13339
13340 [[File:Foobar.svg|frameless|2000px]]
13341 !! html/php
13342 <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>
13343 </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>
13344 </p>
13345 !! html/parsoid
13346 <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>
13347 <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>
13348 !! end
13349
13350 !! test
13351 Image: framed images are always unscaled.
13352 !! options
13353 parsoid=wt2html,wt2wt,html2html
13354 !! wikitext
13355 [[File:Foobar.jpg|frame]]
13356
13357 [[File:Foobar.jpg|frame|50px]]
13358
13359 [[File:Foobar.jpg|frame|50x50px]]
13360
13361 [[File:Foobar.jpg|frame|2000px]]
13362 !! html/php
13363 <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>
13364 <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>
13365 <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>
13366 <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>
13367
13368 !! html/parsoid
13369 <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>
13370 <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>
13371 <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>
13372 <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>
13373 !! end
13374
13375 ###################
13376
13377 !! test
13378 Link to image page- image page normally doesn't exists, hence edit link
13379 Add test with existing image page
13380 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13381 !! wikitext
13382 [[:Image:test]]
13383 !! html
13384 <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>
13385 </p>
13386 !! end
13387
13388 !! test
13389 bug 18784 Link to non-existent image page with caption should use caption as link text
13390 !! wikitext
13391 [[:Image:test|caption]]
13392 !! html
13393 <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>
13394 </p>
13395 !! end
13396
13397 !! test
13398 Frameless image caption with a free URL
13399 !! wikitext
13400 [[File:Foobar.jpg|http://example.com]]
13401 !! html/php
13402 <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>
13403 </p>
13404 !! html/parsoid
13405 <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>
13406 !! end
13407
13408 !! test
13409 Thumbnail image caption with a free URL
13410 !! options
13411 thumbsize=220
13412 !! wikitext
13413 [[File:Foobar.jpg|thumb|http://example.com]]
13414 !! html/php
13415 <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>
13416
13417 !! html/parsoid
13418 <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>
13419 !! end
13420
13421 !! test
13422 Thumbnail image caption with a free URL and explicit alt
13423 !! options
13424 thumbsize=220
13425 parsoid=wt2html,wt2wt,html2html
13426 !! wikitext
13427 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13428 !! html/php
13429 <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>
13430
13431 !! html/parsoid
13432 <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>
13433 !! end
13434
13435 !! test
13436 SVG thumbnails with no language set
13437 !! options
13438 !! wikitext
13439 [[File:Foobar.svg|thumb|caption]]
13440 !! html/php
13441 <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>
13442
13443 !! html/parsoid
13444 <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>
13445 !! end
13446
13447 !! test
13448 SVG thumbnails with language de
13449 !! options
13450 parsoid=wt2html,wt2wt,html2html
13451 !! wikitext
13452 [[File:Foobar.svg|thumb|caption|lang=de]]
13453 !! html/php
13454 <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>
13455
13456 !! html/parsoid
13457 <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>
13458 !! end
13459
13460 !! test
13461 SVG thumbnails with invalid language code
13462 !! options
13463 parsoid=wt2html,wt2wt,html2html
13464 !! wikitext
13465 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13466 !! html/php
13467 <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>
13468
13469 !! html/parsoid
13470 <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>
13471 !! end
13472
13473 !! test
13474 BUG 1887: A ISBN with a thumbnail
13475 !! wikitext
13476 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13477 !! html/php
13478 <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>
13479
13480 !! html/parsoid
13481 <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>
13482 !! end
13483
13484 !! test
13485 BUG 1887: A RFC with a thumbnail
13486 !! wikitext
13487 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13488 !! html/php
13489 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
13490
13491 !! html/parsoid
13492 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13493 !! end
13494
13495 !! test
13496 BUG 1887: A mailto link with a thumbnail
13497 !! wikitext
13498 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13499 !! html/php
13500 <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>
13501
13502 !! html/parsoid
13503 <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>
13504 !! end
13505
13506 # Pending resolution to bug 368
13507 !! test
13508 BUG 648: Frameless image caption with a link
13509 !! wikitext
13510 [[File:Foobar.jpg|text with a [[link]] in it]]
13511 !! html/php
13512 <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>
13513 </p>
13514 !! html/parsoid
13515 <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>
13516 !! end
13517
13518 !! test
13519 BUG 648: Frameless image caption with a link (suffix)
13520 !! wikitext
13521 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13522 !! html/php
13523 <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>
13524 </p>
13525 !! html/parsoid
13526 <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>
13527 !! end
13528
13529 !! test
13530 BUG 648: Frameless image caption with an interwiki link
13531 !! wikitext
13532 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13533 !! html/php
13534 <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>
13535 </p>
13536 !! html/parsoid
13537 <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>
13538 !! end
13539
13540 !! test
13541 BUG 648: Frameless image caption with a piped interwiki link
13542 !! wikitext
13543 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13544 !! html/php
13545 <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>
13546 </p>
13547 !! html/parsoid
13548 <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>
13549 !! end
13550
13551 !! test
13552 T107474: Frameless image caption with <nowiki>
13553 !! wikitext
13554 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13555 !! html/parsoid
13556 <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>
13557 !! end
13558
13559 !! test
13560 Escape HTML special chars in image alt text
13561 !! wikitext
13562 [[File:Foobar.jpg|& < > "]]
13563 !! html/php
13564 <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>
13565 </p>
13566 !! html/parsoid
13567 <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>
13568 !! end
13569
13570 !! test
13571 BUG 499: Alt text should have &#1234;, not &amp;1234;
13572 !! wikitext
13573 [[File:Foobar.jpg|&#9792;]]
13574 !! html/php
13575 <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>
13576 </p>
13577 !! html/parsoid
13578 <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>
13579 !! end
13580
13581 !! test
13582 Broken image caption with link
13583 !! options
13584 parsoid=wt2html,wt2wt,html2html
13585 !! wikitext
13586 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13587 !! html/php
13588 <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.
13589 </p>
13590 !! html/parsoid
13591 <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>
13592 !! end
13593
13594 !! test
13595 Image caption containing another image
13596 !! wikitext
13597 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13598 !! html/php
13599 <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>
13600
13601 !! html/parsoid
13602 <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>
13603 !! end
13604
13605 !! test
13606 Image: caption containing a newline
13607 !! wikitext
13608 [[File:Foobar.jpg|This
13609 *is some text]]
13610 !! html/php
13611 <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>
13612 </p>
13613 !! html/parsoid
13614 <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>
13615 !!end
13616
13617 !!test
13618 Image: caption containing leading space
13619 (The leading space should not trigger nowiki escaping in wt2wt mode)
13620 !! wikitext
13621 [[File:Foobar.jpg|thumb| bar]]
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>bar</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> bar</figcaption></figure>
13627 !!end
13628
13629 !! test
13630 Image: caption containing a table
13631 !! options
13632 parsoid=wt2html,wt2wt,html2html
13633 !! wikitext
13634 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13635 {|
13636 ! Foo !! Bar
13637 |-
13638 | Foo1 || Bar1
13639 |}
13640 and some more text.]]
13641 !! html/php
13642 <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>
13643
13644 !! html/parsoid
13645 <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
13646 <table>
13647 <tbody>
13648 <tr><th>Foo </th><th>Bar</th></tr>
13649 <tr>
13650 <td>Foo1 </td>
13651 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13652 !! end
13653
13654 !! test
13655 Bug 3090: External links other than http: in image captions
13656 !! wikitext
13657 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13658 !! html/php
13659 <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>
13660
13661 !! html/parsoid
13662 <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>
13663 !! end
13664
13665 !! test
13666 Custom class
13667 !! options
13668 parsoid=wt2html,wt2wt,html2html
13669 !! wikitext
13670 [[Image:foobar.jpg|a|class=b]]
13671 !! html/php
13672 <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>
13673 </p>
13674 !! html/parsoid
13675 <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>
13676 !! end
13677
13678 !! test
13679 Localized image handling (1).
13680 !! options
13681 parsoid=wt2html,wt2wt,html2html
13682 language=es
13683 !! wikitext
13684 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13685 !! html/php
13686 <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>
13687
13688 !! html/parsoid
13689 <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>
13690 !! end
13691
13692 !! test
13693 Localized image handling (2).
13694 !! options
13695 thumbsize=220
13696 parsoid=wt2html,wt2wt,html2html
13697 language=es
13698 !! wikitext
13699 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13700 !! html/php
13701 <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>
13702
13703 !! html/parsoid
13704 <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>
13705 !! end
13706
13707 !! test
13708 "border", "frameless" and "class" attributes on an image.
13709 !! options
13710 thumbsize=220
13711 parsoid=wt2html,wt2wt,html2html
13712 !! wikitext
13713 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13714 !! html/php
13715 <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>
13716 </p>
13717 !! html/parsoid
13718 <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>
13719 !! end
13720
13721 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13722 !! test
13723 Invalid image attributes (bug 62500)
13724 !! options
13725 thumbsize=220
13726 parsoid=wt2html,wt2wt,html2html
13727 !! wikitext
13728 [[File:Foobar.jpg|thumb|float|left|caption]]
13729
13730 [[File:Foobar.jpg|thumb|righ|caption]]
13731
13732 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13733 !! html/php
13734 <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>
13735 <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>
13736 <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>
13737
13738 !! html/parsoid
13739 <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>
13740 <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>
13741 <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>
13742 !! end
13743
13744 !! article
13745 File:Barfoo.jpg
13746 !! text
13747 #REDIRECT [[File:Barfoo.jpg]]
13748 !! endarticle
13749
13750 # FIXME: Parsoid should run this test -- but we'd need to teach the
13751 # mockAPI about the redirected Barfoo.jpg image.
13752 !! test
13753 Redirected image
13754 !! wikitext
13755 [[Image:Barfoo.jpg]]
13756 !! html/php
13757 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13758 </p>
13759 !! end
13760
13761 !! test
13762 Missing image with uploads disabled
13763 !! options
13764 wgEnableUploads=0
13765 !! wikitext
13766 [[File:Foobaz.jpg]]
13767 !! html/php
13768 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13769 </p>
13770 !! html/parsoid
13771 <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>
13772 !! end
13773
13774 # Parsoid-specific testing for images
13775 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13776 # Currently imperfect due to a flaw in the Parsoid testrunner
13777 # Work in progress
13778 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13779 # image tests.
13780
13781 !! test
13782 Parsoid-specific image handling - simple image with size and middle alignment
13783 !! wikitext
13784 [[File:Foobar.jpg|middle|50px]]
13785 !! html/parsoid
13786 <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>
13787 !! end
13788
13789 !! test
13790 Parsoid-specific image handling - simple image with size, middle alignment,
13791 non-standard namespace alias
13792 !! options
13793 parsoid=wt2wt,wt2html,html2html
13794 !! wikitext
13795 [[Image:Foobar.jpg|middle|50px]]
13796 !! html/parsoid
13797 <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>
13798 !! end
13799
13800 !! test
13801 Parsoid-specific image handling - simple image with size and middle alignment
13802 (existing content)
13803 !! wikitext
13804 [[File:Foobar.jpg|50px|middle]]
13805 !! html/parsoid
13806 <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>
13807 !! end
13808
13809 !! test
13810 Parsoid-specific image handling - simple image with size and middle alignment
13811 and non-standard namespace name
13812 !! options
13813 parsoid=wt2html,wt2wt,html2html
13814 !! wikitext
13815 [[Image:Foobar.jpg|50px|middle]]
13816 !! html/parsoid
13817 <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>
13818 !! end
13819
13820 !! test
13821 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13822 !! wikitext
13823 [[File:Foobar.jpg|500x10px|baseline|caption]]
13824 !! html/parsoid
13825 <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>
13826 !! end
13827
13828 !! test
13829 Parsoid-specific image handling - simple image with border and size spec
13830 !! wikitext
13831 [[File:Foobar.jpg|50px|border|caption]]
13832 !! html/parsoid
13833 <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>
13834 !! end
13835
13836 !! test
13837 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13838 !! wikitext
13839 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13840 !! html/parsoid
13841 <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>
13842 !! end
13843
13844 !! test
13845 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13846 (existing content)
13847 !! wikitext
13848 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13849 !! html/parsoid
13850 <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>
13851 !! end
13852
13853 !! test
13854 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13855 !! wikitext
13856 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13857 !! html/parsoid
13858 <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>
13859 !! end
13860
13861 !! test
13862 Parsoid-specific image handling - thumbnail with specific size, halign,
13863 valign, and caption (existing content)
13864 !! wikitext
13865 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13866 !! html/parsoid
13867 <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>
13868 !! end
13869
13870 !! test
13871 Parsoid-specific image handling - framed image with specific size and caption
13872 (size is ignored)
13873 !! options
13874 parsoid=wt2html,wt2wt,html2html
13875 !! wikitext
13876 [[File:Foobar.jpg|frame|500x50px|caption]]
13877 !! html/parsoid
13878 <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>
13879 !! end
13880
13881 !! test
13882 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13883 (size is ignored)
13884 !! options
13885 parsoid=wt2html,wt2wt,html2html
13886 !! wikitext
13887 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13888 !! html/parsoid
13889 <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>
13890 !! end
13891
13892 !! test
13893 Parsoid-specific image handling - frameless image with specific size, border, and caption
13894 !! wikitext
13895 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13896 !! html/parsoid
13897 <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>
13898 !! end
13899
13900 !! test
13901 Parsoid-specific image handling - simple image with a formatted caption
13902 !! wikitext
13903 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13904 !! html/parsoid
13905 <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>
13906 !! end
13907
13908 !! test
13909 Parsoid-specific image handling - caption with a template in it
13910 !! wikitext
13911 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13912 !! html/parsoid
13913 <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>
13914 !! end
13915
13916 !! test
13917 Parsoid-specific image handling - caption with unbalanced tags in it
13918 !! options
13919 parsoid=wt2html,wt2wt,html2html
13920 !! wikitext
13921 foo
13922 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13923 bar
13924 !! html/parsoid
13925 <p>foo</p>
13926 <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>
13927 <p>bar</p>
13928 !! end
13929
13930 !! test
13931 Parsoid-specific image handling - empty caption (1)
13932 !! options
13933 parsoid=wt2html,wt2wt
13934 !! wikitext
13935 [[File:Foobar.jpg|thumb|]]
13936 !! html/parsoid
13937 <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>
13938 !! end
13939
13940 # empty captions don't get serialized unless we're in the "round trip" case
13941 !! test
13942 Parsoid-specific image handling - empty caption (2)
13943 !! options
13944 parsoid=html2wt
13945 !! html/parsoid
13946 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13947 <a href="./File:Foobar.jpg">
13948 <img resource="./File:Foobar.jpg"
13949 src="//example.com/images/3/3a/Foobar.jpg"
13950 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13951 height="25" width="220"/>
13952 </a>
13953 <figcaption></figcaption>
13954 </figure>
13955 !! wikitext
13956 [[File:Foobar.jpg|thumb]]
13957 !! end
13958
13959 !! test
13960 Parsoid-specific image handling - whitespace caption
13961 !! wikitext
13962 [[File:Foobar.jpg|thumb| ]]
13963 !! html/parsoid
13964 <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>
13965 !! end
13966
13967 !! test
13968 Parsoid-specific image handling - lang option
13969 !! wikitext
13970 foo
13971 [[File:Foobar.svg|lang=de|caption]]
13972 bar
13973 !! html/parsoid
13974 <p>foo
13975 <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>
13976 bar</p>
13977 !! end
13978
13979 ## Edge case bugs in Parsoid from T93580
13980 !! test
13981 T93580: 1. Templated <ref> inside block images
13982 !! wikitext
13983 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13984
13985 <references />
13986 !! html/parsoid
13987 <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>
13988
13989 <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>
13990 !! end
13991
13992 !! test
13993 T93580: 2. <ref> inside inline images
13994 !! wikitext
13995 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
13996
13997 <references />
13998 !! html/parsoid
13999 <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>
14000
14001 <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>
14002 !! end
14003
14004 !! test
14005 T93580: 3. Templated <ref> inside inline images
14006 !! wikitext
14007 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14008
14009 <references />
14010 !! html/parsoid
14011 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14012
14013 <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>
14014 !! end
14015
14016 ###
14017 ### Subpages
14018 ###
14019 !! article
14020 Subpage test/subpage
14021 !! text
14022 foo
14023 !! endarticle
14024
14025 !! test
14026 Subpage link
14027 !! options
14028 subpage title=[[Subpage test]]
14029 !! wikitext
14030 [[/subpage]]
14031 !! html
14032 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14033 </p>
14034 !! end
14035
14036 !! test
14037 Subpage noslash link
14038 !! options
14039 subpage title=[[Subpage test]]
14040 !! wikitext
14041 [[/subpage/]]
14042 !! html
14043 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14044 </p>
14045 !! end
14046
14047 !! article
14048 Subpage test/1/2/subpage
14049 !! text
14050 blah
14051 !! endarticle
14052
14053 !! test
14054 Relative subpage noslash link
14055 !! options
14056 parsoid=wt2wt,wt2html,html2html
14057 subpage title=[[Subpage test/1/2/3/4]]
14058 !! wikitext
14059 [[../../subpage/]]
14060
14061 [[../../subpage]]
14062 !! html/php
14063 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14064 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14065 </p>
14066 !! html/parsoid
14067 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14068 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14069 !! end
14070
14071 !! test
14072 Parsoid: dot-slash prefixed wikilinks
14073 !! wikitext
14074 [[./foo]]
14075
14076 [[././bar]]
14077
14078 [[././baz/]]
14079 !! html/php
14080 <p>[[./foo]]
14081 </p><p>[[././bar]]
14082 </p><p>[[././baz/]]
14083 </p>
14084 !! html/parsoid
14085 <p>[[./foo]]
14086 </p><p>[[././bar]]
14087 </p><p>[[././baz/]]
14088 </p>
14089 !! end
14090
14091 !! test
14092 Render invalid page names as plain text (bug 51090)
14093 !! wikitext
14094 [[./../foo|bar]]
14095 [[foo�|bar]]
14096 [[foo/.|bar]]
14097 [[foo/..|bar]]
14098 [[foo~~~bar]]
14099 [[foo>bar]]
14100 [[foo[bar]]
14101 [[.]]
14102 [[..]]
14103 [[foo././bar]]
14104
14105 [[{{echo|./../foo}}|bar]]
14106 [[{{echo|foo/.}}|bar]]
14107 [[{{echo|foo/..}}|bar]]
14108 [[{{echo|foo~~~~bar}}]]
14109 [[{{echo|foo>bar}}]]
14110 [[{{echo|foo././bar}}]]
14111 [[{{echo|foo{bar}}]]
14112 [[{{echo|foo}bar}}]]
14113 [[{{echo|foo[bar}}]]
14114 [[{{echo|foo]bar}}]]
14115 [[{{echo|foo<bar}}]]
14116 !!html/php
14117 <p>[[./../foo|bar]]
14118 [[foo�|bar]]
14119 [[foo/.|bar]]
14120 [[foo/..|bar]]
14121 [[foo~~~bar]]
14122 [[foo&gt;bar]]
14123 [[foo[bar]]
14124 [[.]]
14125 [[..]]
14126 [[foo././bar]]
14127 </p><p>[[./../foo|bar]]
14128 [[foo/.|bar]]
14129 [[foo/..|bar]]
14130 [[foo~~~~bar]]
14131 [[foo&gt;bar]]
14132 [[foo././bar]]
14133 [[foo{bar]]
14134 [[foo}bar]]
14135 [[foo[bar]]
14136 [[foo]bar]]
14137 [[foo&lt;bar]]
14138 </p>
14139 !!html/parsoid
14140 <p>[[./../foo|bar]]
14141 [[foo�|bar]]
14142 [[foo/.|bar]]
14143 [[foo/..|bar]]
14144 [[foo~~~bar]]
14145 [[foo>bar]]
14146 [[foo[bar]]
14147 [[.]]
14148 [[..]]
14149 [[foo././bar]]</p>
14150
14151 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14152 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14153 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14154 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14155 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14156 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14157 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14158 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14159 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14160 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14161 [[<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>
14162 !!end
14163
14164 !! test
14165 Disabled subpages
14166 !! wikitext
14167 [[/subpage]]
14168 !! html
14169 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14170 </p>
14171 !! end
14172
14173 !! test
14174 BUG 561: {{/Subpage}}
14175 !! options
14176 subpage title=[[Page]]
14177 !! wikitext
14178 {{/Subpage}}
14179 !! html
14180 <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>
14181 </p>
14182 !! end
14183
14184 ###
14185 ### Categories
14186 ###
14187 !! article
14188 Category:MediaWiki User's Guide
14189 !! text
14190 blah
14191 !! endarticle
14192
14193 !! test
14194 Link to category
14195 !! wikitext
14196 [[:Category:MediaWiki User's Guide]]
14197 !! html
14198 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14199 </p>
14200 !! end
14201
14202 !! test
14203 Simple category
14204 !! options
14205 cat
14206 !! wikitext
14207 [[Category:MediaWiki User's Guide]]
14208 !! html
14209 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14210 !! end
14211
14212 !! test
14213 PAGESINCATEGORY invalid title fatal (r33546 fix)
14214 !! wikitext
14215 {{PAGESINCATEGORY:<bogus>}}
14216 !! html
14217 <p>0
14218 </p>
14219 !! end
14220
14221 !! test
14222 Category with different sort key
14223 !! options
14224 cat
14225 !! wikitext
14226 [[Category:MediaWiki User's Guide|Foo]]
14227 !! html
14228 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14229 !! end
14230
14231 !! test
14232 Category with identical sort key
14233 !! options
14234 cat
14235 !! wikitext
14236 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14237 !! html
14238 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14239 !! end
14240
14241 !! test
14242 Category with empty sort key
14243 !! options
14244 cat
14245 pst
14246 !! wikitext
14247 [[Category:MediaWiki User's Guide|]]
14248 !! html
14249 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14250 !! end
14251
14252 !! test
14253 Category with empty sort key and parentheses
14254 !! options
14255 cat
14256 pst
14257 !! wikitext
14258 [[Category:Foo (bar)|]]
14259 !! html
14260 [[Category:Foo (bar)|Foo]]
14261 !! end
14262
14263 !! test
14264 Category with link tail
14265 !! options
14266 cat
14267 pst
14268 !! wikitext
14269 123[[Category:Foo]]456
14270 !! html
14271 123[[Category:Foo]]456
14272 !! end
14273
14274 !! test
14275 Category with template
14276 !! options
14277 cat
14278 pst
14279 !! wikitext
14280 [[Category:{{echo|Foo}}]]
14281 !! html
14282 [[Category:{{echo|Foo}}]]
14283 !! end
14284
14285 !! test
14286 Category with template in sort key
14287 !! options
14288 cat
14289 pst
14290 !! wikitext
14291 [[Category:Foo|{{echo|Bar}}]]
14292 !! html
14293 [[Category:Foo|{{echo|Bar}}]]
14294 !! end
14295
14296 !! test
14297 Category with template in sort key and title
14298 !! options
14299 cat
14300 pst
14301 !! wikitext
14302 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14303 !! html
14304 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14305 !! end
14306
14307 !! test
14308 Category / paragraph interactions
14309 !! wikitext
14310 Foo [[Category:Baz]] Bar
14311
14312 Foo [[Category:Baz]]
14313 Bar
14314
14315 Foo
14316 [[Category:Baz]]
14317 Bar
14318
14319 Foo
14320 [[Category:Baz]] Bar
14321
14322 Foo
14323 [[Category:Baz]]
14324 [[Category:Baz]]
14325 [[Category:Baz]]
14326 Bar
14327
14328 [[Category:Baz]]
14329 [[Category:Baz]]
14330 [[Category:Baz]]
14331
14332 [[Category:Baz]]
14333 {{echo|[[Category:Baz]]}}
14334 [[Category:Baz]]
14335 !! html
14336 <p>Foo Bar
14337 </p><p>Foo
14338 Bar
14339 </p><p>Foo
14340 Bar
14341 </p><p>Foo Bar
14342 </p><p>Foo
14343 Bar
14344 </p>
14345 !! end
14346
14347 ## The whitespace on the empty line is part of the test. Please do not delete
14348 !! test
14349 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14350 !! options
14351 parsoid=wt2html,wt2wt
14352 !! wikitext
14353 This
14354
14355 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14356
14357 {{echo|[[Category:Foo]] and so should this!}}
14358 !! html
14359 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14360 </p>
14361 !! html/parsoid
14362 <p>This
14363
14364 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14365
14366 <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>
14367 !! end
14368
14369 ## Parsoid will not try to wt2wt this while preserving newlines because
14370 ## it suppresses excess newlines within list items -- and we don't want to
14371 ## introduce a special case just for categories, which is, in reality somewhat
14372 ## odd behavior -- categories are unlikely to be used in list items like this
14373 ## in top-level pages and are only likely to show up in template-generated
14374 ## list items where this RT-ing is a non-issue.
14375 ##
14376 ## The whitespace on the empty line is part of the test. Please do not delete
14377 !! test
14378 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14379 !! options
14380 parsoid=wt2html
14381 !! wikitext
14382 * This
14383
14384 [[Category:Foo]] and this should be part of the same list item
14385 * So should this
14386
14387 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14388 !! html
14389 <ul><li>This and this should be part of the same list item</li>
14390 <li>So should this and this should be part of the same list item</li></ul>
14391 !! html/parsoid
14392 <ul>
14393 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14394 <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>
14395 </ul>
14396 !! end
14397
14398 ## Newlines and categories that follow the last item of a list
14399 ## are treated differently because this (list followed by categories)
14400 ## is an extremely common pattern on wikis.
14401 !! test
14402 3. Categories and newlines: newline suppression for last list item should RT properly
14403 !! wikitext
14404 * a
14405 * b
14406
14407 [[Category:Foo]]
14408
14409 [[Category:Bar]]
14410 [[Category:Baz]]
14411 !! html/parsoid
14412 <ul><li> a</li>
14413 <li> b</li></ul>
14414
14415 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14416
14417 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14418 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14419 !! end
14420
14421 !! test
14422 4. Categories and newlines: newline suppression for last list item should RT properly
14423 !! wikitext
14424 * a
14425 **** b
14426
14427 [[Category:Foo]]
14428 !! html/parsoid
14429 <ul><li> a
14430 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14431
14432 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14433 !! end
14434
14435 ## only wt2html for this to make sure the algo only applies to the rightmost path
14436 !! test
14437 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14438 !! options
14439 parsoid=wt2html
14440 !! wikitext
14441 * a
14442 ** b
14443 [[Category:Foo]]
14444 * c
14445 ** d
14446 [[Category:Foo]]
14447 !! html/parsoid
14448 <ul><li> a
14449 <ul><li> b
14450 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14451 <li> c
14452 <ul><li> d</li></ul></li></ul>
14453 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14454 !! end
14455
14456 !! test
14457 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14458 !! wikitext
14459 * a [[Category:Foo]]
14460 !! html/parsoid
14461 <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>
14462 !! end
14463
14464 # This test also demonstrates because of newline+category tunneling
14465 # through the list hander, template wrapping doesn't expand to the
14466 # containing list when the list item swallows the category.
14467 !! test
14468 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14469 !! wikitext
14470 * {{echo|a
14471 [[Category:Foo]]}}
14472 !! html/parsoid
14473 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
14474 </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>
14475 !! end
14476
14477 !! test
14478 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14479 !! wikitext
14480 * a
14481
14482 {{echo|[[Category:Foo]]
14483 [[Category:Bar]]}}
14484 [[Category:Baz]]
14485 !! html/parsoid
14486 <ul><li> a</li></ul>
14487
14488 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14489 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14490 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14491 !! end
14492
14493 !! test
14494 Parsoid: Serialize link to category page with colon escape
14495 !! options
14496 parsoid
14497 !! wikitext
14498
14499 [[:Category:Foo]]
14500 [[:Category:Foo|Bar]]
14501 !! html
14502 <p>
14503 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14504 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14505 </p>
14506 !! end
14507
14508 # html2wt localizes the "Category" namespace.
14509 # XXX the <link> element needs an empty data-parsoid attribute, or
14510 # else the html2html test fails because spaces are inserted.
14511 !! test
14512 Link prefix/suffixes aren't applied to category links
14513 !! options
14514 parsoid=wt2html,wt2wt,html2html
14515 language=is
14516 !! wikitext
14517 x[[Category:Foo]]y
14518 !! html/php
14519 <p>xy
14520 </p>
14521 !! html/parsoid
14522 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14523 !! end
14524
14525 !! test
14526 Parsoid: Serialize link to file page with colon escape
14527 !! options
14528 parsoid
14529 !! wikitext
14530
14531 [[:File:Foo.png]]
14532 [[:File:Foo.png|Bar]]
14533 !! html
14534 <p>
14535 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14536 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14537 </p>
14538 !! end
14539
14540 !! test
14541 Parsoid: Serialize a genuine category link without colon escape
14542 !! options
14543 parsoid
14544 !! wikitext
14545 [[Category:Foo]]
14546 [[Category:Foo|Bar]]
14547 !! html
14548 <link rel="mw:PageProp/Category" href="./Category:Foo">
14549 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14550 !! end
14551
14552 !! test
14553 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14554 !! options
14555 parsoid=html2wt
14556 !! html/parsoid
14557 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14558 !! wikitext
14559 [[Category:Toxine bactérienne]]
14560 !! end
14561
14562 !! test
14563 Parsoid: Defaultsort
14564 !! wikitext
14565 {{DEFAULTSORT:Foo}}
14566 !! html/parsoid
14567 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14568 !! end
14569
14570 !! test
14571 Parsoid: Defaultsort (template-generated)
14572 !! wikitext
14573 {{{{echo|DEFAULTSORT}}:Foo}}
14574 !! html/parsoid
14575 <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}}]}'/>
14576 !! end
14577
14578 ###
14579 ### Inter-language links
14580 ###
14581 !! test
14582 Interlanguage links
14583 !! options
14584 ill
14585 !! wikitext
14586 [[es:Alimento]]
14587 [[fr:Nourriture]]
14588 [[zh:食品]]
14589 !! html/php
14590 es:Alimento fr:Nourriture zh:食品
14591 !! html/parsoid
14592 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14593 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14594 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14595 !! end
14596
14597 !! test
14598 Duplicate interlanguage links (bug 24502)
14599 !! options
14600 ill
14601 !! wikitext
14602 [[es:1]]
14603 [[es:2]]
14604 [[fr:1]]
14605 [[fr:2]]
14606 !! html/php
14607 es:1 fr:1
14608 !! html/parsoid
14609 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14610 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14611 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14612 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14613 !! end
14614
14615 ###
14616 ### Sections
14617 ###
14618 !! test
14619 Basic section headings
14620 !! wikitext
14621 == Headline 1 ==
14622 Some text
14623
14624 ==Headline 2==
14625 More
14626 ===Smaller headline===
14627 Blah blah
14628 !! html
14629 <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>
14630 <p>Some text
14631 </p>
14632 <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>
14633 <p>More
14634 </p>
14635 <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>
14636 <p>Blah blah
14637 </p>
14638 !! end
14639
14640 !! test
14641 Section headings with TOC
14642 !! wikitext
14643 == Headline 1 ==
14644 === Subheadline 1 ===
14645 ===== Skipping a level =====
14646 ====== Skipping a level ======
14647
14648 == Headline 2 ==
14649 Some text
14650 ===Another headline===
14651 !! html
14652 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14653 <ul>
14654 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14655 <ul>
14656 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14657 <ul>
14658 <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>
14659 <ul>
14660 <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>
14661 </ul>
14662 </li>
14663 </ul>
14664 </li>
14665 </ul>
14666 </li>
14667 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14668 <ul>
14669 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14670 </ul>
14671 </li>
14672 </ul>
14673 </div>
14674
14675 <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>
14676 <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>
14677 <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>
14678 <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>
14679 <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>
14680 <p>Some text
14681 </p>
14682 <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>
14683
14684 !! end
14685
14686 !! test
14687 TOC anchors don't collide
14688 !! wikitext
14689 __FORCETOC__
14690 == Headline 2 ==
14691 == Headline ==
14692 == Headline 2 ==
14693 == Headline ==
14694 !! html/php
14695 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14696 <ul>
14697 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14698 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14699 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14700 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14701 </ul>
14702 </div>
14703
14704 <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>
14705 <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>
14706 <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>
14707 <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>
14708
14709 !! end
14710
14711 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14712 !! test
14713 Handling of sections up to level 6 and beyond
14714 !! wikitext
14715 = Level 1 Heading=
14716 == Level 2 Heading==
14717 === Level 3 Heading===
14718 ==== Level 4 Heading====
14719 ===== Level 5 Heading=====
14720 ====== Level 6 Heading======
14721 ======= Level 7 Heading=======
14722 ======== Level 8 Heading========
14723 ========= Level 9 Heading=========
14724 ========== Level 10 Heading==========
14725 !! html
14726 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14727 <ul>
14728 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14729 <ul>
14730 <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>
14731 <ul>
14732 <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>
14733 <ul>
14734 <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>
14735 <ul>
14736 <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>
14737 <ul>
14738 <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>
14739 <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>
14740 <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>
14741 <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>
14742 <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>
14743 </ul>
14744 </li>
14745 </ul>
14746 </li>
14747 </ul>
14748 </li>
14749 </ul>
14750 </li>
14751 </ul>
14752 </li>
14753 </ul>
14754 </div>
14755
14756 <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>
14757 <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>
14758 <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>
14759 <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>
14760 <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>
14761 <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>
14762 <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>
14763 <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>
14764 <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>
14765 <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>
14766
14767 !! end
14768
14769 !! test
14770 TOC regression (T11764)
14771 !! wikitext
14772 == title 1 ==
14773 === title 1.1 ===
14774 ==== title 1.1.1 ====
14775 === title 1.2 ===
14776 == title 2 ==
14777 === title 2.1 ===
14778 !! html
14779 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14780 <ul>
14781 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14782 <ul>
14783 <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>
14784 <ul>
14785 <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>
14786 </ul>
14787 </li>
14788 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
14789 </ul>
14790 </li>
14791 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14792 <ul>
14793 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
14794 </ul>
14795 </li>
14796 </ul>
14797 </div>
14798
14799 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14800 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14801 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
14802 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14803 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14804 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
14805
14806 !! end
14807
14808 !! test
14809 TOC for heading containing <span id="..."></span> (T96153)
14810 !! wikitext
14811 __FORCETOC__
14812 ==<span id="old-anchor"></span>New title==
14813 !! html/php
14814 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14815 <ul>
14816 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14817 </ul>
14818 </div>
14819
14820 <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>
14821
14822 !! end
14823
14824 !! test
14825 TOC with wgMaxTocLevel=3 (bug 6204)
14826 !! options
14827 wgMaxTocLevel=3
14828 !! wikitext
14829 == title 1 ==
14830 === title 1.1 ===
14831 ==== title 1.1.1 ====
14832 === title 1.2 ===
14833 == title 2 ==
14834 === title 2.1 ===
14835 !! html
14836 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14837 <ul>
14838 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14839 <ul>
14840 <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>
14841 <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>
14842 </ul>
14843 </li>
14844 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14845 <ul>
14846 <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>
14847 </ul>
14848 </li>
14849 </ul>
14850 </div>
14851
14852 <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>
14853 <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>
14854 <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>
14855 <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>
14856 <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>
14857 <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>
14858
14859 !! end
14860
14861 !! test
14862 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14863 !! options
14864 wgMaxTocLevel=3
14865 !! wikitext
14866 ==Section 1==
14867 ===Section 1.1===
14868 ====Section 1.1.1====
14869 ====Section 1.1.1.1====
14870 ==Section 2==
14871 !! html
14872 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14873 <ul>
14874 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14875 <ul>
14876 <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>
14877 </ul>
14878 </li>
14879 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14880 </ul>
14881 </div>
14882
14883 <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>
14884 <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>
14885 <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>
14886 <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>
14887 <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>
14888
14889 !! end
14890
14891
14892 !! test
14893 Resolving duplicate section names
14894 !! wikitext
14895 == Foo bar ==
14896 == Foo bar ==
14897 !! html
14898 <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>
14899 <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>
14900
14901 !! end
14902
14903 !! test
14904 Resolving duplicate section names with differing case (bug 10721)
14905 !! wikitext
14906 == Foo bar ==
14907 == Foo Bar ==
14908 !! html
14909 <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>
14910 <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>
14911
14912 !! end
14913
14914 !! article
14915 Template:sections
14916 !! text
14917 ===Section 1===
14918 ==Section 2==
14919 !! endarticle
14920
14921 !! test
14922 Template with sections, __NOTOC__
14923 !! wikitext
14924 __NOTOC__
14925 ==Section 0==
14926 {{sections}}
14927 ==Section 4==
14928 !! html
14929 <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>
14930 <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>
14931 <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>
14932 <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>
14933
14934 !! end
14935
14936 !! test
14937 __NOEDITSECTION__ keyword
14938 !! wikitext
14939 __NOEDITSECTION__
14940 ==Section 1==
14941 ==Section 2==
14942 !! html
14943 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14944 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14945
14946 !! end
14947
14948 !! test
14949 Link inside a section heading
14950 !! wikitext
14951 ==Section with a [[Main Page|link]] in it==
14952 !! html
14953 <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>
14954
14955 !! end
14956
14957 !! test
14958 TOC regression (T14077)
14959 !! wikitext
14960 __TOC__
14961 == title 1 ==
14962 === title 1.1 ===
14963 == title 2 ==
14964 !! html
14965 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14966 <ul>
14967 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14968 <ul>
14969 <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>
14970 </ul>
14971 </li>
14972 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14973 </ul>
14974 </div>
14975
14976 <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>
14977 <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>
14978 <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>
14979
14980 !! end
14981
14982 !! test
14983 BUG 1219 URL next to image (good)
14984 !! wikitext
14985 http://example.com [[File:Foobar.jpg]]
14986 !! html/php
14987 <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>
14988 </p>
14989 !! html/parsoid
14990 <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>
14991 !!end
14992
14993 !! test
14994 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14995 !! wikitext
14996 ===
14997 The line above must have a trailing space!
14998 === <!--
14999 --> <!-- -->
15000 But just in case it doesn't...
15001 !! html
15002 <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>
15003 <p>The line above must have a trailing space!
15004 </p>
15005 <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>
15006 <p>But just in case it doesn't...
15007 </p>
15008 !! end
15009
15010 !! test
15011 Header with special characters (bug 25462)
15012 !! wikitext
15013 The tooltips shall not show entities to the user (ie. be double escaped)
15014
15015 == text > text ==
15016 section 1
15017
15018 == text < text ==
15019 section 2
15020
15021 == text & text ==
15022 section 3
15023
15024 == text ' text ==
15025 section 4
15026
15027 == text " text ==
15028 section 5
15029 !! html
15030 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15031 </p>
15032 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15033 <ul>
15034 <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>
15035 <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>
15036 <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>
15037 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15038 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15039 </ul>
15040 </div>
15041
15042 <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>
15043 <p>section 1
15044 </p>
15045 <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>
15046 <p>section 2
15047 </p>
15048 <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>
15049 <p>section 3
15050 </p>
15051 <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>
15052 <p>section 4
15053 </p>
15054 <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>
15055 <p>section 5
15056 </p>
15057 !! end
15058
15059 !! test
15060 Header with space, plus and underscore as entity
15061 !! wikitext
15062 Id should not contain + for spaces
15063
15064 == Space between Text ==
15065 section 1
15066
15067 == Space-Entity&#32;between&#32;Text ==
15068 section 2
15069
15070 == Plus+between+Text ==
15071 section 3
15072
15073 == Plus-Entity&#43;between&#43;Text ==
15074 section 4
15075
15076 == Underscore_between_Text ==
15077 section 5
15078
15079 == Underscore-Entity&#95;between&#95;Text ==
15080 section 6
15081
15082 [[#Space between Text]]
15083 [[#Space-Entity&#32;between&#32;Text]]
15084 [[#Plus+between+Text]]
15085 [[#Plus-Entity&#43;between&#43;Text]]
15086 [[#Underscore_between_Text]]
15087 [[#Underscore-Entity&#95;between&#95;Text]]
15088 !! html
15089 <p>Id should not contain + for spaces
15090 </p>
15091 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15092 <ul>
15093 <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>
15094 <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>
15095 <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>
15096 <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>
15097 <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>
15098 <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>
15099 </ul>
15100 </div>
15101
15102 <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>
15103 <p>section 1
15104 </p>
15105 <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>
15106 <p>section 2
15107 </p>
15108 <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>
15109 <p>section 3
15110 </p>
15111 <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>
15112 <p>section 4
15113 </p>
15114 <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>
15115 <p>section 5
15116 </p>
15117 <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>
15118 <p>section 6
15119 </p><p><a href="#Space_between_Text">#Space between Text</a>
15120 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15121 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15122 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15123 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15124 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15125 </p>
15126 !! end
15127
15128 !! test
15129 Headers with excess '=' characters
15130 (Are similar tests necessary beyond the 1st level?)
15131 !! wikitext
15132 =foo==
15133 ==foo=
15134 =''italic'' heading==
15135 ==''italic'' heading=
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="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15140 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15141 <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>
15142 <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>
15143 </ul>
15144 </div>
15145
15146 <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>
15147 <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>
15148 <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>
15149 <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>
15150
15151 !! end
15152
15153 !! test
15154 HTML headers vs TOC (bug 23393)
15155 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15156 !! wikitext
15157 <h1>Header 1</h1>
15158 == Header 1.1 ==
15159 == Header 1.2 ==
15160
15161 <h1>Header 2
15162 </h1>
15163 == Header 2.1 ==
15164 == Header 2.2 ==
15165 __NOEDITSECTION__
15166 !! html
15167 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15168 <ul>
15169 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15170 <ul>
15171 <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>
15172 <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>
15173 </ul>
15174 </li>
15175 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15176 <ul>
15177 <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>
15178 <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>
15179 </ul>
15180 </li>
15181 </ul>
15182 </div>
15183
15184 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15185 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15186 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15187 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15188 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15189 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15190
15191 !! end
15192
15193 !! test
15194 Single-line or multiline-comments can follow headings
15195 !! options
15196 parsoid=wt2html,wt2wt
15197 !! wikitext
15198 ==foo==<!---->
15199 ==bar==<!--c1-->
15200 ==baz==<!--
15201 c2
15202 c3-->
15203 !! html
15204 <h2><span class="mw-headline" id="foo">foo</span></h2>
15205 <h2><span class="mw-headline" id="bar">bar</span></h2>
15206 <h2><span class="mw-headline" id="baz">baz</span></h2>
15207
15208 !! end
15209
15210 !! test
15211 BUG 1219 URL next to image (broken)
15212 !! wikitext
15213 http://example.com[[File:Foobar.jpg]]
15214 !! html/php
15215 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
15216 </p>
15217 !! html/parsoid
15218 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15219 !!end
15220
15221 !! test
15222 Bug 1186 news: in the middle of text
15223 !! wikitext
15224 http://en.wikinews.org/wiki/Wikinews:Workplace
15225 !! html
15226 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15227 </p>
15228 !!end
15229
15230
15231 !! test
15232 Namespaced link must have a title
15233 !! wikitext
15234 [[Project:]]
15235 !! html
15236 <p>[[Project:]]
15237 </p>
15238 !!end
15239
15240 !! test
15241 Namespaced link must have a title (bad fragment version)
15242 !! wikitext
15243 [[Project:#fragment]]
15244 !! html
15245 <p>[[Project:#fragment]]
15246 </p>
15247 !!end
15248
15249
15250 ###
15251 ### HTML tags and HTML attributes
15252 ###
15253
15254 !! test
15255 div with no attributes
15256 !! wikitext
15257 <div>HTML rocks</div>
15258 !! html
15259 <div>HTML rocks</div>
15260
15261 !! end
15262
15263 !! test
15264 div with double-quoted attribute
15265 !! wikitext
15266 <div id="rock">HTML rocks</div>
15267 !! html
15268 <div id="rock">HTML rocks</div>
15269
15270 !! end
15271
15272 !! test
15273 div with single-quoted attribute
15274 !! wikitext
15275 <div id='rock'>HTML rocks</div>
15276 !! html
15277 <div id="rock">HTML rocks</div>
15278
15279 !! end
15280
15281 !! test
15282 div with unquoted attribute
15283 !! wikitext
15284 <div id=rock>HTML rocks</div>
15285 !! html
15286 <div id="rock">HTML rocks</div>
15287
15288 !! end
15289
15290 !! test
15291 div with illegal double attributes
15292 !! wikitext
15293 <div id="a" id="b">HTML rocks</div>
15294 !! html
15295 <div id="b">HTML rocks</div>
15296
15297 !!end
15298
15299 # FIXME: produce empty string instead of "class" in the PHP parser, following
15300 # the HTML5 spec.
15301 !! test
15302 div with empty attribute value, space before equals
15303 !! options
15304 parsoid
15305 !! wikitext
15306 <div class =>HTML rocks</div>
15307 !! html
15308 <div class="">HTML rocks</div>
15309
15310 !! end
15311
15312 !! test
15313 div with multiple empty attribute values
15314 !! options
15315 parsoid
15316 !! wikitext
15317 <div id= title=>HTML rocks</div>
15318 !! html
15319 <div id="" title="">HTML rocks</div>
15320
15321 !! end
15322
15323 !! test
15324 table with multiple empty attribute values
15325 !! options
15326 parsoid
15327 !! wikitext
15328 {| title= id=
15329 | hi
15330 |}
15331 !! html
15332 <table title="" id="">
15333 <tbody><tr><td> hi</td></tr>
15334 </tbody></table>
15335 !! end
15336
15337 !! test
15338 div with braces in attribute value
15339 !! wikitext
15340 <div title="{}">Foo</div>
15341 !! html/php
15342 <div title="&#123;}">Foo</div>
15343
15344 !! html/parsoid
15345 <div title="{}">Foo</div>
15346 !! end
15347
15348 # This it very inconsistent in the PHP parser: it returns
15349 # class="class" if there is a space between the name and the equal sign (see
15350 # 'div with empty attribute value, space before equals'), but strips the
15351 # attribute completely if the space is missing. We hope that not much content
15352 # depends on this, so are implementing the behavior below in Parsoid for
15353 # consistencies' sake.
15354 # FIXME: fix this behavior in the PHP parser?
15355 !! test
15356 div with empty attribute value, no space before equals
15357 !! options
15358 parsoid=wt2html,html2html
15359 !! wikitext
15360 <div class=>HTML rocks</div>
15361 !! html/php
15362 <div>HTML rocks</div>
15363
15364 !! html/parsoid
15365 <div class="">HTML rocks</div>
15366 !! end
15367
15368 !! test
15369 HTML multiple attributes correction
15370 !! wikitext
15371 <p class="error" class="awesome">Awesome!</p>
15372 !! html
15373 <p class="awesome">Awesome!</p>
15374
15375 !!end
15376
15377 !! test
15378 Table multiple attributes correction
15379 !! wikitext
15380 {|
15381 !+ class="error" class="awesome"| status
15382 |}
15383 !! html
15384 <table>
15385 <tr>
15386 <th class="awesome"> status
15387 </th></tr></table>
15388
15389 !!end
15390
15391 !! test
15392 DIV IN UPPERCASE
15393 !! wikitext
15394 <DIV ID="x">HTML ROCKS</DIV>
15395 !! html
15396 <div id="x">HTML ROCKS</div>
15397
15398 !!end
15399
15400 !! test
15401 Non-ASCII pseudo-tags are rendered as text
15402 !! wikitext
15403 <khyô>
15404 !! html
15405 <p>&lt;khyô&gt;
15406 </p>
15407 !! end
15408
15409 !! test
15410 Pseudo-tag with URL 'name' renders as url link
15411 !! wikitext
15412 <http://example.com/>
15413 !! html
15414 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15415 </p>
15416 !! end
15417
15418 !! test
15419 text with amp in the middle of nowhere
15420 !! wikitext
15421 Remember AT&T?
15422 !! html
15423 <p>Remember AT&amp;T?
15424 </p>
15425 !! end
15426
15427 !! test
15428 text with character entity: eacute
15429 !! wikitext
15430 I always thought &eacute; was a cute letter.
15431 !! html
15432 <p>I always thought &#233; was a cute letter.
15433 </p>
15434 !! html+tidy
15435 <p>I always thought é was a cute letter.</p>
15436 !! end
15437
15438 !! test
15439 text with entity-escaped character entity-like string: eacute
15440 !! wikitext
15441 I always thought &amp;eacute; was a cute letter.
15442 !! html
15443 <p>I always thought &amp;eacute; was a cute letter.
15444 </p>
15445 !! end
15446
15447 !! test
15448 text with undefined character entity: xacute
15449 !! wikitext
15450 I always thought &xacute; was a cute letter.
15451 !! html
15452 <p>I always thought &amp;xacute; was a cute letter.
15453 </p>
15454 !! end
15455
15456 !! test
15457 HTML5 tags
15458 !! wikitext
15459 <data value="5">five</data>
15460 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15461 <mark>This highlighted text</mark>
15462 !! html
15463 <p><data value="5">five</data>
15464 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15465 <mark>This highlighted text</mark>
15466 </p>
15467 !! end
15468
15469 !! test
15470 HTML tag with leading space is parsed as text
15471 !! wikitext
15472 < div>foo< /div>
15473 !! html
15474 <p>&lt; div&gt;foo&lt; /div&gt;
15475 </p>
15476 !! end
15477
15478 ###
15479 ### Nesting tests (see bug 41545, 50604, 51081)
15480 ###
15481
15482 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15483 # Note that html2wt is considerably more difficult if we use <b> in
15484 # the test case, instead of <big>
15485 !! test
15486 Ensure that HTML adoption agency algorithm is properly implemented.
15487 !! wikitext
15488 <big>X<big>Y</big>Z</big>
15489 !! html
15490 <p><big>X<big>Y</big>Z</big>
15491 </p>
15492 !! end
15493
15494 # This was bug 41545 in the PHP parser.
15495 # Note that tidy doesn't handle this correctly.
15496 !! test
15497 Nesting of <kbd>
15498 !! wikitext
15499 <kbd>X<kbd>Y</kbd>Z</kbd>
15500 !! html
15501 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15502 </p>
15503 !! end
15504
15505 # The following cases were bug 51081 in the PHP parser.
15506 # Note that there are some other nestable tags (b, i, etc) which are
15507 # not covered; see bug 51081 for discussion.
15508
15509 # Note that tidy doesn't handle this correctly.
15510 !! test
15511 Nesting of <em>
15512 !! wikitext
15513 <em>X<em>Y</em>Z</em>
15514 !! html
15515 <p><em>X<em>Y</em>Z</em>
15516 </p>
15517 !! end
15518
15519 # Note that tidy doesn't handle this correctly.
15520 !! test
15521 Nesting of <strong>
15522 !! wikitext
15523 <strong>X<strong>Y</strong>Z</strong>
15524 !! html
15525 <p><strong>X<strong>Y</strong>Z</strong>
15526 </p>
15527 !! end
15528
15529 !! test
15530 Nesting of <q>
15531 !! wikitext
15532 <q>X<q>Y</q>Z</q>
15533 !! html+tidy
15534 <p><q>X<q>Y</q>Z</q></p>
15535 !! end
15536
15537 # Note that tidy doesn't handle this correctly.
15538 !! test
15539 Nesting of <ruby>
15540 !! wikitext
15541 <ruby>X<ruby>Y</ruby>Z</ruby>
15542 !! html
15543 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15544 </p>
15545 !! end
15546
15547 # Note that tidy doesn't handle this correctly.
15548 !! test
15549 Nesting of <bdo>
15550 !! wikitext
15551 <bdo>X<bdo>Y</bdo>Z</bdo>
15552 !! html
15553 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15554 </p>
15555 !! end
15556
15557
15558 ###
15559 ### Media links
15560 ###
15561
15562 !! test
15563 Media link
15564 !! wikitext
15565 [[Media:Foobar.jpg]]
15566 !! html
15567 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15568 </p>
15569 !! end
15570
15571 !! test
15572 Media link with text
15573 !! wikitext
15574 [[Media:Foobar.jpg|A neat file to look at]]
15575 !! html
15576 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15577 </p>
15578 !! end
15579
15580 # FIXME: this is still bad HTML tag nesting
15581 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15582 !! test
15583 Media link with nasty text
15584 !! wikitext
15585 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15586 !! html
15587 <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>
15588
15589 !! html+tidy
15590 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15591 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15592 !! end
15593
15594 !! test
15595 Media link to nonexistent file (bug 1702)
15596 !! wikitext
15597 [[Media:No such.jpg]]
15598 !! html
15599 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15600 </p>
15601 !! end
15602
15603 !! test
15604 Image link to nonexistent file (bug 1850 - good)
15605 !! wikitext
15606 [[File:No_such.jpg]]
15607 !! html/php
15608 <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>
15609 </p>
15610 !! html/parsoid
15611 <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>
15612 !! end
15613
15614 !! test
15615 :Image link to nonexistent file (bug 1850 - bad)
15616 !! wikitext
15617 [[:Image:No such.jpg]]
15618 !! html/php
15619 <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>
15620 </p>
15621 !! html/parsoid
15622 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15623 !! end
15624
15625
15626
15627 !! test
15628 Character reference normalization in link text (bug 1938)
15629 !! wikitext
15630 [[Main Page|this&that]]
15631 !! html
15632 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15633 </p>
15634 !!end
15635
15636 !! article
15637 אַ
15638 !! text
15639 Test for unicode normalization
15640
15641 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15642 !! endarticle
15643
15644 !! test
15645 (bug 19451) Links should refer to the normalized form.
15646 !! wikitext
15647 [[&#xFB2E;]]
15648 [[&#x5d0;&#x5b7;]]
15649 [[&#x5d0;ַ]]
15650 [[א&#x5b7;]]
15651 [[אַ]]
15652 !! html
15653 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15654 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15655 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15656 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15657 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15658 </p>
15659 !! end
15660
15661 !! test
15662 Empty attribute crash test (bug 2067)
15663 !! wikitext
15664 <font color="">foo</font>
15665 !! html
15666 <p><font color="">foo</font>
15667 </p>
15668 !! end
15669
15670 !! test
15671 Empty attribute crash test single-quotes (bug 2067)
15672 !! wikitext
15673 <font color=''>foo</font>
15674 !! html
15675 <p><font color="">foo</font>
15676 </p>
15677 !! end
15678
15679 !! test
15680 Attribute test: equals, then nothing
15681 !! wikitext
15682 <font color=>foo</font>
15683 !! html
15684 <p><font>foo</font>
15685 </p>
15686 !! end
15687
15688 !! test
15689 Attribute test: unquoted value
15690 !! wikitext
15691 <font color=x>foo</font>
15692 !! html
15693 <p><font color="x">foo</font>
15694 </p>
15695 !! end
15696
15697 !! test
15698 Attribute test: unquoted but illegal value (hash)
15699 !! wikitext
15700 <font color=#x>foo</font>
15701 !! html
15702 <p><font color="#x">foo</font>
15703 </p>
15704 !! end
15705
15706 # Parsoid does not serialize to empty attribute syntax,
15707 # so wt2wt and html2wt cases are skipped
15708 !! test
15709 Attribute test: no value (T54330)
15710 !! options
15711 parsoid=wt2html,html2html
15712 !! wikitext
15713 <font color>foo</font>
15714 !! html/php
15715 <p><font color="">foo</font>
15716 </p>
15717 !! html/parsoid
15718 <p><font color="">foo</font></p>
15719 !! end
15720
15721 !! test
15722 Bug 2095: link with three closing brackets
15723 !! wikitext
15724 [[Main Page]]]
15725 !! html/php
15726 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15727 </p>
15728 !! html/parsoid
15729 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15730 !! end
15731
15732 !! test
15733 Bug 2095: link with pipe and three closing brackets
15734 !! wikitext
15735 [[Main Page|link]]]
15736 !! html/php
15737 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15738 </p>
15739 !! html/parsoid
15740 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15741 !! end
15742
15743 !! test
15744 Bug 2095: link with pipe and three closing brackets, version 2
15745 !! wikitext
15746 [[Main Page|[http://example.com/]]]
15747 !! html/php
15748 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15749 </p>
15750 !! html/parsoid
15751 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15752 !! end
15753
15754
15755 ###
15756 ### Safety
15757 ###
15758
15759 !! article
15760 Template:Dangerous attribute
15761 !! text
15762 " onmouseover="alert(document.cookie)
15763 !! endarticle
15764
15765 !! article
15766 Template:Dangerous style attribute
15767 !! text
15768 border-size: expression(alert(document.cookie))
15769 !! endarticle
15770
15771 !! article
15772 Template:Div style
15773 !! text
15774 <div style="float: right; {{{1}}}">Magic div</div>
15775 !! endarticle
15776
15777 !! test
15778 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15779 !! wikitext
15780 <div title="{{test}}"></div>
15781 !! html
15782 <div title="This is a test template"></div>
15783
15784 !! end
15785
15786 # Parsoid has enough context to handle this case
15787 !! test
15788 Bug 2304: HTML attribute safety (dangerous template; 2309)
15789 !! wikitext
15790 <div title="{{dangerous attribute}}"></div>
15791 !! html/php
15792 <div title=""></div>
15793
15794 !! html/parsoid
15795 <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>
15796 !! end
15797
15798 !! test
15799 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15800 !! wikitext
15801 <div style="{{dangerous style attribute}}"></div>
15802 !! html
15803 <div style="/* insecure input */"></div>
15804
15805 !! end
15806
15807 !! test
15808 Bug 2304: HTML attribute safety (safe parameter; 2309)
15809 !! wikitext
15810 {{div style|width: 200px}}
15811 !! html
15812 <div style="float: right; width: 200px">Magic div</div>
15813
15814 !! end
15815
15816 !! test
15817 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15818 !! wikitext
15819 {{div style|width: expression(alert(document.cookie))}}
15820 !! html
15821 <div style="/* insecure input */">Magic div</div>
15822
15823 !! end
15824
15825 !! test
15826 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15827 !! wikitext
15828 {{div style|"><script>alert(document.cookie)</script>}}
15829 !! html
15830 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15831
15832 !! end
15833
15834 !! test
15835 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15836 !! wikitext
15837 {{div style|" ><script>alert(document.cookie)</script>}}
15838 !! html
15839 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15840
15841 !! end
15842
15843 !! test
15844 Bug 2304: HTML attribute safety (link)
15845 !! wikitext
15846 <div title="[[Main Page]]"></div>
15847 !! html
15848 <div title="&#91;&#91;Main Page]]"></div>
15849
15850 !! end
15851
15852 !! test
15853 Bug 2304: HTML attribute safety (italics)
15854 !! wikitext
15855 <div title="''foobar''"></div>
15856 !! html
15857 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15858
15859 !! end
15860
15861 !! test
15862 Bug 2304: HTML attribute safety (bold)
15863 !! wikitext
15864 <div title="'''foobar'''"></div>
15865 !! html
15866 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15867
15868 !! end
15869
15870
15871 !! test
15872 Bug 2304: HTML attribute safety (ISBN)
15873 !! wikitext
15874 <div title="ISBN 1234567890"></div>
15875 !! html
15876 <div title="&#73;SBN 1234567890"></div>
15877
15878 !! end
15879
15880 !! test
15881 Bug 2304: HTML attribute safety (RFC)
15882 !! wikitext
15883 <div title="RFC 1234"></div>
15884 !! html
15885 <div title="&#82;FC 1234"></div>
15886
15887 !! end
15888
15889 !! test
15890 Bug 2304: HTML attribute safety (PMID)
15891 !! wikitext
15892 <div title="PMID 1234567890"></div>
15893 !! html
15894 <div title="&#80;MID 1234567890"></div>
15895
15896 !! end
15897
15898 !! test
15899 Bug 2304: HTML attribute safety (web link)
15900 !! wikitext
15901 <div title="http://example.com/"></div>
15902 !! html
15903 <div title="http&#58;//example.com/"></div>
15904
15905 !! end
15906
15907 !! test
15908 Bug 2304: HTML attribute safety (named web link)
15909 !! wikitext
15910 <div title="[http://example.com/ link]"></div>
15911 !! html
15912 <div title="&#91;http&#58;//example.com/ link]"></div>
15913
15914 !! end
15915
15916 !! test
15917 Bug 3244: HTML attribute safety (extension; safe)
15918 !! wikitext
15919 <div style="<nowiki>background:blue</nowiki>"></div>
15920 !! html
15921 <div style="background:blue"></div>
15922
15923 !! end
15924
15925 !! test
15926 Bug 3244: HTML attribute safety (extension; unsafe)
15927 !! wikitext
15928 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15929 !! html
15930 <div style="/* insecure input */"></div>
15931
15932 !! end
15933
15934 # More MSIE fun discovered by Tom Gilder
15935
15936 !! test
15937 MSIE CSS safety test: spurious slash
15938 !! wikitext
15939 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15940 !! html
15941 <div style="/* insecure input */">evil</div>
15942
15943 !! end
15944
15945 !! test
15946 MSIE CSS safety test: hex code
15947 !! wikitext
15948 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15949 !! html
15950 <div style="/* insecure input */">evil</div>
15951
15952 !! end
15953
15954 !! test
15955 MSIE CSS safety test: comment in url
15956 !! wikitext
15957 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15958 !! html
15959 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15960
15961 !! end
15962
15963 !! test
15964 MSIE CSS safety test: comment in expression
15965 !! wikitext
15966 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15967 !! html
15968 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15969
15970 !! end
15971
15972 !! test
15973 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15974 !! wikitext
15975 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15976 !! html
15977 <p style="/* invalid control char */">A</p>
15978
15979 !! end
15980
15981 !! test
15982 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15983 !! wikitext
15984 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15985 <div style="top:EXPRESSION(alert())">B</div>
15986 !! html
15987 <p style="/* insecure input */">A</p>
15988 <div style="/* insecure input */">B</div>
15989
15990 !! end
15991
15992 !! test
15993 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15994 !! wikitext
15995 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15996 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15997 !! html
15998 <div style="/* insecure input */">A</div>
15999 <p style="/* insecure input */">B</p>
16000
16001 !! end
16002
16003 !! test
16004 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16005 !! wikitext
16006 <div style="background-image:url⁽javascript:alert())">A</div>
16007 <div style="background-image:url₍javascript:alert())">B</div>
16008 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16009 !! html
16010 <div style="/* insecure input */">A</div>
16011 <div style="/* insecure input */">B</div>
16012 <p style="/* insecure input */">C</p>
16013
16014 !! end
16015
16016 # FIXME: Parsoid fails to sanitize this! See T58846.
16017 !! test
16018 Opera -o-link CSS
16019 !! wikitext
16020 <div
16021 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;"
16022 style="-o-link:attr(title);-o-link-source:current">X</div>
16023 !! html
16024 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16025
16026 !! end
16027
16028 !! test
16029 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16030 !! wikitext
16031 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16032 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16033 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16034 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16035 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16036 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16037 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16038 !! html
16039 <p style="/* insecure input */">A</p>
16040 <p style="/* insecure input */">B</p>
16041 <p style="/* insecure input */">C</p>
16042 <p style="/* insecure input */">D</p>
16043 <p style="/* insecure input */">E</p>
16044 <p style="/* insecure input */">F</p>
16045 <p style="/* insecure input */">G</p>
16046
16047 !! end
16048
16049 !! test
16050 Table attribute legitimate extension
16051 !! wikitext
16052 {|
16053 !+ style="<nowiki>color:blue</nowiki>"| status
16054 |}
16055 !! html
16056 <table>
16057 <tr>
16058 <th style="color:blue"> status
16059 </th></tr></table>
16060
16061 !!end
16062
16063 !! test
16064 Table attribute safety
16065 !! wikitext
16066 {|
16067 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16068 |}
16069 !! html
16070 <table>
16071 <tr>
16072 <th style="/* insecure input */"> status
16073 </th></tr></table>
16074
16075 !! end
16076
16077 !! test
16078 CSS line continuation 1
16079 !! wikitext
16080 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16081 !! html
16082 <div style="/* insecure input */"></div>
16083
16084 !! end
16085
16086 !! test
16087 CSS line continuation 2
16088 !! wikitext
16089 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16090 !! html
16091 <div style="/* invalid control char */"></div>
16092
16093 !! end
16094
16095 !! article
16096 Template:Identity
16097 !! text
16098 {{{1}}}
16099 !! endarticle
16100
16101 !! test
16102 Expansion of multi-line templates in attribute values (bug 6255)
16103 !! wikitext
16104 <div style="background: {{identity|#00FF00}}">-</div>
16105 !! html
16106 <div style="background: #00FF00">-</div>
16107
16108 !! end
16109
16110
16111 !! test
16112 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16113 !! wikitext
16114 <div style="background:
16115 #00FF00">-</div>
16116 !! html/php
16117 <div style="background: #00FF00">-</div>
16118
16119 !! html/parsoid
16120 <div style="background:
16121 #00FF00">-</div>
16122 !! end
16123
16124 !! test
16125 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16126 !! wikitext
16127 <div style="background: &#10;#00FF00">-</div>
16128 !! html
16129 <div style="background: &#10;#00FF00">-</div>
16130
16131 !! end
16132
16133 !! test
16134 evil <math>-wiki-tags without Extension:Math enabled
16135 !! wikitext
16136 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16137 !! html+tidy
16138 <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>
16139 !! end
16140
16141 ###
16142 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16143 ###
16144 !! test
16145 Parser hook: empty input
16146 !! wikitext
16147 <tag></tag>
16148 !! html/php
16149 <pre>
16150 ''
16151 array (
16152 )
16153 </pre>
16154
16155 !! end
16156
16157 !! test
16158 Parser hook: empty input using terminated empty elements
16159 !! wikitext
16160 <tag/>
16161 !! html/php
16162 <pre>
16163 NULL
16164 array (
16165 )
16166 </pre>
16167
16168 !! end
16169
16170 !! test
16171 Parser hook: empty input using terminated empty elements (space before)
16172 !! wikitext
16173 <tag />
16174 !! html/php
16175 <pre>
16176 NULL
16177 array (
16178 )
16179 </pre>
16180
16181 !! end
16182
16183 !! test
16184 Parser hook: basic input
16185 !! wikitext
16186 <tag>input</tag>
16187 !! html/php
16188 <pre>
16189 'input'
16190 array (
16191 )
16192 </pre>
16193
16194 !! end
16195
16196
16197 !! test
16198 Parser hook: case insensitive
16199 !! wikitext
16200 <TAG>input</TAG>
16201 !! html/php
16202 <pre>
16203 'input'
16204 array (
16205 )
16206 </pre>
16207
16208 !! end
16209
16210
16211 !! test
16212 Parser hook: case insensitive, redux
16213 !! wikitext
16214 <TaG>input</TAg>
16215 !! html/php
16216 <pre>
16217 'input'
16218 array (
16219 )
16220 </pre>
16221
16222 !! end
16223
16224 !! test
16225 Parser hook: nested tags
16226 !! options
16227 noxml
16228 !! wikitext
16229 <tag><tag></tag></tag>
16230 !! html/php
16231 <pre>
16232 '<tag>'
16233 array (
16234 )
16235 </pre>&lt;/tag&gt;
16236
16237 !! end
16238
16239 !! test
16240 Parser hook: basic arguments
16241 !! wikitext
16242 <tag width=200 height = "100" depth = '50' square></tag>
16243 !! html/php
16244 <pre>
16245 ''
16246 array (
16247 'width' => '200',
16248 'height' => '100',
16249 'depth' => '50',
16250 'square' => '',
16251 )
16252 </pre>
16253
16254 !! end
16255
16256 !! test
16257 Parser hook: argument containing a forward slash (bug 5344)
16258 !! wikitext
16259 <tag filename='/tmp/bla'></tag>
16260 !! html/php
16261 <pre>
16262 ''
16263 array (
16264 'filename' => '/tmp/bla',
16265 )
16266 </pre>
16267
16268 !! end
16269
16270 !! test
16271 Parser hook: empty input using terminated empty elements (bug 2374)
16272 !! wikitext
16273 <tag foo=bar/>text
16274 !! html/php
16275 <pre>
16276 NULL
16277 array (
16278 'foo' => 'bar',
16279 )
16280 </pre>text
16281
16282 !! end
16283
16284 # </tag> should be output literally since there is no matching tag that begins it
16285 !! test
16286 Parser hook: basic arguments using terminated empty elements (bug 2374)
16287 !! wikitext
16288 <tag width=200 height = "100" depth = '50' square/>
16289 other stuff
16290 </tag>
16291 !! html/php
16292 <pre>
16293 NULL
16294 array (
16295 'width' => '200',
16296 'height' => '100',
16297 'depth' => '50',
16298 'square' => '',
16299 )
16300 </pre>
16301 <p>other stuff
16302 &lt;/tag&gt;
16303 </p>
16304 !! end
16305
16306 ###
16307 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16308 ###
16309
16310 !! test
16311 Parser hook: static parser hook not inside a comment
16312 !! wikitext
16313 <statictag>hello, world</statictag>
16314 <statictag action=flush/>
16315 !! html/php
16316 <p>hello, world
16317 </p>
16318 !! end
16319
16320
16321 !! test
16322 Parser hook: static parser hook inside a comment
16323 !! wikitext
16324 <!-- <statictag>hello, world</statictag> -->
16325 <statictag action=flush/>
16326 !! html/php
16327 <p><br />
16328 </p>
16329 !! end
16330
16331 # Nested template calls; this case was broken by Parser.php rev 1.506,
16332 # since reverted.
16333
16334 !! article
16335 Template:One-parameter
16336 !! text
16337 (My parameter is: {{{1}}})
16338 !! endarticle
16339
16340 !! article
16341 Template:Map-one-parameter
16342 !! text
16343 {{{{{1}}}|{{{2}}}}}
16344 !! endarticle
16345
16346 !! test
16347 Nested template calls
16348 !! wikitext
16349 {{Map-one-parameter|One-parameter|param}}
16350 !! html
16351 <p>(My parameter is: param)
16352 </p>
16353 !! end
16354
16355
16356 ###
16357 ### Sanitizer
16358 ###
16359
16360 # HTML+Tidy effectively strips out the empty tags completely
16361 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16362 # which Tidy would have done for the PHP parser had there been content inside it.
16363 !! test
16364 Sanitizer: Closing of open tags
16365 !! wikitext
16366 <s></s><table></table>
16367 !! html
16368 <s></s><table></table>
16369
16370 !! html/parsoid
16371 <p><s></s></p><table></table>
16372 !! end
16373
16374 !! test
16375 Sanitizer: Closing of open but not closed tags
16376 !! wikitext
16377 <s>foo
16378 !! html
16379 <p><s>foo</s>
16380 </p>
16381 !! end
16382
16383 !! test
16384 Sanitizer: Closing of closed but not open tags
16385 !! options
16386 parsoid=wt2html
16387 !! wikitext
16388 </s>
16389 !! html/php+tidy
16390 !! html/parsoid
16391 !! end
16392
16393 !! test
16394 Sanitizer: Closing of closed but not open table tags
16395 !! options
16396 parsoid=wt2html
16397 !! wikitext
16398 Table not started</td></tr></table>
16399 !! html/php+tidy
16400 <p>Table not started</p>
16401 !! html/parsoid
16402 <p>Table not started</p>
16403 !! end
16404
16405 !! test
16406 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16407 !! wikitext
16408 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16409 !! html
16410 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16411 </p>
16412 !! end
16413
16414 # In HTML5, the restrictions are that id must contain at least one character,
16415 # and must not contain any space characters.
16416 !! test
16417 Sanitizer: Validating the contents of the id attribute (bug 4515)
16418 !! options
16419 disabled
16420 !! wikitext
16421 <br id="" /><br id="a space" />
16422 !! html
16423 Something ...
16424 !! end
16425
16426 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16427 !! test
16428 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16429 !! options
16430 disabled
16431 !! wikitext
16432 <br id="foo" /><br id="foo" />
16433 !! html
16434 Something need to be done. foo-2 ?
16435 !! end
16436
16437 !! test
16438 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16439 !! wikitext
16440 <div itemscope>
16441 <meta itemprop="hello" content="world">
16442 <meta http-equiv="refresh" content="5">
16443 <meta itemprop="hello" http-equiv="refresh" content="5">
16444 <link itemprop="hello" href="{{SERVER}}">
16445 <link rel="stylesheet" href="{{SERVER}}">
16446 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16447 </div>
16448 !! html
16449 <div itemscope="">
16450 <p> <meta itemprop="hello" content="world" />
16451 &lt;meta http-equiv="refresh" content="5"&gt;
16452 <meta itemprop="hello" content="5" />
16453 </p>
16454 <link itemprop="hello" href="http&#58;//example.org" />
16455 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16456 <link itemprop="hello" href="http&#58;//example.org" />
16457 </div>
16458
16459 !! end
16460
16461 !! test
16462 Language converter: output gets cut off unexpectedly (bug 5757)
16463 !! options
16464 language=zh
16465 !! wikitext
16466 this bit is safe: }-
16467
16468 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16469
16470 then we get cut off here: }-
16471
16472 all additional text is vanished
16473 !! html
16474 <p>this bit is safe: }-
16475 </p><p>but if we add a conversion instance: xxx
16476 </p><p>then we get cut off here: }-
16477 </p><p>all additional text is vanished
16478 </p>
16479 !! end
16480
16481 !! test
16482 Self closed html pairs (bug 5487)
16483 !! options
16484 !! wikitext
16485 <center><font id="bug" />Centered text</center>
16486 <div><font id="bug2" />In div text</div>
16487 !! html
16488 <center>&lt;font id="bug" /&gt;Centered text</center>
16489 <div>&lt;font id="bug2" /&gt;In div text</div>
16490
16491 !! end
16492
16493 #
16494 #
16495 #
16496
16497 !! test
16498 Punctuation: nbsp before exclamation
16499 !! wikitext
16500 C'est grave !
16501 !! html
16502 <p>C'est grave&#160;!
16503 </p>
16504 !! end
16505
16506 !! test
16507 Punctuation: CSS !important (bug 11874)
16508 !! wikitext
16509 <div style="width:50% !important">important</div>
16510 !! html
16511 <div style="width:50% !important">important</div>
16512
16513 !!end
16514
16515 !! test
16516 Punctuation: CSS ! important (bug 11874; with space after)
16517 !! wikitext
16518 <div style="width:50% ! important">important</div>
16519 !! html
16520 <div style="width:50% ! important">important</div>
16521
16522 !!end
16523
16524 !! test
16525 HTML bullet list, closed tags (bug 5497)
16526 !! wikitext
16527 <ul>
16528 <li>One</li>
16529 <li>Two</li>
16530 </ul>
16531 !! html/php
16532 <ul>
16533 <li>One</li>
16534 <li>Two</li>
16535 </ul>
16536
16537 !! html/parsoid
16538 <ul data-parsoid='{"stx":"html"}'>
16539 <li data-parsoid='{"stx":"html"}'>One</li>
16540 <li data-parsoid='{"stx":"html"}'>Two</li>
16541 </ul>
16542
16543 !! end
16544
16545 !! test
16546 HTML bullet list, unclosed tags (bug 5497)
16547 !! wikitext
16548 <ul>
16549 <li>One
16550 <li>Two
16551 </ul>
16552 !! html/php+tidy
16553 <ul>
16554 <li>One</li>
16555 <li>Two</li>
16556 </ul>
16557 !! html/parsoid
16558 <ul data-parsoid='{"stx":"html"}'>
16559 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16560 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16561 </ul>
16562
16563 !! end
16564
16565 !! test
16566 HTML ordered list, closed tags (bug 5497)
16567 !! wikitext
16568 <ol>
16569 <li>One</li>
16570 <li>Two</li>
16571 </ol>
16572 !! html/php
16573 <ol>
16574 <li>One</li>
16575 <li>Two</li>
16576 </ol>
16577
16578 !! html/parsoid
16579 <ol data-parsoid='{"stx":"html"}'>
16580 <li data-parsoid='{"stx":"html"}'>One</li>
16581 <li data-parsoid='{"stx":"html"}'>Two</li>
16582 </ol>
16583
16584 !! end
16585
16586 !! test
16587 HTML ordered list, unclosed tags (bug 5497)
16588 !! options
16589 !! wikitext
16590 <ol>
16591 <li>One
16592 <li>Two
16593 </ol>
16594 !! html/php+tidy
16595 <ol>
16596 <li>One</li>
16597 <li>Two</li>
16598 </ol>
16599 !! html/parsoid
16600 <ol data-parsoid='{"stx":"html"}'>
16601 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16602 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16603 </ol>
16604
16605 !! end
16606
16607 !! test
16608 HTML nested bullet list, closed tags (bug 5497)
16609 !! wikitext
16610 <ul>
16611 <li>One</li>
16612 <li>Two:
16613 <ul>
16614 <li>Sub-one</li>
16615 <li>Sub-two</li>
16616 </ul>
16617 </li>
16618 </ul>
16619 !! html
16620 <ul>
16621 <li>One</li>
16622 <li>Two:
16623 <ul>
16624 <li>Sub-one</li>
16625 <li>Sub-two</li>
16626 </ul>
16627 </li>
16628 </ul>
16629
16630 !! end
16631
16632 !! test
16633 HTML nested bullet list, open tags (bug 5497)
16634 !! wikitext
16635 <ul>
16636 <li>One
16637 <li>Two:
16638 <ul>
16639 <li>Sub-one
16640 <li>Sub-two
16641 </ul>
16642 </ul>
16643 !! html/php+tidy
16644 <ul>
16645 <li>One</li>
16646 <li>Two:
16647 <ul>
16648 <li>Sub-one</li>
16649 <li>Sub-two</li>
16650 </ul>
16651 </li>
16652 </ul>
16653 !! html/parsoid
16654 <ul>
16655 <li>One
16656 </li>
16657 <li>Two:
16658 <ul>
16659 <li>Sub-one
16660 </li>
16661 <li>Sub-two
16662 </li>
16663 </ul>
16664 </li>
16665 </ul>
16666
16667 !! end
16668
16669 !! test
16670 HTML nested ordered list, closed tags (bug 5497)
16671 !! wikitext
16672 <ol>
16673 <li>One</li>
16674 <li>Two:
16675 <ol>
16676 <li>Sub-one</li>
16677 <li>Sub-two</li>
16678 </ol>
16679 </li>
16680 </ol>
16681 !! html
16682 <ol>
16683 <li>One</li>
16684 <li>Two:
16685 <ol>
16686 <li>Sub-one</li>
16687 <li>Sub-two</li>
16688 </ol>
16689 </li>
16690 </ol>
16691
16692 !! end
16693
16694 !! test
16695 HTML nested ordered list, open tags (bug 5497)
16696 !! wikitext
16697 <ol>
16698 <li>One
16699 <li>Two:
16700 <ol>
16701 <li>Sub-one
16702 <li>Sub-two
16703 </ol>
16704 </ol>
16705 !! html/php
16706 <ol>
16707 <li>One
16708 <li>Two:
16709 <ol>
16710 <li>Sub-one
16711 <li>Sub-two
16712 </ol>
16713 </ol>
16714
16715 !! html/parsoid
16716 <ol>
16717 <li>One
16718 </li>
16719 <li>Two:
16720 <ol>
16721 <li>Sub-one
16722 </li>
16723 <li>Sub-two
16724 </li>
16725 </ol>
16726 </li>
16727 </ol>
16728
16729 !! end
16730
16731 !! test
16732 HTML ordered list item with parameters oddity
16733 !! wikitext
16734 <ol><li id="fragment">One</li>
16735 </ol>
16736 !! html
16737 <ol><li id="fragment">One</li>
16738 </ol>
16739
16740 !! end
16741
16742 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16743 !!test
16744 bug 5918: autonumbering
16745 !! wikitext
16746 [http://first/] [http://second] [ftp://ftp]
16747
16748 ftp://inlineftp
16749
16750 [mailto:enclosed@mail.tld With target]
16751
16752 [mailto:enclosed@mail.tld]
16753
16754 mailto:inline@mail.tld
16755 !! html/php
16756 <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>
16757 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16758 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16759 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16760 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16761 </p>
16762 !! html/parsoid
16763 <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>
16764 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16765 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16766 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16767 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16768 !! end
16769
16770
16771 #
16772 # Security and HTML correctness
16773 # From Nick Jenkins' fuzz testing
16774 #
16775
16776 !! test
16777 Fuzz testing: Parser13
16778 !! wikitext
16779 {|
16780 | http://a|
16781 !! html
16782 <table>
16783 <tr>
16784 <td>
16785 </td>
16786 </tr>
16787 </table>
16788
16789 !! end
16790
16791 !! test
16792 Fuzz testing: Parser14
16793 !! wikitext
16794 == onmouseover= ==
16795 http://__TOC__
16796 !! html
16797 <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>
16798 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16799 <ul>
16800 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16801 </ul>
16802 </div>
16803
16804
16805 !! html+tidy
16806 <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>
16807 <p>http://</p>
16808 <div id="toc" class="toc">
16809 <div id="toctitle">
16810 <h2>Contents</h2>
16811 </div>
16812 <ul>
16813 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16814 </ul>
16815 </div>
16816 <p></p>
16817 !! end
16818
16819 !! test
16820 Fuzz testing: Parser14-table
16821 !! wikitext
16822 ==a==
16823 {| STYLE=__TOC__
16824 !! html
16825 <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>
16826 <table style="&#95;_TOC&#95;_">
16827 <tr><td></td></tr>
16828 </table>
16829
16830 !! html+tidy
16831 <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>
16832 <table style="__TOC__">
16833 <tr>
16834 <td></td>
16835 </tr>
16836 </table>
16837 !! end
16838
16839 # Known to produce bogus xml (extra </td>)
16840 !! test
16841 Fuzz testing: Parser16
16842 !! options
16843 noxml
16844 !! wikitext
16845 {|
16846 !https://||||||
16847 !! html
16848 <table>
16849 <tr>
16850 <th>https://</th>
16851 <th></th>
16852 <th></th>
16853 <th>
16854 </td>
16855 </tr>
16856 </table>
16857
16858 !! html+tidy
16859 <table>
16860 <tr>
16861 <th>https://</th>
16862 <th></th>
16863 <th></th>
16864 <th></th>
16865 </tr>
16866 </table>
16867 !! end
16868
16869 !! test
16870 Fuzz testing: Parser21
16871 !! wikitext
16872 {|
16873 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16874 |
16875 !! html
16876 <table>
16877 <tr>
16878 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16879 </th>
16880 <td>
16881 </td>
16882 </tr>
16883 </table>
16884
16885 !! end
16886
16887 !! test
16888 Fuzz testing: Parser22
16889 !! wikitext
16890 http://===r:::https://b
16891
16892 {|
16893 !! html
16894 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16895 </p>
16896 <table>
16897 <tr><td></td></tr>
16898 </table>
16899
16900 !! end
16901
16902 # Known to produce bad XML for now
16903 !! test
16904 Fuzz testing: Parser24
16905 !! options
16906 noxml
16907 !! wikitext
16908 {|
16909 {{{|
16910 <u CLASS=
16911 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16912 <br style="onmouseover='alert(document.cookie);' " />
16913
16914 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16915 |
16916 !! html
16917 <table>
16918 {{{|
16919 <u class="&#124;">}}}} &gt;
16920 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16921
16922 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16923 <tr>
16924 <td></u>
16925 </td>
16926 </tr>
16927 </table>
16928
16929 !! end
16930
16931 # Note: the current result listed for this is not what the original one was,
16932 # but the original bug was JavaScript injection, which is fixed in any case.
16933 # It's not clear that the original result listed was any more correct than the
16934 # current one. Original result:
16935 # <p>{{{|
16936 # </p>
16937 # <li class="&#124;&#124;">
16938 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16939 !!test
16940 Fuzz testing: Parser25 (bug 6055)
16941 !! wikitext
16942 {{{
16943 |
16944 <LI CLASS=||
16945 >
16946 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16947 !! html
16948 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16949 </p>
16950 !! end
16951
16952 !!test
16953 Fuzz testing: URL adjacent extension (with space, clean)
16954 !! wikitext
16955 http://example.com <nowiki>junk</nowiki>
16956 !! html/php
16957 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16958 </p>
16959 !! html/parsoid
16960 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16961 !! end
16962
16963 !!test
16964 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16965 !! wikitext
16966 http://example.com<nowiki>junk</nowiki>
16967 !! html/php
16968 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16969 </p>
16970 !! html/parsoid
16971 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16972 !! end
16973
16974 !!test
16975 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16976 !! wikitext
16977 http://example.com<pre>junk</pre>
16978 !! html/php
16979 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16980
16981 !! html/php+tidy
16982 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16983 <pre>
16984 junk
16985 </pre>
16986 !! html/parsoid
16987 <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>
16988 !!end
16989
16990 !!test
16991 Fuzz testing: image with bogus manual thumbnail
16992 !! wikitext
16993 [[Image:foobar.jpg|thumbnail= ]]
16994 !! html/php
16995 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16996
16997 !! html/parsoid
16998 <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>
16999 !!end
17000
17001 !! test
17002 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17003 !! wikitext
17004 <pre dir="&#10;"></pre>
17005 !! html
17006 <pre dir="&#10;"></pre>
17007
17008 !! end
17009
17010 !! test
17011 Parsing optional HTML elements (Bug 6171)
17012 !! options
17013 !! wikitext
17014 <table>
17015 <tr>
17016 <td> Some tabular data</td>
17017 <td> More tabular data ...
17018 <td> And yet som tabular data</td>
17019 </tr>
17020 </table>
17021 !! html
17022 <table>
17023 <tr>
17024 <td> Some tabular data</td>
17025 <td> More tabular data ...
17026 </td><td> And yet som tabular data</td>
17027 </tr>
17028 </table>
17029
17030 !! end
17031
17032 !! test
17033 Correct handling of <td>, <tr> (Bug 6171)
17034 !! options
17035 !! wikitext
17036 <table>
17037 <tr>
17038 <td> Some tabular data</td>
17039 <td> More tabular data ...</td>
17040 <td> And yet som tabular data</td>
17041 </tr>
17042 </table>
17043 !! html
17044 <table>
17045 <tr>
17046 <td> Some tabular data</td>
17047 <td> More tabular data ...</td>
17048 <td> And yet som tabular data</td>
17049 </tr>
17050 </table>
17051
17052 !! end
17053
17054
17055 !! test
17056 Parsing crashing regression (fr:JavaScript)
17057 !! wikitext
17058 </body></x>
17059 !! html
17060 <p>&lt;/body&gt;&lt;/x&gt;
17061 </p>
17062 !! end
17063
17064 !! test
17065 Inline wiki vs wiki block nesting
17066 !! wikitext
17067 '''Bold paragraph
17068
17069 New wiki paragraph
17070 !! html
17071 <p><b>Bold paragraph</b>
17072 </p><p>New wiki paragraph
17073 </p>
17074 !! end
17075
17076 # FIXME: The current php output is documented
17077 # and desired output is the parsoid target.
17078 !! test
17079 Inline HTML vs wiki block nesting
17080 !! wikitext
17081 <b>Bold paragraph
17082
17083 New wiki paragraph
17084 !! html/php
17085 <p><b>Bold paragraph
17086 </p><p>New wiki paragraph</b>
17087 </p>
17088 !! html/parsoid
17089 <p><b>Bold paragraph</b>
17090 </p><p>New wiki paragraph
17091 </p>
17092 !! end
17093
17094 # Original result was this:
17095 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17096 # </p>
17097 # While that might be marginally more intuitive, maybe, the six-apostrophe
17098 # construct is clearly pathological and the result stated here (which is what
17099 # the parser actually does) is about as reasonable as anything.
17100 !!test
17101 Mixing markup for italics and bold
17102 !! options
17103 !! wikitext
17104 '''bold''''''bold''bolditalics'''''
17105 !! html
17106 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17107 </p>
17108 !! end
17109
17110
17111 !! article
17112 Xyzzyx
17113 !! text
17114 Article for special page transclusion test
17115 !! endarticle
17116
17117 !! test
17118 Special page transclusion
17119 !! options
17120 !! wikitext
17121 {{Special:Prefixindex/Xyzzyx}}
17122 !! html
17123 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17124 </ul>
17125
17126 !! end
17127
17128 !! test
17129 Special page transclusion twice (bug 5021)
17130 !! options
17131 !! wikitext
17132 {{Special:Prefixindex/Xyzzyx}}
17133 {{Special:Prefixindex/Xyzzyx}}
17134 !! html
17135 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17136 </ul>
17137 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17138 </ul>
17139
17140 !! end
17141
17142 !! test
17143 Transclusion of default MediaWiki message
17144 !! wikitext
17145 {{MediaWiki:Mainpage}}
17146 !! html
17147 <p>Main Page
17148 </p>
17149 !! end
17150
17151 !! test
17152 Transclusion of nonexistent MediaWiki message
17153 !! wikitext
17154 {{MediaWiki:Mainpagexxx}}
17155 !! html
17156 <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>
17157 </p>
17158 !! end
17159
17160 !! test
17161 Transclusion of MediaWiki message with underscore
17162 !! wikitext
17163 {{MediaWiki:history_short}}
17164 !! html
17165 <p>History
17166 </p>
17167 !! end
17168
17169 !! test
17170 Transclusion of MediaWiki message with space
17171 !! wikitext
17172 {{MediaWiki:history short}}
17173 !! html
17174 <p>History
17175 </p>
17176 !! end
17177
17178 !! test
17179 Invalid header with following text
17180 !! wikitext
17181 = x = y
17182 !! html
17183 <p>= x = y
17184 </p>
17185 !! end
17186
17187
17188 !! test
17189 Section extraction test (section 0)
17190 !! options
17191 section=0
17192 !! wikitext
17193 start
17194 ==a==
17195 ===aa===
17196 ====aaa====
17197 ==b==
17198 ===ba===
17199 ===bb===
17200 ====bba====
17201 ===bc===
17202 ==c==
17203 ===ca===
17204 !! html/php
17205 start
17206 !! end
17207
17208 !! test
17209 Section extraction test (section 1)
17210 !! options
17211 section=1
17212 !! wikitext
17213 start
17214 ==a==
17215 ===aa===
17216 ====aaa====
17217 ==b==
17218 ===ba===
17219 ===bb===
17220 ====bba====
17221 ===bc===
17222 ==c==
17223 ===ca===
17224 !! html/php
17225 ==a==
17226 ===aa===
17227 ====aaa====
17228 !! end
17229
17230 !! test
17231 Section extraction test (section 2)
17232 !! options
17233 section=2
17234 !! wikitext
17235 start
17236 ==a==
17237 ===aa===
17238 ====aaa====
17239 ==b==
17240 ===ba===
17241 ===bb===
17242 ====bba====
17243 ===bc===
17244 ==c==
17245 ===ca===
17246 !! html/php
17247 ===aa===
17248 ====aaa====
17249 !! end
17250
17251 !! test
17252 Section extraction test (section 3)
17253 !! options
17254 section=3
17255 !! wikitext
17256 start
17257 ==a==
17258 ===aa===
17259 ====aaa====
17260 ==b==
17261 ===ba===
17262 ===bb===
17263 ====bba====
17264 ===bc===
17265 ==c==
17266 ===ca===
17267 !! html/php
17268 ====aaa====
17269 !! end
17270
17271 !! test
17272 Section extraction test (section 4)
17273 !! options
17274 section=4
17275 !! wikitext
17276 start
17277 ==a==
17278 ===aa===
17279 ====aaa====
17280 ==b==
17281 ===ba===
17282 ===bb===
17283 ====bba====
17284 ===bc===
17285 ==c==
17286 ===ca===
17287 !! html/php
17288 ==b==
17289 ===ba===
17290 ===bb===
17291 ====bba====
17292 ===bc===
17293 !! end
17294
17295 !! test
17296 Section extraction test (section 5)
17297 !! options
17298 section=5
17299 !! wikitext
17300 start
17301 ==a==
17302 ===aa===
17303 ====aaa====
17304 ==b==
17305 ===ba===
17306 ===bb===
17307 ====bba====
17308 ===bc===
17309 ==c==
17310 ===ca===
17311 !! html/php
17312 ===ba===
17313 !! end
17314
17315 !! test
17316 Section extraction test (section 6)
17317 !! options
17318 section=6
17319 !! wikitext
17320 start
17321 ==a==
17322 ===aa===
17323 ====aaa====
17324 ==b==
17325 ===ba===
17326 ===bb===
17327 ====bba====
17328 ===bc===
17329 ==c==
17330 ===ca===
17331 !! html/php
17332 ===bb===
17333 ====bba====
17334 !! end
17335
17336 !! test
17337 Section extraction test (section 7)
17338 !! options
17339 section=7
17340 !! wikitext
17341 start
17342 ==a==
17343 ===aa===
17344 ====aaa====
17345 ==b==
17346 ===ba===
17347 ===bb===
17348 ====bba====
17349 ===bc===
17350 ==c==
17351 ===ca===
17352 !! html/php
17353 ====bba====
17354 !! end
17355
17356 !! test
17357 Section extraction test (section 8)
17358 !! options
17359 section=8
17360 !! wikitext
17361 start
17362 ==a==
17363 ===aa===
17364 ====aaa====
17365 ==b==
17366 ===ba===
17367 ===bb===
17368 ====bba====
17369 ===bc===
17370 ==c==
17371 ===ca===
17372 !! html/php
17373 ===bc===
17374 !! end
17375
17376 !! test
17377 Section extraction test (section 9)
17378 !! options
17379 section=9
17380 !! wikitext
17381 start
17382 ==a==
17383 ===aa===
17384 ====aaa====
17385 ==b==
17386 ===ba===
17387 ===bb===
17388 ====bba====
17389 ===bc===
17390 ==c==
17391 ===ca===
17392 !! html/php
17393 ==c==
17394 ===ca===
17395 !! end
17396
17397 !! test
17398 Section extraction test (section 10)
17399 !! options
17400 section=10
17401 !! wikitext
17402 start
17403 ==a==
17404 ===aa===
17405 ====aaa====
17406 ==b==
17407 ===ba===
17408 ===bb===
17409 ====bba====
17410 ===bc===
17411 ==c==
17412 ===ca===
17413 !! html/php
17414 ===ca===
17415 !! end
17416
17417 !! test
17418 Section extraction test (nonexistent section 11)
17419 !! options
17420 section=11
17421 !! wikitext
17422 start
17423 ==a==
17424 ===aa===
17425 ====aaa====
17426 ==b==
17427 ===ba===
17428 ===bb===
17429 ====bba====
17430 ===bc===
17431 ==c==
17432 ===ca===
17433 !! html/php
17434 !! end
17435
17436 !! test
17437 Section extraction test with bogus heading (section 1)
17438 !! options
17439 section=1
17440 !! wikitext
17441 ==a==
17442 ==bogus== not a legal section
17443 ==b==
17444 !! html/php
17445 ==a==
17446 ==bogus== not a legal section
17447 !! end
17448
17449 !! test
17450 Section extraction test with bogus heading (section 2)
17451 !! options
17452 section=2
17453 !! wikitext
17454 ==a==
17455 ==bogus== not a legal section
17456 ==b==
17457 !! html/php
17458 ==b==
17459 !! end
17460
17461 !! test
17462 Section extraction test with comment after heading (section 1)
17463 !! options
17464 section=1
17465 !! wikitext
17466 ==a==
17467 ==b== <!-- -->
17468 ==c==
17469 !! html/php
17470 ==a==
17471 !! end
17472
17473 !! test
17474 Section extraction test with comment after heading (section 2)
17475 !! options
17476 section=2
17477 !! wikitext
17478 ==a==
17479 ==b== <!-- -->
17480 ==c==
17481 !! html/php
17482 ==b== <!-- -->
17483 !! end
17484
17485 !! test
17486 Section extraction test with bogus <nowiki> heading (section 1)
17487 !! options
17488 section=1
17489 !! wikitext
17490 ==a==
17491 ==bogus== <nowiki>not a legal section</nowiki>
17492 ==b==
17493 !! html/php
17494 ==a==
17495 ==bogus== <nowiki>not a legal section</nowiki>
17496 !! end
17497
17498 !! test
17499 Section extraction test with bogus <nowiki> heading (section 2)
17500 !! options
17501 section=2
17502 !! wikitext
17503 ==a==
17504 ==bogus== <nowiki>not a legal section</nowiki>
17505 ==b==
17506 !! html/php
17507 ==b==
17508 !! end
17509
17510 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17511 # instead of respecting commented sections
17512 !! test
17513 Section extraction prefixed by comment (section 1)
17514 !! options
17515 section=1
17516 !! wikitext
17517 <!-- -->==sec1==
17518 ==sec2==
17519 !! html/php
17520 ==sec2==
17521 !!end
17522
17523 !! test
17524 Section extraction prefixed by comment (section 2)
17525 !! options
17526 section=2
17527 !! wikitext
17528 <!-- -->==sec1==
17529 ==sec2==
17530 !! html/php
17531
17532 !!end
17533
17534 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17535 # instead of respecting HTML-style headings
17536 !! test
17537 Section extraction, mixed wiki and html (section 1)
17538 !! options
17539 section=1
17540 !! wikitext
17541 <h2>unmarked</h2>
17542 unmarked
17543 ==1==
17544 one
17545 ==2==
17546 two
17547 !! html/php
17548 ==1==
17549 one
17550 !! end
17551
17552 !! test
17553 Section extraction, mixed wiki and html (section 2)
17554 !! options
17555 section=2
17556 !! wikitext
17557 <h2>unmarked</h2>
17558 unmarked
17559 ==1==
17560 one
17561 ==2==
17562 two
17563 !! html/php
17564 ==2==
17565 two
17566 !! end
17567
17568
17569 # Formerly testing for bug 3342
17570 !! test
17571 Section extraction, heading surrounded by <noinclude>
17572 !! options
17573 section=1
17574 !! wikitext
17575 <noinclude>==unmarked==</noinclude>
17576 ==marked==
17577 !! html/php
17578 ==marked==
17579 !!end
17580
17581 # Test behavior of bug 19910
17582 !! test
17583 Sectiion with all-equals
17584 !! options
17585 section=2
17586 !! wikitext
17587 ===
17588 The line above must have a trailing space
17589 === <!--
17590 --> <!-- -->
17591 But just in case it doesn't...
17592 !! html/php
17593 === <!--
17594 --> <!-- -->
17595 But just in case it doesn't...
17596 !! end
17597
17598 !! test
17599 Section replacement test (section 0)
17600 !! options
17601 replace=0,"xxx"
17602 !! wikitext
17603 start
17604 ==a==
17605 ===aa===
17606 ====aaa====
17607 ==b==
17608 ===ba===
17609 ===bb===
17610 ====bba====
17611 ===bc===
17612 ==c==
17613 ===ca===
17614 !! html/php
17615 xxx
17616
17617 ==a==
17618 ===aa===
17619 ====aaa====
17620 ==b==
17621 ===ba===
17622 ===bb===
17623 ====bba====
17624 ===bc===
17625 ==c==
17626 ===ca===
17627 !! end
17628
17629 !! test
17630 Section replacement test (section 1)
17631 !! options
17632 replace=1,"xxx"
17633 !! wikitext
17634 start
17635 ==a==
17636 ===aa===
17637 ====aaa====
17638 ==b==
17639 ===ba===
17640 ===bb===
17641 ====bba====
17642 ===bc===
17643 ==c==
17644 ===ca===
17645 !! html/php
17646 start
17647 xxx
17648
17649 ==b==
17650 ===ba===
17651 ===bb===
17652 ====bba====
17653 ===bc===
17654 ==c==
17655 ===ca===
17656 !! end
17657
17658 !! test
17659 Section replacement test (section 2)
17660 !! options
17661 replace=2,"xxx"
17662 !! wikitext
17663 start
17664 ==a==
17665 ===aa===
17666 ====aaa====
17667 ==b==
17668 ===ba===
17669 ===bb===
17670 ====bba====
17671 ===bc===
17672 ==c==
17673 ===ca===
17674 !! html/php
17675 start
17676 ==a==
17677 xxx
17678
17679 ==b==
17680 ===ba===
17681 ===bb===
17682 ====bba====
17683 ===bc===
17684 ==c==
17685 ===ca===
17686 !! end
17687
17688 !! test
17689 Section replacement test (section 3)
17690 !! options
17691 replace=3,"xxx"
17692 !! wikitext
17693 start
17694 ==a==
17695 ===aa===
17696 ====aaa====
17697 ==b==
17698 ===ba===
17699 ===bb===
17700 ====bba====
17701 ===bc===
17702 ==c==
17703 ===ca===
17704 !! html/php
17705 start
17706 ==a==
17707 ===aa===
17708 xxx
17709
17710 ==b==
17711 ===ba===
17712 ===bb===
17713 ====bba====
17714 ===bc===
17715 ==c==
17716 ===ca===
17717 !! end
17718
17719 !! test
17720 Section replacement test (section 4)
17721 !! options
17722 replace=4,"xxx"
17723 !! wikitext
17724 start
17725 ==a==
17726 ===aa===
17727 ====aaa====
17728 ==b==
17729 ===ba===
17730 ===bb===
17731 ====bba====
17732 ===bc===
17733 ==c==
17734 ===ca===
17735 !! html/php
17736 start
17737 ==a==
17738 ===aa===
17739 ====aaa====
17740 xxx
17741
17742 ==c==
17743 ===ca===
17744 !! end
17745
17746 !! test
17747 Section replacement test (section 5)
17748 !! options
17749 replace=5,"xxx"
17750 !! wikitext
17751 start
17752 ==a==
17753 ===aa===
17754 ====aaa====
17755 ==b==
17756 ===ba===
17757 ===bb===
17758 ====bba====
17759 ===bc===
17760 ==c==
17761 ===ca===
17762 !! html/php
17763 start
17764 ==a==
17765 ===aa===
17766 ====aaa====
17767 ==b==
17768 xxx
17769
17770 ===bb===
17771 ====bba====
17772 ===bc===
17773 ==c==
17774 ===ca===
17775 !! end
17776
17777 !! test
17778 Section replacement test (section 6)
17779 !! options
17780 replace=6,"xxx"
17781 !! wikitext
17782 start
17783 ==a==
17784 ===aa===
17785 ====aaa====
17786 ==b==
17787 ===ba===
17788 ===bb===
17789 ====bba====
17790 ===bc===
17791 ==c==
17792 ===ca===
17793 !! html/php
17794 start
17795 ==a==
17796 ===aa===
17797 ====aaa====
17798 ==b==
17799 ===ba===
17800 xxx
17801
17802 ===bc===
17803 ==c==
17804 ===ca===
17805 !! end
17806
17807 !! test
17808 Section replacement test (section 7)
17809 !! options
17810 replace=7,"xxx"
17811 !! wikitext
17812 start
17813 ==a==
17814 ===aa===
17815 ====aaa====
17816 ==b==
17817 ===ba===
17818 ===bb===
17819 ====bba====
17820 ===bc===
17821 ==c==
17822 ===ca===
17823 !! html/php
17824 start
17825 ==a==
17826 ===aa===
17827 ====aaa====
17828 ==b==
17829 ===ba===
17830 ===bb===
17831 xxx
17832
17833 ===bc===
17834 ==c==
17835 ===ca===
17836 !! end
17837
17838 !! test
17839 Section replacement test (section 8)
17840 !! options
17841 replace=8,"xxx"
17842 !! wikitext
17843 start
17844 ==a==
17845 ===aa===
17846 ====aaa====
17847 ==b==
17848 ===ba===
17849 ===bb===
17850 ====bba====
17851 ===bc===
17852 ==c==
17853 ===ca===
17854 !! html/php
17855 start
17856 ==a==
17857 ===aa===
17858 ====aaa====
17859 ==b==
17860 ===ba===
17861 ===bb===
17862 ====bba====
17863 xxx
17864
17865 ==c==
17866 ===ca===
17867 !!end
17868
17869 !! test
17870 Section replacement test (section 9)
17871 !! options
17872 replace=9,"xxx"
17873 !! wikitext
17874 start
17875 ==a==
17876 ===aa===
17877 ====aaa====
17878 ==b==
17879 ===ba===
17880 ===bb===
17881 ====bba====
17882 ===bc===
17883 ==c==
17884 ===ca===
17885 !! html/php
17886 start
17887 ==a==
17888 ===aa===
17889 ====aaa====
17890 ==b==
17891 ===ba===
17892 ===bb===
17893 ====bba====
17894 ===bc===
17895 xxx
17896 !! end
17897
17898 !! test
17899 Section replacement test (section 10)
17900 !! options
17901 replace=10,"xxx"
17902 !! wikitext
17903 start
17904 ==a==
17905 ===aa===
17906 ====aaa====
17907 ==b==
17908 ===ba===
17909 ===bb===
17910 ====bba====
17911 ===bc===
17912 ==c==
17913 ===ca===
17914 !! html/php
17915 start
17916 ==a==
17917 ===aa===
17918 ====aaa====
17919 ==b==
17920 ===ba===
17921 ===bb===
17922 ====bba====
17923 ===bc===
17924 ==c==
17925 xxx
17926 !! end
17927
17928 !! test
17929 Section replacement test with initial whitespace (bug 13728)
17930 !! options
17931 replace=2,"xxx"
17932 !! wikitext
17933 Preformatted initial line
17934 ==a==
17935 ===a===
17936 !! html/php
17937 Preformatted initial line
17938 ==a==
17939 xxx
17940 !! end
17941
17942
17943 !! test
17944 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17945 !! options
17946 section=1
17947 !! wikitext
17948 ==a==
17949 a
17950 !! html/php
17951 ==a==
17952 a
17953 !! end
17954
17955 !! test
17956 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17957 !! options
17958 section=1
17959 !! wikitext
17960 ==a==
17961 a
17962 !! html/php
17963 ==a==
17964 a
17965 !! end
17966
17967
17968 !! test
17969 Section extraction, <pre> around bogus header (bug 10309)
17970 !! options
17971 noxml section=2
17972 !! wikitext
17973 == Section One ==
17974 <pre>
17975 =======
17976 </pre>
17977
17978 == Section Two ==
17979 stuff
17980 !! html/php
17981 == Section Two ==
17982 stuff
17983 !! end
17984
17985 !! test
17986 Section replacement, <pre> around bogus header (bug 10309)
17987 !! options
17988 noxml replace=2,"xxx"
17989 !! wikitext
17990 == Section One ==
17991 <pre>
17992 =======
17993 </pre>
17994
17995 == Section Two ==
17996 stuff
17997 !! html/php
17998 == Section One ==
17999 <pre>
18000 =======
18001 </pre>
18002
18003 xxx
18004 !! end
18005
18006
18007 !! test
18008 Handling of &#x0A; in URLs
18009 !! wikitext
18010 ** irc://&#x0A;a
18011 !! html/php
18012 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18013
18014 !! html/parsoid
18015 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18016 a">irc://
18017 a</a></li></ul></li></ul>
18018 !! end
18019
18020 !! test
18021 Handling of %0A in URLs
18022 !! wikitext
18023 ** irc://%0Aa
18024 !! html/php
18025 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18026
18027 !! html/parsoid
18028 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18029 !! end
18030
18031
18032 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18033 !! test
18034 5 quotes, code coverage +1 line
18035 !! options
18036 parsoid=wt2html
18037 !! wikitext
18038 '''''
18039 !! html/php
18040 !! html/parsoid
18041 <p><b><i></i></b></p>
18042 !! end
18043
18044 # same html as previous, but wikitext adjusted to match parsoid html2wt
18045 # note that wt2html and html2html will put the <i> before the <b>
18046 !! test
18047 5 quotes, code coverage +1 line w/ nowiki (1)
18048 !! options
18049 parsoid=wt2wt,html2wt
18050 !! wikitext
18051 '''''<nowiki/>'''''
18052 !! html/php
18053 <p><i></i>
18054 </p>
18055 !! html/parsoid
18056 <p><b><i></i></b></p>
18057 !! end
18058
18059 # same as previous, just swapping the <i> and <b>
18060 !! test
18061 5 quotes, code coverage +1 line w/ nowiki (2)
18062 !! wikitext
18063 '''''<nowiki/>'''''
18064 !! html/php
18065 <p><i></i>
18066 </p>
18067 !! html/parsoid
18068 <p><i><b></b></i></p>
18069 !! end
18070
18071 !! test
18072 Special:Search page linking.
18073 !! wikitext
18074 {{Special:search}}
18075 !! html
18076 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18077 </p>
18078 !! end
18079
18080 !! test
18081 {{!}} is a magic word
18082 !! wikitext
18083 {{!}} is a magic word there and {{!}} is still a magic word here
18084 | is not a magic word here but {{!}} is still a magic word here
18085 !! html/php
18086 <p>| is a magic word there and | is still a magic word here
18087 | is not a magic word here but | is still a magic word here
18088 </p>
18089 !! html/parsoid
18090 <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
18091 | 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>
18092
18093 !! end
18094
18095 !! test
18096 Say the magic word
18097 !! options
18098 title=[[Parser test]]
18099 !! wikitext
18100 * {{PAGENAME}}
18101 * {{PAGENAMEE}}
18102 * {{FULLPAGENAME}}
18103 * {{FULLPAGENAMEE}}
18104 * {{BASEPAGENAME}}
18105 * {{BASEPAGENAMEE}}
18106 * {{SUBPAGENAME}}
18107 * {{SUBPAGENAMEE}}
18108 * {{ROOTPAGENAME}}
18109 * {{ROOTPAGENAMEE}}
18110 * {{TALKPAGENAME}}
18111 * {{TALKPAGENAMEE}}
18112 * {{SUBJECTPAGENAME}}
18113 * {{SUBJECTPAGENAMEE}}
18114 * {{NAMESPACEE}}
18115 * {{NAMESPACE}}
18116 * {{NAMESPACENUMBER}}
18117 * {{TALKSPACE}}
18118 * {{TALKSPACEE}}
18119 * {{SUBJECTSPACE}}
18120 * {{SUBJECTSPACEE}}
18121 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18122 !! html
18123 <ul><li> Parser test</li>
18124 <li> Parser_test</li>
18125 <li> Parser test</li>
18126 <li> Parser_test</li>
18127 <li> Parser test</li>
18128 <li> Parser_test</li>
18129 <li> Parser test</li>
18130 <li> Parser_test</li>
18131 <li> Parser test</li>
18132 <li> Parser_test</li>
18133 <li> Talk:Parser test</li>
18134 <li> Talk:Parser_test</li>
18135 <li> Parser test</li>
18136 <li> Parser_test</li>
18137 <li> </li>
18138 <li> </li>
18139 <li> 0</li>
18140 <li> Talk</li>
18141 <li> Talk</li>
18142 <li> </li>
18143 <li> </li>
18144 <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>
18145
18146 !! end
18147 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18148
18149 !! test
18150 Gallery
18151 !! wikitext
18152 <gallery>
18153 image1.png |
18154 image2.gif|||||
18155
18156 image3|
18157 image4 |300px| centre
18158 image5.svg| http://///////
18159 [[x|xx]]]]
18160 * image6
18161 </gallery>
18162 !! html
18163 <ul class="gallery mw-gallery-traditional">
18164 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18165 <div class="thumb" style="height: 150px;">Image1.png</div>
18166 <div class="gallerytext">
18167 </div>
18168 </div></li>
18169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18170 <div class="thumb" style="height: 150px;">Image2.gif</div>
18171 <div class="gallerytext">
18172 <p>||||
18173 </p>
18174 </div>
18175 </div></li>
18176 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18177 <div class="thumb" style="height: 150px;">Image3</div>
18178 <div class="gallerytext">
18179 </div>
18180 </div></li>
18181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18182 <div class="thumb" style="height: 150px;">Image4</div>
18183 <div class="gallerytext">
18184 <p>300px| centre
18185 </p>
18186 </div>
18187 </div></li>
18188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18189 <div class="thumb" style="height: 150px;">Image5.svg</div>
18190 <div class="gallerytext">
18191 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18192 </p>
18193 </div>
18194 </div></li>
18195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18196 <div class="thumb" style="height: 150px;">* image6</div>
18197 <div class="gallerytext">
18198 </div>
18199 </div></li>
18200 </ul>
18201
18202 !! end
18203
18204 !! test
18205 Gallery (with options)
18206 !! wikitext
18207 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18208 File:Nonexistent.jpg|caption
18209 File:Nonexistent.jpg
18210 image:foobar.jpg|some '''caption''' [[Main Page]]
18211 image:foobar.jpg
18212 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18213 </gallery>
18214 !! html
18215 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18216 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18217 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18218 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18219 <div class="gallerytext">
18220 <p>caption
18221 </p>
18222 </div>
18223 </div></li>
18224 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18225 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18226 <div class="gallerytext">
18227 </div>
18228 </div></li>
18229 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18230 <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>
18231 <div class="gallerytext">
18232 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18233 </p>
18234 </div>
18235 </div></li>
18236 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18237 <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>
18238 <div class="gallerytext">
18239 </div>
18240 </div></li>
18241 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18242 <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>
18243 <div class="gallerytext">
18244 <p>Blabla|blabla.
18245 </p>
18246 </div>
18247 </div></li>
18248 </ul>
18249
18250 !! end
18251
18252 !! test
18253 Gallery with link that has fragment
18254 !! wikitext
18255 <gallery>
18256 image:foobar.jpg|link=Main_Page
18257 image:foobar.jpg|link=Main_Page#section
18258 image:foobar.jpg|link=Main Page#section|caption
18259 </gallery>
18260 !! html
18261 <ul class="gallery mw-gallery-traditional">
18262 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18263 <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>
18264 <div class="gallerytext">
18265 </div>
18266 </div></li>
18267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18268 <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>
18269 <div class="gallerytext">
18270 </div>
18271 </div></li>
18272 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18273 <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>
18274 <div class="gallerytext">
18275 <p>caption
18276 </p>
18277 </div>
18278 </div></li>
18279 </ul>
18280
18281 !! end
18282
18283 !! test
18284 Gallery with wikitext inside caption
18285 !! wikitext
18286 <gallery>
18287 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18288 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18289 </gallery>
18290 !! html
18291 <ul class="gallery mw-gallery-traditional">
18292 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18293 <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>
18294 <div class="gallerytext">
18295 <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>
18296 </p>
18297 </div>
18298 </div></li>
18299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18300 <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>
18301 <div class="gallerytext">
18302 <p>This is a test template
18303 </p>
18304 </div>
18305 </div></li>
18306 </ul>
18307
18308 !! end
18309
18310 !! test
18311 gallery (with showfilename option)
18312 !! wikitext
18313 <gallery showfilename>
18314 File:Nonexistent.jpg|caption
18315 File:Nonexistent.jpg
18316 image:foobar.jpg|some '''caption''' [[Main Page]]
18317 File:Foobar.jpg
18318 </gallery>
18319 !! html
18320 <ul class="gallery mw-gallery-traditional">
18321 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18322 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18323 <div class="gallerytext">
18324 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18325 caption
18326 </p>
18327 </div>
18328 </div></li>
18329 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18330 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18331 <div class="gallerytext">
18332 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18333 </p>
18334 </div>
18335 </div></li>
18336 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18337 <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>
18338 <div class="gallerytext">
18339 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18340 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18341 </p>
18342 </div>
18343 </div></li>
18344 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18345 <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>
18346 <div class="gallerytext">
18347 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18348 </p>
18349 </div>
18350 </div></li>
18351 </ul>
18352
18353 !! end
18354
18355 !! test
18356 Gallery (with namespace-less filenames)
18357 !! wikitext
18358 <gallery>
18359 File:Nonexistent.jpg
18360 Nonexistent.jpg
18361 image:foobar.jpg
18362 foobar.jpg
18363 </gallery>
18364 !! html
18365 <ul class="gallery mw-gallery-traditional">
18366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18367 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18368 <div class="gallerytext">
18369 </div>
18370 </div></li>
18371 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18372 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18373 <div class="gallerytext">
18374 </div>
18375 </div></li>
18376 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18377 <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>
18378 <div class="gallerytext">
18379 </div>
18380 </div></li>
18381 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18382 <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>
18383 <div class="gallerytext">
18384 </div>
18385 </div></li>
18386 </ul>
18387
18388 !! end
18389
18390 !! test
18391 HTML Hex character encoding (spells the word "JavaScript")
18392 !! options
18393 parsoid=wt2html,wt2wt,html2html
18394 !! wikitext
18395 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18396 !! html/php
18397 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18398 </p>
18399 !! html/php+tidy
18400 <p>JavaScript</p>
18401 !! html/parsoid
18402 <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>
18403 !! end
18404
18405 !! test
18406 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18407 !! wikitext
18408 &#xsee;&#XSEE;
18409 !! html/php
18410 <p>&amp;#xsee;&amp;#XSEE;
18411 </p>
18412 !! html/parsoid
18413 <p>&amp;#xsee;&amp;#XSEE;</p>
18414 !! end
18415
18416 !! test
18417 HTML Hex character encoding mixed case
18418 !! options
18419 parsoid=wt2html,wt2wt,html2html
18420 !! wikitext
18421 &#xEE;&#Xee;
18422 !! html/php
18423 <p>&#xee;&#xee;
18424 </p>
18425 !! html/php+tidy
18426 <p>îî</p>
18427 !! html/parsoid
18428 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18429 !! end
18430
18431 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18432 # Note that U+000C (form feed) is not a valid XML character, so
18433 # it is banned even though allowed in HTML5.
18434 !! test
18435 Illegal character references (T106578)
18436 !! wikitext
18437 ; Null: &#00;
18438 ; FF: &#xC;
18439 ; CR: &#xD;
18440 ; Control (low): &#8;
18441 ; Control (high): &#x7F; &#x9F;
18442 ; Surrogate: &#xD83D;&#xDCA9;
18443 ; This is an okay astral character: &#x1F4A9;
18444 !! html+tidy
18445 <dl>
18446 <dt>Null</dt>
18447 <dd>&amp;#00;</dd>
18448 <dt>FF</dt>
18449 <dd>&amp;#xC;</dd>
18450 <dt>CR</dt>
18451 <dd>&amp;#xD;</dd>
18452 <dt>Control (low)</dt>
18453 <dd>&amp;#8;</dd>
18454 <dt>Control (high)</dt>
18455 <dd>&amp;#x7F; &amp;#x9F;</dd>
18456 <dt>Surrogate</dt>
18457 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18458 <dt>This is an okay astral character</dt>
18459 <dd>💩</dd>
18460 </dl>
18461 !! end
18462
18463 !! test
18464 __FORCETOC__ override
18465 !! wikitext
18466 __NEWSECTIONLINK__
18467 __FORCETOC__
18468 !! html/php
18469 <p><br />
18470 </p>
18471 !! end
18472
18473 !! test
18474 ISBN code coverage
18475 !! wikitext
18476 ISBN 978-0-1234-56&#x20;789
18477 !! html
18478 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18479 </p>
18480 !! html+tidy
18481 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18482 !! html/parsoid
18483 <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>
18484 !! end
18485
18486 !! test
18487 ISBN followed by 5 spaces
18488 !! wikitext
18489 ISBN
18490 !! html
18491 <p>ISBN
18492 </p>
18493 !! end
18494
18495 !! test
18496 Double ISBN
18497 !! wikitext
18498 ISBN ISBN 1234567890
18499 !! html/php
18500 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18501 </p>
18502 !! html/parsoid
18503 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18504 !! end
18505
18506 # Uppercase X and lowercase x as well
18507 !! test
18508 ISBN with an X
18509 !! wikitext
18510 ISBN 3-462-04561-X
18511 ISBN 3-462-04561-x
18512 ISBN 080442957X
18513 ISBN 080442957x
18514 ISBN 978080442957X
18515 ISBN 978080442957x
18516 !! html/php
18517 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18518 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18519 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18520 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18521 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18522 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18523 </p>
18524 !! html/parsoid
18525 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18526 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18527 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18528 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18529 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18530 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18531 !! end
18532
18533 !! test
18534 ISBN with empty prefix (parsoid test)
18535 !! wikitext
18536 ISBN 1234567890
18537 !! html/php
18538 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18539 </p>
18540 !! html/parsoid
18541 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18542 !! end
18543
18544 !! test
18545 Bug 22905: <abbr> followed by ISBN followed by </a>
18546 !! wikitext
18547 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18548 !! html/php
18549 <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>
18550 </p>
18551 !! html/parsoid
18552 <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>
18553 !! end
18554
18555 !! test
18556 Double RFC
18557 !! wikitext
18558 RFC RFC 1234
18559 !! html
18560 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18561 </p>
18562 !! end
18563
18564 !! test
18565 Double RFC with a wiki link
18566 !! wikitext
18567 RFC [[RFC 1234]]
18568 !! html
18569 <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>
18570 </p>
18571 !! end
18572
18573 !! test
18574 RFC code coverage
18575 !! wikitext
18576 RFC 983&#x20;987
18577 !! html
18578 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18579 </p>
18580 !! html+tidy
18581 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18582 !! end
18583
18584 !! test
18585 Centre-aligned image
18586 !! wikitext
18587 [[Image:foobar.jpg|centre]]
18588 !! html
18589 <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>
18590
18591 !!end
18592
18593 !! test
18594 None-aligned image
18595 !! wikitext
18596 [[Image:foobar.jpg|none]]
18597 !! html
18598 <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>
18599
18600 !!end
18601
18602 !! test
18603 Width + Height sized image (using px) (height is ignored)
18604 !! wikitext
18605 [[Image:foobar.jpg|640x480px]]
18606 !! html
18607 <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>
18608 </p>
18609 !!end
18610
18611 !! test
18612 Width-sized image (using px, no following whitespace)
18613 !! wikitext
18614 [[Image:foobar.jpg|640px]]
18615 !! html
18616 <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>
18617 </p>
18618 !!end
18619
18620 !! test
18621 Width-sized image (using px, with following whitespace - test regression from r39467)
18622 !! wikitext
18623 [[Image:foobar.jpg|640px ]]
18624 !! html
18625 <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>
18626 </p>
18627 !!end
18628
18629 !! test
18630 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18631 !! wikitext
18632 [[Image:foobar.jpg| 640px]]
18633 !! html
18634 <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>
18635 </p>
18636 !!end
18637
18638 !! test
18639 Image with page parameter
18640 !! options
18641 djvu
18642 !! wikitext
18643 [[File:LoremIpsum.djvu|page=2]]
18644 !! html/php
18645 <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>
18646 </p>
18647 !! html/parsoid
18648 <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>
18649 !! end
18650
18651 !! test
18652 Another italics / bold test
18653 !! wikitext
18654 ''' ''x'
18655 !! html
18656 <pre>'<i> </i>x'
18657 </pre>
18658 !!end
18659
18660 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18661 !! test
18662 dt/dd/dl test
18663 !! wikitext
18664 :;;;::
18665 !! html/php
18666 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18667
18668 !! html/parsoid
18669 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18670
18671 !!end
18672
18673
18674 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18675 !! test
18676 Images with the "|" character in the comment
18677 !! wikitext
18678 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18679 !! html/php
18680 <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>
18681
18682 !! html/parsoid
18683 <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>
18684 !! end
18685
18686 !! test
18687 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18688 !! wikitext
18689 <html><script>alert(1);</script></html>
18690 !! html
18691 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18692 </p>
18693 !! end
18694
18695 !! test
18696 HTML with raw HTML ($wgRawHtml==true)
18697 !! options
18698 wgRawHtml=1
18699 !! wikitext
18700 <html><script>alert(1);</script></html>
18701 !! html
18702 <p><script>alert(1);</script>
18703 </p>
18704 !! end
18705
18706 !! test
18707 Parents of subpages, one level up
18708 !! options
18709 subpage title=[[Subpage test/L1/L2/L3]]
18710 !! wikitext
18711 [[../|L2]]
18712 !! html
18713 <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>
18714 </p>
18715 !! end
18716
18717
18718 !! test
18719 Parents of subpages, one level up, not named
18720 !! options
18721 subpage title=[[Subpage test/L1/L2/L3]]
18722 !! wikitext
18723 [[../]]
18724 !! html
18725 <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>
18726 </p>
18727 !! end
18728
18729
18730
18731 !! test
18732 Parents of subpages, two levels up
18733 !! options
18734 subpage title=[[Subpage test/L1/L2/L3]]
18735 !! wikitext
18736 [[../../|L1]]2
18737
18738 [[../../|L1]]l
18739 !! html
18740 <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
18741 </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>
18742 </p>
18743 !! end
18744
18745 !! test
18746 Parents of subpages, two levels up, without trailing slash or name.
18747 !! options
18748 subpage title=[[Subpage test/L1/L2/L3]]
18749 !! wikitext
18750 [[../..]]
18751 !! html
18752 <p>[[../..]]
18753 </p>
18754 !! end
18755
18756 !! test
18757 Parents of subpages, two levels up, with lots of extra trailing slashes.
18758 !! options
18759 subpage title=[[Subpage test/L1/L2/L3]]
18760 !! wikitext
18761 [[../../////]]
18762 !! html
18763 <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>
18764 </p>
18765 !! end
18766
18767 !! article
18768 Subpage test/L1/L2/L3Sibling
18769 !! text
18770 Sibling article
18771 !! endarticle
18772
18773 !! test
18774 Transclusion of a sibling page (one level up)
18775 !! options
18776 subpage title=[[Subpage test/L1/L2/L3]]
18777 !! wikitext
18778 {{../L3Sibling}}
18779 !! html
18780 <p>Sibling article
18781 </p>
18782 !! end
18783
18784 !! test
18785 Transclusion of a child page
18786 !! options
18787 subpage title=[[Subpage test/L1/L2]]
18788 !! wikitext
18789 {{/L3Sibling}}
18790 !! html
18791 <p>Sibling article
18792 </p>
18793 !! end
18794
18795 !! test
18796 Non-transclusion because of too many up levels
18797 !! options
18798 subpage title=[[Subpage test/L1/L2/L3]]
18799 !! wikitext
18800 {{../../../../More than parent}}
18801 !! html
18802 <p>{{../../../../More than parent}}
18803 </p>
18804 !! end
18805
18806 !! test
18807 Definition list code coverage
18808 !! wikitext
18809 ; title : def
18810 ; title : def
18811 ;title: def
18812 !! html/php
18813 <dl><dt> title &#160;</dt>
18814 <dd> def</dd>
18815 <dt> title&#160;</dt>
18816 <dd> def</dd>
18817 <dt>title</dt>
18818 <dd> def</dd></dl>
18819
18820 !! html/parsoid
18821 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18822 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18823 <dt>title</dt><dd> def</dd></dl>
18824 !! end
18825
18826 !! test
18827 Don't fall for the self-closing div
18828 !! wikitext
18829 <div>hello world</div/>
18830 !! html
18831 <div>hello world</div>
18832
18833 !! end
18834
18835 !! test
18836 MSGNW magic word
18837 !! wikitext
18838 {{MSGNW:msg}}
18839 !! html/php
18840 <p>&#91;&#91;:Template:Msg&#93;&#93;
18841 </p>
18842 !! end
18843
18844 !! test
18845 RAW magic word
18846 !! wikitext
18847 {{RAW:QUERTY}}
18848 !! html
18849 <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>
18850 </p>
18851 !! end
18852
18853 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18854 !! test
18855 Always escape literal '>' in output, not just after '<'
18856 !! wikitext
18857 ><>
18858 !! html
18859 <p>&gt;&lt;&gt;
18860 </p>
18861 !! end
18862
18863 !! test
18864 Template caching
18865 !! wikitext
18866 {{Test}}
18867 {{Test}}
18868 !! html
18869 <p>This is a test template
18870 This is a test template
18871 </p>
18872 !! end
18873
18874
18875 !! article
18876 MediaWiki:Fake
18877 !! text
18878 ==header==
18879 !! endarticle
18880
18881 !! test
18882 Inclusion of !userCanEdit() content
18883 !! wikitext
18884 {{MediaWiki:Fake}}
18885 !! html
18886 <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>
18887
18888 !! end
18889
18890
18891 !! test
18892 Out-of-order TOC heading levels
18893 !! wikitext
18894 ==2==
18895 ======6======
18896 ===3===
18897 =1=
18898 =====5=====
18899 ==2==
18900 !! html
18901 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18902 <ul>
18903 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18904 <ul>
18905 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18906 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18907 </ul>
18908 </li>
18909 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18910 <ul>
18911 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18912 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18913 </ul>
18914 </li>
18915 </ul>
18916 </div>
18917
18918 <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>
18919 <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>
18920 <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>
18921 <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>
18922 <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>
18923 <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>
18924
18925 !! end
18926
18927
18928 !! test
18929 ISBN with a dummy number
18930 !! wikitext
18931 ISBN ---
18932 !! html
18933 <p>ISBN ---
18934 </p>
18935 !! end
18936
18937
18938 !! test
18939 ISBN with space-delimited number
18940 !! wikitext
18941 ISBN 92 9017 032 8
18942 !! html
18943 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18944 </p>
18945 !! end
18946
18947
18948 !! test
18949 ISBN with multiple spaces, no number
18950 !! wikitext
18951 ISBN foo
18952 !! html
18953 <p>ISBN foo
18954 </p>
18955 !! end
18956
18957
18958 !! test
18959 ISBN length
18960 !! wikitext
18961 ISBN 123456789
18962
18963 ISBN 1234567890
18964
18965 ISBN 12345678901
18966 !! html
18967 <p>ISBN 123456789
18968 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18969 </p><p>ISBN 12345678901
18970 </p>
18971 !! end
18972
18973
18974 !! test
18975 ISBN with trailing year (bug 8110)
18976 !! wikitext
18977 ISBN 1-234-56789-0 - 2006
18978
18979 ISBN 1 234 56789 0 - 2006
18980 !! html
18981 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18982 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18983 </p>
18984 !! end
18985
18986
18987 !! test
18988 anchorencode
18989 !! wikitext
18990 {{anchorencode:foo bar©#%n}}
18991 !! html
18992 <p>foo_bar.C2.A9.23.25n
18993 </p>
18994 !! end
18995
18996 !! test
18997 anchorencode trims spaces
18998 !! wikitext
18999 {{anchorencode: __pretty__please__}}
19000 !! html
19001 <p>pretty_please
19002 </p>
19003 !! end
19004
19005 !! test
19006 anchorencode deals with links
19007 !! wikitext
19008 {{anchorencode: [[hello|world]] [[hi]]}}
19009 !! html
19010 <p>world_hi
19011 </p>
19012 !! end
19013
19014 !! test
19015 anchorencode deals with templates
19016 !! wikitext
19017 {{anchorencode: {{Foo}} }}
19018 !! html
19019 <p>FOO
19020 </p>
19021 !! end
19022
19023 !! test
19024 anchorencode encodes like the TOC generator: (bug 18431)
19025 !! wikitext
19026 === _ +:.3A%3A&&amp;]] ===
19027 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19028 __NOEDITSECTION__
19029 !! html
19030 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19031 <p>.2B:.3A.253A.26.26.5D.5D
19032 </p>
19033 !! end
19034
19035 !! test
19036 Bug 6200: blockquotes and paragraph formatting
19037 !! wikitext
19038 <blockquote>
19039 foo
19040 </blockquote>
19041
19042 bar
19043
19044 baz
19045 !! html
19046 <blockquote>
19047 <p>foo
19048 </p>
19049 </blockquote>
19050 <p>bar
19051 </p>
19052 <pre>baz
19053 </pre>
19054 !! end
19055
19056 !! test
19057 Bug 8293: Use of center tag ruins paragraph formatting
19058 !! wikitext
19059 <center>
19060 foo
19061 </center>
19062
19063 bar
19064
19065 baz
19066 !! html
19067 <center>
19068 <p>foo
19069 </p>
19070 </center>
19071 <p>bar
19072 </p>
19073 <pre>baz
19074 </pre>
19075 !! end
19076
19077 !!test
19078 Parsing of overlapping (improperly nested) inline html tags
19079 !! wikitext
19080 <span><s>x</span></s>
19081 !! html/php
19082 <p><span><s>x&lt;/span&gt;</s></span>
19083 </p>
19084 !! html/parsoid
19085 <p><span><s>x</s></span>
19086 </p>
19087 !!end
19088
19089 ###
19090 ### Language variants related tests
19091 ###
19092 !! test
19093 Self-link in language variants
19094 !! options
19095 title=[[Dunav]] language=sr
19096 !! wikitext
19097 Both [[Dunav]] and [[Дунав]] are names for this river.
19098 !! html
19099 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19100 </p>
19101 !!end
19102
19103 !! article
19104 Дуна
19105 !! text
19106 content
19107 !! endarticle
19108
19109 !! test
19110 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19111 !! options
19112 title=[[Duna]] language=sr
19113 !! wikitext
19114 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19115 !! html
19116 <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.
19117 </p>
19118 !! end
19119
19120 !! test
19121 Link to a section of a variant of this title shouldn't be parsed as self-link
19122 !! options
19123 title=[[Duna]] language=sr
19124 !! wikitext
19125 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19126 !! html
19127 <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.
19128 </p>
19129 !! end
19130
19131 !! test
19132 Link to pages in language variants
19133 !! options
19134 language=sr
19135 !! wikitext
19136 Main Page can be written as [[Маин Паге]]
19137 !! html
19138 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19139 </p>
19140 !!end
19141
19142
19143 !! test
19144 Multiple links to pages in language variants
19145 !! options
19146 language=sr
19147 !! wikitext
19148 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19149 !! html
19150 <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>.
19151 </p>
19152 !!end
19153
19154
19155 !! test
19156 Simple template in language variants
19157 !! options
19158 language=sr
19159 !! wikitext
19160 {{тест}}
19161 !! html
19162 <p>This is a test template
19163 </p>
19164 !! end
19165
19166
19167 !! test
19168 Template with explicit namespace in language variants
19169 !! options
19170 language=sr
19171 !! wikitext
19172 {{Template:тест}}
19173 !! html
19174 <p>This is a test template
19175 </p>
19176 !! end
19177
19178
19179 !! test
19180 Basic test for template parameter in language variants
19181 !! options
19182 language=sr
19183 !! wikitext
19184 {{парамтест|param=foo}}
19185 !! html
19186 <p>This is a test template with parameter foo
19187 </p>
19188 !! end
19189
19190
19191 !! test
19192 Simple category in language variants
19193 !! options
19194 language=sr cat
19195 !! wikitext
19196 [[Category:МедиаWики Усер'с Гуиде]]
19197 !! html
19198 <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>
19199 !! end
19200
19201
19202 !! article
19203 Category:分类
19204 !! text
19205 blah
19206 !! endarticle
19207
19208 !! article
19209 Category:分類
19210 !! text
19211 blah
19212 !! endarticle
19213
19214 !! test
19215 Don't convert blue categorylinks to another variant (bug 33210)
19216 !! options
19217 language=zh cat
19218 !! wikitext
19219 [[A]][[Category:分类]]
19220 !! html
19221 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19222 !! end
19223
19224
19225 !! test
19226 Stripping -{}- tags (language variants)
19227 !! options
19228 language=sr
19229 !! wikitext
19230 Latin proverb: -{Ne nuntium necare}-
19231 !! html
19232 <p>Latin proverb: Ne nuntium necare
19233 </p>
19234 !! end
19235
19236
19237 !! test
19238 Prevent conversion with -{}- tags (language variants)
19239 !! options
19240 language=sr variant=sr-ec
19241 !! wikitext
19242 Latinski: -{Ne nuntium necare}-
19243 !! html
19244 <p>Латински: Ne nuntium necare
19245 </p>
19246 !! end
19247
19248
19249 !! test
19250 Prevent conversion of text with -{}- tags (language variants)
19251 !! options
19252 language=sr variant=sr-ec
19253 !! wikitext
19254 Latinski: -{Ne nuntium necare}-
19255 !! html
19256 <p>Латински: Ne nuntium necare
19257 </p>
19258 !! end
19259
19260
19261 !! test
19262 Prevent conversion of links with -{}- tags (language variants)
19263 !! options
19264 language=sr variant=sr-ec
19265 !! wikitext
19266 -{[[Main Page]]}-
19267 !! html
19268 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19269 </p>
19270 !! end
19271
19272
19273 !! test
19274 -{}- tags within headlines (within html for parserConvert())
19275 !! options
19276 language=sr variant=sr-ec
19277 !! wikitext
19278 == -{Naslov}- ==
19279 !! html
19280 <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>
19281
19282 !! end
19283
19284
19285 !! test
19286 Explicit definition of language variant alternatives
19287 !! options
19288 language=zh variant=zh-tw
19289 !! wikitext
19290 -{zh:China;zh-tw:Taiwan}-, not China
19291 !! html
19292 <p>Taiwan, not China
19293 </p>
19294 !! end
19295
19296
19297 !! test
19298 Conversion around HTML tags
19299 !! options
19300 language=sr variant=sr-ec
19301 !! wikitext
19302 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19303 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19304 !! html
19305 <p>
19306 <span title="ЛаCтин">ски</span>
19307 </p>
19308 !! end
19309
19310
19311 !! test
19312 Explicit session-wise language variant mapping (A flag and - flag)
19313 !! options
19314 language=zh variant=zh-tw
19315 !! wikitext
19316 Taiwan is not China.
19317 But -{A|zh:China;zh-tw:Taiwan}- is China,
19318 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19319 and -{China}- is China.
19320 !! html
19321 <p>Taiwan is not China.
19322 But Taiwan is Taiwan,
19323 (This should be stripped!)
19324 and China is China.
19325 </p>
19326 !! end
19327
19328 !! test
19329 Explicit session-wise language variant mapping (H flag for hide)
19330 !! options
19331 language=zh variant=zh-tw
19332 !! wikitext
19333 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19334 Taiwan is China.
19335 !! html
19336 <p>(This should be stripped!)
19337 Taiwan is Taiwan.
19338 </p>
19339 !! end
19340
19341 !! test
19342 Adding explicit conversion rule for title (T flag)
19343 !! options
19344 language=zh variant=zh-tw showtitle
19345 !! wikitext
19346 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19347 !! html
19348 Taiwan
19349 <p>Should be stripped!
19350 </p>
19351 !! end
19352
19353 !! test
19354 Testing that changing the language variant here in the tests actually works
19355 !! options
19356 language=zh variant=zh showtitle
19357 !! wikitext
19358 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19359 !! html
19360 China
19361 <p>Should be stripped!
19362 </p>
19363 !! end
19364
19365 !! test
19366 Recursive conversion of alt and title attrs shouldn't clear converter state
19367 !! options
19368 language=zh variant=zh-cn showtitle
19369 !! wikitext
19370 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19371 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19372 !! html
19373 China
19374 <p>
19375 Should be stripped<span title="Exclamation">!</span>
19376 </p>
19377 !! end
19378
19379 !! test
19380 Bug 24072: more test on conversion rule for title
19381 !! options
19382 language=zh variant=zh-tw showtitle
19383 !! wikitext
19384 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19385 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19386 !! html
19387 Taiwan
19388 <p>This should be stripped!
19389 This won't take interferes with the title rule.
19390 </p>
19391 !! end
19392
19393 !! test
19394 Partly disable title conversion if variant == main language code
19395 !! options
19396 language=zh variant=zh title=[[ZH]] showtitle
19397 !! wikitext
19398 -{T|zh-cn:CN;zh-tw:TW}-
19399 !! html
19400 ZH
19401 <p>
19402 </p>
19403 !! end
19404
19405 !! test
19406 Partly disable title conversion if variant == main language code, more
19407 !! options
19408 language=zh variant=zh title=[[ZH]] showtitle
19409 !! wikitext
19410 -{T|TW}-
19411 !! html
19412 ZH
19413 <p>
19414 </p>
19415 !! end
19416
19417 !! test
19418 Raw output of variant escape tags (R flag)
19419 !! options
19420 language=zh variant=zh-tw
19421 !! wikitext
19422 Raw: -{R|zh:China;zh-tw:Taiwan}-
19423 !! html
19424 <p>Raw: zh:China;zh-tw:Taiwan
19425 </p>
19426 !! end
19427
19428 !! test
19429 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19430 !! options
19431 language=zh variant=zh-cn
19432 !! input
19433 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19434 !! result
19435 <p>0
19436 </p>
19437 !! end
19438
19439 !! test
19440 Conversion rules from [numeric-only string] to [something else] (T48634)
19441 !! options
19442 language=zh variant=zh-cn
19443 !! input
19444 -{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
19445 !! result
19446 <p>D12345EE12345
19447 </p>
19448 !! end
19449
19450 !! test
19451 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19452 !! options
19453 language=zh variant=zh-cn
19454 !! input
19455 -{H|zh-cn:foo;zh-tw:;}-foobar
19456 !! result
19457 <p>foobar
19458 </p>
19459 !! end
19460
19461 !! test
19462 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19463 !! options
19464 language=zh variant=zh-cn
19465 !! input
19466 -{H|=>zh-cn:foo;}-foobar
19467 !! result
19468 <p>foobar
19469 </p>
19470 !! end
19471
19472 !! test
19473 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19474 !! options
19475 language=zh variant=zh-cn
19476 !! input
19477 -{H|}-foobar
19478 !! result
19479 <p>foobar
19480 </p>
19481 !! end
19482
19483 !! test
19484 Nested using of manual convert syntax
19485 !! options
19486 language=zh variant=zh-hk
19487 !! wikitext
19488 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19489 !! html
19490 <p>Nested: Hello Hong Kong!
19491 </p>
19492 !! end
19493
19494 !! test
19495 Proper conversion of text in external links
19496 !! options
19497 language=sr variant=sr-ec
19498 !! wikitext
19499 http://www.google.com
19500 gopher://www.google.com
19501 [http://www.google.com http://www.google.com]
19502 [gopher://www.google.com gopher://www.google.com]
19503 [https://www.google.com irc://www.google.com]
19504 [ftp://www.google.com www.google.com/ftp://dir]
19505 [//www.google.com www.google.com]
19506 !! html
19507 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19508 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19509 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19510 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19511 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19512 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19513 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19514 </p>
19515 !! end
19516
19517 !! test
19518 Do not convert roman numbers to language variants
19519 !! options
19520 language=sr variant=sr-ec
19521 !! wikitext
19522 Fridrih IV je car.
19523 !! html
19524 <p>Фридрих IV је цар.
19525 </p>
19526 !! end
19527
19528 !! test
19529 Unclosed language converter markup "-{"
19530 !! options
19531 language=sr
19532 !! wikitext
19533 -{T|hello
19534 !! html
19535 <p>-{T|hello
19536 </p>
19537 !! end
19538
19539 !! test
19540 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19541 !! options
19542 language=sr
19543 !! wikitext
19544 -{R|=&gt;}-
19545 !! html
19546 <p>=&gt;
19547 </p>
19548 !!end
19549
19550 !! test
19551 Don't break link parsing if language converter markup is in the caption.
19552 !! options
19553 language=sr variant=sr-ec
19554 !! wikitext
19555 [[Main Page|-{R|main page}-]]
19556 !! html
19557 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19558 </p>
19559 !! end
19560
19561 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19562 !! test
19563 Don't break image parsing if language converter markup is in the caption.
19564 !! options
19565 language=sr
19566 !! wikitext
19567 [[File:Foobar.jpg|-{R|caption}-]]
19568 !! html/parsoid
19569 <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>
19570 </p>
19571 !! end
19572
19573 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19574 !! test
19575 Don't break list handling if language converter markup is in the item.
19576 !! options
19577 language=zh variant=zh-cn
19578 !! wikitext
19579 ;-{zh-cn:AAA;zh-tw:BBB}-
19580 !! html/php
19581 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19582
19583 !! html/parsoid
19584 <dl><dt>AAA
19585 </dt></dl>
19586 !! end
19587
19588 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19589 !! test
19590 Don't break table handling if language converter markup is in the cell.
19591 !! options
19592 language=sr variant=sr-ec
19593 !! wikitext
19594 {|
19595 |-
19596 | -{R|B}-
19597 |}
19598 !! html/php
19599 <table>
19600
19601 <tr>
19602 <td>Б}-
19603 </td></tr></table>
19604
19605 !! html/parsoid
19606 <table>
19607
19608 <tr>
19609 <td> B
19610 </td></tr></table>
19611
19612 !! end
19613
19614 !! test
19615 Bug 529: Uncovered bullet
19616 !! wikitext
19617 * Foo {{bullet}}
19618 !! html
19619 <ul><li> Foo </li>
19620 <li> Bar</li></ul>
19621
19622 !! end
19623
19624 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19625 # Templates in Wikipedia rely on this behavior, as tidy has always been
19626 # enabled there. These tests are normally run *without* tidy, so specify the
19627 # full output here.
19628 # To test realistic parsing behavior, apply a tidy-like transformation to both
19629 # the expected output and your parser's output.
19630 !! test
19631 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19632 !! wikitext
19633 ******* Foo {{bullet}}
19634 !! html
19635 <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>
19636 <li> Bar</li></ul>
19637
19638 !! end
19639
19640 !! test
19641 Bug 529: Uncovered table already at line-start
19642 !! wikitext
19643 x
19644
19645 {{table}}
19646 y
19647 !! html
19648 <p>x
19649 </p>
19650 <table>
19651 <tr>
19652 <td> 1 </td>
19653 <td> 2
19654 </td></tr>
19655 <tr>
19656 <td> 3 </td>
19657 <td> 4
19658 </td></tr></table>
19659 <p>y
19660 </p>
19661 !! end
19662
19663 !! test
19664 Bug 529: Uncovered bullet in parser function result
19665 !! wikitext
19666 * Foo {{lc:{{bullet}} }}
19667 !! html
19668 <ul><li> Foo </li>
19669 <li> bar</li></ul>
19670
19671 !! end
19672
19673 !! test
19674 Bug 5678: Double-parsed template argument
19675 !! wikitext
19676 {{lc:{{{1}}}|hello}}
19677 !! html
19678 <p>{{{1}}}
19679 </p>
19680 !! end
19681
19682 !! test
19683 Bug 5678: Double-parsed template invocation
19684 !! wikitext
19685 {{lc:{{paramtest {{!}} param = hello }} }}
19686 !! html
19687 <p>{{paramtest | param = hello }}
19688 </p>
19689 !! end
19690
19691 !! test
19692 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19693 !! options
19694 language=cs
19695 title=[[Main Page]]
19696 !! wikitext
19697 {{PRVNÍVELKÉ:ěščř}}
19698 {{prvnívelké:ěščř}}
19699 {{PRVNÍMALÉ:ěščř}}
19700 {{prvnímalé:ěščř}}
19701 {{MALÁ:ěščř}}
19702 {{malá:ěščř}}
19703 {{VELKÁ:ěščř}}
19704 {{velká:ěščř}}
19705 !! html
19706 <p>Ěščř
19707 Ěščř
19708 ěščř
19709 ěščř
19710 ěščř
19711 ěščř
19712 ĚŠČŘ
19713 ĚŠČŘ
19714 </p>
19715 !! end
19716
19717 !! test
19718 Morwen/13: Unclosed link followed by heading
19719 !! wikitext
19720 [[link
19721 ==heading==
19722 !! html
19723 <p>[[link
19724 </p>
19725 <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>
19726
19727 !! end
19728
19729 !! test
19730 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19731 !! wikitext
19732 {{foo|
19733 =heading=
19734 !! html
19735 <p>{{foo|
19736 </p>
19737 <h1><span class="mw-headline" id="heading">heading</span></h1>
19738
19739 !! end
19740
19741 !! test
19742 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19743 !! wikitext
19744 {{foo|
19745 ==heading==
19746 !! html
19747 <p>{{foo|
19748 </p>
19749 <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>
19750
19751 !! end
19752
19753 !! test
19754 Tildes in comments
19755 !! options
19756 pst
19757 !! wikitext
19758 <!-- ~~~~ -->
19759 !! html
19760 <!-- ~~~~ -->
19761 !! end
19762
19763 !! test
19764 Paragraphs inside divs (no extra line breaks)
19765 !! wikitext
19766 <div>Line one
19767
19768 Line two</div>
19769 !! html
19770 <div>Line one
19771 Line two</div>
19772
19773 !! end
19774
19775 !! test
19776 Paragraphs inside divs (extra line break on open)
19777 !! wikitext
19778 <div>
19779 Line one
19780
19781 Line two</div>
19782 !! html
19783 <div>
19784 <p>Line one
19785 </p>
19786 Line two</div>
19787
19788 !! end
19789
19790 !! test
19791 Paragraphs inside divs (extra line break on close)
19792 !! wikitext
19793 <div>Line one
19794
19795 Line two
19796 </div>
19797 !! html
19798 <div>Line one
19799 <p>Line two
19800 </p>
19801 </div>
19802
19803 !! end
19804
19805 !! test
19806 Paragraphs inside divs (extra line break on open and close)
19807 !! wikitext
19808 <div>
19809 Line one
19810
19811 Line two
19812 </div>
19813 !! html
19814 <div>
19815 <p>Line one
19816 </p><p>Line two
19817 </p>
19818 </div>
19819
19820 !! end
19821
19822 !! test
19823 Nesting tags, paragraphs on lines which begin with <div>
19824 !! wikitext
19825 <div></div><strong>A
19826 B</strong>
19827 !! html/php+tidy
19828 <p><strong>A</strong></p>
19829 <p><strong>B</strong></p>
19830 !! html/parsoid
19831 <div></div>
19832 <p><strong>A
19833 B</strong>
19834 </p>
19835 !! end
19836
19837 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19838 !! test
19839 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19840 !! wikitext
19841 <blockquote>Line one
19842
19843 Line two</blockquote>
19844 !! html
19845 <blockquote>Line one
19846 Line two</blockquote>
19847
19848 !! html+tidy
19849 <blockquote>
19850 <p>Line one Line two</p>
19851 </blockquote>
19852 !! end
19853
19854 !! test
19855 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19856 !! wikitext
19857 <blockquote>
19858 Line one
19859
19860 Line two</blockquote>
19861 !! html
19862 <blockquote>
19863 <p>Line one
19864 </p>
19865 Line two</blockquote>
19866
19867 !! html+tidy
19868 <blockquote>
19869 <p>Line one</p>
19870 Line two</blockquote>
19871 !! end
19872
19873 !! test
19874 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19875 !! wikitext
19876 <blockquote>Line one
19877
19878 Line two
19879 </blockquote>
19880 !! html
19881 <blockquote>Line one
19882 <p>Line two
19883 </p>
19884 </blockquote>
19885
19886 !! html+tidy
19887 <blockquote>
19888 <p>Line one</p>
19889 <p>Line two</p>
19890 </blockquote>
19891 !! end
19892
19893 !! test
19894 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19895 !! wikitext
19896 <blockquote>
19897 Line one
19898
19899 Line two
19900 </blockquote>
19901 !! html
19902 <blockquote>
19903 <p>Line one
19904 </p><p>Line two
19905 </p>
19906 </blockquote>
19907
19908 !! html+tidy
19909 <blockquote>
19910 <p>Line one</p>
19911 <p>Line two</p>
19912 </blockquote>
19913 !! end
19914
19915 !! test
19916 Paragraphs inside blockquotes/divs (no extra line breaks)
19917 !! wikitext
19918 <blockquote><div>Line one
19919
19920 Line two</div></blockquote>
19921 !! html
19922 <blockquote><div>Line one
19923 Line two</div></blockquote>
19924
19925 !! end
19926
19927 !! test
19928 Paragraphs inside blockquotes/divs (extra line break on open)
19929 !! wikitext
19930 <blockquote><div>
19931 Line one
19932
19933 Line two</div></blockquote>
19934 !! html
19935 <blockquote><div>
19936 <p>Line one
19937 </p>
19938 Line two</div></blockquote>
19939
19940 !! end
19941
19942 !! test
19943 Paragraphs inside blockquotes/divs (extra line break on close)
19944 !! wikitext
19945 <blockquote><div>Line one
19946
19947 Line two
19948 </div></blockquote>
19949 !! html
19950 <blockquote><div>Line one
19951 <p>Line two
19952 </p>
19953 </div></blockquote>
19954
19955 !! end
19956
19957 !! test
19958 Paragraphs inside blockquotes/divs (extra line break on open and close)
19959 !! wikitext
19960 <blockquote><div>
19961 Line one
19962
19963 Line two
19964 </div></blockquote>
19965 !! html
19966 <blockquote><div>
19967 <p>Line one
19968 </p><p>Line two
19969 </p>
19970 </div></blockquote>
19971
19972 !! end
19973
19974 !! test
19975 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19976 !! options
19977 wgLinkHolderBatchSize=0
19978 !! wikitext
19979 [[meatball:1]]
19980 [[meatball:2]]
19981 [[meatball:3]]
19982 !! html
19983 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19984 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19985 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19986 </p>
19987 !! end
19988
19989 !! test
19990 Free external link invading image caption
19991 !! wikitext
19992 [[Image:Foobar.jpg|thumb|http://x|hello]]
19993 !! html
19994 <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>
19995
19996 !! end
19997
19998 !! test
19999 Bug 15196: localised external link numbers
20000 !! options
20001 language=fa
20002 !! wikitext
20003 [http://en.wikipedia.org/]
20004 !! html/php
20005 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20006 </p>
20007 !! html/parsoid
20008 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20009 !! end
20010
20011 !! test
20012 Multibyte character in padleft
20013 !! wikitext
20014 {{padleft:-Hello|7|Æ}}
20015 !! html
20016 <p>Æ-Hello
20017 </p>
20018 !! end
20019
20020 !! test
20021 Multibyte character in padright
20022 !! wikitext
20023 {{padright:Hello-|7|Æ}}
20024 !! html
20025 <p>Hello-Æ
20026 </p>
20027 !! end
20028
20029 !!test
20030 formatdate parser function
20031 !! wikitext
20032 {{#formatdate:2009-03-24}}
20033 !! html
20034 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20035 </p>
20036 !! end
20037
20038 !!test
20039 formatdate parser function, with default format
20040 !! wikitext
20041 {{#formatdate:2009-03-24|mdy}}
20042 !! html
20043 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20044 </p>
20045 !! end
20046
20047 !! test
20048 Spacing of numbers in formatted dates
20049 !! wikitext
20050 {{#formatdate:January 15}}
20051 !! html
20052 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20053 </p>
20054 !! end
20055
20056 !! test
20057 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
20058 !! options
20059 language=nl title=[[MediaWiki:Common.css]]
20060 !! wikitext
20061 {{#formatdate:2009-03-24|dmy}}
20062 !! html
20063 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20064 </p>
20065 !! end
20066
20067 #
20068 #
20069 #
20070
20071 #
20072 # Edit comments
20073 #
20074
20075 !! test
20076 Edit comment with link
20077 !! options
20078 comment
20079 !! wikitext
20080 I like the [[Main Page]] a lot
20081 !! html
20082 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20083 !!end
20084
20085 !! test
20086 Edit comment with link and link text
20087 !! options
20088 comment
20089 !! wikitext
20090 I like the [[Main Page|best pages]] a lot
20091 !! html
20092 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20093 !!end
20094
20095 !! test
20096 Edit comment with link and link text with suffix
20097 !! options
20098 comment
20099 !! wikitext
20100 I like the [[Main Page|best page]]s a lot
20101 !! html
20102 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20103 !!end
20104
20105 !! test
20106 Edit comment with section link (non-local, eg in history list)
20107 !! options
20108 comment title=[[Main Page]]
20109 !! wikitext
20110 /* External links */ removed bogus entries
20111 !! html
20112 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20113 !!end
20114
20115 !! test
20116 Edit comment with section link and text before it (non-local, eg in history list)
20117 !! options
20118 comment title=[[Main Page]]
20119 !! wikitext
20120 pre-comment text /* External links */ removed bogus entries
20121 !! html
20122 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>
20123 !!end
20124
20125 !! test
20126 Edit comment with section link (local, eg in diff view)
20127 !! options
20128 comment local title=[[Main Page]]
20129 !! wikitext
20130 /* External links */ removed bogus entries
20131 !! html
20132 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20133 !!end
20134
20135 !! test
20136 Edit comment with subpage link (bug 14080)
20137 !! options
20138 comment
20139 subpage
20140 title=[[Subpage test]]
20141 !! wikitext
20142 Poked at a [[/subpage]] here...
20143 !! html
20144 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20145 !!end
20146
20147 !! test
20148 Edit comment with subpage link and link text (bug 14080)
20149 !! options
20150 comment
20151 subpage
20152 title=[[Subpage test]]
20153 !! wikitext
20154 Poked at a [[/subpage|neat little page]] here...
20155 !! html
20156 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20157 !!end
20158
20159 !! test
20160 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20161 !! options
20162 comment
20163 title=[[Subpage test]]
20164 !! wikitext
20165 Poked at a [[/subpage]] here...
20166 !! html
20167 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...
20168 !!end
20169
20170 !! test
20171 Edit comment with bare anchor link (local, as on diff)
20172 !! options
20173 comment
20174 local
20175 title=[[Main Page]]
20176 !! wikitext
20177 [[#section]]
20178 !! html
20179 <a href="#section">#section</a>
20180 !! end
20181
20182 !! test
20183 Edit comment with bare anchor link (non-local, as on history)
20184 !! options
20185 comment
20186 title=[[Main Page]]
20187 !! wikitext
20188 [[#section]]
20189 !! html
20190 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20191 !! end
20192
20193 !! test
20194 Anchor starting with underscore
20195 !! wikitext
20196 [[#_ref|One]]
20197 !! html
20198 <p><a href="#_ref">One</a>
20199 </p>
20200 !! end
20201
20202 !! test
20203 Id starting with underscore
20204 !! wikitext
20205 <div id="_ref"></div>
20206 !! html
20207 <div id="_ref"></div>
20208
20209 !! end
20210
20211 !! test
20212 Space normalisation on autocomment (bug 22784)
20213 !! options
20214 comment
20215 title=[[Main Page]]
20216 !! wikitext
20217 /* __hello__world__ */
20218 !! html
20219 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20220 !! end
20221
20222 !! test
20223 percent-encoding and + signs in comments (Bug 26410)
20224 !! options
20225 comment
20226 !! wikitext
20227 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20228 !! html/php
20229 <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>
20230 !! end
20231
20232 # Parsoid doesn't support this yet: see bug 73581
20233 # but it *should* omit the 'src' attribute if the image is bad.
20234 # PHP side of tests was disabled in
20235 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20236 # because of issues in the PHP parserTests infrastructure
20237 # (but the output below is indeed what the PHP side emits)
20238 !! test
20239 Bad images - basic functionality
20240 !! wikitext
20241 [[File:Bad.jpg]]
20242 !! DISABLED/html/php
20243 !! html/parsoid
20244 <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>
20245 !! end
20246
20247 !! test
20248 Bad images - bug 16039: text after bad image disappears
20249 !! wikitext
20250 Foo bar
20251 [[File:Bad.jpg]]
20252 Bar foo
20253 !! DISABLED/html/php
20254 <p>Foo bar
20255 </p><p>Bar foo
20256 </p>
20257 !! html/parsoid
20258 <p>Foo bar
20259 <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>
20260 Bar foo</p>
20261 !! end
20262
20263 !! test
20264 Verify that displaytitle works (bug #22501) no displaytitle
20265 !! options
20266 showtitle
20267 !! config
20268 wgAllowDisplayTitle=true
20269 wgRestrictDisplayTitle=false
20270 !! wikitext
20271 this is not the the title
20272 !! html/php
20273 Parser test
20274 <p>this is not the the title
20275 </p>
20276 !! end
20277
20278 !! test
20279 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20280 !! options
20281 showtitle
20282 title=[[Screen]]
20283 !! config
20284 wgAllowDisplayTitle=true
20285 wgRestrictDisplayTitle=false
20286 !! wikitext
20287 this is not the the title
20288 {{DISPLAYTITLE:whatever}}
20289 !! html/php
20290 whatever
20291 <p>this is not the the title
20292 </p>
20293 !! end
20294
20295 !! test
20296 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20297 !! options
20298 showtitle
20299 title=[[Screen]]
20300 !! config
20301 wgAllowDisplayTitle=true
20302 wgRestrictDisplayTitle=true
20303 !! wikitext
20304 this is not the the title
20305 {{DISPLAYTITLE:whatever}}
20306 !! html/php
20307 Screen
20308 <p>this is not the the title
20309 </p>
20310 !! end
20311
20312 !! test
20313 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20314 !! options
20315 showtitle
20316 title=[[Screen]]
20317 !! config
20318 wgAllowDisplayTitle=true
20319 wgRestrictDisplayTitle=true
20320 !! wikitext
20321 this is not the the title
20322 {{DISPLAYTITLE:screen}}
20323 !! html/php
20324 screen
20325 <p>this is not the the title
20326 </p>
20327 !! end
20328
20329 !! test
20330 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20331 !! options
20332 showtitle
20333 title=[[Screen]]
20334 !! config
20335 wgAllowDisplayTitle=false
20336 !! wikitext
20337 this is not the the title
20338 {{DISPLAYTITLE:screen}}
20339 !! html/php
20340 Screen
20341 <p>this is not the the title
20342 <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>
20343 </p>
20344 !! end
20345
20346 !! test
20347 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20348 !! options
20349 showtitle
20350 title=[[Screen]]
20351 !! config
20352 wgAllowDisplayTitle=false
20353 !! wikitext
20354 this is not the the title
20355 !! html/php
20356 Screen
20357 <p>this is not the the title
20358 </p>
20359 !! end
20360
20361 !! test
20362 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20363 !! options
20364 showtitle
20365 title=[[Screen]]
20366 !! config
20367 wgAllowDisplayTitle=true
20368 wgRestrictDisplayTitle=true
20369 !! wikitext
20370 this is not the the title
20371 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20372 !! html/php
20373 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20374 <p>this is not the the title
20375 </p>
20376 !! end
20377
20378 !! test
20379 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20380 !! options
20381 showtitle
20382 title=[[Screen]]
20383 !! config
20384 wgAllowDisplayTitle=true
20385 wgRestrictDisplayTitle=true
20386 !! wikitext
20387 this is not the the title
20388 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20389 !! html/php
20390 <span style="color: red;">s</span>creen
20391 <p>this is not the the title
20392 </p>
20393 !! end
20394
20395 !! test
20396 Page status indicators: Empty name is invalid
20397 !! options
20398 showindicators
20399 !! wikitext
20400 <indicator name=" "></indicator>
20401 <indicator></indicator>
20402 !! html
20403 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20404 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20405 </p>
20406 !! end
20407
20408 !! test
20409 Page status indicators: Weird syntaxes that are okay
20410 !! options
20411 showindicators
20412 !! wikitext
20413 <indicator name="empty" />
20414 <indicator name="name"></indicator>
20415 !! html
20416 empty=
20417 name=
20418 <p><br />
20419 </p>
20420 !! end
20421
20422 !! test
20423 Page status indicators: Torture test
20424 !! options
20425 showindicators
20426 !! wikitext
20427 <indicator name="01">hello world</indicator>
20428 <indicator name="02">[[Main Page]]</indicator>
20429 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20430 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20431 <indicator name="05">* foo
20432 * bar</indicator>
20433 <indicator name="06"><nowiki>foo</nowiki></indicator>
20434 <indicator name="07"> Preformatted</indicator>
20435 <indicator name="08"><div>Broken tag</indicator>
20436 <indicator name="09">{| class=wikitable
20437 | cell
20438 |}</indicator>
20439 <indicator name="10">Two
20440
20441 paragraphs</indicator>
20442 !! html
20443 01=hello world
20444 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20445 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" />
20446 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>
20447 05=<ul><li> foo</li>
20448 <li> bar</li></ul>
20449
20450 06=foo
20451 07=<pre>Preformatted
20452 </pre>
20453 08=<div>Broken tag</div>
20454
20455 09=<table class="wikitable">
20456 <tr>
20457 <td> cell
20458 </td></tr></table>
20459
20460 10=<p>Two
20461 </p><p>paragraphs
20462 </p>
20463 <p><br />
20464 </p><p><br />
20465 </p><p><br />
20466 </p><p><br />
20467 </p><p><br />
20468 </p>
20469 !! end
20470
20471 !! test
20472 preload: check <noinclude> and <includeonly>
20473 !! options
20474 preload
20475 !! wikitext
20476 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20477 !! html/php
20478 Hello kind world.
20479 !! end
20480
20481 !! test
20482 preload: check <onlyinclude>
20483 !! options
20484 preload
20485 !! wikitext
20486 Goodbye <onlyinclude>Hello world</onlyinclude>
20487 !! html/php
20488 Hello world
20489 !! end
20490
20491 !! test
20492 preload: can pass tags through if we want to
20493 !! options
20494 preload
20495 !! wikitext
20496 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20497 !! html/php
20498 <includeonly>Hello world</includeonly>
20499 !! end
20500
20501 !! test
20502 preload: check that it doesn't try to do tricks
20503 !! options
20504 preload
20505 !! wikitext
20506 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20507 !! html/php
20508 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20509 !! end
20510
20511 !! test
20512 Play a bit with r67090 and bug 3158
20513 !! wikitext
20514 <div style="width:50% !important">&nbsp;</div>
20515 <div style="width:50%&nbsp;!important">&nbsp;</div>
20516 <div style="width:50%&#160;!important">&nbsp;</div>
20517 <div style="border : solid;">&nbsp;</div>
20518 !! html/php
20519 <div style="width:50% !important">&#160;</div>
20520 <div style="width:50% !important">&#160;</div>
20521 <div style="width:50% !important">&#160;</div>
20522 <div style="border&#160;: solid;">&#160;</div>
20523
20524 !! html/parsoid
20525 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20526 <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>
20527 <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>
20528 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20529
20530 !! end
20531
20532 !! test
20533 HTML5 data attributes
20534 !! wikitext
20535 <span data-foo="bar">Baz</span>
20536 <p data-abc-def_hij="">Quuz</p>
20537 !! html
20538 <p><span data-foo="bar">Baz</span>
20539 </p>
20540 <p data-abc-def_hij="">Quuz</p>
20541
20542 !! end
20543
20544 !! test
20545 Strip reserved data attributes
20546 !! wikitext
20547 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy">d</div>
20548 !! html
20549 <div data-ok="fred">d</div>
20550
20551 !! end
20552
20553 !! test
20554 percent-encoding and + signs in internal links (Bug 26410)
20555 !! wikitext
20556 [[User:+%]] [[Page+title%]]
20557 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20558 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20559 [[%33%45]] [[%33%45+]]
20560 !! html/php
20561 <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>
20562 <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>
20563 <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>
20564 <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>
20565 </p>
20566 !! html/parsoid
20567 <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>
20568 <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>
20569 <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>
20570 <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>
20571 !! end
20572
20573 !! test
20574 Special characters in embedded file links (bug 27679)
20575 !! wikitext
20576 [[File:Contains & ampersand.jpg]]
20577 [[File:Does not exist.jpg|Title with & ampersand]]
20578 !! html/php
20579 <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>
20580 <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>
20581 </p>
20582 !! html/parsoid
20583 <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>
20584 <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>
20585 !! end
20586
20587 !! test
20588 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20589 !! wikitext
20590 Text&apos;s been normalized?
20591 !! html
20592 <p>Text&#39;s been normalized?
20593 </p>
20594 !! end
20595
20596 !! test
20597 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20598 !! wikitext
20599 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20600 !! html
20601 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20602 </p>
20603 !! end
20604
20605 !! test
20606 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20607 !! wikitext
20608 [http://www.example.org/ ideograms]
20609 !! html
20610 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20611 </p>
20612 !! end
20613
20614 !! test
20615 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20616 !! wikitext
20617 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20618 !! html
20619 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20620 </p>
20621 !! end
20622
20623 !! article
20624 Mediawiki:loop1
20625 !! text
20626 {{Identical|A}}
20627 !! endarticle
20628
20629 !! article
20630 Mediawiki:loop2
20631 !! text
20632 {{Identical|B}}
20633 !! endarticle
20634
20635 !! article
20636 Template:Identical
20637 !! text
20638 {{int:loop1}}
20639 {{int:loop2}}
20640 !! endarticle
20641
20642 !! test
20643 Bug 31098 Template which includes system messages which includes the template
20644 !! wikitext
20645 {{Identical}}
20646 !! html
20647 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20648 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20649 </p>
20650 !! end
20651
20652 !! test
20653 Bug31490 Turkish: ucfirst 'blah'
20654 !! options
20655 language=tr
20656 !! wikitext
20657 {{ucfirst:blah}}
20658 !! html
20659 <p>Blah
20660 </p>
20661 !! end
20662
20663 !! test
20664 Bug31490 Turkish: ucfirst 'ix'
20665 !! options
20666 language=tr
20667 !! wikitext
20668 {{ucfirst:ix}}
20669 !! html
20670 <p>İx
20671 </p>
20672 !! end
20673
20674 !! test
20675 Bug31490 Turkish: lcfirst 'BLAH'
20676 !! options
20677 language=tr
20678 !! wikitext
20679 {{lcfirst:BLAH}}
20680 !! html
20681 <p>bLAH
20682 </p>
20683 !! end
20684
20685 !! test
20686 Bug31490 Turkish: ucfırst (with a dotless i)
20687 !! options
20688 language=tr
20689 !! wikitext
20690 {{ucfırst:blah}}
20691 !! html
20692 <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>
20693 </p>
20694 !! end
20695
20696 !! test
20697 Bug31490 ucfırst (with a dotless i) with English language
20698 !! options
20699 language=en
20700 !! wikitext
20701 {{ucfırst:blah}}
20702 !! html
20703 <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>
20704 </p>
20705 !! end
20706
20707 !! test
20708 Bug 26375: TOC with italics
20709 !! options
20710 title=[[Main Page]]
20711 !! wikitext
20712 __TOC__
20713 == ''Lost'' episodes ==
20714 !! html
20715 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20716 <ul>
20717 <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>
20718 </ul>
20719 </div>
20720
20721 <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>
20722
20723 !! end
20724
20725 !! test
20726 Bug 26375: TOC with bold
20727 !! options
20728 title=[[Main Page]]
20729 !! wikitext
20730 __TOC__
20731 == '''should be bold''' then normal text ==
20732 !! html
20733 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20734 <ul>
20735 <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>
20736 </ul>
20737 </div>
20738
20739 <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>
20740
20741 !! end
20742
20743 !! test
20744 Bug 33845: Headings become cursive in TOC when they contain an image
20745 !! options
20746 title=[[Main Page]]
20747 !! wikitext
20748 __TOC__
20749 == Image [[Image:foobar.jpg]] ==
20750 !! html
20751 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20752 <ul>
20753 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20754 </ul>
20755 </div>
20756
20757 <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>
20758
20759 !! end
20760
20761 !! test
20762 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20763 !! options
20764 title=[[Main Page]]
20765 !! wikitext
20766 __TOC__
20767 == <blockquote>Quote</blockquote> ==
20768 !! html
20769 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20770 <ul>
20771 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20772 </ul>
20773 </div>
20774
20775 <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>
20776
20777 !! html+tidy
20778 <p></p>
20779 <div id="toc" class="toc">
20780 <div id="toctitle">
20781 <h2>Contents</h2>
20782 </div>
20783 <ul>
20784 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20785 </ul>
20786 </div>
20787 <p></p>
20788 <h2><span class="mw-headline" id="Quote"></span></h2>
20789 <blockquote>
20790 <p><span class="mw-headline" id="Quote">Quote</span></p>
20791 </blockquote>
20792 <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>
20793 !! end
20794
20795 !! test
20796 Unclosed tags in TOC
20797 !! options
20798 title=[[Main Page]]
20799 !! wikitext
20800 __TOC__
20801 == Proof: 2 < 3 ==
20802 <small>Hanc marginis exiguitas non caperet.</small>
20803 QED
20804 !! html
20805 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20806 <ul>
20807 <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>
20808 </ul>
20809 </div>
20810
20811 <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>
20812 <p><small>Hanc marginis exiguitas non caperet.</small>
20813 QED
20814 </p>
20815 !! end
20816
20817 !! test
20818 Multiple tags in TOC
20819 !! wikitext
20820 __TOC__
20821 == <i>Foo</i> <b>Bar</b> ==
20822
20823 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20824 !! html
20825 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20826 <ul>
20827 <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>
20828 <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>
20829 </ul>
20830 </div>
20831
20832 <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>
20833 <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>
20834
20835 !! html+tidy
20836 <p></p>
20837 <div id="toc" class="toc">
20838 <div id="toctitle">
20839 <h2>Contents</h2>
20840 </div>
20841 <ul>
20842 <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>
20843 <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>
20844 </ul>
20845 </div>
20846 <p></p>
20847 <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>
20848 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20849 <blockquote>
20850 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20851 </blockquote>
20852 <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>
20853 !! end
20854
20855 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20856 # html5 tag parsing.
20857 !! test
20858 Tags with parameters in TOC
20859 !! options
20860 parsoid=wt2html
20861 !! wikitext
20862 __TOC__
20863 == <sup class="in-h2">Hello</sup> ==
20864
20865 == <sup class="a > b">Evilbye</sup> ==
20866 !! html/php
20867 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20868 <ul>
20869 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20870 <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>
20871 </ul>
20872 </div>
20873
20874 <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>
20875 <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>
20876
20877 !! html/parsoid
20878 <meta property="mw:PageProp/toc" />
20879 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
20880
20881 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
20882 !! end
20883
20884 !! test
20885 span tags with directionality in TOC
20886 !! wikitext
20887 __TOC__
20888 == <span dir="ltr">C++</span> ==
20889
20890 == <span dir="rtl">זבנג!</span> ==
20891
20892 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20893
20894 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20895
20896 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20897 !! html
20898 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20899 <ul>
20900 <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>
20901 <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>
20902 <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>
20903 <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>
20904 <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>
20905 </ul>
20906 </div>
20907
20908 <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>
20909 <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>
20910 <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>
20911 <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>
20912 <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>
20913
20914 !! end
20915
20916 !! test
20917 Bug 72884: bdi element in ToC
20918 !! wikitext
20919 __TOC__
20920 == <bdi>test</bdi> ==
20921 !! html
20922 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20923 <ul>
20924 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20925 </ul>
20926 </div>
20927
20928 <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>
20929
20930 !! end
20931
20932 # Note that the html output does not have the <p></p>, but the
20933 # html+tidy output *does*. This is because the empty <p></p> is
20934 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20935 !! test
20936 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20937 !! wikitext
20938 __TOC__
20939 == x ==
20940 !! html
20941 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20942 <ul>
20943 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20944 </ul>
20945 </div>
20946
20947 <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>
20948
20949 !! html+tidy
20950 <p></p>
20951 <div id="toc" class="toc">
20952 <div id="toctitle">
20953 <h2>Contents</h2>
20954 </div>
20955 <ul>
20956 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20957 </ul>
20958 </div>
20959 <p></p>
20960 <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>
20961 !! end
20962
20963 !! article
20964 MediaWiki:Bug32057
20965 !! text
20966 == {{int:headline_sample}} ==
20967 !! endarticle
20968
20969 !! test
20970 Bug 32057: Title needed when expanding <h> nodes.
20971 !! options
20972 title=[[Main Page]]
20973 !! wikitext
20974 {{int:Bug32057}}
20975 !! html
20976 <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>
20977
20978 !! end
20979
20980 !! test
20981 Strip marker in urlencode
20982 !! wikitext
20983 {{urlencode:x<nowiki/>y}}
20984 {{urlencode:x<nowiki/>y|wiki}}
20985 {{urlencode:x<nowiki/>y|path}}
20986 {{urlencode:x<pre id="one">two</pre>y}}
20987 !! html
20988 <p>xy
20989 xy
20990 xy
20991 xy
20992 </p>
20993 !! end
20994
20995 !! test
20996 Strip marker in lc
20997 !! wikitext
20998 {{lc:x<nowiki/>y}}
20999 !! html
21000 <p>xy
21001 </p>
21002 !! end
21003
21004 !! test
21005 Strip marker in uc
21006 !! wikitext
21007 {{uc:x<nowiki/>y}}
21008 !! html
21009 <p>XY
21010 </p>
21011 !! end
21012
21013 !! test
21014 Strip marker in formatNum
21015 !! wikitext
21016 {{formatnum:1<nowiki/>2}}
21017 {{formatnum:1<nowiki/>2|R}}
21018 !! html
21019 <p>12
21020 12
21021 </p>
21022 !! end
21023
21024 !! test
21025 Check noCommafy in formatNum
21026 !! options
21027 language=be-tarask
21028 !! wikitext
21029 {{formatnum:123456.78}}
21030 {{formatnum:123456.78|NOSEP}}
21031 !! html
21032 <p>123 456,78
21033 123456.78
21034 </p>
21035 !! end
21036
21037 !! test
21038 Wrong option for formatNum (bug 56199)
21039 !! wikitext
21040 {{formatnum:1,234.56|Random}}
21041 {{formatnum:1,234.56|EVERYTHING}}
21042 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21043 !! html
21044 <p>1,234.56
21045 1,234.56
21046 1,234.56
21047 </p>
21048 !! end
21049
21050 !! test
21051 Strip marker in grammar
21052 !! options
21053 language=fi
21054 !! wikitext
21055 {{grammar:elative|foo<nowiki/>bar}}
21056 !! html
21057 <p>foobarista
21058 </p>
21059 !! end
21060
21061 !! test
21062 Strip marker in padleft
21063 !! wikitext
21064 {{padleft:|2|x<nowiki/>y}}
21065 !! html
21066 <p>xy
21067 </p>
21068 !! end
21069
21070 !! test
21071 Strip marker in padright
21072 !! wikitext
21073 {{padright:|2|x<nowiki/>y}}
21074 !! html
21075 <p>xy
21076 </p>
21077 !! end
21078
21079 !! test
21080 Strip marker in anchorencode
21081 !! wikitext
21082 {{anchorencode:x<nowiki/>y}}
21083 !! html
21084 <p>xy
21085 </p>
21086 !! end
21087
21088 !! test
21089 nowiki inside link inside heading (bug 18295)
21090 !! wikitext
21091 ==[[foo|x<nowiki>y</nowiki>z]]==
21092 !! html
21093 <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>
21094
21095 !! end
21096
21097 !! test
21098 new support for bdi element (bug 31817)
21099 !! wikitext
21100 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21101 !! html
21102 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21103
21104 !!end
21105
21106 !! test
21107 Ignore pipe between table row attributes
21108 !! wikitext
21109 {|
21110 | quux
21111 |- id=foo | style='color: red'
21112 | bar
21113 |}
21114 !! html
21115 <table>
21116 <tr>
21117 <td> quux
21118 </td></tr>
21119 <tr id="foo" style="color: red">
21120 <td> bar
21121 </td></tr></table>
21122
21123 !! end
21124
21125 !!test
21126 Gallery override link with WikiLink (bug 34852)
21127 !! wikitext
21128 <gallery>
21129 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21130 </gallery>
21131 !! html
21132 <ul class="gallery mw-gallery-traditional">
21133 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21134 <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>
21135 <div class="gallerytext">
21136 <p>caption
21137 </p>
21138 </div>
21139 </div></li>
21140 </ul>
21141
21142 !! end
21143
21144 !!test
21145 Gallery override link with absolute external link (bug 34852)
21146 !! wikitext
21147 <gallery>
21148 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21149 </gallery>
21150 !! html
21151 <ul class="gallery mw-gallery-traditional">
21152 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21153 <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>
21154 <div class="gallerytext">
21155 <p>caption
21156 </p>
21157 </div>
21158 </div></li>
21159 </ul>
21160
21161 !! end
21162
21163 !!test
21164 Gallery override link with malicious javascript (bug 34852)
21165 !! wikitext
21166 <gallery>
21167 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21168 </gallery>
21169 !! html
21170 <ul class="gallery mw-gallery-traditional">
21171 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21172 <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>
21173 <div class="gallerytext">
21174 <p>caption
21175 </p>
21176 </div>
21177 </div></li>
21178 </ul>
21179
21180 !! end
21181
21182 !!test
21183 Gallery with invalid title as link (bug 43964)
21184 !! wikitext
21185 <gallery>
21186 File:foobar.jpg|link=<
21187 </gallery>
21188 !! html
21189 <ul class="gallery mw-gallery-traditional">
21190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21191 <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>
21192 <div class="gallerytext">
21193 </div>
21194 </div></li>
21195 </ul>
21196
21197 !! end
21198
21199 !!test
21200 Language parser function
21201 !! wikitext
21202 {{#language:ar}}
21203 !! html
21204 <p>العربية
21205 </p>
21206 !! end
21207
21208 !!test
21209 Padleft and padright as substr
21210 !! wikitext
21211 {{padleft:|3|abcde}}
21212 {{padright:|3|abcde}}
21213 !! html
21214 <p>abc
21215 abc
21216 </p>
21217 !! end
21218
21219 !!test
21220 Special parser function
21221 !! wikitext
21222 {{#special:RandomPage}}
21223 {{#special:BaDtItLe}}
21224 {{#special:Foobar}}
21225 !! html
21226 <p>Special:Random
21227 Special:Badtitle
21228 Special:Foobar
21229 </p>
21230 !! end
21231
21232 !!test
21233 Bug 34939 - Case insensitive link parsing ([HttP://])
21234 !! wikitext
21235 [HttP://MediaWiki.Org/]
21236 !! html/php
21237 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21238 </p>
21239 !! html/parsoid
21240 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21241 !! end
21242
21243 !!test
21244 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21245 !! wikitext
21246 [HttP://MediaWiki.Org/ MediaWiki]
21247 !! html
21248 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21249 </p>
21250 !! end
21251
21252 !!test
21253 Bug 34939 - Case insensitive link parsing (HttP://)
21254 !! wikitext
21255 HttP://MediaWiki.Org/
21256 !! html/php
21257 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21258 </p>
21259 !! html/parsoid
21260 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21261 !! end
21262
21263 !!test
21264 Disable TOC
21265 !! options
21266 notoc
21267 !! wikitext
21268 Lead
21269 == Section 1 ==
21270 == Section 2 ==
21271 == Section 3 ==
21272 == Section 4 ==
21273 == Section 5 ==
21274 !! html
21275 <p>Lead
21276 </p>
21277
21278 <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>
21279 <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>
21280 <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>
21281 <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>
21282 <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>
21283
21284 !! end
21285
21286
21287 ###
21288 ### Parsoid-specific tests
21289 ### Parsoid-PHP parser incompatibilities
21290 ###
21291 !!test
21292 1. SOL-sensitive wikitext tokens as template-args
21293 !!options
21294 parsoid=wt2html,wt2wt
21295 !! wikitext
21296 {{echo|*a}}
21297 {{echo|#a}}
21298 {{echo|:a}}
21299 !! html
21300 <span about="#mwt1" typeof="mw:Transclusion">
21301 </span><ul about="#mwt1"><li>a</li>
21302 </ul>
21303 <span about="#mwt2" typeof="mw:Transclusion">
21304 </span><ol about="#mwt2"><li>a</li>
21305 </ol>
21306 <span about="#mwt3" typeof="mw:Transclusion">
21307 </span><dl about="#mwt3"><dd>a</dd>
21308 </dl>
21309 !!end
21310
21311 #### -----------------------------------------------------------------
21312 #### Parsoid-specific functionality tests
21313 #### -----------------------------------------------------------------
21314
21315 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21316 # We know wt2wt will fail, but we expect selser to pass.
21317 # Due to the nature of our testing, wt2wt and selser tests will enter the
21318 # blacklist and we'll catch selser regressions based on changes to the
21319 # blacklist entries for selser tests.
21320 !! test
21321 1. Bad treebuilder fixup of formatting elt is cleaned up
21322 !! options
21323 parsoid=wt2html,wt2wt
21324 !! wikitext
21325 {|
21326 |
21327 <small>
21328 [[Image:Foobar.jpg|right|Test]]
21329 </small>
21330 |}
21331 !! html/parsoid
21332 <table>
21333 <tbody><tr><td>
21334 <small>
21335 <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>
21336 </small>
21337 </td></tr>
21338 </tbody></table>
21339 !! end
21340
21341 !! test
21342 2. Bad treebuilder fixup of formatting elt is cleaned up
21343 !! options
21344 parsoid=wt2html,wt2wt
21345 !! wikitext
21346 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21347
21348 <small>[[Image:Foobar.jpg|right|300px]]</small>
21349 !! html/parsoid
21350
21351 <p><b>foo</b></p>
21352 <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>
21353 <p><b>bar</b></p>
21354 <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>
21355 !! end
21356
21357 !! test
21358 3. Bad treebuilder fixup of formatting elt is cleaned up
21359 !! options
21360 parsoid=wt2html,wt2wt
21361 !! wikitext
21362 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21363 !! html/parsoid
21364 <p><small><b>foo</b></small></p>
21365 <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>
21366 <p><small><b>bar</b></small></p>
21367 !! end
21368
21369 !! test
21370 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21371 !! options
21372 parsoid=wt2html,wt2wt
21373 !! wikitext
21374 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21375 !! html/parsoid
21376 <p><b><small></small></b></p>
21377 <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>
21378 <p></p>
21379 !! end
21380
21381 #### ----------------------------------------------------------------
21382 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21383 #### tags. Parsoid's output for these tags differs from that of the
21384 #### PHP parser.
21385 #### ----------------------------------------------------------------
21386
21387 !!test
21388 Ref: 1. ref-location should be replaced with an index span
21389 !!options
21390 parsoid
21391 !! wikitext
21392 A <ref>foo</ref>
21393 B <ref name="x">foo</ref>
21394 C <ref name="y" />
21395 <references />
21396 !! html
21397 <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>
21398 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>
21399 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>
21400 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21401 <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>
21402 <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>
21403 <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>
21404 </ol>
21405 !!end
21406
21407 !!test
21408 Ref: 2. ref-tags with identical names should all get the same index
21409 !!options
21410 parsoid
21411 !! wikitext
21412 A <ref name="x">foo</ref>
21413 B <ref name="x" />
21414 <references />
21415 !! html
21416 <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>
21417 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>
21418 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21419 <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>
21420 </ol>
21421 !!end
21422
21423 !!test
21424 Ref: 3. spaces in ref-names should be ignored
21425 !!options
21426 parsoid
21427 !! wikitext
21428 A <ref name="x">foo</ref>
21429 B <ref name=" x " />
21430 C <ref name= x />
21431 <references />
21432 !! html
21433 <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>
21434 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>
21435 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>
21436 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21437 <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>
21438 </ol>
21439 !!end
21440
21441 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21442 !!test
21443 Ref: 4. 'constructor' should be accepted as a valid ref-name
21444 !!options
21445 parsoid
21446 !! wikitext
21447 A <ref name="constructor">foo</ref>
21448 <references />
21449 !! html
21450 <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>
21451 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21452 <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>
21453 </ol>
21454 !!end
21455
21456 !!test
21457 Ref: 5. body should accept generic wikitext
21458 !!options
21459 parsoid
21460 !! wikitext
21461 A <ref>
21462 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21463 </ref>
21464
21465 <references />
21466 !! html
21467 <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>
21468
21469 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21470 <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>
21471 </span></li>
21472 </ol>
21473 !!end
21474
21475 !!test
21476 Ref: 6. indent-pres should not be output in ref-body
21477 !!options
21478 parsoid
21479 !! wikitext
21480 A <ref>
21481 foo
21482 bar
21483 baz
21484 </ref>
21485
21486 <references />
21487 !! html
21488 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21489
21490 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21491 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21492 bar
21493 baz
21494 </span></li>
21495 </ol>
21496 !!end
21497
21498 !!test
21499 Ref: 7. No p-wrapping in ref-body
21500 !!options
21501 parsoid
21502 !! wikitext
21503 A <ref>
21504 foo
21505
21506 bar
21507
21508
21509 baz
21510
21511
21512
21513 booz
21514 </ref>
21515
21516 <references />
21517 !! html
21518 <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>
21519
21520 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21521 <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
21522
21523 bar
21524
21525
21526 baz
21527
21528
21529
21530 booz
21531 </span></li>
21532 </ol>
21533 !!end
21534
21535 !!test
21536 Ref: 8. transclusion wikitext has lower precedence
21537 !!options
21538 parsoid
21539 !! wikitext
21540 A <ref> foo {{echo|</ref> B C}}
21541
21542 <references />
21543 !! html
21544 <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>
21545 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21546 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
21547 </ol>
21548 !!end
21549
21550 !!test
21551 Ref: 9. unclosed comments should not leak out of ref-body
21552 !!options
21553 parsoid
21554 !! wikitext
21555 A <ref> foo <!--</ref> B C
21556 <references />
21557 !! html
21558 <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>
21559 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21560 <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>
21561 </ol>
21562 !!end
21563
21564 !!test
21565 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21566 !!options
21567 parsoid
21568 !! wikitext
21569 A <ref> <b> foo </ref> B C
21570
21571 <references />
21572 !! html
21573 <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>
21574
21575
21576 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21577 <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>
21578 </ol>
21579 !!end
21580
21581 !!test
21582 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21583 !!options
21584 parsoid
21585 !! wikitext
21586 A <ref>foo</ref> B
21587 C <ref>bar</ref> D
21588 <references />
21589 !! html
21590 <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
21591 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>
21592 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21593 <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>
21594 <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>
21595 </ol>
21596 !!end
21597
21598 !!test
21599 Ref: 12. ref-tags act as trailing newline migration barrier
21600 !! wikitext
21601 <!--the newline at the end of this line moves out of the p tag-->a
21602
21603 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21604 <ref />
21605
21606 c
21607 <references />
21608 !! html/parsoid
21609 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21610
21611
21612 <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>
21613 <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>
21614
21615 <p>c</p>
21616 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21617 <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>
21618 <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>
21619 !!end
21620
21621 !!test
21622 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21623 !!options
21624 parsoid
21625 !! wikitext
21626 <ref>foo</ref> A
21627 <ref>bar
21628 </ref> B
21629 <references />
21630 !! html
21631 <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
21632 <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>
21633 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21634 <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>
21635 <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
21636 </span></li>
21637 </ol>
21638 !!end
21639
21640 !!test
21641 Ref: 14. A nested ref-tag should be emitted as plain text
21642 !!options
21643 parsoid
21644 !! wikitext
21645 <ref>foo <ref>bar</ref> baz</ref>
21646
21647 <references />
21648 !! html
21649 <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>
21650 </p>
21651 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21652 <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>
21653 </ol>
21654 !!end
21655
21656 !!test
21657 Ref: 15. ref-tags with identical names should get identical indexes
21658 !!options
21659 parsoid
21660 !! wikitext
21661 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21662 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21663
21664 <references />
21665 !! html
21666 <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>
21667 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>
21668
21669 <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>
21670 </ol>
21671 !!end
21672
21673 ## We don't bother wt2wt-ing non-standard whitespace
21674 !!test
21675 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21676 !!options
21677 parsoid=wt2html
21678 !! wikitext
21679 A <ref >foo</ref >
21680
21681 <references />
21682 !! html
21683 <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>
21684 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21685 <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>
21686 !!end
21687
21688 !!test
21689 Ref: 17. Generate valid HTML5 id/about attributes
21690 !!options
21691 parsoid
21692 !!wikitext
21693 <ref name="a b">foo</ref>
21694
21695 <references />
21696 !!html
21697 <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>
21698 </p>
21699
21700 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21701 <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>
21702 </ol>
21703 !!end
21704
21705 !!test
21706 Ref: 18. T58916: Extension attributes should be parsed as plain text
21707 !!options
21708 parsoid
21709 !!wikitext
21710 <ref name="{{echo|a}}">foo</ref>
21711
21712 <references />
21713 !!html
21714 <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>
21715 </p>
21716
21717 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21718 <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>
21719 </ol>
21720 !!end
21721
21722 !!test
21723 Ref: 19. ref-tags with identical name encodings should get identical indexes
21724 !!options
21725 parsoid
21726 !! wikitext
21727 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21728
21729 <references />
21730 !! html
21731 <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>
21732 </p>
21733 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21734 <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>
21735 </ol>
21736 !!end
21737
21738 !!test
21739 Ref: 20. ref-tags with identical names but different content should keep it
21740 !!options
21741 parsoid
21742 !! wikitext
21743 A <ref name="foo">Foo one</ref>
21744 B <ref name="foo">Foo two</ref>
21745 C <ref name="foo" />
21746
21747 <references />
21748 !! html
21749 <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>
21750 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>
21751 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>
21752
21753 <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>
21754 </ol>
21755 !!end
21756
21757 !!test
21758 References: 1. references tag without any refs should be handled properly
21759 !! wikitext
21760 <references />
21761 !! html/parsoid
21762 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21763 !!end
21764
21765 !!test
21766 References: 2. references tag with group only outputs references from that group
21767 !! wikitext
21768 A <ref group="a">foo</ref>
21769 B <ref group="b">bar</ref>
21770 C <ref>baz</ref>
21771
21772 <references group="a" />
21773 <references />
21774 <references group="b" />
21775 !! html/parsoid
21776 <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>
21777 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>
21778 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>
21779
21780 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21781 <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>
21782 </ol>
21783 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21784 <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>
21785 </ol>
21786 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21787 <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>
21788 </ol>
21789 !!end
21790
21791 !!test
21792 References: 3. ref list should be cleared after processing references
21793 !! wikitext
21794 A <ref>foo</ref>
21795
21796 <references />
21797
21798 B <ref>bar</ref>
21799
21800 <references />
21801 !! html/parsoid
21802 <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>
21803
21804 <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>
21805 </ol>
21806
21807 <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>
21808
21809 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21810 <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>
21811 </ol>
21812 !!end
21813
21814 !!test
21815 References: 4. only referenced group should be cleared after processing references
21816 !! wikitext
21817 A <ref group="a">afoo</ref>
21818 B <ref>bfoo</ref>
21819
21820 <references group="a" />
21821
21822 C <ref>cfoo</ref>
21823
21824 <references />
21825 !! html/parsoid
21826 <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>
21827 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>
21828
21829 <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>
21830 </ol>
21831
21832 <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>
21833
21834 <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>
21835 </ol>
21836 !!end
21837
21838 !!test
21839 References: 5. ref tags in references should be processed while ignoring all other content
21840 !! wikitext
21841 A <ref name="a" />
21842 B <ref name="b">bar</ref>
21843
21844 <references>
21845 <ref name="a">foo</ref>
21846 This should just get lost.
21847 </references>
21848 !! html/parsoid
21849 <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>
21850 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>
21851
21852
21853 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21854 </ol>
21855 !!end
21856
21857 !!test
21858 References: 6. <references /> from a transclusion
21859 !! wikitext
21860 <ref>Foo</ref> {{echo|<references />}}
21861 !! html/parsoid
21862 <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>
21863 </ol>
21864 !!end
21865
21866 !! test
21867 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21868 !! wikitext
21869 A <ref>foo bar for a</ref>
21870 B <ref group="X" name="b" />
21871
21872 <references />
21873
21874 <references group="X">
21875 <ref name="b">foo</ref>
21876 </references>
21877 !! html/parsoid
21878 <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>
21879 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>
21880 </p>
21881
21882 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21883 <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>
21884 </ol>
21885
21886 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21887 <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>
21888 </ol>
21889 !! end
21890
21891 !! test
21892 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21893 !! wikitext
21894 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21895 <references />
21896 !! html/parsoid
21897 <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>
21898 <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>
21899 </ol>
21900 !!end
21901
21902 # This test only works in wt2html now as the <references /> are always generated
21903 # unless selser is active. Once T72722 is fixed, we should add a changes test
21904 # here to ensure that unrelated changes don't add the new <references /> in
21905 # wt2wt.
21906 !! test
21907 References: 9. Generate missing references list at the end
21908 !! wikitext
21909 A <ref>foo</ref>
21910 B <ref group="inexistent">bar</ref>
21911 !! html/parsoid
21912 <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>
21913 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21914 <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>
21915 </ol>
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21917 <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>
21918 </ol>
21919 !! end
21920
21921 !! test
21922 References: 10. New <references/> shouldn't be added for unrelated edits.
21923 !! options
21924 parsoid={
21925 "modes": ["selser"],
21926 "changes": [["#x", "remove"]],
21927 "selser": "noauto"
21928 }
21929 !! wikitext
21930 Unrelated text<span id="x"> that's going to disappear</span>.
21931 A <ref>foo</ref>
21932 !! wikitext/edited
21933 Unrelated text.
21934 A <ref>foo</ref>
21935 !!end
21936
21937 !! test
21938 Entities in ref name
21939 !! wikitext
21940 <ref name="test &amp; me">hi</ref>
21941 <references />
21942 !! html/parsoid
21943 <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>
21944 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21945 <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>
21946 </ol>
21947 !! end
21948
21949 # This test is wt2html only because we're permitting the serializer to produce
21950 # dirty diffs, normalizing the unclosed references to the self-closed version.
21951 !! test
21952 Generate references for unclosed references tag
21953 !! options
21954 parsoid=wt2html
21955 !! wikitext
21956 a<ref>foo</ref>
21957
21958 <references>
21959 !! html/parsoid
21960 <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>
21961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21962 <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>
21963 !! end
21964
21965 !! test
21966 New reference serializes on its own line
21967 !! options
21968 parsoid=wt2wt,html2wt
21969 !! wikitext
21970 foo
21971 <references />
21972 !! html/parsoid
21973 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21974 !! end
21975
21976 #### ----------------------------------------------------------------
21977 #### Parsoid-only testing of Parsoid's impl of LST
21978 #### Not implemented yet, see
21979 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21980 #### ----------------------------------------------------------------
21981
21982 !!test
21983 LST Sections: 1. Simple section start and end
21984 !! wikitext
21985 <section begin="2011-05-16" />
21986 <section end="2014-04-10 (MW 1.23wmf22)" />
21987 !! html/parsoid
21988 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21989 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21990 !! end
21991
21992 #--------- Test stripping of empty nodes in template content ----------
21993 !!test
21994 Empty LI and TR nodes should be stripped from template content
21995 !!wikitext
21996 {{EmptyLITest}}
21997 {{EmptyTRTest}}
21998 !!html/parsoid
21999 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22000 <li>a</li>
22001 <li>b</li>
22002 </ul>
22003 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22004 <tbody>
22005 <tr>
22006 <td>foo</td>
22007 </tr>
22008 <tr>
22009 <td>bar</td>
22010 </tr>
22011 </tbody>
22012 </table>
22013 !!end
22014
22015 !!test
22016 Empty LI and TR nodes should not be stripped from top-level content
22017 !!wikitext
22018 * a
22019 *
22020 * b
22021 {|
22022 |-
22023 |-
22024 |foo
22025 |}
22026 !!html/parsoid
22027 <ul>
22028 <li> a</li>
22029 <li></li>
22030 <li> b</li>
22031 </ul>
22032 <table>
22033 <tbody>
22034 <tr></tr>
22035 <tr>
22036 <td>foo</td>
22037 </tr>
22038 </tbody>
22039 </table>
22040 !!end
22041
22042 !!test
22043 Empty TR nodes should not be stripped if they have any attributes set
22044 !!wikitext
22045 {{EmptyTRWithHTMLAttrTest}}
22046 !!html/parsoid
22047 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22048 <tr align="center"></tr>
22049 <tr><td>foo</td></tr>
22050 <tr align="center"></tr>
22051 <tr><td>bar</td></tr>
22052 </table>
22053 !!end
22054
22055 #### ----------------------------------------------------------------
22056 #### The following section of tests are primarily to test
22057 #### wikitext escaping capabilities of Parsoid. Given that
22058 #### escaping can be done any number of ways, the wikitext (input)
22059 #### is always adjusted to reflect how Parsoid adds nowiki
22060 #### escape tags.
22061 ####
22062 #### We are marking several tests as parsoid-only since the
22063 #### HTML in the result section is different from what the
22064 #### PHP parser generates for it.
22065 #### ----------------------------------------------------------------
22066
22067
22068 #### --------------- Headings ---------------
22069 #### 0. Unnested
22070 #### 1. Nested inside html <h1>=foo=</h1>
22071 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22072 #### 3. Nested inside html with wikitext split by html tags
22073 #### 4. No escape needed
22074 #### 5. Empty headings <h1></h1>
22075 #### 6. Heading chars in SOL context
22076 #### ----------------------------------------
22077 !! test
22078 Headings: 0. Unnested
22079 !! options
22080 parsoid=html2wt
22081 !! html/parsoid
22082 <p>=foo=</p>
22083
22084 <p> =foo=
22085 <!--cmt-->
22086 =foo=</p>
22087
22088 <p>=foo<i>a</i>=</p>
22089 !! wikitext
22090 <nowiki>=foo=</nowiki>
22091
22092 <nowiki> </nowiki>=foo=
22093 <!--cmt-->
22094 <nowiki>=foo=</nowiki>
22095
22096 =foo''a''<nowiki>=</nowiki>
22097 !!end
22098
22099 # New headings and existing headings are handled differently
22100 !! test
22101 Headings: 1. Nested inside html
22102 !! options
22103 parsoid=html2wt
22104 !! html/parsoid
22105 <h1>=foo=</h1>
22106 <h2>=foo=</h2>
22107 <h3>=foo=</h3>
22108
22109 <h1 data-parsoid=''>=foo=</h1>
22110 <h2 data-parsoid=''>=foo=</h2>
22111 <h3 data-parsoid=''>=foo=</h3>
22112 <h4 data-parsoid=''>=foo=</h4>
22113 <h5 data-parsoid=''>=foo=</h5>
22114 <h6 data-parsoid=''>=foo=</h6>
22115 !! wikitext
22116 = =foo= =
22117
22118 == =foo= ==
22119
22120 === =foo= ===
22121
22122 =<nowiki>=foo=</nowiki>=
22123 ==<nowiki>=foo=</nowiki>==
22124 ===<nowiki>=foo=</nowiki>===
22125 ====<nowiki>=foo=</nowiki>====
22126 =====<nowiki>=foo=</nowiki>=====
22127 ======<nowiki>=foo=</nowiki>======
22128
22129 !!end
22130
22131 !! test
22132 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22133 !! options
22134 parsoid=html2wt
22135 !! html/parsoid
22136 <h1>foo</h1>*bar
22137 <h1>foo</h1>=bar
22138 <h1>foo</h1>=bar=
22139 !! wikitext
22140 = foo =
22141 <nowiki>*</nowiki>bar
22142
22143 = foo =
22144 =bar
22145
22146 = foo =
22147 <nowiki>=bar=</nowiki>
22148 !!end
22149
22150 !! test
22151 Headings: 3. Nested inside html with wikitext split by html tags
22152 !! options
22153 parsoid=html2wt
22154 !! html/parsoid
22155 <h1>=<b>bold</b>foo=</h1>
22156 !! wikitext
22157 = ='''bold'''<nowiki>foo=</nowiki> =
22158 !!end
22159
22160 !! test
22161 Headings: 4a. No escaping needed (testing just h1 and h2)
22162 !! options
22163 parsoid=html2wt
22164 !! html/parsoid
22165 <h1>=foo</h1>
22166 <h1>foo=</h1>
22167 <h1> =foo= </h1>
22168 <h1>=foo= bar</h1>
22169 <h2>=foo</h2>
22170 <h2>foo=</h2>
22171 <h1>=</h1>
22172 <h1><i>=</i>foo=</h1>
22173 !! wikitext
22174 = =foo =
22175
22176 = foo= =
22177
22178 = =foo= =
22179
22180 = =foo= bar =
22181
22182 == =foo ==
22183
22184 == foo= ==
22185
22186 = = =
22187
22188 = ''=''foo= =
22189 !!end
22190
22191 !! test
22192 Headings: 4b. No escaping needed (inside p-tags)
22193 !! options
22194 parsoid=html2wt
22195 !! html/parsoid
22196 <p>===
22197 =foo= x
22198 =foo= <s></s>
22199 </p>
22200 !! wikitext
22201 ===
22202 =foo= x
22203 =foo= <s></s>
22204 !!end
22205
22206 !! test
22207 Headings: 5. Empty headings
22208 !! options
22209 parsoid=html2wt
22210 !! html/parsoid
22211 <h1 data-parsoid='{}'></h1>
22212
22213 <h2 data-parsoid='{}'></h2>
22214
22215 <h3 data-parsoid='{}'></h3>
22216
22217 <h4 data-parsoid='{}'></h4>
22218
22219 <h5 data-parsoid='{}'></h5>
22220
22221 <h6 data-parsoid='{}'></h6>
22222 !! wikitext
22223 =<nowiki/>=
22224
22225 ==<nowiki/>==
22226
22227 ===<nowiki/>===
22228
22229 ====<nowiki/>====
22230
22231 =====<nowiki/>=====
22232
22233 ======<nowiki/>======
22234 !!end
22235
22236 !! test
22237 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22238 !! options
22239 parsoid=html2wt
22240 !! html/parsoid
22241 <p>=a=</p>
22242
22243 <p>=a=</p>
22244
22245 <p>=a=</p>
22246 !! wikitext
22247 <nowiki>=a=</nowiki>
22248
22249 <nowiki>=a=</nowiki>
22250
22251 <nowiki>=a=</nowiki>
22252 !!end
22253
22254 !! test
22255 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22256 !! options
22257 parsoid=html2wt
22258 !! html/parsoid
22259 <p>=a=
22260 b</p>
22261
22262 <p>=a=
22263 b</p>
22264
22265 <p>=a=
22266 b</p>
22267 !! wikitext
22268 <nowiki>=a=</nowiki>
22269 b
22270
22271 <nowiki>=a=</nowiki>
22272 b
22273
22274 <nowiki>=a=</nowiki>
22275 b
22276 !!end
22277
22278 !! test
22279 Headings: 6c. Heading chars in SOL context (leading newline break)
22280 !! options
22281 parsoid=html2wt
22282 !! html/parsoid
22283 <p>a
22284 =b=</p>
22285 !! wikitext
22286 a
22287 <nowiki>=b=</nowiki>
22288 !!end
22289
22290 !! test
22291 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22292 !! options
22293 parsoid=html2wt
22294 !! html/parsoid
22295 <!--c0--><p>=a=</p>
22296
22297 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22298 !! wikitext
22299 <!--c0--><nowiki>=a=</nowiki>
22300
22301 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22302 !!end
22303
22304 !! test
22305 Headings: 6d. Heading chars in SOL context (No escaping needed)
22306 !! options
22307 parsoid=html2wt
22308 !! html/parsoid
22309 =a=<div>b</div>
22310 !! wikitext
22311 =a=<div>b</div>
22312 !!end
22313
22314 !! test
22315 Headings: 7. Insert a newline between new content and headings
22316 !! options
22317 parsoid=html2wt
22318 !! html/parsoid
22319 <h2>NEW</h2>
22320 <p>new</p>
22321 <h2 data-parsoid='{}'>A</h2>
22322 <p data-parsoid='{}'>a</p>
22323 !! wikitext
22324 == NEW ==
22325 new
22326
22327 ==A==
22328 a
22329
22330 !! end
22331
22332 #### --------------- Lists ---------------
22333 #### 0. Outside nests (*foo, etc.)
22334 #### 1. Nested inside html <ul><li>*foo</li></ul>
22335 #### 2. Inside definition lists
22336 #### 3. Only bullets at start should be escaped
22337 #### 4. No escapes needed
22338 #### 5. No unnecessary escapes
22339 #### 6. Escape bullets in SOL position
22340 #### 7. Escape bullets in a multi-line context
22341 #### ----------------------------------------
22342
22343 !! test
22344 Lists: 0. Outside nests
22345 !! options
22346 parsoid=html2wt
22347 !! html/parsoid
22348 <p>*foo</p>
22349
22350 <p>#foo</p>
22351
22352 <p>;Foo:bar</p>
22353 !! wikitext
22354 <nowiki>*</nowiki>foo
22355
22356 <nowiki>#</nowiki>foo
22357
22358 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22359 !!end
22360
22361 !! test
22362 Lists: 1. Nested inside html
22363 !! options
22364 parsoid=html2wt
22365 !! html/parsoid
22366 <ul><li>*foo</li></ul>
22367 <ul><li>#foo</li></ul>
22368 <ul><li>:foo</li></ul>
22369 <ul><li>;foo</li></ul>
22370 <ol><li>*foo</li></ol>
22371 <ol><li>#foo</li></ol>
22372 <ol><li>:foo</li></ol>
22373 <ol><li>;foo</li></ol>
22374
22375 !! wikitext
22376 *<nowiki>*foo</nowiki>
22377
22378 *<nowiki>#foo</nowiki>
22379
22380 *<nowiki>:foo</nowiki>
22381
22382 *<nowiki>;foo</nowiki>
22383
22384 #<nowiki>*foo</nowiki>
22385
22386 #<nowiki>#foo</nowiki>
22387
22388 #<nowiki>:foo</nowiki>
22389
22390 #<nowiki>;foo</nowiki>
22391 !!end
22392
22393 !! test
22394 Lists: 2. Inside definition lists
22395 !! options
22396 parsoid=html2wt
22397 !! html/parsoid
22398 <dl><dt>;foo</dt></dl>
22399 <dl><dt>:foo</dt></dl>
22400 <dl><dt>:foo</dt>
22401 <dd>bar</dd></dl>
22402 <dl><dd>:foo</dd></dl>
22403
22404 !! wikitext
22405 ;<nowiki>;foo</nowiki>
22406
22407 ;<nowiki>:foo</nowiki>
22408
22409 ;<nowiki>:foo</nowiki>
22410 :bar
22411
22412 :<nowiki>:foo</nowiki>
22413 !!end
22414
22415 !! test
22416 Lists: 3. Only bullets at start of text should be escaped
22417 !! options
22418 parsoid=html2wt
22419 !! html/parsoid
22420 <ul><li>*foo*bar</li></ul>
22421 <ul><li>*foo<i>it</i>*bar</li></ul>
22422
22423 !! wikitext
22424 *<nowiki>*foo*bar</nowiki>
22425
22426 *<nowiki>*foo</nowiki>''it''*bar
22427 !!end
22428
22429 !! test
22430 Lists: 4. No escapes needed
22431 !! options
22432 parsoid=html2wt
22433 !! html/parsoid
22434 <ul>
22435 <li>foo*bar
22436 </li>
22437 </ul>
22438 <ul>
22439 <li><i>foo</i>*bar
22440 </li>
22441 </ul>
22442 <ul>
22443 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22444 </li>
22445 </ul>
22446 <ul>
22447 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22448 </li>
22449 </ul>
22450 !! wikitext
22451 *foo*bar
22452
22453 *''foo''*bar
22454
22455 *[[Foo]]: bar
22456
22457 *[[Foo]]*bar
22458 !!end
22459
22460 !! test
22461 Lists: 5. No unnecessary escapes
22462 !! options
22463 parsoid=html2wt
22464 !! html/parsoid
22465 <ul><li> bar <span>[[foo]]</span></li></ul>
22466 <ul><li> =bar <span>[[foo]]</span></li></ul>
22467 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22468 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22469 <ul><li> =bar <span>foo]]</span>=</li></ul>
22470 <ul><li> <s></s>: a</li></ul>
22471 <ul><li> <i>* foo</i></li></ul>
22472
22473 !! wikitext
22474 * bar <span><nowiki>[[foo]]</nowiki></span>
22475
22476 * =bar <span><nowiki>[[foo]]</nowiki></span>
22477
22478 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22479
22480 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22481
22482 * =bar <span>foo]]</span>=
22483
22484 * <s></s>: a
22485
22486 * ''* foo''
22487 !!end
22488
22489 !! test
22490 Lists: 6. Escape bullets in SOL position
22491 !! options
22492 parsoid=html2wt
22493 !! html/parsoid
22494 <p><!--cmt-->*foo</p>
22495 !! wikitext
22496 <!--cmt--><nowiki>*</nowiki>foo
22497 !!end
22498
22499 !! test
22500 Lists: 7. Escape bullets in a multi-line context
22501 !! options
22502 parsoid=html2wt
22503 !! html/parsoid
22504 <p>a
22505 *b
22506 </p>
22507 !! wikitext
22508 a
22509 <nowiki>*</nowiki>b
22510 !!end
22511
22512 !! test
22513 Lists: 8. Escape colons only if not present in tags
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 <dl><dt>a:b<i>c:d</i></dt></dl>
22518 !! wikitext
22519 ; <nowiki>a:b</nowiki>''c:d''
22520 !! end
22521
22522 #### --------------- HRs ---------------
22523 #### 1. Single line
22524 #### -----------------------------------
22525
22526 !! test
22527 HRs: 1. Single line
22528 !! options
22529 parsoid=html2wt
22530 !! html/parsoid
22531 <hr />----
22532 <hr />=foo=
22533 <hr />*foo
22534 !! wikitext
22535 ----<nowiki>----</nowiki>
22536 ----=foo=
22537 ----*foo
22538 !! end
22539
22540 #### --------------- Tables ---------------
22541 #### 1a. Simple example
22542 #### 1b. No escaping needed (!foo)
22543 #### 1c. No escaping needed (|foo)
22544 #### 1d. No escaping needed (|}foo)
22545 ####
22546 #### 2a. Nested in td (<td>foo|bar</td>)
22547 #### 2b. Nested in td (<td>foo||bar</td>)
22548 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22549 ####
22550 #### 3a. Nested in th (<th>foo!bar</th>)
22551 #### 3b. Nested in th (<th>foo!!bar</th>)
22552 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22553 ####
22554 #### 4a. Escape -
22555 #### 4b. Escape +
22556 #### 4c. No escaping needed
22557 #### --------------------------------------
22558
22559 !! test
22560 Tables: 1a. Simple example
22561 !! options
22562 parsoid=html2wt
22563 !! html/parsoid
22564 <p>{|
22565 |}
22566 </p>
22567 !! wikitext
22568 <nowiki>{|</nowiki>
22569 |}
22570 !! end
22571
22572 !! test
22573 Tables: 1b. No escaping needed
22574 !! options
22575 parsoid=html2wt
22576 !! html/parsoid
22577 <p>!foo
22578 </p>
22579 !! wikitext
22580 !foo
22581 !! end
22582
22583 !! test
22584 Tables: 1c. No escaping needed
22585 !! options
22586 parsoid=html2wt
22587 !! html/parsoid
22588 <p>|foo
22589 </p>
22590 !! wikitext
22591 |foo
22592 !! end
22593
22594 !! test
22595 Tables: 1d. No escaping needed
22596 !! options
22597 parsoid=html2wt
22598 !! html/parsoid
22599 <p>|}foo
22600 </p>
22601 !! wikitext
22602 |}foo
22603 !! end
22604
22605 !! test
22606 Tables: 2a. Nested in td
22607 !! options
22608 parsoid=html2wt
22609 !! html/parsoid
22610 <table><tbody><tr>
22611 <td>foo|bar</td></tr>
22612 <tr><td>x<div>a|b</div></td>
22613 </tbody></table>
22614 !! wikitext
22615 {|
22616 |<nowiki>foo|bar</nowiki>
22617 |-
22618 |x<div><nowiki>a|b</nowiki></div>
22619 |}
22620 !! html/php+tidy
22621 <table>
22622 <tr>
22623 <td>foo|bar</td>
22624 </tr>
22625 <tr>
22626 <td>x
22627 <div>a|b</div>
22628 </td>
22629 </tr>
22630 </table>
22631 !! end
22632
22633 !! test
22634 Tables: 2b. Nested in td
22635 !! options
22636 parsoid=html2wt
22637 !! html/parsoid
22638 <table><tbody><tr>
22639 <td>foo||bar</td>
22640 <td>a<i>b||c</i></td>
22641 <td>a<i><div>b||c</div></i></td>
22642 </tr></tbody></table>
22643 !! wikitext
22644 {|
22645 |<nowiki>foo||bar</nowiki>
22646 |a''<nowiki>b||c</nowiki>''
22647 |a''<div><nowiki>b||c</nowiki></div>''
22648 |}
22649 !! html/php
22650 <table>
22651 <tr>
22652 <td>foo||bar
22653 </td>
22654 <td>a<i>b||c</i>
22655 </td>
22656 <td>a<i><div>b||c</div></i>
22657 </td></tr></table>
22658
22659 !! end
22660
22661 !! test
22662 Tables: 2c. Nested in td -- no escaping needed
22663 !! options
22664 parsoid=html2wt
22665 !! html/*
22666 <table>
22667
22668 <tr>
22669 <td>foo!!bar
22670 </td></tr></table>
22671
22672 !! wikitext
22673 {|
22674
22675 |foo!!bar
22676 |}
22677 !! end
22678
22679 !! test
22680 Tables: 3a. Nested in th
22681 !! options
22682 parsoid=html2wt
22683 !! html/*
22684 <table>
22685
22686 <tr>
22687 <th>foo!bar
22688 </th></tr></table>
22689
22690 !! wikitext
22691 {|
22692
22693 !foo!bar
22694 |}
22695 !! end
22696
22697 !! test
22698 Tables: 3b. Nested in th
22699 !! options
22700 parsoid=html2wt
22701 !! html/parsoid
22702 <table><tbody>
22703 <tr><th>foo!!bar</th>
22704 <th><i>foo|bar</i></th>
22705 <th><i>foo!!bar</i></th>
22706 <th><i><span>foo!!bar</span></i></th>
22707 </tr></tbody></table>
22708 !! wikitext
22709 {|
22710 !<nowiki>foo!!bar</nowiki>
22711 !''<nowiki>foo|bar</nowiki>''
22712 !''<nowiki>foo!!bar</nowiki>''
22713 !''<span><nowiki>foo!!bar</nowiki></span>''
22714 |}
22715 !! html/php
22716 <table>
22717 <tr>
22718 <th>foo!!bar
22719 </th>
22720 <th><i>foo|bar</i>
22721 </th>
22722 <th><i>foo!!bar</i>
22723 </th>
22724 <th><i><span>foo!!bar</span></i>
22725 </th></tr></table>
22726
22727 !! end
22728
22729 !! test
22730 Tables: 3c. Nested in th
22731 !! options
22732 parsoid=html2wt
22733 !! html/parsoid
22734 <table><tbody>
22735 <tr><th>foo||bar</th>
22736 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22737 </tr></tbody></table>
22738 !! wikitext
22739 {|
22740 !<nowiki>foo||bar</nowiki>
22741 !<nowiki>foo||bar</nowiki>
22742 |}
22743 !! html/php
22744 <table>
22745 <tr>
22746 <th>foo||bar
22747 </th>
22748 <th>foo||bar
22749 </th></tr></table>
22750
22751 !! end
22752
22753 !! test
22754 Tables: 4a. Escape -
22755 !! options
22756 parsoid=html2wt
22757 !! html/*
22758 <table>
22759
22760 <tr>
22761 <th>-bar
22762 </th></tr>
22763 <tr>
22764 <td>-bar
22765 </td></tr></table>
22766
22767 !! wikitext
22768 {|
22769
22770 !-bar
22771
22772 |-
22773 |<nowiki>-bar</nowiki>
22774 |}
22775 !! end
22776
22777 !! test
22778 Tables: 4b. Escape +
22779 !! options
22780 parsoid=html2wt
22781 !! html/*
22782 <table>
22783
22784 <tr>
22785 <th>+bar
22786 </th></tr>
22787 <tr>
22788 <td>+bar
22789 </td></tr></table>
22790
22791 !! wikitext
22792 {|
22793
22794 !+bar
22795
22796 |-
22797 |<nowiki>+bar</nowiki>
22798 |}
22799 !! end
22800
22801 !! test
22802 Tables: 4c. No escaping needed
22803 !! options
22804 parsoid=html2wt
22805 !! html/parsoid
22806 <table><tbody>
22807 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22808 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22809 <tr><td>foo
22810 <p>bar|baz
22811 +bar
22812 -bar</p></td></tr>
22813 <tr><td>x
22814 <div>a|b</div></td>
22815 </tbody></table>
22816 !! wikitext
22817 {|
22818 |foo-bar
22819 |foo+bar
22820 |-
22821 |''foo''-bar
22822 |''foo''+bar
22823 |-
22824 |foo
22825 bar|baz
22826 +bar
22827 -bar
22828 |-
22829 |x
22830 <div>a|b</div>
22831 |}
22832 !! html/php
22833 <table>
22834 <tr>
22835 <td>foo-bar
22836 </td>
22837 <td>foo+bar
22838 </td></tr>
22839 <tr>
22840 <td><i>foo</i>-bar
22841 </td>
22842 <td><i>foo</i>+bar
22843 </td></tr>
22844 <tr>
22845 <td>foo
22846 <p>bar|baz
22847 +bar
22848 -bar
22849 </p>
22850 </td></tr>
22851 <tr>
22852 <td>x
22853 <div>a|b</div>
22854 </td></tr></table>
22855
22856 !! end
22857
22858 !! test
22859 Tables: 4d. No escaping needed
22860 !! options
22861 parsoid=html2wt
22862 !! html/parsoid
22863 <table>
22864 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22865 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22866 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22867 </tbody></table>
22868 !! wikitext
22869 {|
22870 |[[Foo]]-bar
22871 ||+1
22872 ||-2
22873 |}
22874 !! html/php
22875 <table>
22876 <tr>
22877 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22878 </td>
22879 <td>+1
22880 </td>
22881 <td>-2
22882 </td></tr></table>
22883
22884 !! end
22885
22886 !! test
22887 T97430: Don't emit empty nowiki pairs around marker meta tags
22888 !! options
22889 parsoid=html2wt
22890 !! html/parsoid
22891 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22892 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22893 !! wikitext
22894 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22895 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22896 !! end
22897
22898 !! test
22899 Unclosed xmlish element in table line shouldn't eat end delimiters
22900 !! options
22901 parsoid=html2wt
22902 !! html/parsoid
22903 <table>
22904 <tbody><tr><td> &lt;foo</td>
22905 <td> bar></td></tr>
22906 </tbody></table>
22907 !! wikitext
22908 {|
22909 | <foo
22910 | bar>
22911 |}
22912 !! html/php
22913 <table>
22914 <tr>
22915 <td> &lt;foo
22916 </td>
22917 <td> bar&gt;
22918 </td></tr></table>
22919
22920 !! end
22921
22922 #### --------------- Links ----------------
22923 #### 1. Quote marks in link text
22924 #### 2. Wikilinks: Escapes needed
22925 #### 3. Wikilinks: No escapes needed
22926 #### 4. Extlinks: Escapes needed
22927 #### 5. Extlinks: No escapes needed
22928 #### --------------------------------------
22929 !! test
22930 Links 1. WikiLinks: No escapes needed
22931 !! options
22932 parsoid=html2wt
22933 !! html/parsoid
22934 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22935 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22936 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22937 !! wikitext
22938 [[Foo|Foo''boo'']]
22939 [[Foo|[Foobar]]]
22940 [[Foo|x [Foobar] x]]
22941 !! html/php
22942 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22943 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22944 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22945 </p>
22946 !! end
22947
22948 !! test
22949 Links 2. WikiLinks: Escapes needed
22950 !! options
22951 parsoid=html2wt
22952 !! html/parsoid
22953 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22954 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22955 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22956 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22957 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22958 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22959 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22960 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22961 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22962 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22963 !! wikitext
22964 [[Foo|<nowiki>Foobar]</nowiki>]]
22965 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22966 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22967 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22968 [[Foo|<nowiki>|Bar</nowiki>]]
22969 [[Foo|<nowiki>]]bar</nowiki>]]
22970 [[Foo|<nowiki>[[bar</nowiki>]]
22971 [[Foo|<nowiki>x [[ y</nowiki>]]
22972 [[Foo|<nowiki>x ]] y</nowiki>]]
22973 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22974 !! html/php
22975 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22976 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22977 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22978 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22979 <a href="/wiki/Foo" title="Foo">|Bar</a>
22980 <a href="/wiki/Foo" title="Foo">]]bar</a>
22981 <a href="/wiki/Foo" title="Foo">[[bar</a>
22982 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22983 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22984 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22985 </p>
22986 !! end
22987
22988 !! test
22989 Links 3. WikiLinks: No escapes needed
22990 !! options
22991 parsoid=html2wt
22992 !! html/parsoid
22993 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22994 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22995 !! wikitext
22996 [[Foo|[Foobar]]
22997 [[Foo|foo|bar]]
22998 !! html/php
22999 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23000 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23001 </p>
23002 !! end
23003
23004 !! test
23005 Links 4. ExtLinks: Escapes needed
23006 !! options
23007 parsoid=html2wt
23008 !! html/parsoid
23009 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23010 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23011 <p>[http://google.com]</p>
23012 <p>[http://google.com google]</p>
23013 !! wikitext
23014 [http://google.com <nowiki>[google]</nowiki>]
23015 [http://google.com <nowiki>google]</nowiki>]
23016
23017 <nowiki>[http://google.com]</nowiki>
23018
23019 <nowiki>[http://google.com google]</nowiki>
23020
23021 !! html/php
23022 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23023 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23024 </p><p>[http://google.com]
23025 </p><p>[http://google.com google]
23026 </p>
23027 !! end
23028
23029 !! test
23030 Links 5. ExtLinks: No escapes needed
23031 !! options
23032 parsoid=html2wt
23033 !! html/parsoid
23034 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23035 !! wikitext
23036 [http://google.com [google]
23037 !! html/php
23038 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23039 </p>
23040 !! end
23041
23042 !! test
23043 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23044 !! options
23045 parsoid=html2wt
23046 !! html/parsoid
23047 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23048 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23049 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23050 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23051 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23052 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23053 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23054 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23055 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23056 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23057 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23058 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23059 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23060 </p>
23061 !! wikitext
23062 x<nowiki/>http://example.com<nowiki/>y
23063 http://example.com<nowiki/>?x
23064 http://example.com<nowiki/>&x
23065 http://example.com<nowiki/>'x
23066 http://example.com<nowiki/>,x
23067 http://example.com<nowiki/>.x
23068 http://example.com<nowiki/>;x
23069 http://example.com<nowiki/>:x
23070 http://example.com<nowiki/>;x
23071 http://example.com<nowiki/>!x
23072 http://example.com<nowiki/>=x
23073 http://example.com<nowiki/>(x)
23074 http://example.com(x<nowiki/>)
23075 !! end
23076
23077 !! test
23078 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23079 !! options
23080 parsoid=html2wt
23081 !! html/parsoid
23082 <p>x
23083 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23084 y
23085 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23086 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23087 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23088 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23089 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23090 </p>
23091 !! wikitext
23092 x
23093 http://example.com
23094 y
23095 "http://example.com"
23096 (http://example.com)
23097 (http://example.com) foo
23098 http://example.com,
23099 http://example.com, foo
23100 !! html/php
23101 <p>x
23102 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23103 y
23104 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23105 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23106 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23107 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23108 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23109 </p>
23110 !! end
23111
23112 !! test
23113 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23114 !! options
23115 parsoid=html2wt
23116 !! html/parsoid
23117 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23118 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23119 !! wikitext
23120 http://example.com.,;:!?\
23121 -http://example.com:
23122 !! html/php
23123 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23124 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23125 </p>
23126 !! end
23127
23128 !! test
23129 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23130 !! options
23131 parsoid=html2wt
23132 !! html/parsoid
23133 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23134 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23135 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23136 !! wikitext
23137 RFC 123<nowiki/>4
23138 RFC 123<nowiki/>y
23139 X<nowiki/>RFC 123<nowiki/>y
23140 !! end
23141
23142 !! test
23143 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23144 !! options
23145 parsoid=html2wt
23146 !! html/parsoid
23147 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23148 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23149 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23150 </p>
23151 !! wikitext
23152 RFC 123?foo
23153 RFC 123&foo
23154 -RFC 123-
23155 !! html/php
23156 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23157 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23158 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23159 </p>
23160 !! end
23161
23162 !! test
23163 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23164 !! options
23165 parsoid=html2wt
23166 !! html/parsoid
23167 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23168 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23169 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23170 !! wikitext
23171 PMID 123<nowiki/>4
23172 PMID 123<nowiki/>y
23173 X<nowiki/>PMID 123<nowiki/>y
23174 !! end
23175
23176 !! test
23177 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23178 !! options
23179 parsoid=html2wt
23180 !! html/parsoid
23181 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23182 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23183 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23184 </p>
23185 !! wikitext
23186 PMID 123?foo
23187 PMID 123&foo
23188 -PMID 123-
23189 !! html/php
23190 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23191 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23192 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23193 </p>
23194 !! end
23195
23196 !! test
23197 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23198 !! options
23199 parsoid=html2wt
23200 !! html/parsoid
23201 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23202 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23203 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23204 </p>
23205 !! wikitext
23206 ISBN 1234567890<nowiki/>1
23207 ISBN 1234567890<nowiki/>x
23208 a<nowiki/>ISBN 1234567890<nowiki/>b
23209 !! end
23210
23211 !! test
23212 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23213 !! options
23214 parsoid=html2wt
23215 !! html/parsoid
23216 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23217 !! wikitext
23218 -ISBN 1234567890's
23219 !! html/php
23220 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23221 </p>
23222 !! end
23223
23224 !! test
23225 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23226 !! options
23227 parsoid=html2wt
23228 !! html/*
23229 <p>this is not a link: http://example.com
23230 </p>
23231 !! wikitext
23232 this is not a link: <nowiki>http://example.com</nowiki>
23233 !! end
23234
23235 !! test
23236 Links 15. Link trails can't become link prefixes.
23237 !! options
23238 language=is
23239 parsoid=html2wt
23240 !! html/parsoid
23241 <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>
23242 !! wikitext
23243 [[Söfnuður]]-[[00]]
23244 !! html/php
23245 <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>
23246 </p>
23247 !! end
23248
23249 #### --------------- Quotes ---------------
23250 #### 1. Quotes inside <b> and <i>
23251 #### 2. Link fragments separated by <i> and <b> tags
23252 #### 3. Link fragments inside <i> and <b>
23253 #### 4. No escaping needed
23254 #### --------------------------------------
23255 !! test
23256 1a. Quotes inside <b> and <i>
23257 !! options
23258 parsoid=html2wt
23259 !! html/*
23260 <p><i>'foo'</i>
23261 <i>''foo''</i>
23262 <i>'''foo'''</i>
23263 <i>foo</i>'s
23264 <b>'foo'</b>
23265 <b>''foo''</b>
23266 <b>'''foo'''</b>
23267 <b>foo'<i>bar'</i>baz</b>
23268 <b>foo</b>'s
23269 '<i>foo</i>
23270 <i>foo</i>'
23271 <i>foo'</i>'
23272 '<i>foo</i>'
23273 '<b>foo</b>
23274 <b>foo</b>'
23275 '<b>foo</b>'
23276 <i>fools'<span> errand</span></i>
23277 <i><span>fool</span>'s errand</i>
23278 '<i>foo</i> bar '<i>baz</i>
23279 a|!*#-:;+-~[]{}b'<i>x</i>
23280 </p>
23281 !! wikitext
23282 ''<nowiki/>'foo'''
23283 ''<nowiki>''foo''</nowiki>''
23284 ''<nowiki>'''foo'''</nowiki>''
23285 ''foo''<nowiki/>'s
23286 '''<nowiki/>'foo''''
23287 '''<nowiki>''foo''</nowiki>'''
23288 '''<nowiki>'''foo'''</nowiki>'''
23289 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23290 '''foo'''<nowiki/>'s
23291 '''foo''
23292 ''foo''<nowiki/>'
23293 ''foo'''<nowiki/>'
23294 '''foo''<nowiki/>'
23295 ''''foo'''
23296 '''foo'''<nowiki/>'
23297 ''''foo'''<nowiki/>'
23298 ''fools'<span> errand</span>''
23299 ''<span>fool</span>'s errand''
23300 '<nowiki/>''foo'' bar '''baz''
23301 a|!*#-:;+-~[]{}b'''x''
23302 !! end
23303
23304 !! test
23305 1b. Quotes inside <b> and <i> with other tags on same line
23306 !! options
23307 parsoid=html2wt
23308 !! html/parsoid
23309 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23310 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23311 <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>
23312 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23313 '<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>
23314 '<i>foo</i> <div title="name">test</div>
23315 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23316 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23317 <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>
23318 </ol>
23319 !! wikitext
23320 '''a'' foo ''[[bar]]''
23321 ''a''' foo ''[[bar]]''
23322 ''a''' foo '''{{echo|[[bar]]}}'''
23323 [[foo]] x'''[[bar]]''
23324 '''foo'' <ref>test</ref>
23325 '''foo'' <div title="name">test</div>
23326 '''foo'' and <br> bar
23327 <references />
23328 !! end
23329
23330 !! test
23331 2. Link fragments separated by <i> and <b> tags
23332 !! options
23333 parsoid=html2wt
23334 !! html/parsoid
23335 <p>[[<i>foo</i>hello]]</p>
23336 <p>[[<b>foo</b>hello]]</p>
23337 !! wikitext
23338 [[''foo''<nowiki>hello]]</nowiki>
23339
23340 [['''foo'''<nowiki>hello]]</nowiki>
23341 !! end
23342
23343 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23344 # this is one of the shortcomings of this format
23345 !! test
23346 3. Link fragments inside <i> and <b>
23347 !! options
23348 parsoid=html2wt
23349 !! html/parsoid
23350 <p><i>[[foo</i>]]</p>
23351 <p><b>[[foo</b>]]</p>
23352 !! wikitext
23353 ''[[foo''<nowiki>]]</nowiki>
23354
23355 '''[[foo'''<nowiki>]]</nowiki>
23356 !! end
23357
23358 !! test
23359 4. No escaping needed
23360 !! options
23361 options=html2wt
23362 !! html/parsoid
23363 <p>'<span><i>bar</i></span>'
23364 '<span><b>bar</b></span>'
23365 'a:b'foo
23366 </p>
23367 !! wikitext
23368 '<span>''bar''</span>'
23369 '<span>'''bar'''</span>'
23370 'a:b'foo
23371 !! end
23372
23373 #### ----------- Paragraphs ---------------
23374 #### 1. No unnecessary escapes
23375 #### --------------------------------------
23376
23377 !! test
23378 1. No unnecessary escapes
23379 !! options
23380 parsoid=html2wt
23381 !! html/parsoid
23382 <p>bar <span>[[foo]]</span>
23383 </p><p>=bar <span>[[foo]]</span>
23384 </p><p>[[bar <span>[[foo]]</span>
23385 </p><p>]]bar <span>[[foo]]</span>
23386 </p><p>=bar <span>foo]]</span>=
23387 </p>
23388 !! wikitext
23389 bar <span><nowiki>[[foo]]</nowiki></span>
23390
23391 =bar <span><nowiki>[[foo]]</nowiki></span>
23392
23393 [[bar <span><nowiki>[[foo]]</nowiki></span>
23394
23395 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23396
23397 =bar <span>foo]]</span><nowiki>=</nowiki>
23398 !!end
23399
23400 #### ----------------------- PRE --------------------------
23401 #### 1. Leading whitespace in SOL context should be escaped
23402 #### ------------------------------------------------------
23403 !! test
23404 1. Leading whitespace in SOL context should be escaped
23405 !! options
23406 parsoid=html2wt
23407 !! html/parsoid
23408 <p> a</p>
23409
23410 <p> a</p>
23411
23412 <p> a(tab)</p>
23413
23414 <p> a
23415 <!--cmt-->
23416 a</p>
23417
23418 <p>a
23419 b</p>
23420
23421 <p>a
23422 b</p>
23423
23424 <p>a
23425 b</p>
23426 !! wikitext
23427 <nowiki> </nowiki>a
23428
23429 <nowiki> </nowiki> a
23430
23431 a(tab)
23432
23433 <nowiki> </nowiki> a
23434 <!--cmt-->
23435 <nowiki> </nowiki>a
23436
23437 a
23438 <nowiki> </nowiki>b
23439
23440 a
23441 b
23442
23443 a
23444 b
23445 !! html/php
23446 <p> a
23447 </p><p> a
23448 </p><p> a(tab)
23449 </p><p> a
23450 a
23451 </p><p>a
23452 b
23453 </p><p>a
23454 b
23455 </p><p>a
23456 b
23457 </p>
23458 !! end
23459
23460 !! test
23461 2. Leading whitespace in non-indent-pre contexts should not be escaped
23462 !! options
23463 parsoid=htm2wt
23464 !! html/parsoid
23465 <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>
23466 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23467 <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>
23468 b</span></li>
23469 </ol>
23470 !! wikitext
23471 foo <ref>''a''
23472 b</ref>
23473 <references />
23474 !! end
23475
23476 !! test
23477 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23478 !! options
23479 parsoid=html2wt
23480 !! html/parsoid
23481 <blockquote>
23482 <p>
23483 a
23484 <span>b</span>
23485 c</p>
23486 </blockquote>
23487 !! wikitext
23488 <blockquote>
23489 a
23490 <span>b</span>
23491 c
23492 </blockquote>
23493 !! end
23494
23495 !! test
23496 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23497 !! options
23498 options=html2wt
23499 !! html/parsoid
23500 <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>
23501 !! wikitext
23502 [[File:Foobar.jpg|thumb|caption]]
23503 !! end
23504
23505 !! test
23506 5. Nowiki escaping should account for indent-pres
23507 !! options
23508 parsoid=html2wt
23509 !! html/parsoid
23510 <pre>==foo==</pre>
23511 !! wikitext
23512 ==foo==
23513 !! end
23514
23515 !!test
23516 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23517 !! options
23518 parsoid=html2wt
23519 !! html/parsoid
23520 <pre>
23521 * foo
23522 * bar
23523 </pre>
23524 !! wikitext
23525 * foo
23526 * bar
23527 !! end
23528
23529 #### --------------- Behavior Switches --------------------
23530
23531 !! test
23532 1. Valid behavior switches should be escaped
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 __TOC__
23537 <i>__TOC__</i>
23538 !! wikitext
23539 <nowiki>__TOC__</nowiki>
23540 ''<nowiki>__TOC__</nowiki>''
23541 !! end
23542
23543 !! test
23544 2. Invalid behavior switches should not be escaped
23545 !! options
23546 parsoid=html2wt
23547 !! html/parsoid
23548 __TOO__
23549 __|__
23550 !! wikitext
23551 __TOO__
23552 __|__
23553 !! end
23554
23555 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23556 !! test
23557 Behavior switches should be SOL-transparent
23558 !! options
23559 parsoid=html2wt
23560 !! html/parsoid
23561 <meta property="mw:PageProp/toc" />
23562
23563 <!-- this one's bogus -->
23564 <pre>__TOO__</pre>
23565
23566 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23567
23568 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23569 !! wikitext
23570 __TOC__
23571
23572 <!-- this one's bogus -->
23573 __TOO__
23574
23575 __TOC__ foo
23576
23577 __TOC__ bar
23578 !! end
23579
23580 #### --------------- HTML tags ---------------
23581 #### 1. a tags
23582 #### 2. other tags
23583 #### 3. multi-line html tag
23584 #### 4. extension tags
23585 #### -----------------------------------------
23586 !! test
23587 1. a tags
23588 !! options
23589 parsoid=html2wt
23590 !! html/parsoid
23591 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23592 !! wikitext
23593 <a href="http://google.com">google</a>
23594 !! end
23595
23596 !! test
23597 2. other tags
23598 !! options
23599 parsoid=html2wt
23600 !! html/parsoid
23601 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23602 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23603 <li> &lt;td&gt;</li></ul>
23604
23605 !! wikitext
23606 * <nowiki><div>foo</div></nowiki>
23607 * <nowiki><div style="color:red">foo</div></nowiki>
23608 * <nowiki><td></nowiki>
23609 !! end
23610
23611 !! test
23612 3. multi-line html tag
23613 !! options
23614 parsoid=html2wt
23615 !! html/parsoid
23616 <p>&lt;div
23617 &gt;foo&lt;/div
23618 &gt;
23619 </p>
23620 !! wikitext
23621 <nowiki><div
23622 >foo</div
23623 ></nowiki>
23624 !! end
23625
23626 !! test
23627 4. extension tags
23628 !! options
23629 parsoid=html2wt
23630 !! html/parsoid
23631 <p>&lt;ref&gt;foo&lt;/ref&gt;
23632 </p><p>&lt;ref&gt;bar
23633 </p><p>baz&lt;/ref&gt;
23634 </p>
23635 !! wikitext
23636 <nowiki><ref>foo</ref></nowiki>
23637
23638 <nowiki><ref>bar</nowiki>
23639
23640 baz<nowiki></ref></nowiki>
23641 !! end
23642
23643 #### --------------- Others ---------------
23644 !! test
23645 Escaping nowikis
23646 !! options
23647 parsoid=html2wt
23648 !! html/parsoid
23649 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23650 </p>
23651 !! wikitext
23652 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23653 !! end
23654
23655 ## The quote-char in the input is necessary for triggering the bug
23656 !! test
23657 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23658 !! options
23659 parsoid=html2wt
23660 !! html/parsoid
23661 <p>foo's bar :</p>
23662 !! wikitext
23663 foo's bar :
23664 !! end
23665
23666 #----------- End of wikitext escaping tests --------------
23667
23668 !! test
23669
23670 Tag-like HTML structures are passed through as text
23671 !! wikitext
23672 <x y>
23673
23674 <x.y>
23675
23676 <x-y>
23677
23678 1>2
23679
23680 x<y
23681
23682 a>b
23683
23684 1<d e>f
23685 !! html
23686 <p>&lt;x y&gt;
23687 </p><p>&lt;x.y&gt;
23688 </p><p>&lt;x-y&gt;
23689 </p><p>1&gt;2
23690 </p><p>x&lt;y
23691 </p><p>a&gt;b
23692 </p><p>1&lt;d e&gt;f
23693 </p>
23694 !! end
23695
23696 !! test
23697 HTML tag with necessary entities in attributes
23698 !! wikitext
23699 <span title="&amp;amp;">foo</span>
23700 !! html
23701 <p><span title="&amp;amp;">foo</span>
23702 </p>
23703 !! end
23704
23705 !! test
23706 HTML tag with 'unnecessary' entity encoding in attributes
23707 !! wikitext
23708 <span title="&amp;">foo</span>
23709 !! html
23710 <p><span title="&amp;">foo</span>
23711 </p>
23712 !! end
23713
23714 !! test
23715 HTML tag with broken attribute value quoting
23716 !! wikitext
23717 <span title="Hello world>Foo</span>
23718 !! html/php
23719 <p><span title="Hello world">Foo</span>
23720 </p>
23721 !! html/parsoid
23722 <p><span title="Hello world">Foo</span>
23723 </p>
23724 !! end
23725
23726 !! test
23727 Table with broken attribute value quoting
23728 !! wikitext
23729 {|
23730 | title="Hello world|Foo
23731 |}
23732 !! html/php
23733 <table>
23734 <tr>
23735 <td title="Hello world">Foo
23736 </td></tr></table>
23737
23738 !! html/parsoid
23739 <table>
23740 <tr>
23741 <td title="Hello world">Foo
23742 </td></tr></table>
23743
23744 !! end
23745
23746 !! test
23747 Table with broken attribute value quoting on consecutive lines
23748 !! wikitext
23749 {|
23750 | title="Hello world|Foo
23751 | style="color:red|Bar
23752 |}
23753 !! html/php
23754 <table>
23755 <tr>
23756 <td title="Hello world">Foo
23757 </td>
23758 <td style="color:red">Bar
23759 </td></tr></table>
23760
23761 !! html/parsoid
23762 <table><tbody>
23763 <tr>
23764 <td title="Hello world">Foo
23765 </td><td style="color: red">Bar
23766 </td></tr></tbody></table>
23767
23768 !! end
23769
23770 !! test
23771 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23772 !! options
23773 parsoid
23774 !! wikitext
23775 {{}}
23776 !! html
23777 {{}}
23778 !! end
23779
23780 !! test
23781 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23782 !! options
23783 parsoid
23784 !! wikitext
23785 }}{{
23786 !! html
23787 }}{{
23788 !! end
23789
23790 !!test
23791 Accept empty td cell attribute
23792 !! wikitext
23793 {|
23794 | align="center" | foo || |
23795 |}
23796 !! html
23797 <table>
23798 <tr>
23799 <td align="center"> foo </td>
23800 <td>
23801 </td></tr></table>
23802
23803 !!end
23804
23805 !!test
23806 Non-empty attributes in th-cells
23807 !! wikitext
23808 {|
23809 ! Foo !! style="color: red" | Bar
23810 |}
23811 !! html
23812 <table>
23813 <tr>
23814 <th> Foo </th>
23815 <th style="color: red"> Bar
23816 </th></tr></table>
23817
23818 !!end
23819
23820 !!test
23821 Accept empty attributes in th-cells
23822 !! wikitext
23823 {|
23824 !| foo !!| bar
23825 |}
23826 !! html
23827 <table>
23828 <tr>
23829 <th> foo </th>
23830 <th> bar
23831 </th></tr></table>
23832
23833 !!end
23834
23835 !!test
23836 Empty table rows go away
23837 !! wikitext
23838 {|
23839 | Hello
23840 | there
23841 |- class="foo"
23842 |-
23843 |}
23844 !! html
23845 <table>
23846 <tr>
23847 <td> Hello
23848 </td>
23849 <td> there
23850 </td></tr>
23851
23852 </table>
23853
23854 !! end
23855
23856 ###
23857 ### Parsoid-centric tests for testing RTing of inter-element separators
23858 ### Edge cases not tested by existing parser tests and specific to
23859 ### Parsoid-specific serialization strategies.
23860 ###
23861
23862 !!test
23863 RT-ed inter-element separators should be valid separators
23864 !! wikitext
23865 {|
23866 |- [[foo]]
23867 |}
23868 !! html/php
23869 <table>
23870
23871 </table>
23872
23873 !! html/parsoid
23874 <table>
23875 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
23876 </tbody></table>
23877 !!end
23878
23879 # Parsoid-only since PHP parser relies on Tidy for correct output
23880 !!test
23881 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23882 !!options
23883 parsoid
23884 !! wikitext
23885 {|
23886 |<small>foo
23887 bar
23888 |}
23889
23890 {|
23891 |<small>foo<small>
23892 |}
23893 !! html
23894 <table>
23895 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23896 <p>bar</p></small></td></tr>
23897 </tbody></table>
23898
23899 <table>
23900 <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>
23901 </tbody></table>
23902 !!end
23903
23904 # Note that the "style" attribute is really a template parameter here.
23905 # The = would have to be {{=}} if you wanted the literal.
23906 !!test
23907 Empty TD followed by TD with tpl-generated attribute
23908 !! wikitext
23909 {|
23910 |-
23911 |
23912 |{{echo|style='color:red'}}|foo
23913 |}
23914 !! html
23915 <table>
23916
23917 <tr>
23918 <td>
23919 </td>
23920 <td>foo
23921 </td></tr></table>
23922
23923 !!end
23924
23925 !!test
23926 Indented table with an empty td
23927 !! wikitext
23928 {|
23929 |-
23930 |
23931 |foo
23932 |}
23933 !! html
23934 <table>
23935
23936 <tr>
23937 <td>
23938 </td>
23939 <td>foo
23940 </td></tr></table>
23941
23942 !!end
23943
23944 ## We have some newline diffs RT-ing this edge case
23945 ## and it is not important enough -- we seem to be emitting
23946 ## at most 2 newlines after a </tr> and this is unrelated to
23947 ## the issue from T85627 that this is testing.
23948 !!test
23949 Indented table with blank lines in between (T85627)
23950 !! options
23951 parsoid=wt2html
23952 !! wikitext
23953 {|
23954 |foo
23955
23956
23957 |}
23958 !! html
23959 <table>
23960
23961 <tr>
23962 <td>foo
23963 </td></tr></table>
23964
23965 !!end
23966
23967 !!test
23968 Indented block & table
23969 !! wikitext
23970 <div>foo</div>
23971 {|
23972 |foo
23973 |}
23974 !! html/php
23975 <div>foo</div>
23976 <table>
23977 <tr>
23978 <td>foo
23979 </td></tr></table>
23980
23981 !! html/parsoid
23982 <div data-parsoid='{"stx":"html"}'>foo</div>
23983 <table><tbody>
23984 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23985 </tbody></table>
23986 !!end
23987
23988 !! test
23989 Indent and comment before table row
23990 !! wikitext
23991 {|
23992 <!--hi-->|-
23993 | there
23994 |}
23995 !! html/php
23996 <table>
23997
23998 <tr>
23999 <td> there
24000 </td></tr></table>
24001
24002 !! html/parsoid
24003 <table>
24004 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24005 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24006 </tbody></table>
24007 !! end
24008
24009 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24010 !!test
24011 Empty TR followed by a template-generated TR
24012 !!options
24013 parsoid
24014 !! wikitext
24015 {|
24016 |-
24017 {{echo|<tr><td>foo</td></tr>}}
24018 |}
24019 !! html
24020 <table>
24021 <tbody>
24022 <tr></tr>
24023 <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}}]}'>
24024 <td>foo</td></tr>
24025 </tbody></table>
24026 !!end
24027
24028 ## PHP and parsoid output differ for this, and since this is primarily
24029 ## for testing Parsoid's serializer, marking this Parsoid only
24030 !!test
24031 Empty TR followed by mixed-ws-comment line should RT correctly
24032 !!options
24033 parsoid
24034 !! wikitext
24035 {|
24036 |-
24037 <!--c-->
24038 |-
24039 <!--c--> <!--d-->
24040 |}
24041 !! html
24042 <table>
24043 <tbody>
24044 <tr></tr>
24045 <!--c-->
24046 <tr>
24047 <!--c--> </tr><!--d-->
24048 </tbody></table>
24049
24050 !!end
24051
24052 !!test
24053 Multi-line image caption generated by templates with/without trailing newlines
24054 !! wikitext
24055 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24056 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24057 !! html/parsoid
24058 <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>
24059 <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>
24060 !!end
24061
24062 !! test
24063 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24064 !! options
24065 parsoid=html2wt
24066 !! html/parsoid
24067 <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>
24068
24069 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24070 !! wikitext
24071 <includeonly>foo</includeonly>
24072 new para
24073
24074 [[Category:Foo]]
24075
24076 = new heading =
24077 !! end
24078
24079 ## PHP emits broken html for this, and since this is primarily
24080 ## a Parsoid serializer test, marking this Parsoid only
24081 !!test
24082 Improperly nested inline or quotes tags with whitespace in between
24083 !! wikitext
24084 <span> <s>x</span> </s>
24085 ''' ''x''' ''
24086 !! html/parsoid
24087 <p><span> <s>x</s></span><s> </s>
24088 <b> <i>x</i></b><i> </i>
24089 </p>
24090 !!end
24091
24092 !!test
24093 Encapsulate protected attributes from wt
24094 !! wikitext
24095 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24096 !! html/parsoid
24097 <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>
24098 </body>
24099 !!end
24100
24101 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24102 ## Having nested or stray pre tags results in the attempt to add duplicates,
24103 ## causing an assertion fail. This test tries to prevent that situation.
24104 !!test
24105 Ensure ParagraphWrapper can deal with stray closing pre tags
24106 !!options
24107 parsoid=wt2html
24108 !! wikitext
24109 plain text</pre>
24110 !! html/parsoid
24111 plain text
24112 !!end
24113
24114 !!test
24115 1. Ensure fostered text content is wrapped in element nodes
24116 !!options
24117 parsoid=wt2html
24118 !! wikitext
24119 <table>hi</table><table>ho</table>
24120 !! html/parsoid
24121 <p>hi</p>
24122 <table></table>
24123 <p>ho</p>
24124 <table></table>
24125 !!end
24126
24127 !!test
24128 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24129 !!options
24130 parsoid=wt2html,wt2wt
24131 !! wikitext
24132 <table>
24133 <tr> || ||
24134 <td> a
24135 </table>
24136 !! html/parsoid
24137 <p> || ||
24138 </p><table>
24139 <tbody><tr><td> a</td></tr>
24140 </tbody></table>
24141 !!end
24142
24143 !!test
24144 Encapsulation properly handles null DSR information from foster box
24145 !!options
24146 parsoid=wt2html,wt2wt
24147 !! wikitext
24148 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24149 !! html/parsoid
24150 <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>
24151 !!end
24152
24153 !!test
24154 1. Encapsulate foster-parented transclusion content
24155 !!options
24156 parsoid=wt2wt,wt2html
24157 !! wikitext
24158 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24159 !! html/parsoid
24160 <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>
24161 <tbody>
24162 <tr>
24163 <td>bar</td>
24164 </tr>
24165 </tbody>
24166 </table>
24167 !!end
24168
24169 !!test
24170 2. Encapsulate foster-parented transclusion content
24171 !!options
24172 parsoid=wt2wt,wt2html
24173 !! wikitext
24174 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24175 !! html/parsoid
24176 <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>
24177 <table>
24178 <tbody>
24179 <tr>
24180 <td>bar</td>
24181 </tr>
24182 </tbody>
24183 </table>
24184 !!end
24185
24186 !!test
24187 3. Encapsulate foster-parented transclusion content
24188 !!options
24189 parsoid=wt2wt,wt2html
24190 !! wikitext
24191 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24192 !! html/parsoid
24193 <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;]}">
24194 <p>foo</p>
24195 </div>
24196 <table>
24197 <tbody>
24198 <tr>
24199 <td>bar</td>
24200 </tr>
24201 </tbody>
24202 </table>
24203 !!end
24204
24205 !!test
24206 4. Encapsulate foster-parented transclusion content
24207 !!options
24208 parsoid=wt2wt,wt2html
24209 !! wikitext
24210 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24211 !! html/parsoid
24212 <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;]}">
24213 <p>foo</p>
24214 </div>
24215 <table>
24216 <tbody>
24217 <tr>
24218 <td>bar</td>
24219 </tr>
24220 </tbody>
24221 </table>
24222 !!end
24223
24224 !!test
24225 5. Encapsulate foster-parented transclusion content
24226 !!options
24227 parsoid=wt2wt,wt2html
24228 !! wikitext
24229 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24230 !! html/parsoid
24231 <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>
24232 <table>
24233 <tbody>
24234 <tr>
24235 <td>
24236 <div>
24237 <p>foo</p>
24238 </div>
24239 </td>
24240 </tr>
24241 </tbody>
24242 </table>
24243 !!end
24244
24245 !!test
24246 6. Encapsulate foster-parented transclusion content
24247 !!options
24248 parsoid=wt2wt,wt2html
24249 !! wikitext
24250 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24251 !! html/parsoid
24252 <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>
24253 <table>
24254 <tbody>
24255 <tr>
24256 <td>
24257 <div>
24258 <p>foo</p>
24259 </div>
24260 </td>
24261 </tr>
24262 </tbody>
24263 </table>
24264 <p>ok</p>
24265 !!end
24266
24267 !!test
24268 7. Encapsulate foster-parented transclusion content
24269 !!options
24270 parsoid=wt2wt,wt2html
24271 !! wikitext
24272 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24273 !! html/parsoid
24274 <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>
24275 <table>
24276 <tbody>
24277 <tr>
24278 <td>bar</td>
24279 </tr>
24280 </tbody>
24281 </table>
24282 !!end
24283
24284 # Note that the wt is broken on purpose: the = should be {{=}} if you
24285 # don't want it to be a template parameter key.
24286 !!test
24287 8. Encapsulate foster-parented transclusion content
24288 !!options
24289 parsoid=wt2wt,wt2html
24290 !! wikitext
24291 {{echo|a
24292 }}{|{{echo|style='color:red'}}
24293 |-
24294 |b
24295 |}
24296 !! html/parsoid
24297 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24298 <span> </span>
24299 <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>
24300 <table>
24301 <tbody>
24302 <tr>
24303 <td>b</td>
24304 </tr>
24305 </tbody>
24306 </table>
24307 !!end
24308
24309 !!test
24310 9. Encapsulate foster-parented transclusion content
24311 !!options
24312 parsoid=wt2wt,wt2html
24313 !! wikitext
24314 <table>{{echo|hi</table>hello}}
24315 !! html/parsoid
24316 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
24317 !!end
24318
24319 !!test
24320 Table in fosterable position
24321 !!options
24322 parsoid=wt2html,wt2wt
24323 !! wikitext
24324 {{OpenTable}}
24325 <div>
24326 {|
24327 |}
24328 </div>
24329 |}
24330 !! html/parsoid
24331 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
24332 </span>
24333 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24334
24335 <table>
24336 </table>
24337 !!end
24338
24339 # Parsoid only for bug 64747
24340 !! test
24341 Properly encapsulate empty-content transclusions in fosterable positions
24342 !! wikitext
24343 <table>
24344 {{#if:|
24345 <td>foo</td>
24346 }}
24347 </table>
24348 !! html/parsoid
24349 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}'>
24350
24351 </table>
24352 !! end
24353
24354 !!test
24355 Support <object> element with .data attribute
24356 !!options
24357 parsoid=html2wt
24358 !! html/parsoid
24359 <object data="test.swf"></object>
24360 !! wikitext
24361 <object data="test.swf"></object>
24362 !!end
24363
24364 !! test
24365 Don't block XML namespace declaration
24366 !! wikitext
24367 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24368 !! html/php
24369 <p><span>MediaWiki</span>
24370 </p>
24371 !! html/parsoid
24372 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24373 !! end
24374
24375 # -----------------------------------------------------------------
24376 # The following section of tests are primarily to spec requirements
24377 # around serialization of new/edited content.
24378 #
24379 # All these tests are marked Parsoid html2wt and html2html only
24380 # ----------------------------------------------------------------
24381
24382 # 'mi' is a localinterwiki prefix as well as a language
24383 !! test
24384 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24385 !! options
24386 parsoid=html2wt
24387 !! html/parsoid
24388 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24389 !! wikitext
24390 [[Foo]]
24391 !! end
24392
24393 # See T93839
24394 !! test
24395 New wikilinks should be serialized properly
24396 !! options
24397 parsoid=html2wt
24398 !! html/parsoid
24399 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24400 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24401 !! wikitext
24402 [[Foo]]
24403 [[Foo]]
24404 !! end
24405
24406 !! test
24407 New wiki links (href variations)
24408 !! options
24409 parsoid=html2wt
24410 !! html/parsoid
24411 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24412 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24413 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24414 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24415 !! wikitext
24416 [[Foo_bar]]
24417 [[Foo_bar]]
24418 [[Foo_bar]]
24419 [[Toxine bactérienne]]
24420 !! end
24421
24422 !! test
24423 New wiki links (content string variations)
24424 !! options
24425 parsoid=html2wt
24426 !! html/parsoid
24427 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24428 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24429 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24430 !! wikitext
24431 [[Foo_bar]]
24432 [[Foo bar]]
24433 [[Foo_bar|./Foo_bar]]
24434 !! end
24435
24436 !! test
24437 New category links (href variations)
24438 !! options
24439 parsoid=html2wt
24440 !! html/parsoid
24441 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24442 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24443 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24444 !! wikitext
24445 [[Category:Toxine bactérienne]]
24446 [[Category:Toxine bactérienne]]
24447 [[Category:Toxine bactérienne]]
24448 !! end
24449
24450 !! test
24451 New sol transparent links don't need indent-pre nowiki protection
24452 !! options
24453 parsoid=html2wt
24454 language=de
24455 !! html/parsoid
24456 <link rel="mw:PageProp/redirect" href="./Main_Page">
24457 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24458 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24459 !! wikitext
24460 #WEITERLEITUNG [[Main Page]]
24461 <!-- this is good --> [[Category:Good]]
24462 <!-- this is great --> [[Kategorie:Great]]
24463 !! end
24464
24465 !! test
24466 New interlanguage links (href variations)
24467 !! options
24468 parsoid=html2wt
24469 !! html/parsoid
24470 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24471 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24472 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24473 !! wikitext
24474 [[es:Toxine bactérienne]]
24475 [[es:Toxine_bactérienne]]
24476 [[es:Toxine_bactérienne]]
24477 !! end
24478
24479 !! test
24480 Image: Modifying size of an image (1)
24481 !! options
24482 parsoid={
24483 "modes": ["wt2wt"],
24484 "changes": [
24485 ["img[height]", "attr", "height", "22"],
24486 ["img[width]", "attr", "width", "200"]
24487 ]
24488 }
24489 !! wikitext
24490 [[Image:Foobar.jpg|230x230px]]
24491 !! wikitext/edited
24492 [[Image:Foobar.jpg|200x200px]]
24493 !!end
24494
24495 !! test
24496 Image: Modifying size of an image (2)
24497 !! options
24498 parsoid={
24499 "modes": ["wt2wt"],
24500 "changes": [
24501 ["img[height]", "attr", "height", "100"],
24502 ["img[width]", "attr", "width", "500"]
24503 ]
24504 }
24505 !! wikitext
24506 [[Image:Foobar.jpg|230x230px]]
24507 !! wikitext/edited
24508 [[Image:Foobar.jpg|500x500px]]
24509 !!end
24510
24511 # Change in size is ignored so long as class='mw-default-size'
24512 !! test
24513 Image: Modifying size of an image (3)
24514 !! options
24515 parsoid={
24516 "modes": ["wt2wt"],
24517 "changes": [
24518 ["figure[class]", "removeClass", "mw-default-size"],
24519 ["figure img", "attr", "height", "19"],
24520 ["figure img", "attr", "width", "170"]
24521 ]
24522 }
24523 !! wikitext
24524 [[Image:Foobar.jpg|thumb]]
24525 !! wikitext/edited
24526 [[Image:Foobar.jpg|thumb|170x170px]]
24527 !!end
24528
24529 !! test
24530 Image: Modifying alignment of an image (bug 48665)
24531 !! options
24532 parsoid={
24533 "modes": ["wt2wt"],
24534 "changes": [
24535 ["figure[class]", "removeClass", "mw-halign-right"],
24536 ["figure[class]", "addClass", "mw-halign-left"]
24537 ]
24538 }
24539 !! wikitext
24540 [[Image:Foobar.jpg|thumb|caption|right]]
24541 !! wikitext/edited
24542 [[Image:Foobar.jpg|thumb|caption|left]]
24543 !! end
24544
24545 !! test
24546 Image: Modifying mw-default-size of an frameless image (bug 62805)
24547 !! options
24548 parsoid={
24549 "modes": ["wt2wt"],
24550 "changes": [
24551 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24552 ]
24553 }
24554 !! wikitext
24555 [[Image:Foobar.jpg|frameless|right]]
24556 !! wikitext/edited
24557 [[Image:Foobar.jpg|frameless|right|220x220px]]
24558 !! end
24559
24560 !! test
24561 Image: Modifying valign of an image (bug 49221)
24562 !! options
24563 parsoid={
24564 "modes": ["wt2wt"],
24565 "changes": [
24566 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24567 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24568 ]
24569 }
24570 !! wikitext
24571 [[File:Foobar.jpg|20px|middle]]
24572 !! wikitext/edited
24573 [[File:Foobar.jpg|20px|text-top]]
24574 !! end
24575
24576 !! test
24577 Image: Modifying alt attribute of an image (bug 56400)
24578 !! options
24579 parsoid={
24580 "modes": ["wt2wt"],
24581 "changes": [
24582 ["img[alt]", "attr", "alt", "some alternate edited text"]
24583 ]
24584 }
24585 !! wikitext
24586 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24587 !! wikitext/edited
24588 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24589 !!end
24590
24591 !! test
24592 Image: Modifying caption of an image
24593 !! options
24594 parsoid={
24595 "modes": ["wt2wt"],
24596 "changes": [
24597 ["figcaption", "text", "new caption"]
24598 ]
24599 }
24600 !! wikitext
24601 [[Image:Foobar.jpg|thumb|original caption]]
24602 !! wikitext/edited
24603 [[Image:Foobar.jpg|thumb|new caption]]
24604 !!end
24605
24606 !! test
24607 Image: empty alt attribute (bug 48924)
24608 !! options
24609 parsoid
24610 !! wikitext
24611 [[File:Foobar.jpg|thumb|alt=|bar]]
24612 !! html
24613 <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>
24614 !! end
24615
24616 !! test
24617 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24618 !! options
24619 parsoid=html2wt
24620 language=ar
24621 disabled
24622 !! html/parsoid
24623 <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>
24624 !! wikitext
24625 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24626 !! end
24627
24628 !! test
24629 Image: Block level image should have \n before and after
24630 !! wikitext
24631 123
24632 [[File:Foobar.jpg|right|thumb|150x150px]]
24633 456
24634 !! html/parsoid
24635 <p>123</p>
24636 <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>
24637 <p>456</p>
24638 !!end
24639
24640 !! test
24641 Image: New block level image should have \n before and after (existing content)
24642 !! wikitext
24643 123
24644 [[File:Foobar.jpg|right|thumb|150x150px]]
24645 456
24646 !! html/parsoid
24647 <p>123</p>
24648 <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>
24649 <p>456</p>
24650 !!end
24651
24652 !! test
24653 Image: upright option (parsoid)
24654 !! wikitext
24655 [[File:Foobar.jpg|thumb|upright|caption]]
24656 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24657 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24658 !! html/parsoid
24659 <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>
24660 <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>
24661 <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>
24662 !!end
24663
24664 !! test
24665 Image: upright option is ignored on inline and frame images (parsoid)
24666 !! wikitext
24667 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24668 !! html/parsoid
24669 <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>
24670 !!end
24671
24672 !! test
24673 Image: from basic HTML (1)
24674 !! options
24675 parsoid=html2wt
24676 !! html/parsoid
24677 <span typeof="mw:Image">
24678 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24679 </span>
24680 !! wikitext
24681 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24682 !! end
24683
24684 !! test
24685 Image: from basic HTML (2)
24686 !! options
24687 parsoid=html2wt
24688 !! html/parsoid
24689 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24690 !! wikitext
24691 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24692 !! end
24693
24694 !! test
24695 Image: from basic HTML (3)
24696 !! options
24697 parsoid=html2wt
24698 !! html/parsoid
24699 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24700 !! wikitext
24701 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24702 !! end
24703
24704 !! test
24705 Image: from basic HTML (4)
24706 !! options
24707 parsoid=html2wt
24708 !! html/parsoid
24709 <img src="./File:Foobar.jpg">
24710 !! wikitext
24711 [[File:Foobar.jpg|link=]]
24712 !! end
24713
24714 !! test
24715 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24716 !! options
24717 parsoid=html2wt
24718 !! html/parsoid
24719 <ul>
24720 <li><p>foo</p></li>
24721 </ul>
24722 !! wikitext
24723 * foo
24724 !! end
24725
24726 !! test
24727 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24728 !! options
24729 parsoid=html2wt
24730 !! html/parsoid
24731 <ul> <li>foo</li></ul>
24732 !! wikitext
24733 * foo
24734 !! end
24735
24736 !! test
24737 Don't strip leading whitespace when handling indent-pre suppressing tags
24738 !! options
24739 parsoid=html2wt
24740 !! html/parsoid
24741 <table>
24742 <tr><td> indented row</td></tr>
24743 </table>
24744 <blockquote><p>
24745 <b>This is very bold of you!</b>
24746 </p>
24747 <table><tr><td>
24748 indented cell (no pre-wrapping!)
24749 </td></tr></table>
24750 </blockquote>
24751 <p>foo</p>
24752 <div>bar</div>
24753 !! wikitext
24754 {|
24755 | indented row
24756 |}
24757 <blockquote>
24758 '''This is very bold of you!'''
24759
24760 {|
24761 |
24762 indented cell (no pre-wrapping!)
24763 |}
24764 </blockquote>
24765 foo
24766 <div>bar</div>
24767 !! end
24768
24769 !! test
24770 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24771 !! options
24772 parsoid=html2wt
24773 !! html/parsoid
24774 <p>foo</p>
24775 <span>bar</span>
24776
24777 <span>foo2
24778 </span>bar2
24779
24780 <div>foo</div>
24781 <span>bar</span>
24782
24783 <div>
24784 <span>foo</span>
24785 </div>
24786 !! wikitext
24787 foo
24788 <nowiki> </nowiki><span>bar</span>
24789
24790 <span>foo2
24791 <nowiki> </nowiki></span>bar2
24792
24793 <div>foo</div>
24794 <nowiki> </nowiki><span>bar</span>
24795
24796 <div>
24797 <nowiki> </nowiki><span>foo</span>
24798 </div>
24799 !! end
24800
24801 !! test
24802 Lists: Dont insert newlines in a serialized list item.
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 <ul><li>a<br>b</li><li>c</li></ul>
24807 !! wikitext
24808 * a<br>b
24809 * c
24810 !! end
24811
24812 !! test
24813 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24814 !! options
24815 parsoid={
24816 "modes": ["html2wt"],
24817 "scrubWikitext": false
24818 }
24819 !! html/parsoid
24820 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24821 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24822
24823 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24824 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24825
24826 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24827
24828 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24829 !! wikitext
24830 == hello there [[Category:A1]] ==
24831
24832 == [[Category:A2]] hi pal ==
24833
24834 == <!--foo--> [[Category:A3]] how goes it ==
24835
24836 == it goes well [[Category:A4]] <!--bar--> ==
24837
24838 ==howdy [[Category:A5]] ==
24839
24840 == __TOC__ ok ==
24841 !! end
24842
24843 !! test
24844 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24845 !! options
24846 parsoid={
24847 "modes": ["html2wt"],
24848 "scrubWikitext": true
24849 }
24850 !! html/parsoid
24851 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24852 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24853
24854 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24855 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24856
24857 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24858 !! wikitext
24859 == hello there ==
24860 [[Category:A1]]
24861 [[Category:A2]]
24862
24863 == hi pal ==
24864
24865 <!--foo--> [[Category:A3]]
24866
24867 == how goes it ==
24868
24869 == it goes well ==
24870 [[Category:A4]] <!--bar-->
24871
24872 __TOC__
24873
24874 == ok ==
24875 !! end
24876
24877 !! test
24878 Headings: Don't hoist metas that come from templates
24879 !! options
24880 parsoid={
24881 "modes": ["html2wt"],
24882 "scrubWikitext": true
24883 }
24884 !! html/parsoid
24885 <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>
24886 !! wikitext
24887 == {{echo|foo [[Category:Foo]]}} ==
24888 !! end
24889
24890 !! test
24891 Headings: Category in ref isn't hoisted
24892 !! options
24893 parsoid={
24894 "modes": ["html2wt"],
24895 "scrubWikitext": true
24896 }
24897 !! html/parsoid
24898 <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>
24899
24900 <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>
24901 !! wikitext
24902 == foo <ref>bar
24903 [[Category:Baz]] </ref> ==
24904
24905 <references />
24906 !! end
24907
24908 !! test
24909 Parsoid: Serialize positional parameters with = in them as named parameter
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <p about="#mwt1" typeof="mw:Transclusion"
24914 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24915
24916 <p about="#mwt1" typeof="mw:Transclusion"
24917 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24918
24919 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24920 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24921 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24922 !! wikitext
24923 {{echo|1 = f=oo}}
24924
24925 {{echo|1 = f=oo|2 = bar}}
24926
24927 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24928 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24929 {{echo|<nowiki>f=oo</nowiki>|bar}}
24930 !! end
24931
24932 !! test
24933 Parsoid: Serialize positional parameters with = in extlink as named parameter
24934 !! options
24935 parsoid=html2wt
24936 !! html/parsoid
24937 <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>
24938 !! wikitext
24939 {{echo|1 = http://stuff?is=ok}}
24940 !! end
24941
24942 !! test
24943 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24944 !! options
24945 parsoid=html2wt
24946 !! html/parsoid
24947 <div>a<p>b</p></div>
24948 <div>a
24949 <p>b</p></div>
24950 <div>
24951 a
24952 <p>b</p></div>
24953 !! wikitext
24954 <div>a
24955 b
24956 </div>
24957 <div>a
24958 b
24959 </div>
24960 <div>
24961 a
24962
24963 b
24964 </div>
24965 !! end
24966
24967 !! test
24968 Substrings resembling wikitext in hrefs should not get nowiki escapes
24969 !! options
24970 parsoid=html2wt
24971 !! html/parsoid
24972 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24973 !! wikitext
24974 [[Foo''bar''baz]]
24975 !! end
24976
24977 !! test
24978 Enforce single-line context in the serializer
24979 !! options
24980 parsoid=html2wt
24981 !! html/parsoid
24982 <h2>testing
24983 123</h2>
24984
24985 <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">
24986 </span><span about="#mwt1">you</span> </h2>
24987
24988 <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>
24989
24990 <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
24991 there</span></li></ol>
24992
24993 <ul><li>asd
24994 sdf</li></ul>
24995
24996 <ul><li>foo
24997 bar
24998 baz</li>
24999 <li>foo <b>bar</b>
25000 baz</li></ul>
25001
25002 <dl><dt>hi
25003 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25004 ho</dd></dl>
25005
25006 <dl><dd> <table>
25007 <tbody><tr><td> ha
25008 ha
25009 ha</td></tr>
25010 </tbody></table></dd></dl>
25011 !! wikitext
25012 == testing 123 ==
25013
25014 == hi {{bogus|there
25015 you}} ==
25016
25017 == foo <ref>hello
25018 there</ref> ==
25019
25020 <references />
25021
25022 * asd sdf
25023
25024 * foo bar baz
25025 * foo '''bar''' baz
25026
25027 ; hi ho : hi ho
25028
25029 : {|
25030 | ha
25031 ha
25032 ha
25033 |}
25034 !! end
25035
25036 !! test
25037 Serialize new placeholder space without spans
25038 !! options
25039 parsoid=html2wt
25040 !! html/parsoid
25041 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25042
25043 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25044
25045 <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>
25046 !! wikitext
25047 foo : bar
25048
25049 foo : bar
25050
25051 <ref>foo : bar</ref>ok
25052 !! end
25053
25054
25055 #-----------------------
25056 # Tag minimization tests
25057 #-----------------------
25058
25059 !! test
25060 1. I/B quote minimization: wikitext-only tags should be combined
25061 !! options
25062 parsoid=html2wt
25063 !! html/parsoid
25064 <p><i>A</i><i>B</i></p>
25065 <p><b>A</b><b>B</b></p>
25066 <p><i>A</i><b><i>B</i></b></p>
25067 <p><b>A</b><i><b>B</b></i></p>
25068 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25069 <p><i><b>A</b></i><i><b>B</b></i></p>
25070 <p><i><b>A</b></i><b><i>B</i></b></p>
25071 <p><b><i>A</i></b><i><b>B</b></i></p>
25072 !! wikitext
25073 ''AB''
25074
25075 '''AB'''
25076
25077 ''A'''B'''''
25078
25079 '''A''B'''''
25080
25081 '''A''BC''D'''
25082
25083 '''''AB'''''
25084
25085 '''''AB'''''
25086
25087 '''''AB'''''
25088 !! end
25089
25090 !! test
25091 2. I/B quote minimization: wikitext and html tags should not be combined
25092 !! options
25093 parsoid=html2wt
25094 !! html/parsoid
25095 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25096 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25097 !! wikitext
25098 ''A''<i>B</i>
25099
25100 ''A''<nowiki/>'''<i>B</i>'''
25101 !! end
25102
25103 !! test
25104 3. I/B quote minimization: templated content stops minimization
25105 !! options
25106 parsoid=html2wt
25107 !! html/parsoid
25108 <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>
25109 <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>
25110 !! wikitext
25111 ''A''{{echo|''B''}}
25112
25113 ''A''{{echo|'''''B'''''}}
25114 !! end
25115
25116 !! test
25117 4. I/B quote minimization: new content should be mimimized with adjacent old content
25118 !! options
25119 parsoid=html2wt
25120 !! html/parsoid
25121 <p><i>A</i><i>B</i></p>
25122 <p><b>A</b><b>B</b></p>
25123 <p><i>A</i><b><i>B</i></b></p>
25124 !! wikitext
25125 ''AB''
25126
25127 '''AB'''
25128
25129 ''A'''B'''''
25130 !! end
25131
25132 !! test
25133 5a. Merge adjacent quote nodes if they've been edited
25134 !! options
25135 parsoid={
25136 "modes": ["wt2wt", "selser"],
25137 "changes": [
25138 ["p", "contents", "remove", ":contains('b')"]
25139 ]
25140 }
25141 !! wikitext
25142 ''a''b''c''
25143 !! wikitext/edited
25144 ''ac''
25145 !! end
25146
25147 !! test
25148 5b. Merge adjacent quote nodes if they've been edited
25149 !! options
25150 parsoid={
25151 "modes": ["wt2wt", "selser"],
25152 "changes": [
25153 ["#x", "remove"]
25154 ]
25155 }
25156 !! wikitext
25157 ''a''<span id="x">b</span>''c''
25158 !! wikitext/edited
25159 ''ac''
25160 !! end
25161
25162 !! test
25163 1. Merge adjacent link nodes as long as at least one element is new
25164 !! options
25165 parsoid={
25166 "modes": ["html2wt"],
25167 "scrubWikitext": true
25168 }
25169 !! html/parsoid
25170 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25171 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25172 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25173 !! wikitext
25174 [[Football]]
25175 [[Football]]
25176 [[Football|Foot]][[Football|ball]]
25177 !! end
25178
25179 !! test
25180 2. Merge adjacent link nodes and enable additional normalizations
25181 !! options
25182 parsoid={
25183 "modes": ["html2wt"],
25184 "scrubWikitext": true
25185 }
25186 !! html/parsoid
25187 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25188 !! wikitext
25189 [[Football|''Football'']]
25190 !! end
25191
25192 !! test
25193 3. Don't merge adjacent link nodes if scrubWikitext is false
25194 !! options
25195 parsoid={
25196 "modes": ["html2wt"],
25197 "scrubWikitext": false
25198 }
25199 !! html/parsoid
25200 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25201 !! wikitext
25202 [[Football|Foot]][[Football|ball]]
25203 !! end
25204
25205 #------------------------------
25206 # End of tag minimization tests
25207 #------------------------------
25208
25209 !!test
25210 Bug 54262: New entities
25211 !! options
25212 parsoid=html2wt
25213 !! html/parsoid
25214 <span typeof="mw:Entity">&nbsp;</span>
25215 !! wikitext
25216 &nbsp;
25217 !! end
25218
25219 ## Note that there is no wikitext output for 'unknownproperty' ##
25220 ## Unknown magic words are silently dropped ##
25221
25222 !! test
25223 Magic words
25224 !! options
25225 parsoid=html2wt
25226 !! html/parsoid
25227 <meta property='mw:PageProp/toc' />
25228 <meta property='mw:PageProp/notoc' />
25229 <meta property='mw:PageProp/forcetoc' />
25230 <meta property='mw:PageProp/index' />
25231 <meta property='mw:PageProp/noindex' />
25232 <meta property='mw:PageProp/nogallery' />
25233 <meta property='mw:PageProp/noeditsection' />
25234 <meta property='mw:PageProp/notitleconvert' />
25235 <meta property='mw:PageProp/nocontentconvert' />
25236 <meta property='mw:PageProp/unknownproperty' />
25237 !! wikitext
25238 __TOC__
25239 __NOTOC__
25240 __FORCETOC__
25241 __INDEX__
25242 __NOINDEX__
25243 __NOGALLERY__
25244 __NOEDITSECTION__
25245 __NOTITLECONVERT__
25246 __NOCONTENTCONVERT__
25247 !! end
25248
25249 !! test
25250 Consecutive <pre>s should not get merged
25251 !! options
25252 parsoid=html2wt,html2html
25253 !! html/parsoid
25254 <pre>a</pre><pre>b</pre>
25255
25256 <pre>c
25257 </pre><pre>
25258 d</pre>
25259
25260 <pre>e
25261
25262 </pre><pre>
25263
25264 f</pre>
25265 !! wikitext
25266 a
25267
25268 b
25269
25270 c
25271
25272 d
25273
25274 e
25275
25276
25277
25278 f
25279 !! end
25280
25281 !! test
25282 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25283 !! options
25284 parsoid=html2wt
25285 !! html/parsoid
25286 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25287 !! wikitext
25288 [[Special:BookSources/1234567890|ISBN 1234567895]]
25289 !! end
25290
25291 !! test
25292 Edited RFC links not serializable as RFC links should serialize as extlinks
25293 !! options
25294 parsoid=html2wt
25295 !! html/parsoid
25296 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25297 !! wikitext
25298 [//tools.ietf.org/html/rfc123 New RFC]
25299 !! end
25300
25301 !! test
25302 Edited PMID links not serializable as PMID links should serialize as extlinks
25303 !! options
25304 parsoid=html2wt
25305 !! html/parsoid
25306 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25307 !! wikitext
25308 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25309 !! end
25310
25311 !! test
25312 WTS of autolinks with trailing/surrounding context
25313 !! options
25314 parsoid=html2wt
25315 !! html/parsoid
25316 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25317 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25318 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25319 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25320 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25321 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25322 !! wikitext
25323 http://cscott.net'''foo'''
25324
25325 http://cscott.net<b>foo</b>
25326
25327 '''http://cscott.net'''
25328
25329 '''http://cscott.net '''
25330
25331 '''http://cscott.net<nowiki/>x'''
25332
25333 http://cscott.net<nowiki/>x
25334 !! end
25335
25336 !! test
25337 WTS of autolinks with nowikis (round-trip)
25338 !! wikitext
25339 x<nowiki/>http://cscott.net<nowiki/>x
25340 !! html/parsoid
25341 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25342 !! end
25343
25344 # this is the "easy" test because it leaves in place all the
25345 # data-parsoid information indicating this is an autolink
25346 !! test
25347 WTS of autolinks with escapes (editing)
25348 !! options
25349 parsoid={
25350 "modes": ["wt2wt"],
25351 "changes": [
25352 [ "meta", "remove" ]
25353 ]
25354 }
25355 !! wikitext
25356 x<nowiki/>http://cscott.net<nowiki/>x
25357 !! wikitext/edited
25358 x<nowiki/>http://cscott.net<nowiki/>x
25359 !! end
25360
25361 !! test
25362 WTS of edited autolink-like text (T103364)
25363 !! options
25364 parsoid={
25365 "modes": ["wt2wt"],
25366 "changes": [
25367 [ "span[typeof]", "removeAttr", "typeof" ]
25368 ]
25369 }
25370 !! wikitext
25371 Not a link: <nowiki>http://example.com</nowiki>.
25372 !! wikitext/edited
25373 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25374 !! end
25375
25376 !! test
25377 WTS of newly-authored autolink-like text (T103364)
25378 !! options
25379 parsoid=html2wt
25380 !! html/parsoid
25381 <p>http://example.com is not a link.</p>
25382 !! wikitext
25383 <nowiki>http://example.com</nowiki> is not a link.
25384 !! end
25385
25386 !! test
25387 WTS of autolink-like text after an autolink (T108563)
25388 !! options
25389 parsoid=html2wt
25390 !! html/parsoid
25391 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25392 !! wikitext
25393 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25394 !! end
25395
25396 !! test
25397 Magic links inside links (not autolinked)
25398 !! wikitext
25399 [[Foo|http://example.com]]
25400 [[Foo|RFC 1234]]
25401 [[Foo|PMID 1234]]
25402 [[Foo|ISBN 123456789x]]
25403
25404 [http://foo.com http://example.com]
25405 [http://foo.com RFC 1234]
25406 [http://foo.com PMID 1234]
25407 [http://foo.com ISBN 123456789x]
25408 !! html+tidy
25409 <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>
25410 <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>
25411 !! html/parsoid
25412 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25413 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25414 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25415 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25416
25417 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25418 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25419 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25420 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25421 !! end
25422
25423 !! test
25424 Magic links inside image captions (autolinked)
25425 !! wikitext
25426 [[File:Foobar.jpg|thumb|http://example.com]]
25427 [[File:Foobar.jpg|thumb|RFC 1234]]
25428 [[File:Foobar.jpg|thumb|PMID 1234]]
25429 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25430 !! html+tidy
25431 <div class="thumb tright">
25432 <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>
25433 <div class="thumbcaption">
25434 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25435 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25436 </div>
25437 </div>
25438 <div class="thumb tright">
25439 <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>
25440 <div class="thumbcaption">
25441 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25442 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25443 </div>
25444 </div>
25445 <div class="thumb tright">
25446 <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>
25447 <div class="thumbcaption">
25448 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25449 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25450 </div>
25451 </div>
25452 <div class="thumb tright">
25453 <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>
25454 <div class="thumbcaption">
25455 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25456 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25457 </div>
25458 </div>
25459 !! html/parsoid
25460 <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>
25461 <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>
25462 <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>
25463 <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>
25464 !! end
25465
25466 !! test
25467 WTS of magic word text (T109371)
25468 !! options
25469 parsoid=html2wt
25470 !! html/parsoid
25471 <p>RFC 1234</p>
25472 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25473 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25474 !! wikitext
25475 <nowiki>RFC 1234</nowiki>
25476
25477 [http://foo.com RFC 1234]
25478
25479 [[Foo|RFC 1234]]
25480 !! end
25481
25482 !! test
25483 Edited Redirect link should emit a non-piped wikitext link
25484 !! options
25485 parsoid=html2wt
25486 !! html/parsoid
25487 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25488 !! wikitext
25489 #REDIRECT [[Bar]]
25490 !! end
25491
25492 !! test
25493 T75121: Infer extension name from typeOf if data-mw is not present
25494 !! options
25495 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25496 !! html/parsoid
25497 <div typeOf="mw:Extension/foo"></div>
25498 !! wikitext
25499 <foo />
25500 !! end
25501
25502 # Note that the <p> wrapping isn't present in PHP parser output
25503 # The important thing for this test is that P-wrapping doesn't
25504 # interfere with the <nowiki> protection for leading - in <td>
25505 # (which isn't necessary for <th>).
25506 !! test
25507 T88318: p-wrapped dash in table.
25508 !! options
25509 parsoid=html2wt,wt2wt
25510 !! html/parsoid
25511 <table><tbody>
25512 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25513 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25514 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25515 </tbody></table>
25516 !! wikitext
25517 {|
25518 !-
25519 !-
25520 |-
25521 |<nowiki>-</nowiki>
25522 |<nowiki>- </nowiki>
25523 |-
25524 |<small>-</small>
25525 |<br>
25526 -
25527 |<br>
25528 -
25529 |}
25530 !! html/php+tidy
25531 <table>
25532 <tr>
25533 <th>-</th>
25534 <th>-</th>
25535 </tr>
25536 <tr>
25537 <td>-</td>
25538 <td>-</td>
25539 </tr>
25540 <tr>
25541 <td><small>-</small></td>
25542 <td><br />
25543 <p>-</p>
25544 </td>
25545 <td><br />
25546 <p>-</p>
25547 </td>
25548 </tr>
25549 </table>
25550 !! end
25551
25552 !! test
25553 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25554 !! options
25555 parsoid=html2wt
25556 !! html/parsoid
25557 <table id='mwAb'>
25558 <td id='mwAc'>foo</td>
25559 <td id='serialize-this'>bar</td>
25560 </table>
25561 !! wikitext
25562 {|
25563 |foo
25564 | id="serialize-this" |bar
25565 |}
25566 !! end
25567
25568 !! test
25569 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25570 !! options
25571 parsoid=html2wt
25572 !! html/parsoid
25573 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25574 !! wikitext
25575 <div id="hello">ok</div>
25576 !! end
25577
25578 !! test
25579 WTS change modes
25580 !! options
25581 parsoid={
25582 "modes": ["wt2wt"],
25583 "changes": [
25584 [ "#xyz", "before", "<b>before</b> stuff " ],
25585 [ "#xyz", "after", " stuff <i>after</i>" ],
25586 [ "#xyz", "html", "x <b>y</b> z" ]
25587 ]
25588 }
25589 !! wikitext
25590 <span id="xyz">hello</span>
25591 !! wikitext/edited
25592 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25593 !! end
25594
25595 !! test
25596 Never serialize a-tag as html, regardless of what data-parsoid has to say
25597 !! options
25598 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25599 !! html/parsoid
25600 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25601 !! wikitext
25602 [[Foo]]
25603 !! end
25604
25605 ## SSS FIXME: This is broken output nevertheless.
25606 ## What might be a reasonable non-broken output for this?
25607 ## This is an edge case unlikely to be seen in production
25608 ## that I am not wasting more time on this right now.
25609 !! test
25610 Never serialize a-tag as html, no matter what attributes it has
25611 !! options
25612 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25613 !! html/parsoid
25614 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25615 !! wikitext
25616 [http://boo.org http://boohoo.org]
25617 !! end
25618
25619 # Misnested is an indication that selser can reuse the source but these have
25620 # shown to sneak through on occasion. See T101768.
25621 # The original wikitext here is: [http://test.com [[one]] two three]
25622 !! test
25623 Strip span tags added to mark as misnested
25624 !! options
25625 parsoid=html2wt
25626 !! html/parsoid
25627 <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>
25628 !! wikitext
25629 [http://test.com][[one]] two three
25630 !! end
25631
25632 # --------------------------------------------
25633 # Tests spec'ing wikitext serialization norms |
25634 # --------------------------------------------
25635
25636 !! test
25637 Lists: Add space after bullets
25638 !! options
25639 parsoid=html2wt
25640 !! html/parsoid
25641 <ul>
25642 <li>foo</li>
25643 <li> bar</li>
25644 <li><span> baz</span></li>
25645 </ul>
25646 !! wikitext
25647 * foo
25648 * bar
25649 * <span> baz</span>
25650 !! end
25651
25652 !! test
25653 1. Headings: Add space before/after == (T53744)
25654 !! options
25655 parsoid=html2wt
25656 !! html/parsoid
25657 <h2>foo</h2>
25658 <h2> bar</h2>
25659 <h2>baz </h2>
25660 <h2><span> baz</span></h2>
25661 !! wikitext
25662 == foo ==
25663
25664 == bar ==
25665
25666 == baz ==
25667
25668 == <span> baz</span> ==
25669 !! end
25670
25671 !! test
25672 2. Headings: Add space before/after == even after hoisted content
25673 !! options
25674 parsoid={
25675 "modes": ["html2wt"],
25676 "scrubWikitext": true
25677 }
25678 !! html/parsoid
25679 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25680 !! wikitext
25681 [[Category:A2]]
25682
25683 == ok ==
25684 !! end
25685
25686 !! test
25687 1. Headings: suppress newly created empty headings
25688 !! options
25689 parsoid={
25690 "modes": ["html2wt"],
25691 "scrubWikitext": true
25692 }
25693 !! html/parsoid
25694 <h2></h2>
25695 !! wikitext
25696 !! end
25697
25698 !! test
25699 2. Headings: don't suppress empty headings if scrubWikitext is false
25700 !! options
25701 parsoid=html2wt
25702 !! html/parsoid
25703 <h2></h2>
25704 !! wikitext
25705 ==<nowiki/>==
25706 !! end
25707
25708 !! test
25709 3. Headings: suppress empty headings on edits
25710 !! options
25711 parsoid={
25712 "modes": ["selser"],
25713 "scrubWikitext": true,
25714 "changes": [
25715 [ "#x", "remove"]
25716 ]
25717 }
25718 !! wikitext
25719 ==<span id="x">foo</span>==
25720 !! wikitext/edited
25721 !! end
25722
25723 !! test
25724 1. WT Quote Tags: suppress newly created empty style tags
25725 !! options
25726 parsoid={
25727 "modes": ["html2wt"],
25728 "scrubWikitext": true
25729 }
25730 !! html/parsoid
25731 <i></i><b></b>
25732 !! wikitext
25733 !! end
25734
25735 !! test
25736 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25737 !! options
25738 parsoid=html2wt
25739 !! html/parsoid
25740 <i></i><b></b>
25741 !! wikitext
25742 ''<nowiki/>'''''<nowiki/>'''
25743 !! end
25744
25745 !! test
25746 3. WT Quote Tags: suppress empty style tags on edits
25747 !! options
25748 parsoid={
25749 "modes": ["selser"],
25750 "scrubWikitext": true,
25751 "changes": [
25752 [ "#x", "remove"]
25753 ]
25754 }
25755 !! wikitext
25756 '''<span id="x">foo</span>'''
25757 !! wikitext/edited
25758 !! end
25759
25760 !! test
25761 1. Anchors: suppress newly created empty anchors
25762 !! options
25763 parsoid={
25764 "modes": ["html2wt"],
25765 "scrubWikitext": true
25766 }
25767 !! html/parsoid
25768 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25769 !! wikitext
25770 !! end
25771
25772 !! test
25773 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25774 !! options
25775 parsoid={
25776 "modes": ["html2wt"],
25777 "scrubWikitext": false
25778 }
25779 !! html/parsoid
25780 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25781 !! wikitext
25782 [[Test|<nowiki/>]]
25783 !! end
25784
25785 !! test
25786 3. Anchors: suppress empty anchors on edits
25787 !! options
25788 parsoid={
25789 "modes": ["selser"],
25790 "scrubWikitext": true,
25791 "changes": [
25792 [ "#x", "remove"]
25793 ]
25794 }
25795 !! wikitext
25796 [[Test|<span id="x">foo</span>]]
25797 !! wikitext/edited
25798 !! end
25799
25800 !! test
25801 3a. Anchors: do not suppress numbered extlinks
25802 !! options
25803 parsoid={
25804 "modes": ["wt2wt"],
25805 "scrubWikitext": true
25806 }
25807 !! wikitext
25808 [http://foo.com]
25809 !! html/parsoid
25810 <a rel="mw:ExtLink" href="http://foo.com"></a>
25811 !! end
25812
25813 !! test
25814 3b. Anchors: do not suppress numbered extlinks
25815 !! options
25816 parsoid={
25817 "modes": ["wt2wt"],
25818 "scrubWikitext": true,
25819 "changes": [
25820 [ "#x", "remove"]
25821 ]
25822 }
25823 !! wikitext
25824 [http://foo.com <span id="x">foo</span>]
25825 !! wikitext/edited
25826 [http://foo.com]
25827 !! end
25828
25829 !!test
25830 Normalizations should be restricted to edited content
25831 !!options
25832 parsoid={
25833 "modes": ["selser"],
25834 "scrubWikitext": true,
25835 "changes": [
25836 [ "h1", "before", "<i></i>"]
25837 ]
25838 }
25839 !!wikitext
25840 a
25841 = =
25842 b
25843 !!wikitext/edited
25844 a
25845 = =
25846 b
25847 !!end
25848
25849 !! test
25850 1. Multiple normalizations (html2wt)
25851 !! options
25852 parsoid={
25853 "modes": ["html2wt"],
25854 "scrubWikitext": true
25855 }
25856 !! html
25857 <h2><i></i></h2>
25858 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25859 </a><b><i></i></b>x</p>
25860 !! wikitext
25861
25862 [[foo]]
25863 x
25864
25865 !! end
25866
25867 !! test
25868 2. Multiple normalizations (selser)
25869 !! options
25870 parsoid={
25871 "modes": ["selser"],
25872 "scrubWikitext": true,
25873 "changes": [
25874 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25875 ]
25876 }
25877 !! wikitext
25878 <span id="x">foo</span>
25879 !! wikitext/edited
25880 <span id="x">foo</span>
25881
25882 x
25883 !! end
25884
25885 !! test
25886 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25887 !! options
25888 parsoid={
25889 "modes": ["html2wt"],
25890 "scrubWikitext": true
25891 }
25892 !! html/parsoid
25893 <p> hi</p>
25894 <p> hello</p>
25895 !! wikitext
25896 hi
25897
25898 hello
25899 !! end
25900
25901 !! test
25902 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25903 !! options
25904 parsoid=html2wt
25905 !! html/parsoid
25906 <p> hi</p>
25907 <p> hello</p>
25908 !! wikitext
25909 <nowiki> </nowiki>hi
25910
25911 <nowiki> </nowiki> hello
25912 !! end
25913
25914 !! test
25915 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25916 !! options
25917 parsoid={
25918 "modes": ["html2wt"],
25919 "scrubWikitext": true
25920 }
25921 !! html/parsoid
25922 <p>Foo
25923 bar
25924 baz</p>
25925
25926 <table><tr><td>Foo
25927 bar
25928 baz bang</td></tr></table>
25929
25930 <p><!--boo--> foo
25931 bar</p>
25932
25933 <p> foo
25934 bar<span>boo</span></p>
25935 !! wikitext
25936 Foo
25937 bar
25938 baz
25939
25940 {|
25941 |Foo
25942 bar
25943 baz bang
25944 |}
25945
25946 <!--boo-->foo
25947 bar
25948
25949 foo
25950 bar<span>boo</span>
25951 !! end
25952
25953 !! test
25954 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25955 !! options
25956 parsoid={
25957 "modes": ["selser"],
25958 "scrubWikitext": true,
25959 "changes": [
25960 [ "p", "html", " a\n b" ]
25961 ]
25962 }
25963 !! wikitext
25964 xyz
25965 !! wikitext/edited
25966 a
25967 b
25968 !! end
25969
25970 !! test
25971 1. New links that end in spaces
25972 !! options
25973 parsoid={
25974 "modes": ["html2wt"],
25975 "scrubWikitext": false
25976 }
25977 !! html/parsoid
25978 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25979 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25980 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25981 !! wikitext
25982 [[Berlin ]]<nowiki/>is the capital of Germany.
25983
25984 [[Foo ]]'''bar'''
25985
25986 [[Boston ]] is a city.
25987 !! end
25988
25989 !! test
25990 2. New links that end in spaces
25991 !! options
25992 parsoid={
25993 "modes": ["html2wt"],
25994 "scrubWikitext": true
25995 }
25996 !! html/parsoid
25997 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25998 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25999 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26000 !! wikitext
26001 [[Berlin]] is the capital of Germany.
26002
26003 [[Foo]] '''bar'''
26004
26005 [[Boston]] is a city.
26006 !! end
26007
26008 !! test
26009 1. Table cells with escapable prefixes
26010 !! options
26011 parsoid={
26012 "modes": ["html2wt"],
26013 "scrubWikitext": false
26014 }
26015 !! html
26016 <table>
26017 <tr><td>a</td></tr>
26018 <tr><td>-</td></tr>
26019 <tr><td>+</td></tr>
26020 </table>
26021 !! wikitext
26022 {|
26023 |a
26024 |-
26025 |<nowiki>-</nowiki>
26026 |-
26027 |<nowiki>+</nowiki>
26028 |}
26029 !! end
26030
26031 !! test
26032 2. Table cells with escapable prefixes
26033 !! options
26034 parsoid={
26035 "modes": ["html2wt"],
26036 "scrubWikitext": true
26037 }
26038 !! html
26039 <table>
26040 <tr><td>a</td></tr>
26041 <tr><td>-</td></tr>
26042 <tr><td>+</td></tr>
26043 </table>
26044 !! wikitext
26045 {|
26046 |a
26047 |-
26048 | -
26049 |-
26050 | +
26051 |}
26052 !! end
26053
26054 !! test
26055 3a. Table cells with escapable prefixes after edits
26056 !! options
26057 parsoid={
26058 "modes": ["selser"],
26059 "scrubWikitext": true,
26060 "changes": [
26061 [ "table tbody tr:first-child td:first-child", "remove"]
26062 ]
26063 }
26064 !! wikitext
26065 {|
26066 |a||-
26067 |}
26068 !! wikitext/edited
26069 {|
26070 | -
26071 |}
26072 !! end
26073
26074 !! test
26075 3b. Table cells with escapable prefixes after edits
26076 !! options
26077 parsoid={
26078 "modes": ["selser"],
26079 "scrubWikitext": true,
26080 "changes": [
26081 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26082 [ "#x", "remove" ]
26083 ]
26084 }
26085 !! wikitext
26086 {|
26087 |pqr
26088 |<span id="x">foo</span>+
26089 |}
26090 !! wikitext/edited
26091 {|
26092 | -
26093 | +
26094 |}
26095 !! end
26096
26097 # FIXME: This test will fail because
26098 # normalization doesn't realize that the id attribute
26099 # will eliminate the escapable scenario
26100 !! test
26101 4a. Table cells without escapable prefixes after edits
26102 !! options
26103 parsoid={
26104 "modes": ["selser"],
26105 "scrubWikitext": true,
26106 "changes": [
26107 [ "#x", "html", "-" ]
26108 ]
26109 }
26110 !! wikitext
26111 {|
26112 | id="x" |abcd
26113 |}
26114 !! wikitext/edited
26115 {|
26116 | id="x" |-
26117 |}
26118 !! end
26119
26120 ## This tests normalizer's ability to discriminate between
26121 ## cells having identical content.
26122 !! test
26123 4b. Table cells without escapable prefixes after edits
26124 !! options
26125 parsoid={
26126 "modes": ["selser"],
26127 "scrubWikitext": true,
26128 "changes": [
26129 [ "td", "html", "-" ]
26130 ]
26131 }
26132 !! wikitext
26133 {|
26134 |a||b
26135 |}
26136 !! wikitext/edited
26137 {|
26138 | -||-
26139 |}
26140 !! end
26141
26142 ## This tests normalizer's ability to not be tripped by
26143 ## comments (and whitespace)
26144 !! test
26145 4c. Table cells without escapable prefixes after edits
26146 !! options
26147 parsoid={
26148 "modes": ["selser"],
26149 "scrubWikitext": true,
26150 "changes": [
26151 [ "table tbody tr td:first-child", "remove" ]
26152 ]
26153 }
26154 !! wikitext
26155 {|
26156 |-
26157 <!--foo--> |a||-
26158 |}
26159 !! wikitext/edited
26160 {|
26161 |-
26162 <!--foo--> | -
26163 |}
26164 !! end
26165
26166 ## This tests normalizer's ability to handle HTML cells
26167 !! test
26168 4d. Table cells without escapable prefixes after edits
26169 !! options
26170 parsoid={
26171 "modes": ["selser"],
26172 "scrubWikitext": true,
26173 "changes": [
26174 [ "td", "html", "-" ]
26175 ]
26176 }
26177 !! wikitext
26178 <table>
26179 <tr><td>a</td></tr>
26180 </table>
26181 !! wikitext/edited
26182 <table>
26183 <tr><td>-</td></tr>
26184 </table>
26185 !! end
26186
26187 ## T111151 Remove font elements without attributes
26188 !! test
26189 5a. font tags without attributes should be dropped in scrubWikitext mode
26190 !! options
26191 parsoid={
26192 "modes": ["html2wt"],
26193 "scrubWikitext": true
26194 }
26195 !! html
26196 <font>foo</font>
26197 <font><font>bar</font></font>
26198 <font class="x">boo</font>
26199 !! wikitext
26200 foo
26201 bar
26202 <font class="x">boo</font>
26203 !! end
26204
26205 !! test
26206 5b. font tags should not be dropped without scrubWikitext being enabled
26207 !! options
26208 parsoid={
26209 "modes": ["html2wt"],
26210 "scrubWikitext": false
26211 }
26212 !! html
26213 <font>foo</font>
26214 !! wikitext
26215 <font>foo</font>
26216 !! end
26217
26218 !! test
26219 Escape nowiki DOM elements
26220 !! options
26221 parsoid=html2wt
26222 !! html/parsoid
26223 <nowiki><i>foo</i></nowiki>
26224 !! wikitext
26225 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26226 !! end
26227
26228 # ---------------------------------------------------
26229 # End of tests spec'ing wikitext serialization norms |
26230 # ---------------------------------------------------
26231
26232 # -----------------------------------------------------------------
26233 # End of section for Parsoid-only html2wt tests for serialization
26234 # of new content
26235 # -----------------------------------------------------------------
26236
26237 # -----------------------------------------------------------------
26238 # The following section of tests are primarily to spec behavior of
26239 # the selective serializer. All these tests have manual selser
26240 # changes. The automated selser changes for all tests handle the
26241 # wide variation of changes, but these tests here capture specs
26242 # deterministically.
26243 # ----------------------------------------------------------------
26244
26245 ## T90517
26246 !! test
26247 Selser: New comments should not be lost
26248 !! options
26249 parsoid={
26250 "modes": ["selser"],
26251 "changes": [
26252 [ "#a", "after", "<!--c1-->" ],
26253 [ "#b", "before", "<!--c2-->" ]
26254 ]
26255 }
26256 !! wikitext
26257 <span id="a">a</span>
26258
26259 <span id="b">b</span>
26260 !! wikitext/edited
26261 <span id="a">a</span><!--c1-->
26262
26263 <!--c2--><span id="b">b</span>
26264 !! end
26265
26266 ## T89383
26267 !! test
26268 Selser: Check for validity of DSR before using it
26269 !! options
26270 parsoid={
26271 "modes": ["selser"],
26272 "changes": [
26273 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26274 ]
26275 }
26276 !! wikitext
26277 <span id="a">a</span>
26278 !! wikitext/edited
26279 {{DISPLAYTITLE:foo}}
26280 <span id="a">a</span>
26281 !! end
26282
26283 !! test
26284 1. DOMDiff: Changes to <ref> content should be looked up using id
26285 !! options
26286 parsoid={
26287 "modes": ["selser"],
26288 "changes": [
26289 ["#X", "after", "bar"],
26290 ["#Y", "after", "baz"]
26291 ]
26292 }
26293 !! wikitext
26294 X <ref><span id="X">foo</span></ref>
26295 Y <ref name="a" />
26296 <references>
26297 <ref name="a"><span id="Y">foo</span></ref>
26298 </references>
26299 !! wikitext/edited
26300 X <ref><span id="X">foo</span>bar</ref>
26301 Y <ref name="a" />
26302 <references>
26303 <ref name="a"><span id="Y">foo</span>baz</ref>
26304 </references>
26305 !! end
26306
26307 !! test
26308 2. DOMDiff: Changes to <ref> content should be looked up using id
26309 !! options
26310 parsoid={
26311 "modes": ["selser"],
26312 "changes": [
26313 ["#Z", "after", "bar"]
26314 ]
26315 }
26316 !! wikitext
26317 A <ref>foo bar for a</ref>
26318 B <ref group="X" name="b" />
26319
26320 <references />
26321
26322 <references group="X">
26323 <ref name="b"><span id="Z">foo</span></ref>
26324 </references>
26325 !! wikitext/edited
26326 A <ref>foo bar for a</ref>
26327 B <ref group="X" name="b" />
26328
26329 <references />
26330
26331 <references group="X">
26332 <ref name="b"><span id="Z">foo</span>bar</ref>
26333 </references>
26334 !! end
26335
26336 !! test
26337 Empty LI (T49673)
26338 !! wikitext
26339 * a
26340 *
26341 *
26342 * b
26343 !! html/php+tidy
26344 <ul>
26345 <li>a</li>
26346 <li class="mw-empty-li"></li>
26347 <li class="mw-empty-li"></li>
26348 <li>b</li>
26349 </ul>
26350 !! end