cf7daed1e299d03446649df65dd7105bf8ea5ab3
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml
39 #
40 # For testing purposes, temporary articles can created:
41 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
42 # where '/' denotes a newline.
43
44 # This is the standard article assumed to exist.
45 !! article
46 Main Page
47 !! text
48 blah blah
49 !! endarticle
50
51 !!article
52 Foo
53 !!text
54 FOO
55 !!endarticle
56
57 !!article
58 Template:Foo
59 !!text
60 FOO
61 !!endarticle
62
63 !! article
64 Template:Blank
65 !! text
66 !! endarticle
67
68 !! article
69 Template:pipe
70 !! text
71 |
72 !! endarticle
73
74 !! article
75 Template:=
76 !! text
77 <nowiki>=</nowiki>
78 !! endarticle
79
80 !!article
81 MediaWiki:bad image list
82 !!text
83 * [[File:Bad.jpg]] except [[Nasty page]]
84 !!endarticle
85
86 !! article
87 Template:inner list
88 !! text
89 * item 1
90 !! endarticle
91
92 !! article
93 Template:tbl-start
94 !! text
95 {|
96 !! endarticle
97
98 !! article
99 Template:tbl-end
100 !! text
101 |}
102 !! endarticle
103
104 !! article
105 Template:echo
106 !! text
107 {{{1}}}
108 !! endarticle
109
110 !! article
111 Template:echo_with_span
112 !! text
113 <span>{{{1}}}</span>
114 !! endarticle
115
116 !! article
117 Template:echo_with_div
118 !! text
119 <div>{{{1}}}</div>
120 !! endarticle
121
122 !! article
123 Template:blank_param
124 !! text
125 {{{1}}}
126 {{{}}}
127 !! endarticle
128
129 !! article
130 Template:table_attribs
131 !! text
132 <noinclude>
133 |</noinclude>style="color:red;"|Foo
134 !! endarticle
135
136 !! article
137 Template:table_attribs_2
138 !! text
139 <noinclude>
140 |</noinclude>style="color:red;"|Foo
141 |Bar||Baz
142 !! endarticle
143
144 !! article
145 Template:table_attribs_3
146 !! text
147 <noinclude>
148 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
149 !! endarticle
150
151 !! article
152 Template:table_attribs_4
153 !! text
154 | style="background-color:#DC241f;" width="10px" |
155 !! endarticle
156
157 !! article
158 Template:table_attribs_5
159 !! text
160 <noinclude>
161 |</noinclude>style="color:red;"||Bar
162 !! endarticle
163
164 !! article
165 Template:table_attribs_6
166 !! text
167 style="background: <nowiki>
168
169
170 red;</nowiki>" |
171 !! endarticle
172
173 !! article
174 Template:table_attribs_7
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
178 !! endarticle
179
180 !! article
181 Template:table_header_cells
182 !! text
183 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
184 !! endarticle
185
186 !! article
187 Template:table_cells
188 !! text
189 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
190 !! endarticle
191
192 !! article
193 Template:PartialTable
194 !! text
195 {|
196 |-
197 !! endarticle
198
199 !! article
200 Template:image_attribs
201 !! text
202 <noinclude>
203 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
204 !! endarticle
205
206 ## See T48811 for details
207 !! article
208 Template:mixed_attr_content_template
209 !! text
210 style="color:red;" title="T48811"
211 |-
212 |foo
213 !! endarticle
214
215 !! article
216 Template:definition_list
217 !! text
218 one
219 ::two
220 !! endarticle
221
222 !! article
223 A?b
224 !! text
225 Weirdo titles!
226 !! endarticle
227
228 !!article
229 Template:Bullet
230 !!text
231 * Bar
232 !!endarticle
233
234 !!article
235 Template:OpenTable
236 !!text
237 {|
238 !!endarticle
239
240 !!article
241 Template:EmptyLITest
242 !!text
243 *a
244 *
245 *
246 *b
247 !!endarticle
248
249 !!article
250 Template:EmptyTRTest
251 !!text
252 {|
253 |-
254 |-
255 |foo
256 |-
257 |-
258 |bar
259 |}
260 !!endarticle
261
262 !!article
263 Template:EmptyTRWithHTMLAttrTest
264 !!text
265 <table>
266 <tr align="center"></tr>
267 <tr><td>foo</td></tr>
268 <tr align="center"></tr>
269 <tr><td>bar</td></tr>
270 </table>
271 !!endarticle
272
273 ###
274 ### Basic tests
275 ###
276 !! test
277 Blank input
278 !! wikitext
279 !! html
280 !! end
281
282
283 !! test
284 Simple paragraph
285 !! wikitext
286 This is a simple paragraph.
287 !! html
288 <p>This is a simple paragraph.
289 </p>
290 !! end
291
292 !! test
293 Paragraphs with extra newline spacing
294 !! wikitext
295 foo
296
297 bar
298
299
300 baz
301
302
303
304 booz
305 !! html
306 <p>foo
307 </p><p>bar
308 </p><p><br />
309 baz
310 </p><p><br />
311 </p><p>booz
312 </p>
313 !! end
314
315 !! test
316 Paragraphs with newline spacing with comment lines in between
317 !! wikitext
318 ----
319 a
320 <!--foo-->
321 b
322 ----
323 a
324 <!--foo--><!--More than 1 comment, still stripped-->
325 b
326 ----
327 a
328 <!--foo--> <!----> <!-- bar -->
329 b
330 ----
331 a
332 <!--foo-->
333
334 b
335 ----
336 a
337
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo-->
343
344
345 b
346 ----
347 a
348
349
350 <!--foo-->
351 b
352 ----
353 !! html
354 <hr />
355 <p>a
356 b
357 </p>
358 <hr />
359 <p>a
360 b
361 </p>
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 </p><p>b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380 <p>a
381 </p><p><br />
382 b
383 </p>
384 <hr />
385
386 !! end
387
388 !! test
389 Paragraphs with newline spacing with non-empty white-space lines in between
390 !! wikitext
391 ----
392 a
393
394 b
395 ----
396 a
397
398
399 b
400 ----
401 !! html
402 <hr />
403 <p>a
404 </p><p>b
405 </p>
406 <hr />
407 <p>a
408 </p><p><br />
409 b
410 </p>
411 <hr />
412
413 !! end
414
415 !! test
416 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
417 !! wikitext
418 ----
419 a
420 <!--foo-->
421 b
422 ----
423 a
424 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
425 b
426 ----
427 a
428
429 <!--foo-->
430 <!--bar-->
431 b
432 ----
433 a
434
435 <!--foo-->
436 <!--bar-->
437
438 b
439 ----
440 !! html
441 <hr />
442 <p>a
443 b
444 </p>
445 <hr />
446 <p>a
447 b
448 </p>
449 <hr />
450 <p>a
451 </p><p>b
452 </p>
453 <hr />
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 <hr />
459
460 !! end
461
462 !! test
463 Extra newlines: More paragraphs with indented comment
464 !! wikitext
465 a
466
467 <!--boo-->
468
469 b
470 !! html
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 !!end
476
477 !! test
478 Extra newlines followed by heading
479 !! wikitext
480 a
481
482
483
484 =b=
485 [[a]]
486
487
488 =b=
489 !! html
490 <p>a
491 </p><p><br />
492 </p>
493 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p><p><br />
496 </p>
497 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
498
499 !! end
500
501 !! test
502 Extra newlines between heading and content are swallowed
503 !! wikitext
504 =b=
505
506
507
508 [[a]]
509 !! html
510 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p>
513 !! end
514
515 !! test
516 Parsing an URL
517 !! wikitext
518 http://fr.wikipedia.org/wiki/🍺
519 <!-- EasterEgg we love beer, better be able be able to link to it -->
520 !! html
521 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
522 </p>
523 !! end
524
525 # Note that the html+tidy output removes the spaces after the <li>,
526 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
527 # This is an issue for all tests with lists. We intentionally do
528 # *not* add html+tidy clauses for these, as we don't want to
529 # document/test the broken behavior. (Parsoid matches the non-tidy
530 # output in these cases.)
531
532 !! test
533 Simple list
534 !! wikitext
535 * Item 1
536 * Item 2
537 !! html
538 <ul><li> Item 1</li>
539 <li> Item 2</li></ul>
540
541 !! end
542
543 !! test
544 Italics and bold
545 !! wikitext
546 * plain
547 * plain''italic''plain
548 * plain''italic''plain''italic''plain
549 * plain'''bold'''plain
550 * plain'''bold'''plain'''bold'''plain
551 * plain''italic''plain'''bold'''plain
552 * plain'''bold'''plain''italic''plain
553 * plain''italic'''bold-italic'''italic''plain
554 * plain'''bold''bold-italic''bold'''plain
555 * plain'''''bold-italic'''italic''plain
556 * plain'''''bold-italic''bold'''plain
557 * plain''italic'''bold-italic'''''plain
558 * plain'''bold''bold-italic'''''plain
559 * plain l'''italic''plain
560 * plain l''''bold''' plain
561 !! html
562 <ul><li> plain</li>
563 <li> plain<i>italic</i>plain</li>
564 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
565 <li> plain<b>bold</b>plain</li>
566 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
567 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
568 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
569 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
570 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
571 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
572 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
573 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
574 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
575 <li> plain l'<i>italic</i>plain</li>
576 <li> plain l'<b>bold</b> plain</li></ul>
577
578 !! end
579
580 # this example taken from the [[simple:Moon]] article (bug 47326)
581 !! test
582 Italics and possessives (1)
583 !! wikitext
584 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
585 !! html
586 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
587 </p>
588 !! end
589
590 # this example taken from [[en:Flaming Pie]] (bug 49926)
591 !! test
592 Italics and possessives (2)
593 !! wikitext
594 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
595 !! html
596 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
597 </p>
598 !! end
599
600 # this example taken from [[en:Dictionary]] (bug 49926)
601 !! test
602 Italics and possessives (3)
603 !! wikitext
604 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
605 !! html
606 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
607 </p>
608 !! end
609
610
611 ###
612 ### 2-quote opening sequence tests
613 ###
614 !! test
615 Italics and bold: 2-quote opening sequence: (2,2)
616 !! wikitext
617 ''foo''
618 !! html
619 <p><i>foo</i>
620 </p>
621 !!end
622
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,3)
625 !! wikitext
626 ''foo'''
627 !! html/*
628 <p><i>foo'</i>
629 </p>
630 !!end
631
632 !! test
633 Italics and bold: 2-quote opening sequence: (2,4)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 ''foo''''
638 !! html/*
639 <p><i>foo''</i>
640 </p>
641 !!end
642
643 # same html as previous, but wikitext adjusted to match parsoid html2wt
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
646 !! wikitext
647 ''foo<nowiki>''</nowiki>''
648 !! html
649 <p><i>foo''</i>
650 </p>
651 !! end
652
653 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
654 !! test
655 Italics and bold: 2-quote opening sequence: (2,5)
656 !! options
657 parsoid=wt2html
658 !! wikitext
659 ''foo'''''
660 !! html/php
661 <p><i>foo</i>
662 </p>
663 !! html/parsoid
664 <p><i>foo</i><b></b>
665 </p>
666 !!end
667
668 # same html as previous, but wikitext adjusted to match parsoid html2wt
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
671 !! wikitext
672 ''foo'''''<nowiki/>'''
673 !! html/php
674 <p><i>foo</i>
675 </p>
676 !! html/parsoid
677 <p><i>foo</i><b></b>
678 </p>
679 !! end
680
681
682 ###
683 ### 3-quote opening sequence tests
684 ###
685
686 !! test
687 Italics and bold: 3-quote opening sequence: (3,2)
688 !! wikitext
689 '''foo''
690 !! html/*
691 <p>'<i>foo</i>
692 </p>
693 !!end
694
695 !! test
696 Italics and bold: 3-quote opening sequence: (3,3)
697 !! wikitext
698 '''foo'''
699 !! html
700 <p><b>foo</b>
701 </p>
702 !!end
703
704 !! test
705 Italics and bold: 3-quote opening sequence: (3,4)
706 !! wikitext
707 '''foo''''
708 !! html/*
709 <p><b>foo'</b>
710 </p>
711 !!end
712
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 '''foo'''''
720 !! html/php
721 <p><b>foo</b>
722 </p>
723 !! html/parsoid
724 <p><b>foo</b><i></i>
725 </p>
726 !!end
727
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
731 !! wikitext
732 '''foo'''''<nowiki/>''
733 !! html/php
734 <p><b>foo</b>
735 </p>
736 !! html/parsoid
737 <p><b>foo</b><i></i>
738 </p>
739 !! end
740
741
742 ###
743 ### 4-quote opening sequence tests
744 ###
745
746 !! test
747 Italics and bold: 4-quote opening sequence: (4,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 ''''foo''
752 !! html/*
753 <p>''<i>foo</i>
754 </p>
755 !!end
756
757 # same html as previous, but wikitext adjusted to match parsoid html2wt
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
760 !! wikitext
761 <nowiki>''</nowiki>''foo''
762 !! html
763 <p>''<i>foo</i>
764 </p>
765 !! end
766
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,3)
769 !! wikitext
770 ''''foo'''
771 !! html/*
772 <p>'<b>foo</b>
773 </p>
774 !!end
775
776 !! test
777 Italics and bold: 4-quote opening sequence: (4,4)
778 !! options
779 parsoid=wt2html
780 !! wikitext
781 ''''foo''''
782 !! html/*
783 <p>'<b>foo'</b>
784 </p>
785 !!end
786
787 # same html as previous, but wikitext adjusted to match parsoid html2wt
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
790 !! wikitext
791 '<nowiki/>'''foo''''
792 !! html
793 <p>'<b>foo'</b>
794 </p>
795 !! end
796
797 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
798 !! test
799 Italics and bold: 4-quote opening sequence: (4,5)
800 !! options
801 parsoid=wt2html
802 !! wikitext
803 ''''foo'''''
804 !! html/php
805 <p>'<b>foo</b>
806 </p>
807 !! html/parsoid
808 <p>'<b>foo</b><i></i>
809 </p>
810 !!end
811
812 # same html as previous, but wikitext adjusted to match parsoid html2wt
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
815 !! wikitext
816 '<nowiki/>'''foo'''''<nowiki/>''
817 !! html/php
818 <p>'<b>foo</b>
819 </p>
820 !! html/parsoid
821 <p>'<b>foo</b><i></i>
822 </p>
823 !! end
824
825
826 ###
827 ### 5-quote opening sequence tests
828 ###
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,2)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 '''''foo''
836 !! html/*
837 <p><b><i>foo</i></b>
838 </p>
839 !!end
840
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! wikitext
845 '''''foo'''''
846 !! html/*
847 <p><i><b>foo</b></i>
848 </p>
849 !! end
850
851 !! test
852 Italics and bold: 5-quote opening sequence: (5,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 '''''foo'''
857 !! html/*
858 <p><i><b>foo</b></i>
859 </p>
860 !!end
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3+2)
865 !! wikitext
866 '''''foo'''''
867 !! html
868 <p><i><b>foo</b></i>
869 </p>
870 !! end
871
872 !! test
873 Italics and bold: 5-quote opening sequence: (5,4)
874 !! options
875 parsoid=wt2html
876 !! wikitext
877 '''''foo''''
878 !! html/*
879 <p><i><b>foo'</b></i>
880 </p>
881 !!end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,5)
885 !! wikitext
886 '''''foo'''''
887 !! html
888 <p><i><b>foo</b></i>
889 </p>
890 !!end
891
892 !! test
893 Italics and bold: 5-quote opening sequence: (5,6)
894 !! wikitext
895 '''''foo''''''
896 !! html/*
897 <p><i><b>foo'</b></i>
898 </p>
899 !! end
900
901 ###
902 ### multiple quote sequences in a line
903 ###
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,2)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 ''foo''''bar''
910 !! html/*
911 <p><i>foo'<b>bar</b></i>
912 </p>
913 !!end
914
915
916 # same html as previous, but wikitext adjusted to match parsoid html2wt
917 !! test
918 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
919 !! wikitext
920 ''foo'<nowiki/>'''bar'''''
921 !! html
922 <p><i>foo'<b>bar</b></i>
923 </p>
924 !! end
925
926
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,3)
929 !! options
930 parsoid=wt2html
931 !! wikitext
932 ''foo''''bar'''
933 !! html/*
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !!end
937
938
939 # same html as previous, but wikitext adjusted to match parsoid html2wt
940 !! test
941 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
942 !! wikitext
943 ''foo'<nowiki/>'''bar'''''
944 !! html
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,4)
952 !! options
953 parsoid=wt2html
954 !! wikitext
955 ''foo''''bar''''
956 !! html/*
957 <p><i>foo'<b>bar'</b></i>
958 </p>
959 !!end
960
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'<nowiki/>'''''
967 !! html
968 <p><i>foo'<b>bar'</b></i>
969 </p>
970 !! end
971
972
973 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
974 !! test
975 Italics and bold: multiple quote sequences: (3,4,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''foo''''bar''
980 !! html/php
981 <p><b>foo'</b>bar
982 </p>
983 !! html/parsoid
984 <p><b>foo'</b>bar<i></i>
985 </p>
986 !!end
987
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
991 !! options
992 parsoid
993 !! wikitext
994 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
995 !! html/php
996 <p><b>foo'</b>bar
997 </p>
998 !! html/parsoid
999 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1000 </p>
1001 !! end
1002
1003
1004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,3)
1007 !! options
1008 parsoid=wt2html
1009 !! wikitext
1010 '''foo''''bar'''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b>foo'</b>bar<b></b>
1016 </p>
1017 !!end
1018
1019 # same html as previous, but wikitext adjusted to match parsoid html2wt
1020 !! test
1021 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1022 !! wikitext
1023 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1024 !! html/php
1025 <p><b>foo'</b>bar
1026 </p>
1027 !! html/parsoid
1028 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### other quote tests
1034 ###
1035 !! test
1036 Italics and bold: other quote tests: (2,3,5)
1037 !! wikitext
1038 ''this is about '''foo's family'''''
1039 !! html
1040 <p><i>this is about <b>foo's family</b></i>
1041 </p>
1042 !!end
1043
1044
1045 !! test
1046 Italics and bold: other quote tests: (2,(3,3),2)
1047 !! wikitext
1048 ''this is about '''foo's''' family''
1049 !! html
1050 <p><i>this is about <b>foo's</b> family</i>
1051 </p>
1052 !!end
1053
1054
1055 !! test
1056 Italics and bold: other quote tests: (3,2,3,2)
1057 !! options
1058 parsoid=wt2html
1059 !! wikitext
1060 '''this is about ''foo'''s family''
1061 !! html/*
1062 <p><b>this is about <i>foo</i></b><i>s family</i>
1063 </p>
1064 !!end
1065
1066
1067 # same html as previous, but wikitext adjusted to match parsoid html2wt
1068 !! test
1069 Italics and bold: other quote tests: (3,2,3+2+2,2)
1070 !! wikitext
1071 '''this is about ''foo'''''<nowiki/>''s family''
1072 !! html
1073 <p><b>this is about <i>foo</i></b><i>s family</i>
1074 </p>
1075 !! end
1076
1077
1078 !! test
1079 Italics and bold: other quote tests: (3,2,3,3)
1080 !! wikitext
1081 '''this is about ''foo'''s family'''
1082 !! html/*
1083 <p>'<i>this is about </i>foo<b>s family</b>
1084 </p>
1085 !!end
1086
1087
1088 !! test
1089 Italics and bold: other quote tests: (3,(2,2),3)
1090 !! wikitext
1091 '''this is about ''foo's'' family'''
1092 !! html
1093 <p><b>this is about <i>foo's</i> family</b>
1094 </p>
1095 !!end
1096
1097
1098 !! test
1099 Italicized possessive
1100 !! wikitext
1101 The ''[[Main Page]]'''s talk page.
1102 !! html/php
1103 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1104 </p>
1105 !! html/parsoid
1106 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1107 !! end
1108
1109 !! test
1110 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1111 (Requires tidy for PHP parser output to be fixed up)
1112 !! options
1113 parsoid=wt2html,wt2wt
1114 !! wikitext
1115 {|
1116 !''a!!''b
1117 |''a||''b
1118 |}
1119 !! html/php+tidy
1120 <table>
1121 <tr>
1122 <th><i>a</i></th>
1123 <th><i>b</i></th>
1124 <td><i>a</i></td>
1125 <td><i>b</i></td>
1126 </tr>
1127 </table>
1128 !! html/parsoid
1129 <table>
1130 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1131 <td><i>a</i></td><td><i>b</i></td></tr>
1132 </tbody></table>
1133 !! end
1134
1135 ###
1136 ### Non-html5 tags
1137 ###
1138
1139 !! test
1140 Non-html5 tags should be accepted
1141 !! wikitext
1142 <center>''foo''</center>
1143 <big>''foo''</big>
1144 <font>''foo''</font>
1145 <strike>''foo''</strike>
1146 <tt>''foo''</tt>
1147 !! html
1148 <center><i>foo</i></center>
1149 <p><big><i>foo</i></big>
1150 <font><i>foo</i></font>
1151 <strike><i>foo</i></strike>
1152 <tt><i>foo</i></tt>
1153 </p>
1154 !! end
1155
1156 !! test
1157 <wbr> is valid wikitext (bug 52468)
1158 !! wikitext
1159 <wbr>
1160 !! html
1161 <p><wbr />
1162 </p>
1163 !! end
1164
1165 # <strike> is HTML4, <s> is HTML4/5.
1166 !! test
1167 <s> or <strike> for strikethrough
1168 !! wikitext
1169 <strike>strike</strike>
1170
1171 <s>s</s>
1172 !! html
1173 <p><strike>strike</strike>
1174 </p><p><s>s</s>
1175 </p>
1176 !! end
1177
1178 ## a not permitted
1179 ## i,b,br omitted
1180 !! test
1181 Text-level semantic html elements in wikitext
1182 !! wikitext
1183 <em>text</em>
1184 <strong>text</strong>
1185 <small>text</small>
1186 <s>text</s>
1187 <cite>text</cite>
1188 <q>text</q>
1189 <dfn>text</dfn>
1190 <abbr>text</abbr>
1191 <data>text</data>
1192 <time>text</time>
1193 <code>text</code>
1194 <var>text</var>
1195 <samp>text</samp>
1196 <kbd>text</kbd>
1197 <sub>text</sub>
1198 <u>text</u>
1199 <mark>text</mark>
1200 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1201 <bdi>text</bdi>
1202 <bdo>text</bdo>
1203 <span>text</span>
1204 <wbr />
1205 !! html
1206 <p><em>text</em>
1207 <strong>text</strong>
1208 <small>text</small>
1209 <s>text</s>
1210 <cite>text</cite>
1211 <q>text</q>
1212 <dfn>text</dfn>
1213 <abbr>text</abbr>
1214 <data>text</data>
1215 <time>text</time>
1216 <code>text</code>
1217 <var>text</var>
1218 <samp>text</samp>
1219 <kbd>text</kbd>
1220 <sub>text</sub>
1221 <u>text</u>
1222 <mark>text</mark>
1223 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1224 <bdi>text</bdi>
1225 <bdo>text</bdo>
1226 <span>text</span>
1227 <wbr />
1228 </p>
1229 !! end
1230
1231 # test cases taken from
1232 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1233 !! test
1234 Ruby markup (W3C-style)
1235 !! wikitext
1236 ; Mono-ruby for individual base characters
1237 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1238 ; Group ruby
1239 : <ruby>今日<rt>きょう</rt></ruby>
1240 ; Jukugo ruby
1241 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1242 ; Inline ruby
1243 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1244 ; Double-sided ruby
1245 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1246 <ruby>
1247 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1248 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1249 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1250 </ruby>
1251 !! html
1252 <dl><dt> Mono-ruby for individual base characters</dt>
1253 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1254 <dt> Group ruby</dt>
1255 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1256 <dt> Jukugo ruby</dt>
1257 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1258 <dt> Inline ruby</dt>
1259 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1260 <dt> Double-sided ruby</dt>
1261 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1262 <p><ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 </p>
1268 !! end
1269
1270 # The next two test different paths in the sanitizer.
1271 !! test
1272 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1273 !! wikitext
1274 <blockquote|>a</blockquote>
1275
1276 <b→> doesn't terminate </b→>
1277
1278 <bä> doesn't terminate </bä>
1279
1280 <boo> doesn't terminate </boo>
1281
1282 <s.foo> doesn't terminate </s.foo>
1283
1284 <sub-ID#1>
1285 !! html
1286 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1287 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1288 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1289 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1290 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1291 </p><p>&lt;sub-ID#1&gt;
1292 </p>
1293 !! end
1294
1295 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1296 # If the non-word-character tag made it through the sanitizer, tidy
1297 # would munge it up.
1298 !! test
1299 Non-word characters don't terminate tag names + tidy
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html+tidy
1313 <p>&lt;blockquote|&gt;a</p>
1314 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1315 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1316 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1317 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1318 <p>&lt;sub-ID#1&gt;</p>
1319 !! end
1320
1321 ###
1322 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1323 ### This checks that HTML5 tags (with non-word characters in the tag
1324 ### name) make it safely through the parser -- the Sanitizer will
1325 ### munge them later, as it should.
1326 ###
1327 !! test
1328 Non-word characters are valid in extension tags (T19663)
1329 !! wikitext
1330 <tåg>tåg</tåg>
1331 !! html/php
1332 <pre>
1333 'tåg'
1334 array (
1335 )
1336 </pre>
1337
1338 !! html/parsoid
1339 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! wikitext
1464 {{echo|&ndash;}}
1465 !! html/php+tidy
1466 <p>–</p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html/parsoid
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1525 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|<nowiki>a }} b</nowiki>}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1790 a
1791 {{blank}} <!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html/php
1807 <ul><li>a</li>
1808 <li>b</li></ul>
1809
1810 !! html/parsoid
1811 <!--c1--><ul>
1812 <li>a
1813 </li>
1814 <!--c2--><!--c3--><!--c4-->
1815 <li>b
1816 </li>
1817 </ul>
1818 !! end
1819
1820 ###
1821 ### paragraph wrapping tests
1822 ###
1823 !! test
1824 No block tags
1825 !! wikitext
1826 a
1827
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Block tag on one line (<div>)
1837 !! wikitext
1838 a <div>foo</div>
1839
1840 b
1841 !! html
1842 a <div>foo</div>
1843 <p>b
1844 </p>
1845 !! html+tidy
1846 <p>a</p>
1847 <div>foo</div>
1848 <p>b</p>
1849 !! end
1850
1851 !! test
1852 Block tag on one line (<blockquote>)
1853 !! wikitext
1854 a <blockquote>foo</blockquote>
1855
1856 b
1857 !! html
1858 a <blockquote>foo</blockquote>
1859 <p>b
1860 </p>
1861 !! html+tidy
1862 <p>a</p>
1863 <blockquote>
1864 <p>foo</p>
1865 </blockquote>
1866 <p>b</p>
1867 !! end
1868
1869 !! test
1870 Block tag on both lines (<div>)
1871 !! wikitext
1872 a <div>foo</div>
1873
1874 b <div>foo</div>
1875 !! html
1876 a <div>foo</div>
1877 b <div>foo</div>
1878
1879 !! html+tidy
1880 <p>a</p>
1881 <div>foo</div>
1882 <p>b</p>
1883 <div>foo</div>
1884 !! end
1885
1886 !! test
1887 Block tag on both lines (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b <blockquote>foo</blockquote>
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 b <blockquote>foo</blockquote>
1895
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 <blockquote>
1903 <p>foo</p>
1904 </blockquote>
1905 !! end
1906
1907 !! test
1908 Multiple lines without block tags
1909 !! wikitext
1910 <div>foo</div> a
1911 b
1912 c
1913 d<!--foo--> e
1914 x <div>foo</div> z
1915 !! html
1916 <div>foo</div> a
1917 <p>b
1918 c
1919 d e
1920 </p>
1921 x <div>foo</div> z
1922
1923 !! html+tidy
1924 <div>foo</div>
1925 <p>a</p>
1926 <p>b c d e</p>
1927 <p>x</p>
1928 <div>foo</div>
1929 <p>z</p>
1930 !! end
1931
1932 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1933 # So, we have a separate section for Parsoid. We don't want
1934 # to mimic this stripping behavior in Parsoid. It affects
1935 # editing experience and also requires us to maintain additional
1936 # info for RT-ing.
1937 !! test
1938 Empty lines between lines with block tags
1939 !! wikitext
1940 <div></div>
1941
1942
1943 <div></div>a
1944
1945 b
1946 <div>a</div>b
1947
1948 <div>b</div>d
1949
1950
1951 <div>e</div>
1952 !! html
1953 <div></div>
1954 <p><br />
1955 </p>
1956 <div></div>a
1957 <p>b
1958 </p>
1959 <div>a</div>b
1960 <div>b</div>d
1961 <p><br />
1962 </p>
1963 <div>e</div>
1964
1965 !! html+tidy
1966 <p><br /></p>
1967 <p>a</p>
1968 <p>b</p>
1969 <div>a</div>
1970 <p>b</p>
1971 <div>b</div>
1972 <p>d</p>
1973 <p><br /></p>
1974 <div>e</div>
1975 !! html/parsoid
1976 <div data-parsoid='{"stx":"html"}'></div>
1977
1978 <p><br /></p>
1979 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1980
1981 <p>b</p>
1982 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1983
1984 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1985
1986 <p><br /></p>
1987 <div data-parsoid='{"stx":"html"}'>e</div>
1988 !! end
1989
1990 ## PHP parser emits output which is broken
1991 !! test
1992 Unclosed HTML p-tags should be handled properly
1993 !! wikitext
1994 <div><p>foo</div>
1995 a
1996
1997 b
1998 !! html/php+tidy
1999 <div>
2000 <p>foo</p>
2001 </div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! html/parsoid
2005 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2006 <p>a</p>
2007 <p>b</p>
2008 !! end
2009
2010 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2011 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2012 ## them for now.
2013 !! test
2014 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2015 !! options
2016 parsoid=wt2html
2017 !! wikitext
2018 a [[Category:A1]] [[Category:A2]]
2019 [[Category:A3]]
2020 [[Category:A4]]
2021 !! html/parsoid
2022 <p>a</p>
2023 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2024 !! end
2025
2026 !! test
2027 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2028 !! options
2029 parsoid=wt2html
2030 !! wikitext
2031 [[Category:A1]]a
2032 !! html/parsoid
2033 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2034 !! end
2035
2036 ###
2037 ### Preformatted text
2038 ###
2039 !! test
2040 Preformatted text
2041 !! wikitext
2042 This is some
2043 Preformatted text
2044 With ''italic''
2045 And '''bold'''
2046 And a [[Main Page|link]]
2047 !! html
2048 <pre>This is some
2049 Preformatted text
2050 With <i>italic</i>
2051 And <b>bold</b>
2052 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2053 </pre>
2054 !! end
2055
2056 !! test
2057 Tabs don't trigger preformatted text
2058 !! wikitext
2059 This is not
2060 preformatted text.
2061 This is preformatted text.
2062 So is this.
2063 !! html/php
2064 <p> This is not
2065 preformatted text.
2066 </p>
2067 <pre>This is preformatted text.
2068 So is this.
2069 </pre>
2070 !! html/parsoid
2071 <p> This is not
2072 preformatted text.</p>
2073 <pre>This is preformatted text.
2074 So is this.</pre>
2075 !! end
2076
2077 !! test
2078 Space before tab needs nowiki pre protection
2079 !! options
2080 parsoid=html2wt
2081 !! html/parsoid
2082 <p> a</p>
2083 !! wikitext
2084 <nowiki> </nowiki> a
2085 !! end
2086
2087 !! test
2088 Ident preformatting with inline content
2089 !! wikitext
2090 a
2091 ''b''
2092 !! html
2093 <pre>a
2094 <i>b</i>
2095 </pre>
2096 !! end
2097
2098 !! test
2099 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2100 !! wikitext
2101 <pre><nowiki>
2102 <b>
2103 <cite>
2104 <em>
2105 </nowiki></pre>
2106 !! html
2107 <pre>
2108 &lt;b&gt;
2109 &lt;cite&gt;
2110 &lt;em&gt;
2111 </pre>
2112
2113 !! end
2114
2115 !! test
2116 Regression with preformatted in <center>
2117 !! wikitext
2118 <center>
2119 Blah
2120 </center>
2121 !! html
2122 <center>
2123 <pre>Blah
2124 </pre>
2125 </center>
2126
2127 !! end
2128
2129 !! test
2130 Bug 52763: Preformatted in <blockquote>
2131 !! wikitext
2132 <blockquote>
2133 Blah
2134 {|
2135 |
2136 indented cell (no pre-wrapping!)
2137 |}
2138 </blockquote>
2139 !! html
2140 <blockquote>
2141 <p> Blah
2142 </p>
2143 <table>
2144 <tr>
2145 <td>
2146 <p> indented cell (no pre-wrapping!)
2147 </p>
2148 </td></tr></table>
2149 </blockquote>
2150
2151 !! end
2152
2153 !! test
2154 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2155 !! wikitext
2156 <blockquote>
2157 Foo
2158
2159 Bar
2160 </blockquote>
2161 !! html
2162 <blockquote>
2163 <p>Foo
2164 </p><p>Bar
2165 </p>
2166 </blockquote>
2167
2168 !! end
2169
2170 !! test
2171 Bug 15491: <ins>/<del> in blockquote
2172 !! wikitext
2173 <blockquote>
2174 Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p>Foo <del>bar</del> <ins>baz</ins> quux
2179 </p>
2180 </blockquote>
2181
2182 !! end
2183
2184 # Note that the p-wrapping is newline sensitive, which could be
2185 # considered a bug: tidy will wrap only the 'Foo' in the example
2186 # below in a <p> tag. (see comment 23-25 of bug #6200)
2187 !! test
2188 Bug 15491: <ins>/<del> in blockquote (2)
2189 !! wikitext
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192 !! html
2193 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2194 </blockquote>
2195
2196 !! html+tidy
2197 <blockquote>
2198 <p>Foo</p>
2199 <del>bar</del> <ins>baz</ins> quux</blockquote>
2200 !! end
2201
2202 !! test
2203 <pre> with attributes (bug 3202)
2204 !! wikitext
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206 !! html
2207 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2208
2209 !! end
2210
2211 !! test
2212 <pre> with width attribute (bug 3202)
2213 !! wikitext
2214 <pre width="8">Narrow screen goodies</pre>
2215 !! html
2216 <pre width="8">Narrow screen goodies</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute (bug 3202)
2222 !! wikitext
2223 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 Entities inside <pre>
2231 !! wikitext
2232 <pre>&lt;</pre>
2233 !! html
2234 <pre>&lt;</pre>
2235
2236 !! end
2237
2238 !! test
2239 <pre> with forbidden attribute values (bug 3202)
2240 !! wikitext
2241 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2244
2245 !! end
2246
2247 !! test
2248 <nowiki> inside <pre> (bug 13238)
2249 !! wikitext
2250 <pre>
2251 <nowiki>
2252 </pre>
2253 <pre>
2254 <nowiki></nowiki>
2255 </pre>
2256 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2257 !! html
2258 <pre>
2259 &lt;nowiki&gt;
2260 </pre>
2261 <pre>
2262
2263 </pre>
2264 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2265
2266 !! end
2267
2268 !! test
2269 <nowiki> inside of #tag:pre
2270 !! wikitext
2271 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2272 !! html/php
2273 <pre>Foo &#8594;bar</pre>
2274
2275 !! html/parsoid
2276 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2277 !! end
2278
2279 !! test
2280 <nowiki> and <pre> preference (first one wins)
2281 !! wikitext
2282 <pre>
2283 <nowiki>
2284 </pre>
2285 </nowiki>
2286 </pre>
2287
2288 <nowiki>
2289 <pre>
2290 <nowiki>
2291 </pre>
2292 </nowiki>
2293 </pre>
2294
2295 !! html/php
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <p>&lt;/nowiki&gt;
2300 &lt;/pre&gt;
2301 </p><p>
2302 &lt;pre&gt;
2303 &lt;nowiki&gt;
2304 &lt;/pre&gt;
2305
2306 &lt;/pre&gt;
2307 </p>
2308 !! html/parsoid
2309 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2310 </pre>
2311 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2312 &lt;/pre></p>
2313
2314 <p><span typeof="mw:Nowiki">
2315 &lt;pre>
2316 &lt;nowiki>
2317 &lt;/pre>
2318 </span>
2319 &lt;/pre></p>
2320 !! end
2321
2322 !! test
2323 </pre> inside nowiki
2324 !! wikitext
2325 <nowiki></pre></nowiki>
2326 !! html
2327 <p>&lt;/pre&gt;
2328 </p>
2329 !! end
2330
2331 # Parsoid doesn't strip empty tags, like Tidy does.
2332 !! test
2333 Empty pre; pre inside other HTML tags (bug 54946)
2334 !! options
2335 parsoid=wt2html,wt2wt
2336 !! wikitext
2337 a
2338
2339 <div><pre>
2340 foo
2341 </pre></div>
2342 <pre></pre>
2343 !! html/php
2344 <p>a
2345 </p>
2346 <div><pre>
2347 foo
2348 </pre></div>
2349 <pre></pre>
2350
2351 !! html/php+tidy
2352 <p>a</p>
2353 <div>
2354 <pre>
2355 foo
2356 </pre></div>
2357 !! html/parsoid
2358 <p>a</p>
2359
2360 <div><pre>foo
2361 </pre></div>
2362 <pre></pre>
2363 !! end
2364
2365 !! test
2366 HTML pre followed by indent-pre
2367 !! wikitext
2368 <pre>foo</pre>
2369 bar
2370 !! html
2371 <pre>foo</pre>
2372 <pre>bar
2373 </pre>
2374 !! end
2375
2376 # Note that tidy removes the empty <p> tags from the start and end.
2377 # Parsoid does not, by design.
2378 !!test
2379 Block tag pre
2380 !! wikitext
2381 <p><pre>foo</pre></p>
2382 !! html/php+tidy
2383 <pre>
2384 foo
2385 </pre>
2386 !! html/parsoid
2387 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2388 !!end
2389
2390 !!test
2391 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2392 !! wikitext
2393 {{echo|}}
2394 !! html
2395
2396 !!end
2397
2398 !!test
2399 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2400 !! wikitext
2401 {{echo|
2402 foo}}
2403 !! html
2404 <p>foo
2405 </p>
2406 !!end
2407
2408 !! test
2409 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2410 !! wikitext
2411 {{echo|a
2412 b}}
2413 !! html
2414 <pre>a
2415 </pre>
2416 <p>b
2417 </p>
2418 !!end
2419
2420 !! test
2421 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2422 !! wikitext
2423 {{echo|a
2424 b
2425 c
2426 d
2427 e
2428 }}
2429 !! html
2430 <pre>a
2431 </pre>
2432 <p>b
2433 c
2434 </p>
2435 <pre>d
2436 </pre>
2437 <p>e
2438 </p>
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2443 !! wikitext
2444 {{echo| foo}}
2445
2446 {{echo| foo}}{{echo| bar}}
2447
2448 {{echo| foo}}
2449 {{echo| bar}}
2450
2451 {{echo|<!--cmt--> foo}}
2452
2453 <!--cmt-->{{echo| foo}}
2454
2455 {{echo|{{echo| }}bar}}
2456 !! html
2457 <pre>foo
2458 </pre>
2459 <pre>foo bar
2460 </pre>
2461 <pre>foo
2462 bar
2463 </pre>
2464 <pre>foo
2465 </pre>
2466 <pre>foo
2467 </pre>
2468 <pre>bar
2469 </pre>
2470 !!end
2471
2472 !! test
2473 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2474 !! wikitext
2475 {{echo| }}a
2476
2477 {{echo|
2478 }}a
2479
2480 {{echo|
2481 b}}
2482
2483 {{echo|a
2484 }}b
2485
2486 {{echo|a
2487 }} b
2488 !! html
2489 <pre>a
2490 </pre>
2491 <p><br />
2492 </p>
2493 <pre>a
2494 </pre>
2495 <p><br />
2496 </p>
2497 <pre>b
2498 </pre>
2499 <p>a
2500 </p>
2501 <pre>b
2502 </pre>
2503 <p>a
2504 </p>
2505 <pre>b
2506 </pre>
2507 !!end
2508
2509 !! test
2510 Pres with newline attributes
2511 !! wikitext
2512 <pre class="one
2513 two">hi</pre>
2514 !! html/php
2515 <pre class="one two">hi</pre>
2516
2517 !! html/parsoid
2518 <pre class="one
2519 two" data-parsoid='{"stx":"html"}'>hi</pre>
2520 !! end
2521
2522 !! test
2523 Things that look like <pre> tags aren't treated as such
2524 !! wikitext
2525 Barack Obama <President> of the United States
2526 <President></President>
2527 !! html
2528 <p>Barack Obama &lt;President&gt; of the United States
2529 &lt;President&gt;&lt;/President&gt;
2530 </p>
2531 !! end
2532
2533 !! test
2534 Handle broken pre-like tags (bug 64025)
2535 !! options
2536 parsoid=wt2html
2537 !! wikitext
2538 {{echo|<pre <pre>x</pre>}}
2539
2540 <table><pre </table>
2541 !! html/php
2542 <pre>x</pre>
2543 <table>&lt;pre </table>
2544
2545 !! html/php+tidy
2546 <pre>
2547 x
2548 </pre>
2549 <p>&lt;pre</p>
2550 !! html/parsoid
2551 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2552
2553
2554 <p>&lt;pre </p>
2555
2556 <table></table>
2557 !! end
2558
2559 !! test
2560 Parsoid: handle pre with space after attribute
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 <pre style="width:50%;" >{{echo|foo}}</pre>
2565 !! html/php
2566 <pre style="width:50%;">{{echo|foo}}</pre>
2567
2568 !! html/parsoid
2569 <pre style="width:50%;">{{echo|foo}}</pre>
2570 !! end
2571
2572 # TODO / maybe: fix wt2wt for this
2573 !! test
2574 Parsoid: Don't paragraph-wrap fosterable content
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2578 {|
2579 <td></td>
2580 <td></td>
2581
2582
2583
2584 |}
2585 !! html
2586 <table>
2587
2588 <tbody>
2589 <tr>
2590 <td></td>
2591
2592 <td></td></tr>
2593
2594
2595
2596 </tbody></table>
2597 !! end
2598
2599 !! test
2600 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 {|
2605 <td>
2606 <td>
2607 </td>
2608
2609
2610
2611 |}
2612 !! html
2613 <table>
2614
2615 <tbody>
2616 <tr>
2617 <td></td>
2618
2619 <td>
2620 </td></tr>
2621
2622
2623
2624 </tbody></table>
2625 !! end
2626
2627
2628 #--------------------------------------------------------------------
2629 # Transclusion parameter whitespace stripping tests
2630 # Behavior is different for positional and named parameters
2631 #--------------------------------------------------------------------
2632 !! test
2633 Templates: Strip leading and trailing whitespace from named-param values
2634 !! wikitext
2635 {{echo|1= a }}
2636
2637 {{echo|1= {{echo|b}} }}
2638
2639 {{echo| 1 =
2640 c }}
2641
2642 {{echo| 1 =
2643 * d
2644 }}
2645 !! html
2646 <p>a
2647 </p><p>b
2648 </p><p>c
2649 </p>
2650 <ul><li> d</li></ul>
2651
2652 !! end
2653
2654 !! test
2655 Templates: Don't strip whitespace from positional-param values
2656 !! wikitext
2657 {{echo|a }}
2658
2659 {{echo|{{echo|b}} }}
2660
2661 {{echo| c
2662 }}
2663
2664 {{echo| {{echo|d}}
2665 }}
2666
2667 {{echo|
2668 e}}
2669
2670 {{echo|
2671 * f}}
2672
2673 {{echo|
2674 }}g
2675 !! html
2676 <p>a
2677 </p><p>b
2678 </p>
2679 <pre>c
2680 </pre>
2681 <p><br />
2682 </p>
2683 <pre>d
2684 </pre>
2685 <p><br />
2686 </p>
2687 <pre>e
2688 </pre>
2689 <p><br />
2690 </p>
2691 <ul><li> f</li></ul>
2692 <p><br />
2693 </p>
2694 <pre>g
2695 </pre>
2696 !! end
2697
2698 !! test
2699 Templates: Handle empty comment-and-ws-only lines correctly
2700 !! wikitext
2701 {{echo|foo
2702 <!--should be ignored-->
2703 <!--should be ignored as well-->
2704 bar}}
2705 !! html
2706 <p>foo
2707 bar
2708 </p>
2709 !! end
2710
2711 !! test
2712 Templates: Handle comments in the target
2713 !! wikitext
2714 {{echo
2715 <!-- should be ignored -->
2716 |foo}}
2717
2718 {{echo<!-- should be ignored -->
2719 |foo}}
2720
2721 {{echo<!-- should be ignored -->|foo}}
2722
2723 {{<!-- should be ignored -->echo|foo}}
2724 !!html/parsoid
2725 <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>
2726
2727 <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>
2728
2729 <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>
2730
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2732 !!end
2733
2734 !! test
2735 Templates: Handle comments in parameter names (bug 67657)
2736 !! wikitext
2737 {{echo|1
2738 <!-- should be ignored -->
2739 =foo}}
2740
2741 {{echo|
2742 <!-- should be ignored -->
2743 1 = foo}}
2744
2745 {{echo|1<!-- should be ignored -->=foo}}
2746
2747 {{echo|<!-- should be ignored -->1=foo}}
2748 !!html/parsoid
2749 <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>
2750
2751 <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>
2752
2753 <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>
2754
2755 <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>
2756 !!end
2757
2758 !! test
2759 Templates: Other wikitext in parameter names (bug 67657)
2760 !! wikitext
2761 {{echo|''1''=foo}}
2762 !!html/parsoid
2763 <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>
2764 !!html/php
2765 <p>{{{1}}}
2766 </p>
2767 !!end
2768
2769 #--------------------------------------------------------------------
2770 # Transclusion parameter escaping tests
2771 #--------------------------------------------------------------------
2772 !! test
2773 Templates: Parsoid parameter escaping test 1
2774 !! wikitext
2775 {{echo|[foo]|{{echo|[bar]}}}}
2776 !! html/php+tidy
2777 <p>[foo]</p>
2778 !! html/parsoid
2779 <p about="#mwt1" typeof="mw:Transclusion"
2780 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2781 !! end
2782
2783 !! test
2784 Parsoid: Pipes in external links in template parameter
2785 !! wikitext
2786 {{echo|[{{echo|http://example.com}} link]}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2789 !! html/parsoid
2790 <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>
2791 !! end
2792
2793 !! test
2794 Parsoid: pipe in transclusion parameter
2795 !! wikitext
2796 {{echo|http://foo.com/a&#124;b}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 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>
2803 !! end
2804
2805 !! test
2806 Parsoid: Pipe in external link target and content in template parameter
2807 !! options
2808 parsoid=html2wt,wt2wt
2809 !! wikitext
2810 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2813 !! html/parsoid
2814 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2815 typeof="mw:Transclusion"
2816 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2817 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2818 !! end
2819
2820 !! test
2821 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2822 !! options
2823 parsoid
2824 !! wikitext
2825 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2826 !! html
2827 <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>
2828 !! end
2829
2830 !! test
2831 Templates: Don't escape already nowiki-escaped text in template parameters
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|foo<nowiki>|</nowiki>bar}}
2836 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2837 {{echo|<nowiki></nowiki>}}
2838 !! html/php+tidy
2839 <p>foo|bar &lt;div&gt;</p>
2840 !! html/parsoid
2841 <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>
2842 <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>
2843 <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>
2844 </p>
2845 !! end
2846
2847 ## Bug 52824
2848 !! test
2849 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2850 !! options
2851 parsoid=html2wt,wt2wt
2852 !! wikitext
2853 {{echo|{{echo|1=bar}}}}
2854 !! html/php+tidy
2855 <p>bar</p>
2856 !! html/parsoid
2857 <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>
2858 !! end
2859
2860 ## Bug 56733
2861 !! test
2862 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2863 !! wikitext
2864 {{echo|a : b}}
2865 !! html/php+tidy
2866 <p>a&#160;: b</p>
2867 !! html/parsoid
2868 <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>
2869 !! end
2870
2871 ## Bug T73412
2872 !! test
2873 Templates: Preserve blank parameter names
2874 !! wikitext
2875 {{echo|=foo}}
2876 !! html/php+tidy
2877 <p>{{{1}}}</p>
2878 !! html/parsoid
2879 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2880 !! end
2881
2882 !! test
2883 Templates: Preserve blank parameter names in other positions
2884 !! wikitext
2885 {{blank_param|bar|=foo}}
2886 !! html/php+tidy
2887 <p>bar foo</p>
2888 !! html/parsoid
2889 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2890 foo</p>
2891 !! end
2892
2893 ###
2894 ### Parsoid-centric tests for testing RT edge cases for pre
2895 ###
2896
2897 !!test
2898 1a. Indent-Pre and Comments
2899 !! wikitext
2900 a
2901 <!--a-->
2902 c
2903 !! html
2904 <pre>a
2905 </pre>
2906 <p>c
2907 </p>
2908 !!end
2909
2910 !!test
2911 1b. Indent-Pre and Comments
2912 !! wikitext
2913 a
2914 <!--a-->
2915 c
2916 !! html
2917 <pre>a
2918 </pre>
2919 <p>c
2920 </p>
2921 !!end
2922
2923 !!test
2924 1c. Indent-Pre and Comments
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--a--> a
2929 !! html
2930 <pre> a
2931 </pre>
2932 <pre> a
2933 </pre>
2934 !!end
2935
2936 !!test
2937 1d. Indent-Pre and Comments
2938 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2939 !! wikitext
2940 <!--a--> a
2941
2942 <!--b-->b
2943 !! html
2944 <pre>a
2945 </pre>
2946 <pre>b
2947 </pre>
2948 !!end
2949
2950 !!test
2951 2a. Indent-Pre and tables
2952 !! wikitext
2953 {|
2954 |-
2955 !h1!!h2
2956 |foo||bar
2957 |}
2958 !! html
2959 <table>
2960
2961 <tr>
2962 <th>h1</th>
2963 <th>h2
2964 </th>
2965 <td>foo</td>
2966 <td>bar
2967 </td></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2b. Indent-Pre and tables
2973 !! wikitext
2974 {|
2975 |-
2976 |foo
2977 |}
2978 !! html
2979 <table>
2980
2981 <tr>
2982 <td>foo
2983 </td></tr></table>
2984
2985 !!end
2986
2987 !!test
2988 2c. Indent-Pre and tables (bug 42252)
2989 !! wikitext
2990 {|
2991 |+ foo
2992 ! | bar
2993 |}
2994 !! html
2995 <table>
2996 <caption> foo
2997 </caption>
2998 <tr>
2999 <th> bar
3000 </th></tr></table>
3001
3002 !!end
3003
3004 !!test
3005 2d. Indent-Pre and tables
3006 !! wikitext
3007 a
3008 {|
3009 | b
3010 |}
3011 !! html/php
3012 <pre>a
3013 </pre>
3014 <table>
3015 <tr>
3016 <td> b
3017 </td></tr></table>
3018
3019 !! html/parsoid
3020 <pre>a</pre>
3021 <table>
3022 <tbody><tr><td> b</td></tr>
3023 </tbody></table>
3024 !!end
3025
3026 !!test
3027 2e. Indent-Pre and table-line syntax
3028 !! wikitext
3029 a
3030 | b
3031 | c
3032 !! html/php
3033 <pre>a
3034 | b
3035 | c
3036 </pre>
3037 !!end
3038
3039 !!test
3040 2f. Indent-pre started by table-line syntax
3041 !! wikitext
3042 a
3043 | b
3044 | c
3045 !! html/php
3046 <p>a
3047 </p>
3048 <pre>| b
3049 | c
3050 </pre>
3051 !! html/parsoid
3052 <p>a</p>
3053 <pre>
3054 | b
3055 | c</pre>
3056 !!end
3057
3058 !!test
3059 3a. Indent-Pre and block tags (single-line html)
3060 !! wikitext
3061 a <p> foo </p>
3062 b <div> foo </div>
3063 c <blockquote> foo </blockquote>
3064 <span> foo </span>
3065 !! html
3066 a <p> foo </p>
3067 b <div> foo </div>
3068 c <blockquote> foo </blockquote>
3069 <pre><span> foo </span>
3070 </pre>
3071 !! html/parsoid
3072 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3073 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3074 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3075 <pre><span> foo </span>
3076 </pre>
3077 !! html+tidy
3078 <p>a</p>
3079 <p>foo</p>
3080 <p>b</p>
3081 <div>foo</div>
3082 <p>c</p>
3083 <blockquote>
3084 <p>foo</p>
3085 </blockquote>
3086 <pre>
3087 <span> foo </span>
3088 </pre>
3089 !! end
3090
3091 !!test
3092 3b. Indent-Pre and block tags (multi-line html)
3093 !! wikitext
3094 a <span>foo</span>
3095 b <div> foo </div>
3096 !! html
3097 <pre>a <span>foo</span>
3098 </pre>
3099 b <div> foo </div>
3100
3101 !! html/parsoid
3102 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3103 b <div data-parsoid='{"stx":"html"}'> foo </div>
3104 !! html+tidy
3105 <pre>
3106 a <span>foo</span>
3107 </pre>
3108 <p>b</p>
3109 <div>foo</div>
3110 !!end
3111
3112 !!test
3113 3c. Indent-Pre and block tags (pre-content on separate line)
3114 !! wikitext
3115 <p>
3116 foo
3117 </p>
3118
3119 <div>
3120 foo
3121 </div>
3122
3123 <center>
3124 foo
3125 </center>
3126
3127 <blockquote>
3128 foo
3129 </blockquote>
3130
3131 <blockquote>
3132 <pre>
3133 foo
3134 </pre>
3135 </blockquote>
3136
3137 <table><tr><td>
3138 foo
3139 </td></tr></table>
3140
3141 <ul><li>
3142 foo
3143 </li></ul>
3144
3145 !! html
3146 <p>
3147 foo
3148 </p>
3149 <div>
3150 <pre>foo
3151 </pre>
3152 </div>
3153 <center>
3154 <pre>foo
3155 </pre>
3156 </center>
3157 <blockquote>
3158 <p> foo
3159 </p>
3160 </blockquote>
3161 <blockquote>
3162 <pre>
3163 foo
3164 </pre>
3165 </blockquote>
3166 <table><tr><td>
3167 <pre>foo
3168 </pre>
3169 </td></tr></table>
3170 <ul><li>
3171 foo
3172 </li></ul>
3173
3174 !!end
3175
3176 !!test
3177 4. Indent-Pre and extension tags
3178 !! wikitext
3179 a <gallery>
3180 File:foobar.jpg
3181 </gallery>
3182 !! html
3183 a <ul class="gallery mw-gallery-traditional">
3184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3185 <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>
3186 <div class="gallerytext">
3187 </div>
3188 </div></li>
3189 </ul>
3190
3191 !! html+tidy
3192 <p>a</p>
3193 <ul class="gallery mw-gallery-traditional">
3194 <li class="gallerybox" style="width: 155px">
3195 <div style="width: 155px">
3196 <div class="thumb" style="width: 150px;">
3197 <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>
3198 </div>
3199 <div class="gallerytext"></div>
3200 </div>
3201 </li>
3202 </ul>
3203 !!end
3204
3205 !! test
3206 Table wikitext syntax outside wiki-tables
3207 !! wikitext
3208 a
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3213 b
3214 |}
3215 |-
3216 c
3217 !! html
3218 <p>a
3219 ! not a table heading
3220 |- not a table row
3221 | not a table cell
3222 | class="foo bar" | baz
3223 b
3224 |}
3225 |-
3226 c
3227 </p>
3228 !! end
3229
3230 !!test
3231 Render paragraphs when indent-pre is suppressed in blocklevels
3232 !! wikitext
3233 <blockquote>
3234 foo
3235
3236 bar
3237 </blockquote>
3238 !! html
3239 <blockquote>
3240 <p> foo
3241 </p><p> bar
3242 </p>
3243 </blockquote>
3244
3245 !!end
3246
3247 !!test
3248 4. Multiple spaces at start-of-line
3249 !! wikitext
3250 <p> foo </p>
3251 foo
3252 {|
3253 |foo
3254 |}
3255 !! html
3256 <p> foo </p>
3257 <pre> foo
3258 </pre>
3259 <table>
3260 <tr>
3261 <td>foo
3262 </td></tr></table>
3263
3264 !!end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5a. White-space in indent-pre
3269 !! wikitext
3270 a<br />
3271
3272 b
3273 !! html
3274 <pre>a<br />
3275
3276 b
3277 </pre>
3278 !! end
3279
3280 ## NOTE: the leading white-space chars on empty line are significant
3281 !! test
3282 5b. White-space in indent-pre
3283 !! wikitext
3284 a
3285
3286 b
3287
3288
3289 c
3290 !! html
3291 <pre>a
3292
3293 b
3294
3295
3296 c
3297 </pre>
3298 !! end
3299
3300 !! test
3301 5c. White-space in indent-pre
3302 !! wikitext
3303 ''a''
3304 ''b''
3305 ''c''
3306 !! html
3307 <pre><i>a</i>
3308 <i>b</i>
3309 <i>c</i>
3310 </pre>
3311 !! end
3312
3313 !! test
3314 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3315 !! wikitext
3316 a
3317
3318 <!-- continue -->
3319 b
3320
3321 c
3322
3323 d
3324 !! html
3325 <pre>a
3326
3327 b
3328 </pre>
3329 <pre>c
3330
3331 </pre>
3332 <p>d
3333 </p>
3334 !! end
3335
3336 !! test
3337 7a. Indent-pre and category links
3338 !! options
3339 parsoid=wt2html,wt2wt
3340 !! wikitext
3341 [[Category:foo]] <!-- No pre-wrapping -->
3342 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3343 !! html/php+tidy
3344 !! html/parsoid
3345 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3346 <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 -->
3347 !! end
3348
3349 ## We used to, but no longer wt2wt this test since the default serializer
3350 ## will normalize all categories to serialize on their own line.
3351 ## This wikitext usage is going to be fairly uncommon in production and
3352 ## selser will take care of preserving formatting in those scenarios.
3353 !! test
3354 7b. Indent-pre and category links
3355 !! options
3356 parsoid=wt2html
3357 !! wikitext
3358 [[Category:foo]] a
3359 [[Category:foo]] {{echo|b}}
3360 !! html/parsoid
3361 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3362 <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>
3363 !! end
3364
3365 !! test
3366 Indent-Pre: Newlines in comments shouldn't affect sol state
3367 !! wikitext
3368 a <!--
3369 foo
3370 --> b
3371 !! html/php+tidy
3372 <p>a b</p>
3373 !! html/parsoid
3374 <p>a <!--
3375 foo
3376 --> b</p>
3377 !! end
3378
3379 ###
3380 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3381 ###
3382
3383 !!test
3384 HTML-pre: 1. embedded newlines
3385 !! wikitext
3386 <pre>foo</pre>
3387
3388 <pre>
3389 foo
3390 </pre>
3391
3392 <pre>
3393
3394 foo
3395 </pre>
3396
3397 <pre>
3398
3399
3400 foo
3401 </pre>
3402 !! html/php+tidy
3403 <pre>
3404 foo
3405 </pre>
3406 <pre>
3407 foo
3408 </pre>
3409 <pre>
3410
3411 foo
3412 </pre>
3413 <pre>
3414
3415
3416 foo
3417 </pre>
3418 !! html/parsoid
3419 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3420
3421 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3422 foo
3423 </pre>
3424
3425 <pre data-parsoid='{"stx":"html"}'>
3426
3427 foo
3428 </pre>
3429
3430 <pre data-parsoid='{"stx":"html"}'>
3431
3432
3433 foo
3434 </pre>
3435 !!end
3436
3437 !! test
3438 HTML-pre: big spaces
3439 !! wikitext
3440 <pre>
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 haha
3451
3452
3453
3454
3455 </pre>
3456 !! html/php+tidy
3457 <pre>
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 haha
3468
3469
3470
3471
3472 </pre>
3473 !! html/parsoid
3474 <pre data-parsoid='{"stx":"html"}'>
3475
3476
3477
3478
3479 haha
3480
3481
3482
3483
3484 haha
3485
3486
3487
3488
3489 </pre>
3490 !! end
3491
3492 !!test
3493 HTML-pre: 2: indented text
3494 !! wikitext
3495 <pre>
3496 foo
3497 </pre>
3498 !! html
3499 <pre>
3500 foo
3501 </pre>
3502
3503 !!end
3504
3505 !!test
3506 HTML-pre: 3: other wikitext
3507 !! wikitext
3508 <pre>
3509 * foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !! html/php
3516 <pre>
3517 * foo
3518 # bar
3519 = no-h =
3520 '' no-italic ''
3521 [[ NoLink ]]
3522 </pre>
3523
3524 !! html/parsoid
3525 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3526 # bar
3527 = no-h =
3528 '' no-italic ''
3529 [[ NoLink ]]
3530 </pre>
3531 !!end
3532
3533 ###
3534 ### Definition lists
3535 ###
3536 !! test
3537 Simple definition
3538 !! wikitext
3539 ; name : Definition
3540 !! html
3541 <dl><dt> name&#160;</dt>
3542 <dd> Definition</dd></dl>
3543
3544 !! end
3545
3546 !! test
3547 Definition list for indentation only
3548 !! wikitext
3549 : Indented text
3550 !! html
3551 <dl><dd> Indented text</dd></dl>
3552
3553 !! end
3554
3555 !! test
3556 Definition list with no space
3557 !! wikitext
3558 ;name:Definition
3559 !! html
3560 <dl><dt>name</dt>
3561 <dd>Definition</dd></dl>
3562
3563 !!end
3564
3565 !! test
3566 Definition list with URL link
3567 !! wikitext
3568 ; http://example.com/ : definition
3569 !! html
3570 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3571 <dd> definition</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list with bracketed URL link
3577 !! wikitext
3578 ;[http://www.example.com/ Example]:Something about it
3579 !! html
3580 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3581 <dd>Something about it</dd></dl>
3582
3583 !! end
3584
3585 !! test
3586 Definition list with wikilink containing colon
3587 !! wikitext
3588 ; [[Help:FAQ]]: The least-read page on Wikipedia
3589 !! html
3590 <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>
3591 <dd> The least-read page on Wikipedia</dd></dl>
3592
3593 !! end
3594
3595 # At Brion's and JeLuF's insistence... :)
3596 !! test
3597 Definition list with news link containing colon
3598 !! wikitext
3599 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3600 !! html/php
3601 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3602 <dd> This isn't even a real newsgroup!</dd></dl>
3603
3604 !! html/parsoid
3605 <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>
3606 !! end
3607
3608 !! test
3609 Malformed definition list with colon
3610 !! wikitext
3611 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3612 !! html
3613 <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>
3614
3615 !! end
3616
3617 !! test
3618 Definition lists: colon in external link text
3619 !! wikitext
3620 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3621 !! html
3622 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3623 <dd> OK, I made that up</dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition lists: colon in HTML attribute
3629 !! wikitext
3630 ;<b style="display: inline">bold</b>
3631 !! html
3632 <dl><dt><b style="display: inline">bold</b></dt></dl>
3633
3634 !! end
3635
3636 !! test
3637 Definition lists: self-closed tag
3638 !! wikitext
3639 ;one<br/>two : two-line fun
3640 !! html
3641 <dl><dt>one<br />two&#160;</dt>
3642 <dd> two-line fun</dd></dl>
3643
3644 !! end
3645
3646 !! test
3647 Bug 11748: Literal closing tags
3648 !! wikitext
3649 <dl>
3650 <dt>test 1</dt>
3651 <dd>test test test test test</dd>
3652 <dt>test 2</dt>
3653 <dd>test test test test test</dd>
3654 </dl>
3655 !! html
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3662
3663 !! end
3664
3665 !! test
3666 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3667 !! wikitext
3668 <ul><li>
3669 ; term : description
3670 * unordered
3671 </li></ul>
3672 !! html
3673 <ul><li>
3674 <dl><dt> term&#160;</dt>
3675 <dd> description</dd></dl>
3676 <ul><li> unordered</li></ul>
3677 </li></ul>
3678
3679 !! end
3680
3681 !! test
3682
3683 Definition list with empty definition and following paragraph
3684 !! wikitext
3685 ; term:
3686 Paragraph text
3687 !! html
3688 <dl><dt> term</dt>
3689 <dd></dd></dl>
3690 <p>Paragraph text
3691 </p>
3692 !! end
3693
3694 !! test
3695 Nested definition lists using html syntax
3696 !! wikitext
3697 <dl><dt>x</dt>
3698 <dd>a</dd>
3699 <dd>b</dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: No nesting: Multiple dd's
3705 !! wikitext
3706 ;x
3707 :a
3708 :b
3709 !! html
3710 <dl><dt>x</dt>
3711 <dd>a</dd>
3712 <dd>b</dd></dl>
3713
3714 !! end
3715
3716 !! test
3717 Definition Lists: Indentation: Regular
3718 !! wikitext
3719 :i1
3720 ::i2
3721 :::i3
3722 !! html
3723 <dl><dd>i1
3724 <dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Missing 1st level
3731 !! wikitext
3732 ::i2
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3737
3738 !! end
3739
3740 !! test
3741 Definition Lists: Indentation: Multi-level indent
3742 !! wikitext
3743 :::i3
3744 !! html
3745 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3746
3747 !! end
3748
3749 !! test
3750 Definition Lists: Hacky use to indent tables
3751 !! wikitext
3752 ::{|
3753 |foo
3754 |bar
3755 |}
3756 this text
3757 should be left alone
3758 !! html
3759 <dl><dd><dl><dd><table>
3760 <tr>
3761 <td>foo
3762 </td>
3763 <td>bar
3764 </td></tr></table></dd></dl></dd></dl>
3765 <p>this text
3766 should be left alone
3767 </p>
3768 !! end
3769
3770 !! test
3771 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3772 !! wikitext
3773 <!-- foo -->
3774 ::{|
3775 |foo
3776 |bar
3777 |}<!-- bar -->
3778 this text
3779 should be left alone
3780 !! html/parsoid
3781 <!-- foo -->
3782 <dl><dd><dl><dd><table><tr>
3783 <td>foo</td>
3784 <td>bar</td>
3785 </tr></table><!-- bar --></dd></dl></dd></dl>
3786 <p>this text
3787 should be left alone</p>
3788 !! end
3789
3790 !! test
3791 Definition Lists: Hacky use to indent tables, with comment before table
3792 !! wikitext
3793 ::<!-- foo -->{|
3794 |foo
3795 |}
3796 !! html/parsoid
3797 <dl><dd><dl><dd><!-- foo --><table><tr>
3798 <td>foo</td>
3799 </tr></table></dd></dl></dd></dl>
3800 !! end
3801
3802 # The trailing whitespace in this test is to catch a regression in
3803 # Parsoid after T54473.
3804 !! test
3805 Definition Lists: Hacky use to indent tables (WS-insensitive)
3806 !! wikitext
3807 : {|
3808 |a
3809 |}
3810 !! html/php
3811 <dl><dd><table>
3812 <tr>
3813 <td>a
3814 </td></tr></table></dd></dl>
3815
3816 !! html/parsoid
3817 <dl><dd> <table>
3818 <tbody><tr><td>a</td></tr>
3819 </tbody></table> </dd></dl>
3820 !! end
3821
3822 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3823 ## as an empty dt item. It also ignores all but the last ";" when followed
3824 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3825 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3826 ## ";"s.
3827 ##
3828 ## Ex: ";;t2 ::d2" is transformed into:
3829 ##
3830 ## <dl>
3831 ## <dt>t2 </dt>
3832 ## <dd>
3833 ## <dl>
3834 ## <dt></dt>
3835 ## <dd>d2</dd>
3836 ## </dl>
3837 ## </dd>
3838 ## </dl>
3839 ##
3840 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3841 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3842 ##
3843 ## <dl>
3844 ## <dt>
3845 ## <dl>
3846 ## <dt>t2 </dt>
3847 ## <dd>:d2</dd>
3848 ## </dl>
3849 ## </dt>
3850 ## </dl>
3851 ##
3852 ## All Parsoid only definition list tests have this difference.
3853 ##
3854 ## See also: https://phabricator.wikimedia.org/T8569
3855 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3856
3857 !! test
3858 Table / list interaction: indented table with lists in table contents
3859 !! wikitext
3860 :{|
3861 |-
3862 | a
3863 * b
3864 |-
3865 | c
3866 * d
3867 |}
3868 !! html
3869 <dl><dd><table>
3870
3871 <tr>
3872 <td> a
3873 <ul><li> b</li></ul>
3874 </td></tr>
3875 <tr>
3876 <td> c
3877 <ul><li> d</li></ul>
3878 </td></tr></table></dd></dl>
3879
3880 !! end
3881
3882 !!test
3883 Table / list interaction: lists nested in tables nested in indented lists
3884 !! wikitext
3885 :{|
3886 |
3887 :a
3888 :b
3889 |
3890 *c
3891 *d
3892 |}
3893
3894 *e
3895 *f
3896 !! html
3897 <dl><dd><table>
3898 <tr>
3899 <td>
3900 <dl><dd>a</dd>
3901 <dd>b</dd></dl>
3902 </td>
3903 <td>
3904 <ul><li>c</li>
3905 <li>d</li></ul>
3906 </td></tr></table></dd></dl>
3907 <ul><li>e</li>
3908 <li>f</li></ul>
3909
3910 !!end
3911
3912 !! test
3913 Definition Lists: Nesting: Multi-level (Parsoid only)
3914 !! options
3915 parsoid
3916 !! wikitext
3917 ;t1 :d1
3918 ;;t2 ::d2
3919 ;;;t3 :::d3
3920 !! html
3921 <dl>
3922 <dt>t1 </dt>
3923 <dd>d1</dd>
3924 <dt>
3925 <dl>
3926 <dt>t2 </dt>
3927 <dd>:d2</dd>
3928 <dt>
3929 <dl>
3930 <dt>t3 </dt>
3931 <dd>::d3</dd>
3932 </dl>
3933 </dt>
3934 </dl>
3935 </dt>
3936 </dl>
3937
3938
3939 !! end
3940
3941
3942 !! test
3943 Definition Lists: Nesting: Test 2 (Parsoid only)
3944 !! wikitext
3945 ;t1
3946 ::d2
3947 !! html/php+tidy
3948 <dl>
3949 <dt>t1</dt>
3950 <dd>
3951 <dl>
3952 <dd>d2</dd>
3953 </dl>
3954 </dd>
3955 </dl>
3956 !! html/parsoid
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965
3966 !! end
3967
3968
3969 !! test
3970 Definition Lists: Nesting: Test 3 (Parsoid only)
3971 !! wikitext
3972 :;t1
3973 ::::d2
3974 !! html/php+tidy
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dt>t1</dt>
3979 <dd>
3980 <dl>
3981 <dd>
3982 <dl>
3983 <dd>d2</dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 !! html/parsoid
3992 <dl>
3993 <dd>
3994 <dl>
3995 <dt>t1</dt>
3996 <dd>
3997 <dl>
3998 <dd>
3999 <dl>
4000 <dd>d2</dd>
4001 </dl>
4002 </dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 </dd>
4007 </dl>
4008
4009 !! end
4010
4011
4012 !! test
4013 Definition Lists: Nesting: Test 4
4014 !! wikitext
4015 ::;t3
4016 :::d3
4017 !! html
4018 <dl><dd><dl><dd><dl><dt>t3</dt>
4019 <dd>d3</dd></dl></dd></dl></dd></dl>
4020
4021 !! end
4022
4023
4024 ## The Parsoid team believes the following three test exposes a
4025 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4026 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4027 ## It also exposes a "misfeature" in tidy, which doesn't like
4028 ## <dl> tags with a single <dt> child; it converts the <dt> into
4029 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4030 !! test
4031 Definition Lists: Mixed Lists: Test 1
4032 !! wikitext
4033 :;* foo
4034 ::* bar
4035 :; baz
4036 !! html/php
4037 <dl><dd><dl><dt><ul><li> foo</li>
4038 <li> bar</li></ul></dt></dl>
4039 <dl><dt> baz</dt></dl></dd></dl>
4040
4041 !! html/php+tidy
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dd>
4046 <ul>
4047 <li>foo</li>
4048 <li>bar</li>
4049 </ul>
4050 </dd>
4051 </dl>
4052 <dl>
4053 <dt>baz</dt>
4054 </dl>
4055 </dd>
4056 </dl>
4057 !! html/parsoid
4058 <dl>
4059 <dd><dl>
4060 <dt><ul>
4061 <li> foo
4062 </li>
4063 </ul></dt>
4064 <dd><ul>
4065 <li> bar
4066 </li>
4067 </ul></dd>
4068 <dt> baz</dt>
4069 </dl></dd>
4070 </dl>
4071 !! end
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 2
4075 !! wikitext
4076 *: d1
4077 *: d2
4078 !! html
4079 <ul><li><dl><dd> d1</dd>
4080 <dd> d2</dd></dl></li></ul>
4081
4082 !! end
4083
4084
4085 !! test
4086 Definition Lists: Mixed Lists: Test 3
4087 !! wikitext
4088 *::: d1
4089 *::: d2
4090 !! html
4091 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4092 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 4
4099 !! wikitext
4100 *;d1 :d2
4101 *;d3 :d4
4102 !! html
4103 <ul><li><dl><dt>d1&#160;</dt>
4104 <dd>d2</dd>
4105 <dt>d3&#160;</dt>
4106 <dd>d4</dd></dl></li></ul>
4107
4108 !! end
4109
4110
4111 !! test
4112 Definition Lists: Mixed Lists: Test 5
4113 !! wikitext
4114 *:d1
4115 *:: d2
4116 !! html
4117 <ul><li><dl><dd>d1
4118 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4119
4120 !! end
4121
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 6
4125 !! wikitext
4126 #*:d1
4127 #*::: d3
4128 !! html
4129 <ol><li><ul><li><dl><dd>d1
4130 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 7
4137 !! wikitext
4138 :* d1
4139 :* d2
4140 !! html
4141 <dl><dd><ul><li> d1</li>
4142 <li> d2</li></ul></dd></dl>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 8
4149 !! wikitext
4150 :* d1
4151 ::* d2
4152 !! html
4153 <dl><dd><ul><li> d1</li></ul>
4154 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 9
4161 !! wikitext
4162 *;foo :bar
4163 !! html
4164 <ul><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ul>
4166
4167 !! end
4168
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 10
4172 !! wikitext
4173 *#;foo :bar
4174 !! html
4175 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ol></li></ul>
4177
4178 !! end
4179
4180 # The Parsoid team disagrees with the PHP parser's seemingly-random
4181 # rules regarding dd/dt on the next two tests. Parsoid is more
4182 # consistent, and recognizes the shared nesting and keeps the
4183 # still-open tags around until the nesting is complete.
4184 # (And tidy again converts <dt> to <dd> before 'bar'.)
4185
4186 !! test
4187 Definition Lists: Mixed Lists: Test 11
4188 !! wikitext
4189 *#*#;*;;foo :bar
4190 *#*#;boo :baz
4191 !! html/php
4192 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4193 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4194 <dl><dt>boo&#160;</dt>
4195 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4196
4197 !! html/php+tidy
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>foo&#160;</dt>
4208 <dd>
4209 <ul>
4210 <li>
4211 <dl>
4212 <dd>
4213 <dl>
4214 <dt>bar</dt>
4215 </dl>
4216 </dd>
4217 </dl>
4218 </li>
4219 </ul>
4220 </dd>
4221 </dl>
4222 <dl>
4223 <dt>boo&#160;</dt>
4224 <dd>baz</dd>
4225 </dl>
4226 </li>
4227 </ol>
4228 </li>
4229 </ul>
4230 </li>
4231 </ol>
4232 </li>
4233 </ul>
4234 !! html/parsoid
4235 <ul>
4236 <li>
4237 <ol>
4238 <li>
4239 <ul>
4240 <li>
4241 <ol>
4242 <li>
4243 <dl>
4244 <dt>
4245 <ul>
4246 <li>
4247 <dl>
4248 <dt>
4249 <dl>
4250 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4251 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4252 </dl></dt>
4253 </dl></li>
4254 </ul></dt>
4255 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4256 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4257 </dl></li>
4258 </ol></li>
4259 </ul></li>
4260 </ol></li>
4261 </ul>
4262 !! end
4263
4264
4265 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4266 # From whitelist:
4267 # * The test is wrong, there are two colons where there should be :;
4268 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4269 !! test
4270 Definition Lists: Weird Ones: Test 1
4271 !! wikitext
4272 *#;*::;; foo : bar (who uses this?)
4273 !! html/php
4274 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4275 <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>
4276
4277 !! html/php+tidy
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <dl>
4283 <dt>foo&#160;</dt>
4284 <dd>
4285 <ul>
4286 <li>
4287 <dl>
4288 <dd>
4289 <dl>
4290 <dd>
4291 <dl>
4292 <dd>
4293 <dl>
4294 <dt>bar (who uses this?)</dt>
4295 </dl>
4296 </dd>
4297 </dl>
4298 </dd>
4299 </dl>
4300 </dd>
4301 </dl>
4302 </li>
4303 </ul>
4304 </dd>
4305 </dl>
4306 </li>
4307 </ol>
4308 </li>
4309 </ul>
4310 !! html/parsoid
4311 <ul>
4312 <li>
4313 <ol>
4314 <li>
4315 <dl>
4316 <dt>
4317 <ul>
4318 <li>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dt>
4325 <dl>
4326 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4327 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4328 </dl></dt>
4329 </dl></dd>
4330 </dl></dd>
4331 </dl></li>
4332 </ul></dt>
4333 </dl></li>
4334 </ol></li>
4335 </ul>
4336 !! end
4337
4338 !! test
4339 Definition Lists: colons occurring in tags
4340 !! wikitext
4341 ;a:b
4342 ;'''a:b'''
4343 ;<i>a:b</i>
4344 ;<span>a:b</span>
4345 ;<div>a:b</div>
4346 ;<div>a
4347 :b</div>
4348 ;{{echo|a:b}}
4349 ;{{echo|''a:b''}}
4350 ;;;''a:b''
4351 !! html+tidy
4352 <dl>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><b>a:b</b></dt>
4356 <dt><i>a:b</i></dt>
4357 <dt><span>a:b</span></dt>
4358 <dd>
4359 <div>a:b</div>
4360 </dd>
4361 <dd>
4362 <div>a
4363 <dl>
4364 <dd>b</dd>
4365 </dl>
4366 </div>
4367 </dd>
4368 <dt>a</dt>
4369 <dd>b</dd>
4370 <dt><i>a:b</i></dt>
4371 </dl>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt><i>a:b</i></dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 !! html/parsoid
4384 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4385 <dt><b>a:b</b></dt>
4386 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4387 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4388 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4389 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4390 <dd>b</dd>
4391 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4392 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4393 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4394 !! end
4395
4396 !! test
4397 Definition Lists: colons and tables 1
4398 !! wikitext
4399 :{|
4400 | x
4401 |}
4402 :{|
4403 | y
4404 |}
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td> x
4409 </td></tr></table></dd></dl>
4410 <dl><dd><table>
4411 <tr>
4412 <td> y
4413 </td></tr></table></dd></dl>
4414
4415 !! end
4416
4417 # Parsoid's output (as documented below) differs from php's in this case.
4418 # This is probably a bug. If we fixup parsoid to match php's output, the
4419 # above test should pass and the below test case can be removed. It is
4420 # unclear which output is more desirable.
4421
4422 !! test
4423 Definition Lists: colons and tables 2
4424 !! wikitext
4425 :{|
4426 | x
4427 |}
4428 :{|
4429 | y
4430 |}
4431 !! html/parsoid
4432 <dl><dd><table>
4433 <tr>
4434 <td> x
4435 </td></tr></table></dd>
4436 <dd><table>
4437 <tr>
4438 <td> y
4439 </td></tr></table></dd></dl>
4440 !! end
4441
4442 !! test
4443 Definition Lists: template interaction
4444 !! wikitext
4445 ::{{definition_list}}
4446
4447 :one
4448 ::{{definition_list}}
4449 :::two
4450 :::three
4451 ::four
4452 !! html/parsoid
4453 <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">
4454 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4455
4456 <dl><dd data-parsoid='{}'>one
4457 <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">
4458 </span><dd about="#mwt2">two
4459 <dl><dd>two</dd>
4460 <dd>three</dd></dl></dd>
4461 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4462 !! end
4463
4464
4465 ###
4466 ### External links
4467 ###
4468 !! test
4469 External links: non-bracketed
4470 !! wikitext
4471 Non-bracketed: http://example.com
4472 !! html
4473 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4474 </p>
4475 !! end
4476
4477 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4478 !! test
4479 External links: numbered
4480 !! wikitext
4481 Numbered: [http://example.com]
4482 Numbered: [http://example.net]
4483 Numbered: [http://example.com]
4484 !! html/php
4485 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4486 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4487 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4488 </p>
4489 !! html/parsoid
4490 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4491 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4492 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4493 !!end
4494
4495 !! test
4496 External links: specified text
4497 !! wikitext
4498 Specified text: [http://example.com link]
4499 !! html
4500 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4501 </p>
4502 !!end
4503
4504 !! test
4505 External links: trail
4506 !! wikitext
4507 Linktrails should not work for external links: [http://example.com link]s
4508 !! html
4509 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4510 </p>
4511 !! end
4512
4513 !! test
4514 External links: dollar sign in URL
4515 !! wikitext
4516 http://example.com/1$2345
4517 !! html
4518 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4519 </p>
4520 !! end
4521
4522 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4523 !! test
4524 External links: dollar sign in URL (autonumber)
4525 !! wikitext
4526 [http://example.com/1$2345]
4527 !! html/php
4528 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4529 </p>
4530 !! html/parsoid
4531 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4532 !!end
4533
4534 !! test
4535 External links: open square bracket forbidden in URL (bug 4377)
4536 !! options
4537 parsoid=wt2html,wt2wt,html2html
4538 !! wikitext
4539 http://example.com/1[2345
4540 !! html/php
4541 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4542 </p>
4543 !! html/parsoid
4544 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4545 !! end
4546
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 !! options
4550 parsoid=wt2html,html2html
4551 !! wikitext
4552 [http://example.com/1[2345]
4553 !! html/php
4554 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4555 </p>
4556 !! html/parsoid
4557 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4558 !!end
4559
4560 # parsoid adds a space before the link name
4561 !! test
4562 External links: open square bracket forbidden in URL (named) (bug 4377)
4563 Parsoid variant.
4564 !! wikitext
4565 [http://example.com/1 [2345]
4566 !! html
4567 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4568 </p>
4569 !!end
4570
4571 !! test
4572 External links: nowiki in URL link text (bug 6230)
4573 !! wikitext
4574 [http://example.com/ <nowiki>''example site''</nowiki>]
4575 !! html
4576 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4577 </p>
4578 !! end
4579
4580 !! test
4581 External links: newline forbidden in text (bug 6230 regression check)
4582 !! wikitext
4583 [http://example.com/ first
4584 second]
4585 !! html
4586 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4587 second]
4588 </p>
4589 !!end
4590
4591 !! test
4592 External links: Pipe char between url and text
4593 !! wikitext
4594 [http://example.com | link]
4595 !! html
4596 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4597 </p>
4598 !!end
4599
4600 !! test
4601 External links: protocol-relative URL in brackets
4602 !! wikitext
4603 [//example.com/ Test]
4604 !! html
4605 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4606 </p>
4607 !! end
4608
4609 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4610 !! test
4611 External links: protocol-relative URL in brackets without text
4612 !! wikitext
4613 [//example.com]
4614 !! html/php
4615 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4616 </p>
4617 !! html/parsoid
4618 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4619 !! end
4620
4621 !! test
4622 External links: protocol-relative URL in free text is left alone
4623 !! wikitext
4624 //example.com/Foo
4625 !! html
4626 <p>//example.com/Foo
4627 </p>
4628 !!end
4629
4630 !! test
4631 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4632 !! wikitext
4633 foo//example.com/Foo
4634 !! html
4635 <p>foo//example.com/Foo
4636 </p>
4637 !! end
4638
4639 !! test
4640 External links: with no contents
4641 !! wikitext
4642 [http://en.wikipedia.org/wiki/Foo]
4643
4644 [[wikipedia:Foo|Bar]]
4645
4646 [[wikipedia:Foo|<span>Bar</span>]]
4647 !! html/php
4648 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4649 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4650 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4654 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4655 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4656 !! end
4657
4658 !! test
4659 External links: Free with trailing punctuation
4660 !! wikitext
4661 http://example.com,
4662 http://example.com;
4663 http://example.com\
4664 http://example.com.
4665 http://example.com:
4666 http://example.com!
4667 http://example.com?
4668 http://example.com)
4669 http://example.com/url_with_(brackets)
4670 (http://example.com/url_without_brackets)
4671 http://example.com/url_with_entity&amp;
4672 http://example.com/url_with_entity&#x26;
4673 http://example.com/url_with_entity&#038;
4674 http://example.com/url_with_entity&nbsp;
4675 http://example.com/url_with_entity&#xA0;
4676 http://example.com/url_with_entity&#160;
4677 http://example.com/url_with_entity&lt;
4678 http://example.com/url_with_entity&#x3C;
4679 http://example.com/url_with_entity&#60;
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4686 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4687 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4688 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4690 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4698 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4699 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4700 </p>
4701 !! html/parsoid
4702 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4707 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4708 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4709 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4711 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4712 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4713 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4714 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4715 <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>
4716 <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>
4717 <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>
4718 <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>
4719 <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>
4720 <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>
4721 !! end
4722
4723 !! test
4724 External links: tricky Parsoid html2html case
4725 !! options
4726 parsoid=wt2html,wt2wt,html2html
4727 !! wikitext
4728 http://example.com/url_with_entity&amp;amp;
4729 !! html/php
4730 <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>;
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4734 !! end
4735
4736 !! test
4737 External links: Free with trailing quotes (T113666)
4738 !! wikitext
4739 '''News:''' Stuff here
4740
4741 news:'a'b''c''d e
4742 !! html/php
4743 <p><b>News:</b> Stuff here
4744 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4745 </p>
4746 !! html/parsoid
4747 <p><b>News:</b> Stuff here</p>
4748 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4749 !! end
4750
4751 !! test
4752 External links: Lone protocols are never linked (T105697)
4753 !! wikitext
4754 http://
4755 http://;
4756 (http://)
4757 bitcoin:
4758 bitcoin:;
4759 (bitcoin:)
4760 !! html
4761 <p>http://
4762 http://;
4763 (http://)
4764 bitcoin:
4765 bitcoin:;
4766 (bitcoin:)
4767 </p>
4768 !! end
4769
4770 !! test
4771 External links: No preceding word characters allowed (bug 65278)
4772 !! wikitext
4773 NOPEhttp://example.com
4774 N0http://example.com
4775 ok:http://example.com
4776 ok-http://example.com
4777 !! html
4778 <p>NOPEhttp://example.com
4779 N0http://example.com
4780 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4781 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4782 </p>
4783 !! end
4784
4785 !! test
4786 External links: nofollow domain exception
4787 !! wikitext
4788 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4789 !! html
4790 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4791 </p>
4792 !!end
4793
4794 !! test
4795 External image
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4800 </p>
4801 !! end
4802
4803 !! test
4804 External image from https
4805 !! wikitext
4806 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4807 !! html
4808 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External image (when not allowed)
4814 !! options
4815 wgAllowExternalImages=0
4816 !! wikitext
4817 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <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>
4820 </p>
4821 !! end
4822
4823 !! test
4824 Link to non-http image, no img tag
4825 !! wikitext
4826 Link to non-http image, no img tag: ftp://example.com/test.jpg
4827 !! html
4828 <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>
4829 </p>
4830 !! end
4831
4832 !! test
4833 External links: terminating separator
4834 !! wikitext
4835 Terminating separator: http://example.com/thing,
4836 !! html
4837 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4838 </p>
4839 !! end
4840
4841 !! test
4842 External links: intervening separator
4843 !! wikitext
4844 Intervening separator: http://example.com/1,2,3
4845 !! html
4846 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4847 </p>
4848 !! end
4849
4850 !! test
4851 External links: old bug with URL in query
4852 !! wikitext
4853 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4854 !! html
4855 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4856 </p>
4857 !! end
4858
4859 !! test
4860 External links: old URL-in-URL bug, mixed protocols
4861 !! wikitext
4862 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4863 !! html
4864 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4865 </p>
4866 !!end
4867
4868 !! test
4869 External links: URL in text
4870 !! wikitext
4871 URL in text: [http://example.com http://example.com]
4872 !! html
4873 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: Clickable images
4879 !! wikitext
4880 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4881 !! html/php
4882 <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>
4883 </p>
4884 !! html/parsoid
4885 <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>
4886 !! end
4887
4888 !! test
4889 External links: raw ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&y
4892 !! html
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! end
4896
4897 !! test
4898 External links: encoded ampersand
4899 !! wikitext
4900 Old &amp; use: http://x&amp;y
4901 !! html/php
4902 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4903 </p>
4904 !! html/parsoid
4905 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4906 !! end
4907
4908 !! test
4909 External links: encoded equals (bug 6102)
4910 !! wikitext
4911 http://example.com/?foo&#61;bar
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4917 !! end
4918
4919 ##
4920 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4921 ## does it number them. As discussed in bug 53505, we can identify
4922 ## autonumbered links via CSS.
4923 ##
4924
4925 !! test
4926 External links: [raw ampersand]
4927 !! wikitext
4928 Old &amp; use: [http://x&y]
4929 !! html/php
4930 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4931 </p>
4932 !! html/parsoid
4933 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4934 !! end
4935
4936 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4937 # mode will return the [raw ampersand] wikitext
4938 !! test
4939 External links: [encoded ampersand]
4940 !! options
4941 parsoid=wt2html,wt2wt,html2html
4942 !! wikitext
4943 Old &amp; use: [http://x&amp;y]
4944 !! html/php
4945 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4946 </p>
4947 !! html/parsoid
4948 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4949 !! end
4950
4951 !! test
4952 External links: [raw equals]
4953 !! wikitext
4954 [http://example.com/?foo=bar]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4960 !! end
4961
4962 # note that parsoid html is identical to [raw equals] case; so html2wt
4963 # mode will return the [raw equals] wikitext
4964 !! test
4965 External links: [encoded equals] (bug 6102)
4966 !! options
4967 parsoid=wt2html,wt2wt,html2html
4968 !! wikitext
4969 [http://example.com/?foo&#61;bar]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4975 !! end
4976
4977 # xxx parsoid strips the IDN character, so the round-trip tests will
4978 # obviously fail and are disabled. --cscott
4979 !! test
4980 External links: [IDN ignored character reference in hostname; strip it right off]
4981 !! options
4982 parsoid=wt2html,wt2wt,html2html
4983 !! wikitext
4984 [http://e&zwnj;xample.com/]
4985 !! html/php
4986 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4990 !! end
4991
4992 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4993 # Where an external link could easily circumvent the sanitization of the text of
4994 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4995 # test demands a higher standard. That's a bit strange.
4996 #
4997 # Example:
4998 #
4999 # http://e‌xample.com -> [http://example.com|http://example.com]
5000 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5001 #
5002 # The first example is sanitized, but the second is not. Any security benefits
5003 # from this production are trivial to circumvent. Either remove this test and
5004 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5005 # the test accordingly.
5006 #
5007 # All our love,
5008 # The Parsoid team.
5009 # xxx parsoid strips the IDN character, so the round-trip tests will
5010 # obviously fail and are disabled. --cscott
5011 !! test
5012 External links: IDN ignored character reference in hostname; strip it right off
5013 !! options
5014 parsoid=wt2html,html2html
5015 !! wikitext
5016 http://e&zwnj;xample.com/
5017 !! html/php
5018 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5019 </p>
5020 !! html/parsoid
5021 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5022 !! end
5023
5024 !! test
5025 External links: www.jpeg.org (bug 554)
5026 !! wikitext
5027 http://www.jpeg.org
5028 !! html
5029 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5030 </p>
5031 !! end
5032
5033 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5034 !! test
5035 External links: URL within URL (original bug 2)
5036 !! wikitext
5037 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5038 !! html/php
5039 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5040 </p>
5041 !! html/parsoid
5042 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5043 !! end
5044
5045 !! test
5046 BUG 361: URL inside bracketed URL
5047 !! wikitext
5048 [http://www.example.com/foo http://www.example.com/bar]
5049 !! html
5050 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5051 </p>
5052 !! end
5053
5054 !! test
5055 BUG 361: URL within URL, not bracketed
5056 !! wikitext
5057 http://www.example.com/foo?=http://www.example.com/bar
5058 !! html
5059 <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>
5060 </p>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<hello>
5067 !! html
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in URL-tail
5074 !! wikitext
5075 http://www.example.com/<b>html</b>
5076 !! html/php
5077 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5078 </p>
5079 !! html/parsoid
5080 <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>
5081 !! end
5082
5083 !! test
5084 BUG 289: ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<hello> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5089 </p>
5090 !!end
5091
5092 !! test
5093 BUG 289: literal ">"-token in bracketed URL
5094 !! wikitext
5095 [http://www.example.com/<b>html</b> stuff]
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5098 </p>
5099 !!end
5100
5101 !! test
5102 BUG 289: literal double quote at end of URL
5103 !! wikitext
5104 http://www.example.com/"hello"
5105 !! html
5106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5107 </p>
5108 !!end
5109
5110 !! test
5111 BUG 289: literal double quote in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/"hello" stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5116 </p>
5117 !!end
5118
5119 !! test
5120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5121 !! wikitext
5122 [http://www.example.com test]
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5125 </p>
5126 !! end
5127
5128 !! test
5129 External links: link text with spaces
5130 !! wikitext
5131 [http://www.example.com a b c]
5132 [http://www.example.com ''a'' ''b'']
5133 !! html
5134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5136 </p>
5137 !! end
5138
5139 !! test
5140 External links: wiki links within external link (Bug 3695)
5141 !! options
5142 parsoid=wt2html,html2html
5143 !! wikitext
5144 [http://example.com [[wikilink]] embedded in ext link]
5145 !! html/php
5146 <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>
5147 </p>
5148 !! html/parsoid
5149 <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>
5150 !! end
5151
5152 !! test
5153 BUG 787: Links with one slash after the url protocol are invalid
5154 !! wikitext
5155 http:/example.com
5156
5157 [http:/example.com title]
5158 !! html
5159 <p>http:/example.com
5160 </p><p>[http:/example.com title]
5161 </p>
5162 !! end
5163
5164 !! test
5165 Bracketed external links with template-generated invalid target
5166 !! wikitext
5167 [{{echo|http:/example.com}} title]
5168 !! html
5169 <p>[http:/example.com title]
5170 </p>
5171 !! end
5172
5173 !! test
5174 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5175 !! wikitext
5176 ''[http://example.com text'']
5177 [http://example.com '''text]'''
5178 ''Something [http://example.com in italic'']
5179 ''Something [http://example.com mixed''''', even bold]'''
5180 '''''Now [http://example.com both''''']
5181 !! html
5182 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5183 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5184 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5185 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5186 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5187 </p>
5188 !! end
5189
5190
5191 !! test
5192 Bug 4781: %26 in URL
5193 !! wikitext
5194 http://www.example.com/?title=AT%26T
5195 !! html/php
5196 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5200 !! end
5201
5202 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5203 # % is actually legal in HTML5. Any change in output would need testing though.
5204 !! test
5205 Bug 4781, 5267: %25 in URL
5206 !! wikitext
5207 http://www.example.com/?title=100%25_Bran
5208 !! html/php
5209 <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>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %28, %29 in URL
5217 !! wikitext
5218 http://www.example.com/?title=Ben-Hur_%281959_film%29
5219 !! html/php
5220 <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>
5221 </p>
5222 !! html/parsoid
5223 <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>
5224 !! end
5225
5226
5227 !! test
5228 Bug 4781: %26 in autonumber URL
5229 !! wikitext
5230 [http://www.example.com/?title=AT%26T]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5236 !! end
5237
5238 !! test
5239 Bug 4781, 5267: %26 in autonumber URL
5240 !! wikitext
5241 [http://www.example.com/?title=100%25_Bran]
5242 !! html/php
5243 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %28, %29 in autonumber URL
5251 !! wikitext
5252 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5253 !! html/php
5254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5255 </p>
5256 !! html/parsoid
5257 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5258 !! end
5259
5260
5261 !! test
5262 Bug 4781: %26 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=AT%26T link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %25 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=100%25_Bran link]
5276 !! html
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5278 </p>
5279 !! end
5280
5281 !! test
5282 Bug 4781, 5267: %28, %29 in bracketed URL
5283 !! wikitext
5284 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5285 !! html/php
5286 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5290 !! end
5291
5292 !! test
5293 External link containing a period in the anchor. (bug 63947)
5294 !! wikitext
5295 [//foo.org/bar#baz. bang]
5296
5297 [//foo.org/bar. bang]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5300 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5304 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5305 !! end
5306
5307 !! test
5308 External link containing a single quote. (bug 63947)
5309 !! wikitext
5310 [//foo.org/bar'baz]
5311
5312 [//foo.org/bar'baz bang]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5315 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5316 </p>
5317 !! html/parsoid
5318 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5319 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5320 !! end
5321
5322 !! test
5323 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5324 !! wikitext
5325 Some [http://example.com/ pretty ''italics'' and stuff]!
5326 !! html
5327 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5328 </p>
5329 !! end
5330
5331 !! test
5332 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5333 !! wikitext
5334 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5335 !! html
5336 <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>
5337 </p>
5338 !! end
5339
5340 !! test
5341 External link containing double-single-quotes with no space separating the url from text in italics
5342 !! wikitext
5343 [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]].]
5344 !! html/php
5345 <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>
5346 </p>
5347 !! html/php+tidy
5348 <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>
5349 !! html/parsoid
5350 <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>
5351 !! end
5352
5353 !! test
5354 External link with comments in link text
5355 !! wikitext
5356 [http://www.google.com Google <!-- comment -->]
5357 !! html/php
5358 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5359 </p>
5360 !! html/parsoid
5361 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5362 !! end
5363
5364 !! test
5365 External link to bare IPv4 address
5366 !! wikitext
5367 [http://192.168.0.1 Link]
5368 !! html/php
5369 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5370 </p>
5371 !! html/parsoid
5372 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5373 !! end
5374
5375 !! test
5376 URL-encoding in URL functions (single parameter)
5377 !! wikitext
5378 {{localurl:Some page|amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;amp=&amp;
5381 </p>
5382 !! end
5383
5384 !! test
5385 URL-encoding in URL functions (multiple parameters)
5386 !! wikitext
5387 {{localurl:Some page|q=?&amp=&}}
5388 !! html
5389 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5390 </p>
5391 !! end
5392
5393 !! test
5394 Brackets in urls
5395 !! wikitext
5396 http://example.com/index.php?foozoid%5B%5D=bar
5397
5398 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5399 !! html/php
5400 <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>
5401 </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>
5402 </p>
5403 !! html/parsoid
5404 <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>
5405
5406 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5407 !! end
5408
5409 !! test
5410 IPv6 urls, autolink format (T23261)
5411 !! wikitext
5412 http://[2404:130:0:1000::187:2]/index.php
5413
5414 Examples from RFC 2373, section 2.2:
5415 * http://[1080::8:800:200C:417A]/unicast
5416 * http://[FF01::101]/multicast
5417 * http://[::1]/loopback
5418 * http://[::]/unspecified
5419 * http://[::13.1.68.3]/ipv4compat
5420 * http://[::FFFF:129.144.52.38]/ipv4compat
5421
5422 Examples from RFC 2732, section 2:
5423 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5424 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5425 * http://[3ffe:2a00:100:7031::1]
5426 * http://[1080::8:800:200C:417A]/foo
5427 * http://[::192.9.5.5]/ipng
5428 * http://[::FFFF:129.144.52.38]:80/index.html
5429 * http://[2010:836B:4179::836B:4179]
5430
5431 !! html/php
5432 <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>
5433 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5434 </p>
5435 <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>
5436 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <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>
5441 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5442 </p>
5443 <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>
5444 <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>
5445 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <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>
5449 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450
5451 !! html/parsoid
5452 <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>
5453
5454 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5455 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5461
5462 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5463 <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>
5464 <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>
5465 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5468 <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>
5469 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5470 !! end
5471
5472 !! test
5473 IPv6 urls, bracketed format (T23261)
5474 !! wikitext
5475 [http://[2404:130:0:1000::187:2]/index.php test]
5476
5477 Examples from RFC 2373, section 2.2:
5478 * [http://[1080::8:800:200C:417A] unicast]
5479 * [http://[FF01::101] multicast]
5480 * [http://[::1]/ loopback]
5481 * [http://[::] unspecified]
5482 * [http://[::13.1.68.3] ipv4compat]
5483 * [http://[::FFFF:129.144.52.38] ipv4compat]
5484
5485 Examples from RFC 2732, section 2:
5486 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5487 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5488 * [http://[3ffe:2a00:100:7031::1] 3]
5489 * [http://[1080::8:800:200C:417A]/foo 4]
5490 * [http://[::192.9.5.5]/ipng 5]
5491 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5492 * [http://[2010:836B:4179::836B:4179] 7]
5493
5494 !! html/php
5495 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5496 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5497 </p>
5498 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5505 </p>
5506 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5516
5517 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5518 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5524
5525 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5526 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5528 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5529 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5530 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5531 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5532 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5533 !! end
5534
5535 !! test
5536 Non-extlinks in brackets
5537 !! wikitext
5538 [foo]
5539 [foo bar]
5540 [foo ''bar'']
5541 [fool's] errand
5542 [fool's errand]
5543 [{{echo|foo}}]
5544 [{{echo|foo}} bar]
5545 [{{echo|foo}} ''bar'']
5546 [{{echo|foo}}l's] errand
5547 [{{echo|foo}}l's errand]
5548 [url={{echo|foo}}]
5549 [url=http://example.com]
5550 [http:// bare protocols don't count]
5551 !! html/php
5552 <p>[foo]
5553 [foo bar]
5554 [foo <i>bar</i>]
5555 [fool's] errand
5556 [fool's errand]
5557 [foo]
5558 [foo bar]
5559 [foo <i>bar</i>]
5560 [fool's] errand
5561 [fool's errand]
5562 [url=foo]
5563 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5564 [http:// bare protocols don't count]
5565 </p>
5566 !! html/parsoid
5567 <p>[foo]
5568 [foo bar]
5569 [foo <i>bar</i>]
5570 [fool's] errand
5571 [fool's errand]
5572 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5573 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5574 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5575 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5576 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5577 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5578 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5579 [http:// bare protocols don't count]</p>
5580 !! end
5581
5582 !! test
5583 Percent encoding in external links
5584 !! wikitext
5585 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5586 !! html/php
5587 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5588 </p>
5589 !! html/parsoid
5590 <p><a rel="mw:ExtLink"
5591 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5592 !! end
5593
5594 !! test
5595 Use url link syntax for links where the content is equal the link target
5596 !! wikitext
5597 http://example.com
5598 !! html/php
5599 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5603 !! end
5604
5605 !! test
5606 Parenthesis in external links, especially URL links
5607 !! wikitext
5608 http://example.com)
5609
5610 http://example.com/test)
5611
5612 http://example.com/(test)
5613
5614 http://example.com/((test)
5615
5616 (http://example.com/(test))
5617
5618 (http://example.com/(test)))))
5619
5620 http://example.com/a)b
5621
5622 [http://example.com) foo]
5623 !! html/php
5624 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5625 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5626 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5627 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5630 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5631 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5632 </p>
5633 !! html/parsoid
5634 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5635 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5636 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5637 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5638 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5639 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5640 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5641 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5642 !! end
5643
5644 !! test
5645 Parenthesis in external links, w/ transclusion or comment
5646 !! wikitext
5647 (http://example.com/{{echo|hi}})
5648
5649 (http://example.com<!-- hi -->)
5650 !! html/php
5651 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5652 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5653 </p>
5654 !! html/parsoid
5655 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5656
5657 <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>
5658 !! end
5659
5660 !! test
5661 Serialize <a> tags with invalid link targets as plain text
5662 !! options
5663 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5664 !! html/parsoid
5665 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5666 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5667 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5668 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5669 !! wikitext
5670 text
5671 <nowiki>*</nowiki>text
5672 <nowiki>[[foo]]</nowiki>
5673 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5674 !! end
5675
5676 !! test
5677 mw:ExtLink -vs- mw:WikiLink (T94723)
5678 !! options
5679 parsoid=html2wt
5680 !! html/parsoid
5681 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5682 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5683 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5684 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5685 <p>
5686 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5687 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5688 </p>
5689 !! wikitext
5690 [[Foo|Bar]]
5691 [[Foo|Bar]]
5692 [[wikipedia:Foo|Bar]]
5693 [[wikipedia:Foo|Bar]]
5694
5695 [[wikipedia:European_Robin|European Robin]]
5696 [[wikipedia:European_Robin|European Robin]]
5697 !! end
5698
5699 !! test
5700 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5701 !! options
5702 parsoid=wt2wt
5703 !! wikitext
5704 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5705 !! html/parsoid
5706 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5707 !! end
5708
5709
5710 ###
5711 ### Quotes
5712 ###
5713
5714 !! test
5715 Quotes
5716 !! wikitext
5717 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5718
5719 Normal text. '''''Bold italic text.''''' Normal text.
5720 !! html
5721 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5722 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5723 </p>
5724 !! end
5725
5726
5727 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5728 # parser strips. The wikitext contains just the first half of the bold
5729 # quote pair.
5730 !! test
5731 Unclosed and unmatched quotes
5732 !! wikitext
5733 '''''Bold italic text '''with bold deactivated''' in between.'''''
5734
5735 '''''Bold italic text ''with italic deactivated'' in between.'''''
5736
5737 '''Bold text..
5738
5739 ..spanning two paragraphs (should not work).'''
5740
5741 '''Bold tag left open
5742
5743 ''Italic tag left open
5744
5745 Normal text.
5746
5747 <!-- Unmatching number of opening, closing tags: -->
5748 '''This year''''s election ''should'' beat '''last year''''s.
5749
5750 ''Tom'''s car is bigger than ''Susan'''s.
5751
5752 Plain ''italic'''s plain
5753 !! html/php
5754 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5755 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5756 </p><p><b>Bold text..</b>
5757 </p><p>..spanning two paragraphs (should not work).
5758 </p><p><b>Bold tag left open</b>
5759 </p><p><i>Italic tag left open</i>
5760 </p><p>Normal text.
5761 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5762 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5763 </p><p>Plain <i>italic'</i>s plain
5764 </p>
5765 !! html/parsoid
5766 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5767 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5768 </p><p><b>Bold text..</b>
5769 </p><p>..spanning two paragraphs (should not work).<b></b>
5770 </p><p><b>Bold tag left open</b>
5771 </p><p><i>Italic tag left open</i>
5772 </p><p>Normal text.
5773 </p>
5774 <!-- Unmatching number of opening, closing tags: -->
5775 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5776 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5777 </p><p>Plain <i>italic'</i>s plain
5778 </p>
5779 !! end
5780
5781 ###
5782 ### Tables
5783 ###
5784 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5785 ###
5786
5787 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5788 # is the bare minimum required by the spec, see:
5789 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5790 # Parsoid team replies: empty table tags are legal in HTML5
5791 !! test
5792 A table with no data.
5793 !! options
5794 parsoid=wt2html
5795 !! wikitext
5796 {||}
5797 !! html/php
5798
5799 !! html/parsoid
5800 <table></table>
5801
5802 !! end
5803
5804 !! test
5805 A table with stray table end tags on start tag line (wt2html)
5806 !! options
5807 parsoid=wt2html
5808 !! wikitext
5809 {|style="color: red;"|}
5810
5811 {|style="color: red;" |}
5812 |foo
5813 |}
5814
5815 {|style="color: red;"|} id="foo"
5816 |foo
5817 |}
5818
5819 {|style="color: red;" |} id="foo"
5820 |foo
5821 |}
5822 !! html
5823 <table style="color: red;"></table>
5824
5825 <table style="color: red;">
5826 <tbody><tr>
5827 <td>foo</td>
5828 </tr></tbody>
5829 </table>
5830
5831 <table style="color: red;" id="foo">
5832 <tbody><tr>
5833 <td>foo</td>
5834 </tr></tbody>
5835 </table>
5836
5837 <table style="color: red;" id="foo">
5838 <tbody><tr>
5839 <td>foo</td>
5840 </tr></tbody>
5841 </table>
5842
5843 !! end
5844
5845 !! test
5846 A table with no data (take 2)
5847 !! wikitext
5848 {|
5849 |}
5850 !! html/parsoid
5851 <table></table>
5852 !! end
5853
5854 # A table with nothing but a caption is invalid XHTML, we might want to render
5855 # this as <p>caption</p>
5856 # Parsoid team replies: table with only a caption is legal in HTML5
5857 !! test
5858 A table with nothing but a caption
5859 !! wikitext
5860 {|
5861 |+ caption
5862 |}
5863 !! html/php
5864 <table>
5865 <caption> caption
5866 </caption><tr><td></td></tr></table>
5867
5868 !! html/parsoid
5869 <table><caption> caption</caption></table>
5870 !! end
5871
5872 !! test
5873 A table with caption with default-spaced attributes and a table row
5874 !! wikitext
5875 {|
5876 |+ style="color: red;" | caption1
5877 |-
5878 | foo
5879 |}
5880 !! html
5881 <table>
5882 <caption style="color: red;"> caption1
5883 </caption>
5884 <tr>
5885 <td> foo
5886 </td></tr></table>
5887
5888 !! end
5889
5890 !! test
5891 A table with captions with non-default spaced attributes and a table row
5892 !! wikitext
5893 {|
5894 |+style="color: red;"|caption2
5895 |+ style="color: red;"| caption3
5896 |-
5897 | foo
5898 |}
5899 !! html
5900 <table>
5901 <caption style="color: red;">caption2
5902 </caption>
5903 <caption style="color: red;"> caption3
5904 </caption>
5905 <tr>
5906 <td> foo
5907 </td></tr></table>
5908
5909 !! end
5910
5911 !! test
5912 Table td-cell syntax variations
5913 !! wikitext
5914 {|
5915 | foo bar foo | baz
5916 | foo bar foo || baz
5917 | style='color:red;' | baz
5918 | style='color:red;' || baz
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <td> baz
5924 </td>
5925 <td> foo bar foo </td>
5926 <td> baz
5927 </td>
5928 <td style="color:red;"> baz
5929 </td>
5930 <td> style='color:red;' </td>
5931 <td> baz
5932 </td></tr></table>
5933
5934 !! end
5935
5936 !! test
5937 Simple table
5938 !! wikitext
5939 {|
5940 | 1 || 2
5941 |-
5942 | 3 || 4
5943 |}
5944 !! html
5945 <table>
5946 <tr>
5947 <td> 1 </td>
5948 <td> 2
5949 </td></tr>
5950 <tr>
5951 <td> 3 </td>
5952 <td> 4
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Simple table but with multiple dashes for row wikitext
5959 !! wikitext
5960 {|
5961 | foo
5962 |-----
5963 | bar
5964 |}
5965 !! html
5966 <table>
5967 <tr>
5968 <td> foo
5969 </td></tr>
5970 <tr>
5971 <td> bar
5972 </td></tr></table>
5973
5974 !! end
5975
5976 !! test
5977 Multiplication table
5978 !! wikitext
5979 {| border="1" cellpadding="2"
5980 |+Multiplication table
5981 |-
5982 ! &times; !! 1 !! 2 !! 3
5983 |-
5984 ! 1
5985 | 1 || 2 || 3
5986 |-
5987 ! 2
5988 | 2 || 4 || 6
5989 |-
5990 ! 3
5991 | 3 || 6 || 9
5992 |-
5993 ! 4
5994 | 4 || 8 || 12
5995 |-
5996 ! 5
5997 | 5 || 10 || 15
5998 |}
5999 !! html
6000 <table border="1" cellpadding="2">
6001 <caption>Multiplication table
6002 </caption>
6003 <tr>
6004 <th> &#215; </th>
6005 <th> 1 </th>
6006 <th> 2 </th>
6007 <th> 3
6008 </th></tr>
6009 <tr>
6010 <th> 1
6011 </th>
6012 <td> 1 </td>
6013 <td> 2 </td>
6014 <td> 3
6015 </td></tr>
6016 <tr>
6017 <th> 2
6018 </th>
6019 <td> 2 </td>
6020 <td> 4 </td>
6021 <td> 6
6022 </td></tr>
6023 <tr>
6024 <th> 3
6025 </th>
6026 <td> 3 </td>
6027 <td> 6 </td>
6028 <td> 9
6029 </td></tr>
6030 <tr>
6031 <th> 4
6032 </th>
6033 <td> 4 </td>
6034 <td> 8 </td>
6035 <td> 12
6036 </td></tr>
6037 <tr>
6038 <th> 5
6039 </th>
6040 <td> 5 </td>
6041 <td> 10 </td>
6042 <td> 15
6043 </td></tr></table>
6044
6045 !! end
6046
6047 !! test
6048 Accept "||" in table headings
6049 !! wikitext
6050 {|
6051 !h1 || h2
6052 |}
6053 !! html
6054 <table>
6055 <tr>
6056 <th>h1 </th>
6057 <th> h2
6058 </th></tr></table>
6059
6060 !! end
6061
6062 !! test
6063 Accept "!!" in table data
6064 !! wikitext
6065 {|
6066 | Foo!! ||
6067 |}
6068 !! html
6069 <table>
6070 <tr>
6071 <td> Foo!! </td>
6072 <td>
6073 </td></tr></table>
6074
6075 !! html/parsoid
6076 <table>
6077 <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>
6078 </tbody></table>
6079 !! end
6080
6081 !! test
6082 Accept "||" in indented table headings
6083 !! wikitext
6084 :{|
6085 !h1 || h2
6086 |}
6087 !! html
6088 <dl><dd><table>
6089 <tr>
6090 <th>h1 </th>
6091 <th> h2
6092 </th></tr></table></dd></dl>
6093
6094 !! end
6095
6096 !! test
6097 Accept "!!" in templates
6098 !! wikitext
6099 {|
6100 !a {{echo|b!!c}}
6101 |}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a b</th>
6106 <th>c
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6112 !! end
6113
6114 !! test
6115 Accept "!!" in table headings after newline
6116 !! wikitext
6117 {|
6118 !a
6119 b!!c
6120 |}
6121 !! html/php
6122 <table>
6123 <tr>
6124 <th>a
6125 <p>b!!c
6126 </p>
6127 </th></tr></table>
6128
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a
6132 <p>b!!c</p></th></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept "!!" in table data of mixed wikitext / html syntax
6138 !! wikitext
6139 {|
6140 !a
6141 <tr><td>b!!c</td></tr>
6142 |}
6143 !! html+tidy
6144 <table>
6145 <tr>
6146 <th>a</th>
6147 </tr>
6148 <tr>
6149 <td>b!!c</td>
6150 </tr>
6151 </table>
6152 !! html/parsoid
6153 <table>
6154 <tbody><tr><th>a</th></tr>
6155 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6156 </tbody></table>
6157 !! end
6158
6159 !! test
6160 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6161 !! wikitext
6162 {|
6163 !| h1
6164 || a
6165 |}
6166 !! html
6167 <table>
6168 <tr>
6169 <th> h1
6170 </th>
6171 <td> a
6172 </td></tr></table>
6173
6174 !! end
6175
6176 !!test
6177 Accept "| !" at start of line in tables (ignore !-attribute)
6178 !! wikitext
6179 {|
6180 |-
6181 | !style="color:red" | bar
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td> bar
6188 </td></tr></table>
6189
6190 !!end
6191
6192 !!test
6193 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 +/-
6194 !! wikitext
6195 {|
6196 |-
6197 |style='color:red;'|+1
6198 |style='color:blue;'|-1
6199 |-
6200 | 1 || 2 || 3
6201 | 1 ||+2 ||-3
6202 |-
6203 | +1
6204 | -1
6205 |}
6206 !! html
6207 <table>
6208
6209 <tr>
6210 <td style="color:red;">+1
6211 </td>
6212 <td style="color:blue;">-1
6213 </td></tr>
6214 <tr>
6215 <td> 1 </td>
6216 <td> 2 </td>
6217 <td> 3
6218 </td>
6219 <td> 1 </td>
6220 <td>+2 </td>
6221 <td>-3
6222 </td></tr>
6223 <tr>
6224 <td> +1
6225 </td>
6226 <td> -1
6227 </td></tr></table>
6228
6229 !!end
6230
6231 !! test
6232 Table rowspan
6233 !! wikitext
6234 {| border=1
6235 | Cell 1, row 1
6236 |rowspan=2| Cell 2, row 1 (and 2)
6237 | Cell 3, row 1
6238 |-
6239 | Cell 1, row 2
6240 | Cell 3, row 2
6241 |}
6242 !! html
6243 <table border="1">
6244 <tr>
6245 <td> Cell 1, row 1
6246 </td>
6247 <td rowspan="2"> Cell 2, row 1 (and 2)
6248 </td>
6249 <td> Cell 3, row 1
6250 </td></tr>
6251 <tr>
6252 <td> Cell 1, row 2
6253 </td>
6254 <td> Cell 3, row 2
6255 </td></tr></table>
6256
6257 !! end
6258
6259 !! test
6260 Nested table
6261 !! wikitext
6262 {| border=1
6263 | &alpha;
6264 |
6265 {| bgcolor=#ABCDEF border=2
6266 |nested
6267 |-
6268 |table
6269 |}
6270 |the original table again
6271 |}
6272 !! html
6273 <table border="1">
6274 <tr>
6275 <td> &#945;
6276 </td>
6277 <td>
6278 <table bgcolor="#ABCDEF" border="2">
6279 <tr>
6280 <td>nested
6281 </td></tr>
6282 <tr>
6283 <td>table
6284 </td></tr></table>
6285 </td>
6286 <td>the original table again
6287 </td></tr></table>
6288
6289 !! end
6290
6291 !! test
6292 Invalid attributes in table cell (bug 1830)
6293 !! wikitext
6294 {|
6295 |Cell:|broken
6296 |}
6297 !! html
6298 <table>
6299 <tr>
6300 <td>broken
6301 </td></tr></table>
6302
6303 !! end
6304
6305 !! test
6306 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6307 !! wikitext
6308 {|
6309 | title="foo" |bar
6310 | title="foo<nowiki>|</nowiki>" |bar
6311 | title="foo<nowiki>|</nowiki>" bar
6312 |}
6313 !! html/php
6314 <table>
6315 <tr>
6316 <td title="foo">bar
6317 </td>
6318 <td title="foo&#124;">bar
6319 </td>
6320 <td> title="foo|" bar
6321 </td></tr></table>
6322
6323 !! html/parsoid
6324 <table>
6325 <tbody><tr><td title="foo">bar</td>
6326 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6327 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6328 </tbody></table>
6329 !! end
6330
6331 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6332 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6333 # *2wt modes will fail.
6334 !! test
6335 Table security: embedded pipes
6336 !! options
6337 parsoid=wt2html,html2html
6338 !! wikitext
6339 {|
6340 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6341 !! html/php
6342 <table>
6343 <tr>
6344 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6345 <td>]" onmouseover="alert(document.cookie)"&gt;test
6346 </td>
6347 </tr>
6348 </table>
6349
6350 !! html/parsoid
6351 <table><tbody>
6352 <tr>
6353 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6354 !! end
6355
6356 !! test
6357 Element attributes with double ! should not be broken up by <th>
6358 !! wikitext
6359 {|
6360 ! hi <div class="!!">ha</div> ho
6361 |}
6362 !! html/php
6363 <table>
6364 <tr>
6365 <th> hi <div class="!!">ha</div> ho
6366 </th></tr></table>
6367
6368 !! html/parsoid
6369 <table>
6370 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6371 </tbody></table>
6372 !! end
6373
6374 !! test
6375 ! and || in element attributes should not be parsed as <th>/<td>
6376 !! wikitext
6377 {|
6378 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6379 |}
6380 !! html/php
6381 <table>
6382 <tr>
6383 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6384 </td></tr></table>
6385
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6389 </tbody></table>
6390 !! end
6391
6392 # FIXME: The output seems broken. Filed as T110268.
6393 !! test
6394 ! and || in td attributes should not be parsed as <th>/<td>
6395 !! options
6396 parsoid=wt2html
6397 !! wikitext
6398 {|
6399 | style="color: red !important;" data-contrived="put this here ||" | foo
6400 |}
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td> style="color: red !important;" data-contrived="put this here </td>
6405 <td> foo
6406 </td></tr></table>
6407
6408 !! html/parsoid
6409 <table>
6410 <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>
6411 </tbody></table>
6412 !! end
6413
6414 !! test
6415 Break on | in element attribute in template
6416 !! options
6417 parsoid=wt2html,html2html
6418 !! wikitext
6419 {{echo|1=<div class="hi|ho">ha</div>}}
6420 !! html/php
6421 <p>ho"&gt;ha&lt;/div&gt;
6422 </p>
6423 !! html/parsoid
6424 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6425 !! end
6426
6427 !! test
6428 Indented table markup mixed with indented pre content (proposed in bug 6200)
6429 !! wikitext
6430 <table>
6431 <tr>
6432 <td>
6433 Text that should be rendered preformatted
6434 </td>
6435 </tr>
6436 </table>
6437 !! html
6438 <table>
6439 <tr>
6440 <td>
6441 <pre>Text that should be rendered preformatted
6442 </pre>
6443 </td>
6444 </tr>
6445 </table>
6446
6447 !! end
6448
6449 !! test
6450 1. Template-generated table cell attributes and cell content
6451 !! wikitext
6452 {|
6453 |{{table_attribs}}
6454 | {{table_attribs}}
6455 || {{table_attribs_5}}
6456 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6457 |align=center {{table_attribs}}
6458 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td style="color:red;">Foo
6464 </td>
6465 <td style="color:red;">Foo
6466 </td>
6467 <td> style="color:red;"</td>
6468 <td>Bar
6469 </td>
6470 <td style="color:red;">Foo
6471 </td>
6472 <td align="center" style="color:red;">Foo
6473 </td>
6474 <td align="center" style="color:red;">Foo
6475 </td></tr></table>
6476
6477 !! end
6478
6479 !! test
6480 2. Template-generated table cell attributes and cell content
6481 !! wikitext
6482 {|
6483 |{{table_attribs_2}}
6484 |}
6485 !! html/php
6486 <table>
6487 <tr>
6488 <td style="color:red;">Foo
6489 </td>
6490 <td>Bar</td>
6491 <td>Baz
6492 </td></tr></table>
6493
6494 !! html/parsoid
6495 <table>
6496 <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>
6497 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6498 </tbody></table>
6499 !! end
6500
6501 !! test
6502 3. Template-generated table cell attributes and cell content
6503 !! wikitext
6504 {|
6505 !align=center {{table_header_cells}}
6506 |-
6507 |align=center {{table_cells}}
6508 |}
6509 !! html/php
6510 <table>
6511 <tr>
6512 <th align="center" style="color:red;">Foo</th>
6513 <th style="color:red;"><i>Bar</i></th>
6514 <th style="color:brown;"><i>Foo</i> and Baz
6515 </th></tr>
6516 <tr>
6517 <td align="center" style="color:red;">Foo</td>
6518 <td style="color:red;"><i>Bar</i></td>
6519 <td style="color:brown;"><i>Foo</i> and Baz
6520 </td></tr></table>
6521
6522 !! html/parsoid
6523 <table>
6524 <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>
6525 <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>
6526 </tbody></table>
6527 !! end
6528
6529 !! test
6530 4. Template-generated table cell attributes and cell content inside a templated table
6531 !! wikitext
6532 {{tbl-start}}
6533 !align=center {{table_header_cells}}
6534 |-
6535 |align=center {{table_cells}}
6536 {{tbl-end}}
6537 !! html/php
6538 <table>
6539 <tr>
6540 <th align="center" style="color:red;">Foo</th>
6541 <th style="color:red;"><i>Bar</i></th>
6542 <th style="color:brown;"><i>Foo</i> and Baz
6543 </th></tr>
6544 <tr>
6545 <td align="center" style="color:red;">Foo</td>
6546 <td style="color:red;"><i>Bar</i></td>
6547 <td style="color:brown;"><i>Foo</i> and Baz
6548 </td></tr></table>
6549
6550 !! html/parsoid
6551 <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}}]}'>
6552 <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>
6553 <tr>
6554 <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>
6555 </tbody></table>
6556 !! end
6557
6558 ## Edge case fix to prevent future regressions
6559 !! test
6560 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6561 !! wikitext
6562 {|
6563 |{{table_attribs_7}}
6564 |}
6565 <references />
6566 !! html/parsoid
6567 <table>
6568 <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>
6569 </tbody></table>
6570 <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>
6571 !! end
6572
6573 !! test
6574 Table with row followed by newlines and table heading
6575 !! wikitext
6576 {|
6577 |-
6578
6579 ! foo
6580 |}
6581 !! html
6582 <table>
6583
6584
6585 <tr>
6586 <th> foo
6587 </th></tr></table>
6588
6589 !! end
6590
6591 !! test
6592 Table with empty line following the start tag
6593 !! wikitext
6594 {|
6595
6596 |-
6597 | foo
6598 |}
6599 !! html
6600 <table>
6601
6602
6603 <tr>
6604 <td> foo
6605 </td></tr></table>
6606
6607 !! end
6608
6609 !! test
6610 Table attributes with empty value
6611 !! options
6612 parsoid=wt2html,html2html
6613 !! wikitext
6614 {|
6615 | style=| hello
6616 |}
6617 !! html/php
6618 <table>
6619 <tr>
6620 <td style=""> hello
6621 </td></tr></table>
6622
6623 !! html/parsoid
6624 <table>
6625 <tbody><tr><td style=""> hello</td></tr>
6626 </tbody></table>
6627 !! end
6628
6629 !! test
6630 Wikitext table with a lot of comments
6631 !! wikitext
6632 {|
6633 <!-- c0 -->
6634 | foo
6635 <!-- c1 -->
6636 |-<!-- c2 -->
6637 <!-- c3 -->
6638 |<!-- c4 -->
6639 <!-- c5 -->
6640 |}
6641 !! html
6642 <table>
6643 <tr>
6644 <td> foo
6645 </td></tr>
6646 <tr>
6647 <td>
6648 </td></tr></table>
6649
6650 !! end
6651
6652 !! test
6653 Wikitext table comments represented in parsoid dom
6654 !! wikitext
6655 {|<!--c1--><!--c2-->
6656 |-<!--c3-->
6657 | x
6658 |}
6659 !! html/php+tidy
6660 <table>
6661 <tr>
6662 <td>x</td>
6663 </tr>
6664 </table>
6665 !! html/parsoid
6666 <table><!--c1--><!--c2-->
6667 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6668 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6669 </tbody></table>
6670 !! end
6671
6672 !! test
6673 Wikitext table with double-line table cell
6674 !! wikitext
6675 {|
6676 |a
6677 b
6678 |}
6679 !! html
6680 <table>
6681 <tr>
6682 <td>a
6683 <p>b
6684 </p>
6685 </td></tr></table>
6686
6687 !! end
6688
6689 !! test
6690 Table cell with a single comment
6691 !! wikitext
6692 {|
6693 | <!-- c1 -->
6694 | a
6695 |}
6696 !! html
6697 <table>
6698 <tr>
6699 <td>
6700 </td>
6701 <td> a
6702 </td></tr></table>
6703
6704 !! end
6705
6706 !! test
6707 Table-cell after a comment-only-empty-line
6708 !! wikitext
6709 {|
6710 |a
6711 <!--c1-->
6712 <!--c2-->| b
6713 |}
6714 !! html
6715 <table>
6716 <tr>
6717 <td>a
6718 </td>
6719 <td> b
6720 </td></tr></table>
6721
6722 !! html/parsoid
6723 <table>
6724 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6725 <!--c1-->
6726 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6727 </tbody></table>
6728
6729 !! end
6730
6731 !! test
6732 Build table with {{!}}
6733 !! wikitext
6734 {{{!}} class="wikitable"
6735 ! header
6736 ! second header
6737 {{!}}- style="color:red;"
6738 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6739 {{!}}}
6740 !! html
6741 <table class="wikitable">
6742 <tr>
6743 <th> header
6744 </th>
6745 <th> second header
6746 </th></tr>
6747 <tr style="color:red;">
6748 <td> data </td>
6749 <td style="color:red;"> second data
6750 </td></tr></table>
6751
6752 !! end
6753
6754 !! test
6755 Build table with pipe as data
6756 !! wikitext
6757 {| class="wikitable"
6758 ! header
6759 ! second header
6760 |- style="color:red;"
6761 | data || style="color:red;" | second data
6762 |-
6763 | style="color:red;" | data with | || style="color:red;" | second data with |
6764 |-
6765 || data with | ||| second data with |
6766 |}
6767 !! html
6768 <table class="wikitable">
6769 <tr>
6770 <th> header
6771 </th>
6772 <th> second header
6773 </th></tr>
6774 <tr style="color:red;">
6775 <td> data </td>
6776 <td style="color:red;"> second data
6777 </td></tr>
6778 <tr>
6779 <td style="color:red;"> data with | </td>
6780 <td style="color:red;"> second data with |
6781 </td></tr>
6782 <tr>
6783 <td> data with | </td>
6784 <td> second data with |
6785 </td></tr></table>
6786
6787 !! end
6788
6789 !! test
6790 Build table with wikilink
6791 !! wikitext
6792 {| class="wikitable"
6793 ! header || second header
6794 |- style="color:red;"
6795 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6796 |-
6797 | data || second data [[Main Page|link|text with pipe]]
6798 |}
6799 !! html
6800 <table class="wikitable">
6801 <tr>
6802 <th> header </th>
6803 <th> second header
6804 </th></tr>
6805 <tr style="color:red;">
6806 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6807 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6808 </td></tr>
6809 <tr>
6810 <td> data </td>
6811 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6812 </td></tr></table>
6813
6814 !! end
6815
6816 # The expected HTML structure in this test is debatable. The PHP parser does
6817 # not parse this kind of table at all. The main focus for Parsoid is on
6818 # round-tripping, so this output is ok for now. TODO: revisit!
6819 !! test
6820 Wikitext table with html-syntax row
6821 !! wikitext
6822 {|
6823 |-
6824 <td>foo</td>
6825 |}
6826 !! html/parsoid
6827 <table>
6828 <tbody>
6829 <tr>
6830 <td>foo</td></tr></tbody></table>
6831 !! end
6832
6833 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6834 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6835 ## PHP parser, which tidy then compounds by fostering the content
6836 ## entirely out of the table. Parsoid recognizes the table context
6837 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6838 ## depends on PHP's treatment of broken table markup!
6839 !! test
6840 Implicit <td> after a |-
6841 !! options
6842 parsoid=wt2html,html2html
6843 !! wikitext
6844 {|
6845 |-
6846 a
6847 |}
6848 !! html/php
6849 <table>
6850
6851 a
6852 </table>
6853
6854 !! html/php+tidy
6855 <p>a</p>
6856 !! html/parsoid
6857 <table>
6858 <tr><td>a</td></tr>
6859 </table>
6860 !! end
6861
6862 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6863 !! test
6864 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6865 !! options
6866 parsoid=wt2html,html2html
6867 !! wikitext
6868 {|
6869 |-
6870 |
6871 a
6872 |-
6873 b
6874 |}
6875 !! html/php
6876 <table>
6877
6878 <tr>
6879 <td>
6880 <pre>a
6881 </pre>
6882 </td></tr>
6883 b
6884 </table>
6885
6886 !! html/php+tidy
6887 <p>b</p>
6888 <table>
6889 <tr>
6890 <td>
6891 <pre>
6892 a
6893 </pre></td>
6894 </tr>
6895 </table>
6896 !! html/parsoid
6897 <table>
6898 <tbody>
6899 <tr><td><pre>a</pre></td></tr>
6900 <tr><td> b</td></tr>
6901 </tbody>
6902 </table>
6903 !! end
6904
6905 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6906 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6907 !! test
6908 Lists should be recognized in an implicit <td> context
6909 !! options
6910 parsoid=wt2html,html2html
6911 !! wikitext
6912 {|
6913 |-
6914 *a
6915 |}
6916 !! html/php
6917 <table>
6918
6919 <ul><li>a</li></ul>
6920 </table>
6921
6922 !! html/php+tidy
6923 <ul>
6924 <li>a</li>
6925 </ul>
6926 !! html/parsoid
6927 <table>
6928 <tr>
6929 <td><ul>
6930 <li>a</li>
6931 </ul></td>
6932 </tr>
6933 </table>
6934 !! end
6935
6936 !! test
6937 Table cells not properly parsed in an implicit-td context
6938 !! wikitext
6939 {|
6940 |-
6941 {{table_attribs_4}} || a || b
6942 |}
6943 !! html/php+tidy
6944 <table>
6945 <tr>
6946 <td style="background-color:#DC241f;" width="10px"></td>
6947 <td>a</td>
6948 <td>b</td>
6949 </tr>
6950 </table>
6951 !! html/parsoid
6952 <table>
6953 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6954 <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>
6955 </tbody></table>
6956 !! end
6957
6958 !! test
6959 Parsoid: Round-trip tables directly followed by content (bug 51219)
6960 !! options
6961 parsoid=wt2html,wt2wt
6962 !! wikitext
6963 {|
6964 |foo
6965 |} bar
6966
6967 {|
6968 |baz
6969 |}<b>quux</b>
6970 !! html+tidy
6971 <table>
6972 <tr>
6973 <td>foo</td>
6974 </tr>
6975 </table>
6976 <p>bar</p>
6977 <table>
6978 <tr>
6979 <td>baz</td>
6980 </tr>
6981 </table>
6982 <p><b>quux</b></p>
6983 !! end
6984
6985 !! test
6986 Parsoid: Default to a newline after tables in new content (bug 51219)
6987 !! options
6988 parsoid=html2wt
6989 !! html/parsoid
6990 <table><tbody>
6991 <tr><td>foo</td></tr></tbody></table> bar
6992 <table><tbody>
6993 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6994 !! wikitext
6995 {|
6996 |foo
6997 |}
6998 <nowiki> </nowiki>bar
6999 {|
7000 |baz
7001 |}
7002 '''quux'''
7003 !! end
7004
7005 !! test
7006 Parsoid: newline inducing block nodes don't suppress <nowiki>
7007 !! options
7008 parsoid=html2wt
7009 !! html/parsoid
7010 a<h1>foo</h1>
7011 !! wikitext
7012 <nowiki> </nowiki>a
7013
7014 = foo =
7015 !! end
7016
7017 !! test
7018 Parsoid: Row-syntax table headings followed by comment & table cells
7019 !! options
7020 parsoid=wt2html,wt2wt
7021 !! wikitext
7022 {|
7023 ! foo || bar
7024 <!-- foo --> || baz || quux
7025 |}
7026 !! html/php
7027 <table>
7028 <tr>
7029 <th> foo </th>
7030 <th> bar
7031 </th>
7032 <td> baz </td>
7033 <td> quux
7034 </td></tr></table>
7035
7036 !! html/parsoid
7037 <table>
7038 <tbody><tr><th> foo </th><th> bar
7039 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7040 </tbody></table>
7041 !! end
7042
7043 !!test
7044 Parsoid: Recover better from broken table attributes
7045 !!options
7046 parsoid=wt2html
7047 !!wikitext
7048 {| class="foo
7049 | class="bar" |
7050 foo
7051 |}
7052 !!html/php+tidy
7053 <table class="foo">
7054 <tr>
7055 <td class="bar">
7056 <p>foo</p>
7057 </td>
7058 </tr>
7059 </table>
7060 !!html/parsoid
7061 <table class="foo">
7062 <tr>
7063 <td class="bar">
7064 <p>foo</p></td></tr>
7065 </tbody></table>
7066 !!end
7067
7068 !! test
7069 Tables: Digest broken attributes on table and tr tag
7070 !! options
7071 parsoid=wt2html
7072 !! wikitext
7073 {| || |} ++
7074 |- || || ++ --
7075 |- > [
7076 |}
7077 !! html
7078 <table>
7079 <tbody>
7080 <tr></tr>
7081 <tr></tr>
7082 </tbody></table>
7083 !! end
7084
7085 !! test
7086 Strip unsupported table tags
7087 !! options
7088 parsoid=html2wt
7089 !! html/parsoid
7090 <table>
7091 <thead>
7092 <tr>
7093 <th>Month</th>
7094 <th>Savings</th>
7095 </tr>
7096 </thead>
7097 <tbody>
7098 <tr>
7099 <td>January</td>
7100 <td>$100</td>
7101 </tr>
7102 <tr>
7103 <td>February</td>
7104 <td>$80</td>
7105 </tr>
7106 </tbody>
7107 <tfoot>
7108 <tr>
7109 <td>Sum</td>
7110 <td>$180</td>
7111 </tr>
7112 </tfoot>
7113 </table>
7114 !! wikitext
7115 {|
7116
7117 !Month
7118 !Savings
7119
7120 |January
7121 |$100
7122
7123 |-
7124 |February
7125 |$80
7126
7127 |Sum
7128 |$180
7129
7130 |}
7131 !! end
7132
7133 !! test
7134 Testing serialization after deletion in references
7135 !! options
7136 parsoid={
7137 "modes": ["wt2wt"],
7138 "changes": [
7139 ["#x", "remove"]
7140 ]
7141 }
7142 !! wikitext
7143 hi <ref><div id="x">ho</div></ref>
7144
7145 <references />
7146 !! wikitext/edited
7147 hi <ref></ref>
7148
7149 <references />
7150 !! end
7151
7152 !!test
7153 Testing serialization after deletion of table cells
7154 !!options
7155 parsoid={
7156 "modes": ["wt2wt", "selser"],
7157 "changes": [
7158 ["#x", "remove"]
7159 ]
7160 }
7161 !!wikitext
7162 {|
7163 !h1 !!h2 !!h3
7164 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7165 |}
7166 !! wikitext/edited
7167 {|
7168 !h1 !!h2 !!h3
7169 |c2 |||c3
7170 |}
7171 !!end
7172
7173 !! test
7174 Testing selser after addition of new row before first row (T125419)
7175 !! options
7176 parsoid={
7177 "modes": ["wt2wt", "selser"],
7178 "changes": [
7179 [ "tr", "before", "<tr><td>X</td></tr>" ]
7180 ]
7181 }
7182 !! wikitext
7183 {|
7184 |a
7185 |}
7186 !! wikitext/edited
7187 {|
7188 |X
7189 |-
7190 |a
7191 |}
7192 !! end
7193
7194 !! test
7195 Serialize new table rows in a HTML table using HTML tags
7196 !! options
7197 parsoid={
7198 "modes": ["wt2wt", "selser"],
7199 "changes": [
7200 [ "tr", "before", "<tr><td>X</td></tr>" ]
7201 ]
7202 }
7203 !! wikitext
7204 <table><tr><td>a</td></tr></table>
7205 !! wikitext/edited
7206 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7207 !! end
7208
7209 !! test
7210 Serialize new table cells in a HTML row using HTML tags
7211 !! options
7212 parsoid={
7213 "modes": ["wt2wt", "selser"],
7214 "changes": [
7215 [ "td", "before", "<td>X</td>" ]
7216 ]
7217 }
7218 !! wikitext
7219 <table><tr><td>a</td></tr></table>
7220 !! wikitext/edited
7221 <table><tr><td>X</td><td>a</td></tr></table>
7222 !! end
7223
7224 !! test
7225 Wikitext tables can be nested inside HTML tables
7226 !! options
7227 parsoid=html2wt
7228 !! html
7229 <table data-parsoid='{"stx":"html"}'>
7230 <tr><td>
7231 <table>
7232 <tr><td>foo</td></tr>
7233 </table>
7234 </td></tr>
7235 </table>
7236 !! wikitext
7237 <table>
7238 <tr><td>
7239 {|
7240 |foo
7241 |}
7242 </td></tr>
7243 </table>
7244 !! end
7245
7246 ###
7247 ### Internal links
7248 ###
7249 !! test
7250 Plain link, capitalized
7251 !! wikitext
7252 [[Main Page]]
7253 !! html
7254 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7255 </p>
7256 !! end
7257
7258 !! test
7259 Plain link, uncapitalized
7260 !! wikitext
7261 [[main Page]]
7262 !! html
7263 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7264 </p>
7265 !! end
7266
7267 !! test
7268 Piped link
7269 !! wikitext
7270 [[Main Page|The Main Page]]
7271 !! html
7272 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7273 </p>
7274 !! end
7275
7276 !! test
7277 Piped link with comment in link text
7278 !! wikitext
7279 [[Main Page|The Main<!--front--> Page]]
7280 !! html
7281 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7282 </p>
7283 !! end
7284
7285 !! test
7286 Piped link with multiple pipe characters in link text
7287 !! wikitext
7288 [[Main Page||The|Main|Page|]]
7289 !! html/php
7290 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7291 </p>
7292 !! html/parsoid
7293 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7294 !! end
7295
7296 !! test
7297 Piped link with no link text
7298 !! wikitext
7299 [[Thomas Bek (bishop of St David's)|]]
7300 !! html/php
7301 <p>[[Thomas Bek (bishop of St David's)|]]
7302 </p>
7303 !! html/parsoid
7304 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7305 !! end
7306
7307 !! test
7308 Broken link
7309 !! wikitext
7310 [[Zigzagzogzagzig]]
7311 !! html
7312 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7313 </p>
7314 !! end
7315
7316 !! test
7317 Broken link with fragment
7318 !! wikitext
7319 [[Zigzagzogzagzig#zug]]
7320 !! html
7321 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7322 </p>
7323 !! end
7324
7325 !! test
7326 Special page link with fragment
7327 !! wikitext
7328 [[Special:Version#anchor]]
7329 !! html
7330 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Nonexistent special page link with fragment
7336 !! wikitext
7337 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7338 !! html
7339 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7340 </p>
7341 !! end
7342
7343 !! test
7344 Link with prefix
7345 !! wikitext
7346 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7347 !! html
7348 <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>
7349 </p>
7350 !! end
7351
7352 !! test
7353 Link with suffix
7354 !! wikitext
7355 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7356 !! html
7357 <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>!!!
7358 </p>
7359 !! end
7360
7361 !! article
7362 prefixed article
7363 !! text
7364 Some text
7365 !! endarticle
7366
7367 !! test
7368 Bug 43661: Piped links with identical prefixes
7369 !! wikitext
7370 [[prefixed article|prefixed articles with spaces]]
7371
7372 [[prefixed article|prefixed articlesaoeu]]
7373
7374 [[Main Page|Main Page test]]
7375 !! html
7376 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7377 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7378 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7379 </p>
7380 !! end
7381
7382
7383 !! test
7384 Link with HTML entity in suffix / tail
7385 !! wikitext
7386 [[Main Page]]&quot;, [[Main Page]]&#97;
7387 !! html/php
7388 <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;
7389 </p>
7390 !! html/parsoid
7391 <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>
7392 !! end
7393
7394 !! test
7395 Link with 3 brackets
7396 !! wikitext
7397 [[[Main Page]]]
7398 Foo [[[Main Page]]]
7399 !! html
7400 <p>[[[Main Page]]]
7401 Foo [[[Main Page]]]
7402 </p>
7403 !! end
7404
7405 !! test
7406 Link with 4 brackets
7407 !! wikitext
7408 [[[[Main Page]]]]
7409 !! html
7410 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7411 </p>
7412 !! end
7413
7414 !! test
7415 Piped link with 3 brackets
7416 !! wikitext
7417 [[[main page|the main page]]]
7418 !! html
7419 <p>[[[main page|the main page]]]
7420 </p>
7421 !! end
7422
7423 !! test
7424 Piped link with extlink-like text
7425 !! wikitext
7426 [[Main Page|[bar]]]
7427 [[Main Page|This is a [bar]]]
7428 !! html/php
7429 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7430 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7431 </p>
7432 !! html/parsoid
7433 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7434 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7435 !! end
7436
7437 !! test
7438 Link with multiple pipes
7439 !! wikitext
7440 [[Main Page|The|Main|Page]]
7441 !! html
7442 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7443 </p>
7444 !! end
7445
7446 # Note that parsoid does not munge anchor text; all non-space
7447 # characters are valid in HTML5 ids.
7448 !! test
7449 Anchor containing a #. (bug 63430)
7450 !! wikitext
7451 [[Main Page#And#Link]]
7452 !! html/php
7453 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7454 </p>
7455 !! html/parsoid
7456 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7457 !! end
7458
7459 !! test
7460 Link to namespaces
7461 !! wikitext
7462 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7463 !! html
7464 <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>
7465 </p>
7466 !! end
7467
7468 !! test
7469 Link with space in namespace
7470 !! wikitext
7471 [[User talk:Foo bar]]
7472 !! html
7473 <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>
7474 </p>
7475 !! end
7476
7477 !! article
7478 MemoryAlpha:AlphaTest
7479 !! text
7480 This is an article in the MemoryAlpha namespace
7481 (which shadows the memoryalpha interwiki link).
7482 !! endarticle
7483
7484 !! test
7485 Namespace takes precedence over interwiki link (bug 51680)
7486 !! wikitext
7487 [[MemoryAlpha:AlphaTest]]
7488 !! html
7489 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7490 </p>
7491 !! end
7492
7493 # The previous test doesn't work correctly in html2*, due to not recognizing the
7494 # link as an internal one. This one checks for the correct behavior.
7495 !! test
7496 Link to namespace preferred over interwiki with correct rel attribute
7497 !! options
7498 parsoid=html2wt,html2html
7499 !! html/parsoid
7500 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7501 !! wikitext
7502 [[MemoryAlpha:AlphaTest]]
7503 !! end
7504
7505 !! test
7506 Piped link to namespace
7507 !! wikitext
7508 [[Meta:Disclaimers|The disclaimers]]
7509 !! html
7510 <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>
7511 </p>
7512 !! end
7513
7514 !! test
7515 Link containing }
7516 !! wikitext
7517 [[Usually caused by a typo (oops}]]
7518 !! html
7519 <p>[[Usually caused by a typo (oops}]]
7520 </p>
7521 !! end
7522
7523 !! article
7524 7% Solution
7525 !! text
7526 Just a test of an article title containing a percent.
7527 !! endarticle
7528
7529 !! test
7530 Link containing % (not as a hex sequence)
7531 !! wikitext
7532 [[7% Solution]]
7533 !! html/php
7534 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7535 </p>
7536 !! html/parsoid
7537 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7538 !! end
7539
7540 # note that the parsoid HTML is identical to the previous test output,
7541 # so the previous test ensures that the html2wt mode will generate the
7542 # "not as a hex sequence" wikitext.
7543 !! test
7544 Link containing % as a single hex sequence interpreted to char
7545 !! options
7546 parsoid=wt2wt,wt2html,html2html
7547 !! wikitext
7548 [[7%25 Solution]]
7549 !! html/php
7550 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7551 </p>
7552 !! html/parsoid
7553 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7554 !!end
7555
7556 !! test
7557 Link containing % as a double hex sequence interpreted to hex sequence
7558 !! wikitext
7559 [[7%2525 Solution]]
7560 !! html
7561 <p>[[7%2525 Solution]]
7562 </p>
7563 !!end
7564
7565 # note that parsoid does not munge anchor text; all non-space
7566 # characters are valid in HTML5 anchors.
7567 !! test
7568 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7569 Example for such a section: == < ==
7570 !! wikitext
7571 [[%23%3c]][[%23%3e]]
7572 !! html/php
7573 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7574 </p>
7575 !! html/parsoid
7576 <p><a rel="mw:WikiLink" href="./Main_Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#%3E" title="Main Page">#></a></p>
7577 !! end
7578
7579 !! test
7580 Link containing "<#" and ">#" as a hex sequences
7581 !! wikitext
7582 [[%3c%23]][[%3e%23]]
7583 !! html
7584 <p>[[%3c%23]][[%3e%23]]
7585 </p>
7586 !! end
7587
7588 !! test
7589 Link containing an equals sign
7590 !! wikitext
7591 [[Special:BookSources/isbn=4-00-026157-6]]
7592 !! html/php
7593 <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>
7594 </p>
7595 !! html/parsoid
7596 <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>
7597 !! end
7598
7599 !! article
7600 Foo~bar
7601 !! text
7602 Just a test of an article title containing a tilde.
7603 !! endarticle
7604
7605 # note that links containing signatures, like [[Foo~~~~]], are
7606 # massaged by the pre-save transform (PST) and so the tildes are never
7607 # seen by the parser.
7608 !! test
7609 Link containing a tilde
7610 !! wikitext
7611 [[Foo~bar]]
7612 !! html/php
7613 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7614 </p>
7615 !! html/parsoid
7616 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7617 !! end
7618
7619 !! test
7620 Link containing double-single-quotes '' (bug 4598)
7621 !! wikitext
7622 [[Lista d''e paise d''o munno]]
7623 !! html/php
7624 <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>
7625 </p>
7626 !! html/parsoid
7627 <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>
7628 !! end
7629
7630 !! test
7631 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7632 !! wikitext
7633 Some [[Link|pretty ''italics'' and stuff]]!
7634 !! html/php
7635 <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>!
7636 </p>
7637 !! html/parsoid
7638 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7639 !! end
7640
7641 !! test
7642 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7643 !! wikitext
7644 ''Some [[Link|pretty ''italics'' and stuff]]!''
7645 !! html
7646 <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>
7647 </p>
7648 !! end
7649
7650 !! test
7651 Link with double quotes in title part (literal) and alternate part (interpreted)
7652 !! wikitext
7653 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7654
7655 [[''Pentecoste'']]
7656
7657 [[''Pentecoste''|Pentecoste]]
7658
7659 [[''Pentecoste''|''Pentecoste'']]
7660 !! html/php
7661 <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>
7662 </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>
7663 </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>
7664 </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>
7665 </p>
7666 !! html/parsoid
7667 <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>
7668 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7669 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7670 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7671 !! end
7672
7673 !! test
7674 Broken image links with HTML captions (bug 39700)
7675 !! wikitext
7676 [[File:Nonexistent|<script></script>]]
7677 [[File:Nonexistent|100x100px|<script></script>]]
7678 [[File:Nonexistent|&lt;]]
7679 [[File:Nonexistent|a<i>b</i>c]]
7680 !! html/php
7681 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7682 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7683 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7684 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7685 </p>
7686 !! html/parsoid
7687 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7688 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7689 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7690 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7691 !! end
7692
7693 !! test
7694 Plain link to URL
7695 !! wikitext
7696 [[http://www.example.com]]
7697 !! html/php
7698 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7699 </p>
7700 !! html/parsoid
7701 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7702 !! end
7703
7704 !! test
7705 Plain link to URL with link text
7706 !! wikitext
7707 [[http://www.example.com Link text]]
7708 !! html
7709 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7710 </p>
7711 !! end
7712
7713 !! test
7714 Plain link to protocol-relative URL
7715 !! wikitext
7716 [[//www.example.com]]
7717 !! html/php
7718 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7719 </p>
7720 !! html/parsoid
7721 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7722 !! end
7723
7724 !! test
7725 Plain link to protocol-relative URL with link text
7726 !! wikitext
7727 [[//www.example.com Link text]]
7728 !! html
7729 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7730 </p>
7731 !! end
7732
7733 !! test
7734 Plain link to page with question mark in title
7735 !! wikitext
7736 [[A?b]]
7737
7738 [[A?b|Baz]]
7739 !! html
7740 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7741 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7742 </p>
7743 !! end
7744
7745
7746 # I'm fairly sure the expected result here is wrong.
7747 # We want these to be URL links, not pseudo-pages with URLs for titles....
7748 # However the current output is also pretty screwy.
7749 #
7750 # ----
7751 # I'm changing it to match the current output--it arguably makes more
7752 # sense in the light of the test above. Old expected result was:
7753 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7754 #</p>
7755 # But I think this test is bordering on "garbage in, garbage out" anyway.
7756 # -- wtm
7757 !! test
7758 Piped link to URL
7759 !! wikitext
7760 Piped link to URL: [[http://www.example.com|an example URL]]
7761 !! html/php
7762 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7763 </p>
7764 !! html/parsoid
7765 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7766 !! end
7767
7768 !! test
7769 BUG 2: [[page|http://url/]] should link to page, not http://url/
7770 !! wikitext
7771 [[Main Page|http://url/]]
7772 !! html/php
7773 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7774 </p>
7775 !! html/parsoid
7776 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7777 !! end
7778
7779 # Parsoid does not mark self-links, by design.
7780 !! test
7781 BUG 337: Escaped self-links should be bold
7782 !! options
7783 title=[[Bug462]]
7784 !! wikitext
7785 [[Bu&#103;462]] [[Bug462]]
7786 !! html/php
7787 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7788 </p>
7789 !! html/php+tidy
7790 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7791 !! html/parsoid
7792 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7793 !! end
7794
7795 !! test
7796 Self-link to section should not be bold
7797 !! options
7798 title=[[Main Page]]
7799 !! wikitext
7800 [[Main Page#section]]
7801 !! html
7802 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7803 </p>
7804 !! end
7805
7806 !! article
7807 00
7808 !! text
7809 This is 00.
7810 !! endarticle
7811
7812 !!test
7813 Self-link to numeric title
7814 !!options
7815 title=[[0]]
7816 !! wikitext
7817 [[0]]
7818 !! html
7819 <p><strong class="selflink">0</strong>
7820 </p>
7821 !!end
7822
7823 !!test
7824 Link to numeric-equivalent title
7825 !!options
7826 title=[[0]]
7827 !! wikitext
7828 [[00]]
7829 !! html
7830 <p><a href="/wiki/00" title="00">00</a>
7831 </p>
7832 !!end
7833
7834 !! test
7835 <nowiki> inside a link
7836 !! wikitext
7837 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7838 !! html
7839 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7840 </p>
7841 !! end
7842
7843 !! test
7844 Non-breaking spaces in title
7845 !! wikitext
7846 [[&nbsp; Main &nbsp; Page &nbsp;]]
7847 !! html
7848 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7849 </p>
7850 !!end
7851
7852 !! test
7853 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7854 !! options
7855 language=ca
7856 !! wikitext
7857 '''[[Main Page]]'''
7858 !! html
7859 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7860 </p>
7861 !! end
7862
7863 !! test
7864 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7865 !! options
7866 language=ca
7867 !! wikitext
7868 ''[[Main Page]]''
7869 !! html
7870 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7871 </p>
7872 !! end
7873
7874 !! test
7875 Internal link with en linktrail: no apostrophes (bug 27473)
7876 !! options
7877 language=en
7878 !! wikitext
7879 [[Something]]'nice
7880 !! html
7881 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7882 </p>
7883 !! end
7884
7885 !! test
7886 Internal link with ca linktrail with apostrophes (bug 27473)
7887 !! options
7888 language=ca
7889 !! wikitext
7890 [[Something]]'nice
7891 !! html
7892 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7893 </p>
7894 !! end
7895
7896 !! test
7897 Internal link with kaa linktrail with apostrophes (bug 27473)
7898 !! options
7899 language=kaa
7900 !! wikitext
7901 [[Something]]'nice
7902 !! html
7903 <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>
7904 </p>
7905 !! end
7906
7907 !! test
7908 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7909 !! wikitext
7910 [[User:Foo/Test/63636:Bar|Test]]
7911 !! html/php
7912 <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>
7913 </p>
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7916 !! end
7917
7918 !! test
7919 Purely hash wikilink
7920 !! options
7921 title=[[User:test/123]]
7922 !! wikitext
7923 [[#a|b]]
7924 !! html/php
7925 <p><a href="#a">b</a>
7926 </p>
7927 !! html/parsoid
7928 <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>
7929 !! end
7930
7931 !! test
7932 1. Interaction of linktrail and template encapsulation
7933 !! options
7934 parsoid
7935 !! wikitext
7936 {{echo|[[Foo]]}}l
7937 !! html
7938 <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>
7939 !! end
7940
7941 !! test
7942 2. Interaction of linktrail and template encapsulation
7943 !! options
7944 parsoid
7945 !! wikitext
7946 {{echo|Some [[Fool]]}}s
7947 !! html
7948 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7949 !! end
7950
7951 !! test
7952 3. Interaction of linktrail and template encapsulation
7953 !! options
7954 parsoid
7955 !! wikitext
7956 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7957 !! html
7958 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7959 !! end
7960
7961 !! article
7962 Söfnuður
7963 !! text
7964 Test.
7965 !! endarticle
7966
7967 !! test
7968 Internal link with is link prefix
7969 !! options
7970 language=is
7971 !! wikitext
7972 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7973 !! html
7974 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7975 </p>
7976 !! end
7977
7978 !! article
7979 Mótmælendatrú
7980 !! text
7981 Test.
7982 !! endarticle
7983
7984 !! test
7985 Internal link with is link trail and link prefix
7986 !! options
7987 language=is
7988 !! wikitext
7989 [[mótmælendatrú|xxx]]ar
7990 [[mótmælendatrú]]ar
7991 mótmælenda[[söfnuður]]
7992 mótmælenda[[söfnuður|söfnuðir]]
7993 mótmælenda[[söfnuður|söfnuðir]]xxx
7994 !! html
7995 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7996 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7997 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7998 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7999 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8000 </p>
8001 !! end
8002
8003 !! test
8004 Parsoid link trail escaping
8005 !! options
8006 parsoid=html2wt,html2html
8007 !! html/parsoid
8008 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8009 !! wikitext
8010 [[apple]]<nowiki/>s
8011 !! end
8012
8013 !! test
8014 Parsoid link prefix escaping
8015 !! options
8016 language=is
8017 parsoid=html2wt,html2html
8018 !! html/parsoid
8019 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8020 !! wikitext
8021 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8022 !! end
8023
8024 !! test
8025 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8026 !! wikitext
8027 [[Foo| bar]]
8028
8029 [[Foo| ''bar'']]
8030
8031 [http://wp.org foo]
8032
8033 [http://wp.org ''foo'']
8034 !! html
8035 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8036 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8037 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8038 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8039 </p>
8040 !! end
8041
8042 !! test
8043 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8044 !! options
8045 parsoid
8046 !! wikitext
8047 [[Foo|{{echo|a}} b {{echo|c}}]]
8048 !! html
8049 <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>
8050 !! end
8051
8052 !! test
8053 Link with angle bracket after anchor
8054 !! wikitext
8055 [[Foo#<bar>]]
8056 !! html/php
8057 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8058 </p>
8059 !! html/parsoid
8060 <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>
8061 !! end
8062
8063 ###
8064 ### Interwiki links (see maintenance/interwiki.sql)
8065 ###
8066
8067 !! test
8068 Inline interwiki link
8069 !! options
8070 parsoid=wt2html,wt2wt,html2html
8071 !! wikitext
8072 [[MeatBall:SoftSecurity]]
8073 !! html/php
8074 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8075 </p>
8076 !! html/parsoid
8077 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8078 !! end
8079
8080 !! test
8081 Inline interwiki link with empty title (bug 2372)
8082 !! options
8083 parsoid=wt2html,wt2wt,html2html
8084 !! wikitext
8085 [[MeatBall:]]
8086 !! html/php
8087 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8088 </p>
8089 !! html/parsoid
8090 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8091 !! end
8092
8093 !! test
8094 Interwiki link encoding conversion (bug 1636)
8095 !! wikitext
8096 *[[Wikipedia:ro:Olteni&#0355;a]]
8097 *[[Wikipedia:ro:Olteni&#355;a]]
8098 !! html
8099 <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>
8100 <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>
8101
8102 !! html+tidy
8103 <ul>
8104 <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>
8105 <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>
8106 </ul>
8107 !! end
8108
8109 !! test
8110 Interwiki link with fragment (bug 2130)
8111 !! wikitext
8112 [[MeatBall:SoftSecurity#foo]]
8113 !! html
8114 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8115 </p>
8116 !! end
8117
8118 # Ideally the wikipedia: prefix here should be proto-relative too
8119 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8120 # define the 'en' prefix, and originally the test used 'wikipedia',
8121 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8122 # article.
8123 !! test
8124 Different interwiki prefixes mapping to the same URL
8125 !! wikitext
8126 [[:en:Foo]]
8127
8128 [[:en:Foo|Foo]]
8129
8130 [[wikipedia:Foo]]
8131
8132 [[:wikipedia:Foo|Foo]]
8133
8134 [[wikipedia:en:Foo]]
8135
8136 [[:wikipedia:en:Foo]]
8137
8138 [[ wikiPEdia :Foo]]
8139 !! html/parsoid
8140 <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>
8141
8142 <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>
8143
8144 <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>
8145
8146 <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>
8147
8148 <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>
8149
8150 <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>
8151
8152 <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>
8153 !! end
8154
8155 !! test
8156 Interwiki links that cannot be represented in wiki syntax
8157 !! wikitext
8158 [[meatball:ok]]
8159 [[meatball:ok#foo|ok with fragment]]
8160 [[meatball:ok_as_well?|ok ending with ? mark]]
8161 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8162 [http://de.wikipedia.org/wiki/#foo is just fragment]
8163
8164 !! html/php
8165 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8166 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8167 <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>
8168 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8169 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8170 </p>
8171 !! html/parsoid
8172 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8173 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8174 <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>
8175 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8176 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8177 !! end
8178
8179 !! test
8180 Interwiki links: trail
8181 !! wikitext
8182 [[wikipedia:Foo|Ba]]r
8183 !! html/php
8184 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8185 </p>
8186 !! html/parsoid
8187 <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>
8188 !! end
8189
8190 !! test
8191 Local interwiki link
8192 !! options
8193 parsoid=wt2html,wt2wt,html2html
8194 !! wikitext
8195 [[local:Template:Foo]]
8196 !! html/php
8197 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8198 </p>
8199 !! html/parsoid
8200 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8201 !! end
8202
8203 # Parsoid does not mark self-links, by design.
8204 !! test
8205 Local interwiki link: self-link to current page
8206 !! options
8207 title=[[Main Page]]
8208 parsoid=wt2html,wt2wt,html2html
8209 !! wikitext
8210 [[local:Main Page]]
8211 !! html/php
8212 <p><strong class="selflink">local:Main Page</strong>
8213 </p>
8214 !! html/parsoid
8215 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8216 !! end
8217
8218 !! test
8219 Local interwiki link: prefix only (bug 64167)
8220 !! options
8221 parsoid=wt2html,wt2wt,html2html
8222 !! wikitext
8223 [[local:]]
8224 !! html/php
8225 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8226 </p>
8227 !! html/parsoid
8228 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8229 !! end
8230
8231 !! test
8232 Local interwiki link: with additional interwiki prefix (bug 61357)
8233 !! options
8234 parsoid=wt2html,wt2wt,html2html
8235 !! wikitext
8236 [[local:meatball:Hello]]
8237 !! html/php
8238 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8239 </p>
8240 !! html/parsoid
8241 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8242 !! end
8243
8244 !! test
8245 Multiple local interwiki link prefixes
8246 !! wikitext
8247 [[local:local:local:local:mi:local:Foo]]
8248 !! options
8249 parsoid=wt2html,wt2wt,html2html
8250 !! html/php
8251 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8252 </p>
8253 !! html/parsoid
8254 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8255 !! end
8256
8257 ###
8258 ### Interlanguage links
8259 ### Language links (so that searching for '### language' matches..)
8260 ###
8261
8262 !! test
8263 Interlanguage link
8264 !! options
8265 parsoid=wt2html,wt2wt,html2html
8266 !! wikitext
8267 Blah blah blah
8268 [[zh:Chinese]]
8269 !! html/php
8270 <p>Blah blah blah
8271 </p>
8272 !! html/parsoid
8273 <p>Blah blah blah</p>
8274 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8275 !! end
8276
8277 !! test
8278 Interlanguage link with spacing
8279 !! options
8280 parsoid=wt2html,wt2wt,html2html
8281 !! wikitext
8282 Blah blah blah
8283 [[ zh : Chinese ]]
8284 !! html/php
8285 <p>Blah blah blah
8286 </p>
8287 !! html/parsoid
8288 <p>Blah blah blah</p>
8289 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8290 !! end
8291
8292 !! test
8293 Double interlanguage link
8294 !! options
8295 parsoid=wt2html,wt2wt,html2html
8296 !! wikitext
8297 Blah blah blah
8298 [[es:Spanish]]
8299 [[zh:Chinese]]
8300 !! html/php
8301 <p>Blah blah blah
8302 </p>
8303 !! html/parsoid
8304 <p>Blah blah blah</p>
8305 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8306 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8307 !! end
8308
8309 !! test
8310 Interlanguage link variations
8311 !! options
8312 parsoid=wt2html,wt2wt,html2html
8313 !! wikitext
8314 Blah blah blah
8315 [[ es :Spanish]]
8316 [[ ZH :Chinese]]
8317 [[es:Foo_bar]]
8318 !! html/php
8319 <p>Blah blah blah
8320 </p>
8321 !! html/parsoid
8322 <p>Blah blah blah</p>
8323 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8324 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8325 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8326 !! end
8327
8328 !! test
8329 Space and question mark encoding in interlanguage links (T95473)
8330 !! options
8331 parsoid=wt2html,wt2wt,html2html
8332 !! wikitext
8333 Blah blah blah
8334 [[es:Foo bar?]]
8335 !! html/php
8336 <p>Blah blah blah
8337 </p>
8338 !! html/parsoid
8339 <p>Blah blah blah</p>
8340 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8341 !! end
8342
8343 !! test
8344 Interlanguage link, with prefix links
8345 !! options
8346 language=ln
8347 !! wikitext
8348 Blah blah blah
8349 [[zh:Chinese]]
8350 !! html/php
8351 <p>Blah blah blah
8352 </p>
8353 !! html/parsoid
8354 <p>Blah blah blah</p>
8355 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8356 !! end
8357
8358 !! test
8359 Double interlanguage link, with prefix links (bug 8897)
8360 !! options
8361 language=ln
8362 !! wikitext
8363 Blah blah blah
8364 [[es:Spanish]]
8365 [[zh:Chinese]]
8366 !! html/php
8367 <p>Blah blah blah
8368 </p>
8369 !! html/parsoid
8370 <p>Blah blah blah</p>
8371 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8372 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8373 !! end
8374
8375 !! test
8376 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8377 !! wikitext
8378 Blah blah blah
8379 [[mul:Article]]
8380 !! html/php
8381 <p>Blah blah blah
8382 </p>
8383 !! html/parsoid
8384 <p>Blah blah blah</p>
8385 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8386 !! end
8387
8388 !! test
8389 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8390 !! options
8391 language=ln
8392 !! wikitext
8393 [[WW&nbsp;II]]
8394 !! html
8395 <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>
8396 </p>
8397 !! end
8398
8399 !! test
8400 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8401 !! options
8402 parsoid=html2wt
8403 !! html/parsoid
8404 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8405 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8406 !! wikitext
8407 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8408
8409 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8410 !! end
8411
8412 !! test
8413 Parsoid: handle constructor well
8414 !! wikitext
8415 [[constructor]]
8416
8417 [[constructor:foo]]
8418 !! html/php
8419 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8420 </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>
8421 </p>
8422 !! html/parsoid
8423 <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>
8424
8425 <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>
8426 !! end
8427
8428 !! article
8429 ko:
8430 !! text
8431 Test.
8432 !! endarticle
8433
8434 # Note that `ko` isn't a known interlanguage prefix
8435 !! test
8436 Parsoid: recognize interlanguage links without a target page
8437 !! options
8438 ill
8439 !! wikitext
8440 [[es:]]
8441
8442 [[ko:]]
8443 !! html/php
8444 es:
8445 !! html/parsoid
8446 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8447
8448 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8449 !! end
8450
8451 # Note that `ko` isn't a known interwiki prefix
8452 !! test
8453 Parsoid: recognize interwiki links without a target page
8454 !! options
8455 parsoid=wt2html,wt2wt,html2html
8456 !! wikitext
8457 [[:es:]]
8458
8459 [[:ko:]]
8460 !! html/php
8461 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8462 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8463 </p>
8464 !! html/parsoid
8465 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8466 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8467 !! end
8468
8469 !! test
8470 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8471 !! wikitext
8472 [[mi:Foo]]
8473 !! html/php
8474 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8475 </p>
8476 !! html/parsoid
8477 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8478 !! end
8479
8480 !! test
8481 Interlanguage link with preceding local interwiki link (bug 68085)
8482 !! options
8483 parsoid=wt2html,wt2wt,html2html
8484 !! wikitext
8485 Blah blah blah
8486 [[local:es:Spanish]]
8487 !! html/php
8488 <p>Blah blah blah
8489 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8490 </p>
8491 !! html/parsoid
8492 <p>Blah blah blah
8493 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8494 !! end
8495
8496 !! test
8497 Looks like an interlanguage link, but is actually a local interwiki
8498 !! options
8499 parsoid=wt2html,wt2wt,html2html
8500 !! wikitext
8501 Blah blah blah
8502 [[mi:Template:Foo]]
8503 !! html/php
8504 <p>Blah blah blah
8505 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8506 </p>
8507 !! html/parsoid
8508 <p>Blah blah blah
8509 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8510 !! end
8511
8512 ###
8513 ### Redirects, Parsoid-only
8514 ###
8515
8516 !! test
8517 1. Simple redirect to page
8518 !! wikitext
8519 #REDIRECT [[Main Page]]
8520 !! html/parsoid
8521 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8522 !! end
8523
8524 !! test
8525 2. Other redirect variants
8526 !! wikitext
8527 #REDIRECT [[Main_Page]]
8528 !! html/parsoid
8529 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8530 !! end
8531
8532 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8533 # This tests the Parsoid bail-out code.
8534 !! test
8535 3. Other redirect variants
8536 !! wikitext
8537 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8538 !! html/parsoid
8539 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8540 !! end
8541
8542 !! test
8543 4. Redirect to a templated destination
8544 !! wikitext
8545 #REDIRECT [[{{echo|Foo}}bar]]
8546 !! html/parsoid
8547 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8548 !! end
8549
8550 !! test
8551 Empty redirect
8552 !! options
8553 parsoid=wt2html,wt2wt
8554 !! wikitext
8555 #REDIRECT [[]]
8556 !! html/parsoid
8557 <ol>
8558 <li>REDIRECT [[]]</li></ol>
8559 !! end
8560
8561 !! test
8562 Optional colon in #REDIRECT
8563 !! options
8564 # the colon is archaic syntax. we support it for wt2html, but we
8565 # don't care that it roundtrips back to the modern syntax.
8566 parsoid=wt2html,html2html
8567 !! wikitext
8568 #REDIRECT:[[Main Page]]
8569 !! html/parsoid
8570 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8571 !! end
8572
8573 !! test
8574 Whitespace in #REDIRECT with optional colon
8575 !! options
8576 # the colon and gratuitous whitespace is archaic syntax. we support
8577 # it for wt2html, but we don't care that it roundtrips back to the
8578 # modern syntax (without extra whitespace)
8579 parsoid=wt2html,html2html
8580 !! wikitext
8581
8582 #REDIRECT
8583 :
8584 [[Main Page]]
8585 !! html/parsoid
8586 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8587 !! end
8588
8589 !! test
8590 Piped link in #REDIRECT
8591 !! options
8592 # content after piped link is ignored. we support this syntax,
8593 # but don't care that the piped link is lost when we roundtrip this.
8594 parsoid=wt2html
8595 !! wikitext
8596 #REDIRECT [[Main Page|bar]]
8597 !! html/parsoid
8598 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8599 !! end
8600
8601 !! test
8602 Redirect to category (T104502)
8603 !! options
8604 parsoid=wt2html,wt2wt
8605 !! wikitext
8606 #REDIRECT [[Category:Foo]]
8607 !! html/parsoid
8608 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8609 !! end
8610
8611 !! test
8612 Redirect to category with URL encoding (T104502)
8613 !! options
8614 parsoid=wt2html
8615 !! wikitext
8616 #REDIRECT [[Category%3AFoo]]
8617 !! html/parsoid
8618 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8619 !! end
8620
8621 !! test
8622 Redirect to category page
8623 !! wikitext
8624 #REDIRECT [[:Category:Foo]]
8625 !! html/parsoid
8626 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8627 !! end
8628
8629 !! test
8630 Redirect to image page (1)
8631 !! wikitext
8632 #REDIRECT [[File:Wiki.png]]
8633 !! html/parsoid
8634 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8635 !! end
8636
8637 !! test
8638 Redirect to image page (2)
8639 !! wikitext
8640 #REDIRECT [[Image:Wiki.png]]
8641 !! html/parsoid
8642 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8643 !! end
8644
8645 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8646 # Next test confirms this.
8647 !! test
8648 Redirect to language (1) (T104918)
8649 !! options
8650 parsoid=wt2html,wt2wt,html2html
8651 !! wikitext
8652 #REDIRECT [[en:File:Wiki.png]]
8653 !! html/parsoid
8654 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8655 !! end
8656
8657 !! test
8658 Redirect to language (2) (T104918)
8659 !! wikitext
8660 #REDIRECT [[:en:File:Wiki.png]]
8661 !! html/parsoid
8662 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8663 !! end
8664
8665 !! test
8666 Redirect to interwiki (T104918)
8667 !! wikitext
8668 #REDIRECT [[meatball:File:Wiki.png]]
8669 !! html/parsoid
8670 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8671 !! end
8672
8673 !! test
8674 Non-English #REDIRECT
8675 !! options
8676 language=is
8677 !! wikitext
8678 #TILVÍSUN [[Main Page]]
8679 !! html/parsoid
8680 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8681 !! end
8682
8683 !! test
8684 Redirect syntax under text isn't considered a redirect
8685 !! wikitext
8686 some text
8687 #redirect [[Main Page]]
8688 !! html/parsoid
8689 <p>some text</p>
8690 <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>
8691 !! end
8692
8693 # FIXME: Should hoist the redirect to the top of the page and ensure there
8694 # is only one.
8695 !! test
8696 New redirect
8697 !! options
8698 parsoid=html2wt
8699 !! html/parsoid
8700 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8701 !! wikitext
8702 Foo
8703 #REDIRECT [[Foo]]
8704 !! end
8705
8706 ##
8707 ## XHTML tidiness
8708 ###
8709
8710 !! test
8711 <br> to <br />
8712 !! wikitext
8713 1<br>2<br />3
8714 !! html
8715 <p>1<br />2<br />3
8716 </p>
8717 !! end
8718
8719 !! test
8720 Broken br tag sanitization
8721 !! wikitext
8722 </br>
8723 !! html/php
8724 <p>&lt;/br&gt;
8725 </p>
8726 !! end
8727
8728 # TODO: Fix html2html mode (bug 51055)!
8729 !! test
8730 Parsoid: Broken br tag recognition
8731 !! options
8732 parsoid=wt2html
8733 !! wikitext
8734 </br>
8735
8736 <br/ >
8737 !! html+tidy
8738 <p><br /></p>
8739 <p><br /></p>
8740 !! end
8741
8742 !! test
8743 Incorrecly removing closing slashes from correctly formed XHTML
8744 !! wikitext
8745 <br style="clear:both;" />
8746 !! html
8747 <p><br style="clear:both;" />
8748 </p>
8749 !! end
8750
8751 !! test
8752 Failing to transform badly formed HTML into correct XHTML
8753 !! wikitext
8754 <br style="clear: left;">
8755 <br style="clear: right;">
8756 <br style="clear: both;">
8757 !! html
8758 <p><br style="clear: left;" />
8759 <br style="clear: right;" />
8760 <br style="clear: both;" />
8761 </p>
8762 !!end
8763
8764 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8765 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8766 !! test
8767 Handling html with a div self-closing tag
8768 !! wikitext
8769 <div title />
8770 <div title/>
8771 <div title/ >
8772 <div title=bar />
8773 <div title=bar/>
8774 <div title=bar/ >
8775 !! html/php
8776 <p>&lt;div title /&gt;
8777 &lt;div title/&gt;
8778 </p>
8779 <div>
8780 <p>&lt;div title=bar /&gt;
8781 &lt;div title=bar/&gt;
8782 </p>
8783 <div title="bar/"></div>
8784 </div>
8785
8786 !! html/parsoid
8787 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8788 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8789 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8790 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8791 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8792 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8793 !! end
8794
8795 !! test
8796 Handling html with a br self-closing tag
8797 !! wikitext
8798 <br title />
8799 <br title/>
8800 <br title/ >
8801 <br title=bar />
8802 <br title=bar/>
8803 <br title=bar/ >
8804 !! html/php
8805 <p><br title="" />
8806 <br title="" />
8807 <br />
8808 <br title="bar" />
8809 <br title="bar" />
8810 <br title="bar/" />
8811 </p>
8812 !! html/parsoid
8813 <p><br title="" />
8814 <br title="" />
8815 <br title="" />
8816 <br title="bar" />
8817 <br title="bar" />
8818 <br title="bar/" />
8819 </p>
8820 !! end
8821
8822 !! test
8823 Horizontal ruler (should it add that extra space?)
8824 !! wikitext
8825 <hr>
8826 <hr >
8827 foo <hr
8828 > bar
8829 !! html+tidy
8830 <hr />
8831 <hr />
8832 <p>foo</p>
8833 <hr />
8834 <p>bar</p>
8835 !! end
8836
8837 !! test
8838 Horizontal ruler -- 4+ dashes render hr
8839 !! wikitext
8840 ----
8841 !! html
8842 <hr />
8843
8844 !! end
8845
8846 !! test
8847 Horizontal ruler -- eats additional dashes on the same line
8848 !! wikitext
8849 ---------
8850 !! html
8851 <hr />
8852
8853 !! end
8854
8855 !! test
8856 Horizontal ruler -- does not collapse dashes on consecutive lines
8857 !! wikitext
8858 ----
8859 ----
8860 !! html
8861 <hr />
8862 <hr />
8863
8864 !! end
8865
8866 !! test
8867 Horizontal ruler -- <4 dashes render as plain text
8868 !! wikitext
8869 ---
8870 !! html
8871 <p>---
8872 </p>
8873 !! end
8874
8875 !! test
8876 Horizontal ruler -- Supports content following dashes on same line
8877 !! wikitext
8878 ---- Foo
8879 !! html
8880 <hr /> Foo
8881
8882 !! html+tidy
8883 <hr />
8884 <p>Foo</p>
8885 !! end
8886
8887 ###
8888 ### Block-level elements
8889 ###
8890 !! test
8891 Common list
8892 !! wikitext
8893 *Common list
8894 * item 2
8895 *item 3
8896 !! html
8897 <ul><li>Common list</li>
8898 <li> item 2</li>
8899 <li>item 3</li></ul>
8900
8901 !! end
8902
8903 !! test
8904 Numbered list
8905 !! wikitext
8906 #Numbered list
8907 #item 2
8908 # item 3
8909 !! html
8910 <ol><li>Numbered list</li>
8911 <li>item 2</li>
8912 <li> item 3</li></ol>
8913
8914 !! end
8915
8916 !! test
8917 Mixed list
8918 !! wikitext
8919 *Mixed list
8920 *# with numbers
8921 ** and bullets
8922 *# and numbers
8923 *bullets again
8924 **bullet level 2
8925 ***bullet level 3
8926 ***#Number on level 4
8927 **bullet level 2
8928 **#Number on level 3
8929 **#Number on level 3
8930 *#number level 2
8931 *Level 1
8932 *** Level 3
8933 #** Level 3, but ordered
8934 !! html
8935 <ul><li>Mixed list
8936 <ol><li> with numbers</li></ol>
8937 <ul><li> and bullets</li></ul>
8938 <ol><li> and numbers</li></ol></li>
8939 <li>bullets again
8940 <ul><li>bullet level 2
8941 <ul><li>bullet level 3
8942 <ol><li>Number on level 4</li></ol></li></ul></li>
8943 <li>bullet level 2
8944 <ol><li>Number on level 3</li>
8945 <li>Number on level 3</li></ol></li></ul>
8946 <ol><li>number level 2</li></ol></li>
8947 <li>Level 1
8948 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8949 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8950
8951 !! end
8952
8953 !! test
8954 1. Nested mixed wikitext and html list
8955 !! wikitext
8956 * hi
8957 * <ul><li>ho</li></ul>
8958 * hi
8959 ** ho
8960 !! html/php
8961 <ul><li> hi</li>
8962 <li> <ul><li>ho</li></ul></li>
8963 <li> hi
8964 <ul><li> ho</li></ul></li></ul>
8965
8966 !! html/parsoid
8967 <ul><li> hi</li>
8968 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8969 <li> hi
8970 <ul><li> ho</li></ul></li></ul>
8971 !! end
8972
8973 !! test
8974 2. Nested mixed wikitext and html list (incompatible)
8975 !! wikitext
8976 ; hi
8977 : {{echo|<li>ho</li>}}
8978 !! html/php
8979 <dl><dt> hi</dt>
8980 <dd> <li>ho</li></dd></dl>
8981
8982 !! html/parsoid
8983 <dl><dt> hi</dt>
8984 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
8985 !! end
8986
8987 !! test
8988 Nested lists 1
8989 !! wikitext
8990 *foo
8991 **bar
8992 !! html
8993 <ul><li>foo
8994 <ul><li>bar</li></ul></li></ul>
8995
8996 !! end
8997
8998 !! test
8999 Nested lists 2
9000 !! wikitext
9001 **foo
9002 *bar
9003 !! html
9004 <ul><li><ul><li>foo</li></ul></li>
9005 <li>bar</li></ul>
9006
9007 !! end
9008
9009 !! test
9010 Nested lists 3 (first element empty)
9011 !! wikitext
9012 *
9013 **bar
9014 !! html
9015 <ul><li>
9016 <ul><li>bar</li></ul></li></ul>
9017
9018 !! end
9019
9020 !! test
9021 Nested lists 4 (first element empty)
9022 !! wikitext
9023 **
9024 *bar
9025 !! html
9026 <ul><li><ul><li></li></ul></li>
9027 <li>bar</li></ul>
9028
9029 !! end
9030
9031 !! test
9032 Nested lists 5 (both elements empty)
9033 !! wikitext
9034 **
9035 *
9036 !! html
9037 <ul><li><ul><li></li></ul></li>
9038 <li></li></ul>
9039
9040 !! end
9041
9042 !! test
9043 Nested lists 6 (both elements empty)
9044 !! wikitext
9045 *
9046 **
9047 !! html
9048 <ul><li>
9049 <ul><li></li></ul></li></ul>
9050
9051 !! end
9052
9053 !! test
9054 Nested lists 7 (skip initial nesting levels)
9055 !! wikitext
9056 *** foo
9057 !! html
9058 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9059
9060 !! end
9061
9062 !! test
9063 Nested lists 8 (multiple nesting transitions)
9064 !! wikitext
9065 * foo
9066 *** bar
9067 ** baz
9068 * boo
9069 !! html
9070 <ul><li> foo
9071 <ul><li><ul><li> bar</li></ul></li>
9072 <li> baz</li></ul></li>
9073 <li> boo</li></ul>
9074
9075 !! end
9076
9077 !! test
9078 Nested lists 9 (extension interaction)
9079 !! options
9080 parsoid
9081 !! wikitext
9082 *<references />
9083 !! html/parsoid
9084 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9085 !! end
9086
9087 !! test
9088 1. Lists with start-of-line-transparent tokens before bullets: Comments
9089 !! wikitext
9090 *foo
9091 *<!--cmt-->bar
9092 <!--cmt-->*baz
9093 !! html
9094 <ul><li>foo</li>
9095 <li>bar</li>
9096 <li>baz</li></ul>
9097
9098 !! end
9099
9100 !! test
9101 2. Lists with start-of-line-transparent tokens before bullets: Template close
9102 !! wikitext
9103 *foo {{echo|bar
9104 }}*baz
9105 !! html
9106 <ul><li>foo bar</li>
9107 <li>baz</li></ul>
9108
9109 !! end
9110
9111 !! test
9112 List items are not parsed correctly following a <pre> block (bug 785)
9113 !! wikitext
9114 * <pre>foo</pre>
9115 * <pre>bar</pre>
9116 * zar
9117 !! html/php
9118 <ul><li> <pre>foo</pre></li>
9119 <li> <pre>bar</pre></li>
9120 <li> zar</li></ul>
9121
9122 !! html/parsoid
9123 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9124 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9125 <li> zar</li></ul>
9126 !! end
9127
9128 !! test
9129 List items from template
9130 !! wikitext
9131
9132 {{inner list}}
9133 * item 2
9134
9135 * item 0
9136 {{inner list}}
9137 * item 2
9138
9139 * item 0
9140 * notSOL{{inner list}}
9141 * item 2
9142 !! html
9143 <ul><li> item 1</li>
9144 <li> item 2</li></ul>
9145 <ul><li> item 0</li>
9146 <li> item 1</li>
9147 <li> item 2</li></ul>
9148 <ul><li> item 0</li>
9149 <li> notSOL</li>
9150 <li> item 1</li>
9151 <li> item 2</li></ul>
9152
9153 !! end
9154
9155 !! test
9156 List interrupted by empty line or heading
9157 !! wikitext
9158 * foo
9159
9160 ** bar
9161 == A heading ==
9162 * Another list item
9163 !! html
9164 <ul><li> foo</li></ul>
9165 <ul><li><ul><li> bar</li></ul></li></ul>
9166 <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>
9167 <ul><li> Another list item</li></ul>
9168
9169 !!end
9170
9171 !!test
9172 Multiple list tags generated by templates
9173 !! wikitext
9174 {{echo|<li>}}a
9175 {{echo|<li>}}b
9176 {{echo|<li>}}c
9177 !! html
9178 <li>a
9179 <li>b
9180 <li>c</li>
9181 </li>
9182 </li>
9183
9184 !! html+tidy
9185 <ul>
9186 <li>a</li>
9187 <li>b</li>
9188 <li>c</li>
9189 </ul>
9190 !!end
9191
9192 !!test
9193 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9194 !! wikitext
9195 *a
9196 <!--This line will NOT split the list-->
9197 *b
9198 <!--This line will NOT split the list either-->
9199 *c
9200 <!--foo--> <!----> <!--This line NOT split the list either-->
9201 *d
9202 !! html
9203 <ul><li>a</li>
9204 <li>b</li>
9205 <li>c</li>
9206 <li>d</li></ul>
9207
9208 !!end
9209
9210 !!test
9211 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9212 !! wikitext
9213 *a
9214 <!--This line will NOT split the list-->
9215 *b
9216 <!--This line will NOT split the list either-->
9217 *c
9218 <!--foo--> <!----> <!--This line NOT split the list
9219 either-->
9220 *d
9221 !! html
9222 <ul><li>a</li>
9223 <li>b</li>
9224 <li>c</li>
9225 <li>d</li></ul>
9226
9227 !!end
9228
9229 !!test
9230 Test the li-hack
9231 (The PHP parser relies on Tidy for the hack)
9232 !!options
9233 parsoid=wt2html,wt2wt
9234 !! wikitext
9235 * foo
9236 * <li>li-hack
9237 * {{echo|<li>templated li-hack}}
9238 * <!--foo--> <li> unsupported li-hack with preceding comments
9239
9240 <ul>
9241 <li><li>not a li-hack
9242 </li>
9243 </ul>
9244 !! html+tidy
9245 <ul>
9246 <li>foo</li>
9247 <li>li-hack</li>
9248 <li>templated li-hack</li>
9249 <li>unsupported li-hack with preceding comments</li>
9250 </ul>
9251 <ul>
9252 <li>not a li-hack</li>
9253 </ul>
9254 !!end
9255
9256 !! test
9257 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9258 !! options
9259 parsoid
9260 !! wikitext
9261 # foo
9262 ## bar
9263 * foo
9264 ** bar
9265 : foo
9266 :: bar
9267 !! html
9268 <ol>
9269 <li> foo<ol>
9270 <li> bar</li>
9271 </ol></li>
9272 </ol><ul>
9273 <li> foo<ul>
9274 <li> bar</li>
9275 </ul></li>
9276 </ul><dl>
9277 <dd> foo<dl>
9278 <dd> bar</dd>
9279 </dl></dd>
9280 </dl>
9281 !! end
9282
9283 !! test
9284 Parsoid: Test of whitespace serialization with Templated bullets
9285 !! options
9286 parsoid
9287 !! wikitext
9288 * {{bullet}}
9289 !! html
9290 <ul>
9291 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9292 </ul>
9293 !! end
9294
9295 # ------------------------------------------------------------------------
9296 # The next set of tests are about Parsoid's ability to handle badly nested
9297 # tags (parse, minimize scope of fixup, and roundtrip back)
9298 # ------------------------------------------------------------------------
9299
9300 !! test
9301 Unbalanced closing block tags break a list
9302 (php parser relies on Tidy to fix up)
9303 !! wikitext
9304 <div>
9305 *a</div><div>
9306 *b</div>
9307 !! html+tidy
9308 <div>
9309 <ul>
9310 <li>a</li>
9311 </ul>
9312 </div>
9313 <div>
9314 <ul>
9315 <li>b</li>
9316 </ul>
9317 </div>
9318 !! end
9319
9320 # Parsoid fails this test, but it might be tricky to support properly.
9321 # See bug 68395.
9322 !! test
9323 Unbalanced closing non-block tags don't break a list
9324 (php parser relies on Tidy to fix up)
9325 !! wikitext
9326 <span>
9327 *a</span><span>
9328 *b</span>
9329 !! html/php+tidy
9330 <ul>
9331 <li><span>a</span></li>
9332 <li><span>b</span></li>
9333 </ul>
9334 !! html/parsoid
9335 <span>
9336 <ul>
9337 <li>a<span></span>
9338 </li>
9339 <li>b
9340 </li>
9341 </ul>
9342 </span>
9343 !! end
9344
9345 !! test
9346 Unclosed formatting tags that straddle lists are closed and reopened
9347 (php parser relies on Tidy to fix up)
9348 !! options
9349 parsoid=wt2html,wt2wt,html2html
9350 !! wikitext
9351 # <s> a
9352 # b </s>
9353 !! html/php+tidy
9354 <ol>
9355 <li><s>a</s></li>
9356 <li><s>b</s></li>
9357 </ol>
9358 !! html/parsoid
9359 <ol><li> <s> a</s></li>
9360 <li><s> b </s></li></ol>
9361 !! end
9362
9363 # See bug 68395.
9364 !!test
9365 1. List embedded in a formatting tag
9366 !! wikitext
9367 <small>
9368 * foo
9369 </small>
9370 !! html/php+tidy
9371 <ul>
9372 <li><small>foo</small></li>
9373 </ul>
9374 !! html/parsoid
9375 <small>
9376 <ul>
9377 <li> foo</li>
9378 </ul>
9379 </small>
9380 !!end
9381
9382 ## Ugly Parsoid output here
9383 ## Not sure what the right output is.
9384 !!test
9385 2. List embedded in a formatting tag
9386 !! wikitext
9387 <small>
9388 *a
9389 *b</small>
9390 !! html/php+tidy
9391 <ul>
9392 <li><small>a</small></li>
9393 <li><small>b</small></li>
9394 </ul>
9395 !! html/parsoid
9396 <small></small>
9397 <ul><small>
9398 <li>a</li>
9399 </small>
9400 <li><small>b</small></li>
9401 </ul>
9402 !!end
9403
9404 # Ugly Parsoid and PHP parser output here
9405 # Not sure if we want to make this a test!
9406 #
9407 ## !!test
9408 ## 3. Unclosed formatting tags in list elements
9409 ## !! wikitext
9410 ## *<small>a
9411 ## *<small>b
9412 ## !! html/php+tidy
9413 ## <ul>
9414 ## <li><small>a</small></li>
9415 ## <li><small><small>b</small></small></li>
9416 ## </ul>
9417 ## !! html/parsoid
9418 ## <ul>
9419 ## <li><small>a</small></li>
9420 ## <small>
9421 ## <li><small>b</small></li>
9422 ## </small></ul>
9423 ## !!end
9424
9425 # This is a bug in the PHP parser + tidy combination.
9426 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9427 # and then fostered out of the table by tidy.)
9428 # We believe the Parsoid output to be correct.
9429 !! test
9430 Table with missing opening <tr> tag
9431 !! options
9432 parsoid=wt2html,wt2wt
9433 !! wikitext
9434 <table>
9435 <td>foo</td>
9436 </tr>
9437 </table>
9438 !! html+tidy
9439 <table>
9440 <tr>
9441 <td>foo</td>
9442 </tr>
9443 </table>
9444 !! end
9445
9446 ###
9447 ### Magic Words
9448 ###
9449
9450 # Note that the current date is hard-coded as
9451 # 1970-01-01T00:02:03Z (a Thursday)
9452 # when running parser tests. The timezone is also fixed to GMT, so
9453 # local date will be identical to current date.
9454
9455 !! test
9456 Magic Word: {{CURRENTDAY}}
9457 !! wikitext
9458 {{CURRENTDAY}}
9459 !! html
9460 <p>1
9461 </p>
9462 !! end
9463
9464 !! test
9465 Magic Word: {{CURRENTDAY2}}
9466 !! wikitext
9467 {{CURRENTDAY2}}
9468 !! html
9469 <p>01
9470 </p>
9471 !! end
9472
9473 !! test
9474 Magic Word: {{CURRENTDAYNAME}}
9475 !! wikitext
9476 {{CURRENTDAYNAME}}
9477 !! html
9478 <p>Thursday
9479 </p>
9480 !! end
9481
9482 !! test
9483 Magic Word: {{CURRENTDOW}}
9484 !! wikitext
9485 {{CURRENTDOW}}
9486 !! html
9487 <p>4
9488 </p>
9489 !! end
9490
9491 !! test
9492 Magic Word: {{CURRENTMONTH}}
9493 !! wikitext
9494 {{CURRENTMONTH}}
9495 !! html
9496 <p>01
9497 </p>
9498 !! end
9499
9500 !! test
9501 Magic Word: {{CURRENTMONTH1}}
9502 !! wikitext
9503 {{CURRENTMONTH1}}
9504 !! html
9505 <p>1
9506 </p>
9507 !! end
9508
9509 !! test
9510 Magic Word: {{CURRENTMONTHABBREV}}
9511 !! wikitext
9512 {{CURRENTMONTHABBREV}}
9513 !! html
9514 <p>Jan
9515 </p>
9516 !! end
9517
9518 !! test
9519 Magic Word: {{CURRENTMONTHNAME}}
9520 !! wikitext
9521 {{CURRENTMONTHNAME}}
9522 !! html
9523 <p>January
9524 </p>
9525 !! end
9526
9527 !! test
9528 Magic Word: {{CURRENTMONTHNAMEGEN}}
9529 !! wikitext
9530 {{CURRENTMONTHNAMEGEN}}
9531 !! html
9532 <p>January
9533 </p>
9534 !! end
9535
9536 !! test
9537 Magic Word: {{CURRENTTIME}}
9538 !! wikitext
9539 {{CURRENTTIME}}
9540 !! html
9541 <p>00:02
9542 </p>
9543 !! end
9544
9545 !! test
9546 Magic Word: {{CURRENTHOUR}}
9547 !! wikitext
9548 {{CURRENTHOUR}}
9549 !! html
9550 <p>00
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9556 !! wikitext
9557 {{CURRENTWEEK}}
9558 !! html
9559 <p>1
9560 </p>
9561 !! end
9562
9563 !! test
9564 Magic Word: {{CURRENTYEAR}}
9565 !! wikitext
9566 {{CURRENTYEAR}}
9567 !! html
9568 <p>1970
9569 </p>
9570 !! end
9571
9572 !! test
9573 Magic Word: {{CURRENTTIMESTAMP}}
9574 !! wikitext
9575 {{CURRENTTIMESTAMP}}
9576 !! html
9577 <p>19700101000203
9578 </p>
9579 !! end
9580
9581 !! test
9582 Magic Words LOCAL (UTC)
9583 !! wikitext
9584 * {{LOCALMONTH}}
9585 * {{LOCALMONTH1}}
9586 * {{LOCALMONTHNAME}}
9587 * {{LOCALMONTHNAMEGEN}}
9588 * {{LOCALMONTHABBREV}}
9589 * {{LOCALDAY}}
9590 * {{LOCALDAY2}}
9591 * {{LOCALDAYNAME}}
9592 * {{LOCALYEAR}}
9593 * {{LOCALTIME}}
9594 * {{LOCALHOUR}}
9595 * {{LOCALWEEK}}
9596 * {{LOCALDOW}}
9597 * {{LOCALTIMESTAMP}}
9598 !! html
9599 <ul><li> 01</li>
9600 <li> 1</li>
9601 <li> January</li>
9602 <li> January</li>
9603 <li> Jan</li>
9604 <li> 1</li>
9605 <li> 01</li>
9606 <li> Thursday</li>
9607 <li> 1970</li>
9608 <li> 00:02</li>
9609 <li> 00</li>
9610 <li> 1</li>
9611 <li> 4</li>
9612 <li> 19700101000203</li></ul>
9613
9614 !! end
9615
9616 !! test
9617 Magic Word: {{FULLPAGENAME}}
9618 !! options
9619 title=[[User:Ævar Arnfjörð Bjarmason]]
9620 !! wikitext
9621 {{FULLPAGENAME}}
9622 !! html
9623 <p>User:Ævar Arnfjörð Bjarmason
9624 </p>
9625 !! end
9626
9627 !! test
9628 Magic Word: {{FULLPAGENAMEE}}
9629 !! options
9630 title=[[User:Ævar Arnfjörð Bjarmason]]
9631 !! wikitext
9632 {{FULLPAGENAMEE}}
9633 !! html
9634 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9635 </p>
9636 !! end
9637
9638 !! test
9639 Magic Word: {{TALKSPACE}}
9640 !! options
9641 title=[[User:Ævar Arnfjörð Bjarmason]]
9642 !! wikitext
9643 {{TALKSPACE}}
9644 !! html
9645 <p>User talk
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{TALKSPACE}}, same namespace
9651 !! options
9652 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9653 !! wikitext
9654 {{TALKSPACE}}
9655 !! html
9656 <p>User talk
9657 </p>
9658 !! end
9659
9660 !! test
9661 Magic Word: {{TALKSPACE}}, main namespace
9662 !! options
9663 title=[[Parser Test]]
9664 !! wikitext
9665 {{TALKSPACE}}
9666 !! html
9667 <p>Talk
9668 </p>
9669 !! end
9670
9671 !! test
9672 Magic Word: {{TALKSPACEE}}
9673 !! options
9674 title=[[User:Ævar Arnfjörð Bjarmason]]
9675 !! wikitext
9676 {{TALKSPACEE}}
9677 !! html
9678 <p>User_talk
9679 </p>
9680 !! end
9681
9682 !! test
9683 Magic Word: {{SUBJECTSPACE}}
9684 !! options
9685 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9686 !! wikitext
9687 {{SUBJECTSPACE}}
9688 !! html
9689 <p>User
9690 </p>
9691 !! end
9692
9693 !! test
9694 Magic Word: {{SUBJECTSPACE}}, same namespace
9695 !! options
9696 title=[[User:Ævar Arnfjörð Bjarmason]]
9697 !! wikitext
9698 {{SUBJECTSPACE}}
9699 !! html
9700 <p>User
9701 </p>
9702 !! end
9703
9704 !! test
9705 Magic Word: {{SUBJECTSPACE}}, main namespace
9706 !! options
9707 title=[[Parser Test]]
9708 !! wikitext
9709 {{SUBJECTSPACE}}
9710 !! html
9711
9712 !! end
9713
9714 !! test
9715 Magic Word: {{SUBJECTSPACEE}}
9716 !! options
9717 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9718 !! wikitext
9719 {{SUBJECTSPACEE}}
9720 !! html
9721 <p>User
9722 </p>
9723 !! end
9724
9725 !! test
9726 Magic Word: {{NAMESPACE}}
9727 !! options
9728 title=[[User:Ævar Arnfjörð Bjarmason]]
9729 !! wikitext
9730 {{NAMESPACE}}
9731 !! html
9732 <p>User
9733 </p>
9734 !! end
9735
9736 !! test
9737 Magic Word: {{NAMESPACEE}}
9738 !! options
9739 title=[[User:Ævar Arnfjörð Bjarmason]]
9740 !! wikitext
9741 {{NAMESPACEE}}
9742 !! html
9743 <p>User
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{NAMESPACENUMBER}}
9749 !! options
9750 title=[[User:Ævar Arnfjörð Bjarmason]]
9751 !! wikitext
9752 {{NAMESPACENUMBER}}
9753 !! html
9754 <p>2
9755 </p>
9756 !! end
9757
9758 !! test
9759 Magic Word: {{SUBPAGENAME}}
9760 !! options
9761 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9762 !! wikitext
9763 {{SUBPAGENAME}}
9764 !! html
9765 <p>sub ö
9766 </p>
9767 !! end
9768
9769 !! test
9770 Magic Word: {{SUBPAGENAMEE}}
9771 !! options
9772 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9773 !! wikitext
9774 {{SUBPAGENAMEE}}
9775 !! html
9776 <p>sub_%C3%B6
9777 </p>
9778 !! end
9779
9780 !! test
9781 Magic Word: {{ROOTPAGENAME}}
9782 !! options
9783 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9784 !! wikitext
9785 {{ROOTPAGENAME}}
9786 !! html
9787 <p>Ævar Arnfjörð Bjarmason
9788 </p>
9789 !! end
9790
9791 !! test
9792 Magic Word: {{ROOTPAGENAMEE}}
9793 !! options
9794 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9795 !! wikitext
9796 {{ROOTPAGENAMEE}}
9797 !! html
9798 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9799 </p>
9800 !! end
9801
9802 !! test
9803 Magic Word: {{BASEPAGENAME}}
9804 !! options
9805 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9806 !! wikitext
9807 {{BASEPAGENAME}}
9808 !! html
9809 <p>Ævar Arnfjörð Bjarmason
9810 </p>
9811 !! end
9812
9813 !! test
9814 Magic Word: {{BASEPAGENAMEE}}
9815 !! options
9816 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9817 !! wikitext
9818 {{BASEPAGENAMEE}}
9819 !! html
9820 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9821 </p>
9822 !! end
9823
9824 !! test
9825 Magic Word: {{TALKPAGENAME}}
9826 !! options
9827 title=[[User:Ævar Arnfjörð Bjarmason]]
9828 !! wikitext
9829 {{TALKPAGENAME}}
9830 !! html
9831 <p>User talk:Ævar Arnfjörð Bjarmason
9832 </p>
9833 !! end
9834
9835 !! test
9836 Magic Word: {{TALKPAGENAMEE}}
9837 !! options
9838 title=[[User:Ævar Arnfjörð Bjarmason]]
9839 !! wikitext
9840 {{TALKPAGENAMEE}}
9841 !! html
9842 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9843 </p>
9844 !! end
9845
9846 !! test
9847 Magic Word: {{SUBJECTPAGENAME}}
9848 !! options
9849 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9850 !! wikitext
9851 {{SUBJECTPAGENAME}}
9852 !! html
9853 <p>User:Ævar Arnfjörð Bjarmason
9854 </p>
9855 !! end
9856
9857 !! test
9858 Magic Word: {{SUBJECTPAGENAMEE}}
9859 !! options
9860 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9861 !! wikitext
9862 {{SUBJECTPAGENAMEE}}
9863 !! html
9864 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9865 </p>
9866 !! end
9867
9868 !! test
9869 Magic Word: {{NUMBEROFFILES}}
9870 !! wikitext
9871 {{NUMBEROFFILES}}
9872 !! html
9873 <p>7
9874 </p>
9875 !! end
9876
9877 !! test
9878 Magic Word: {{PAGENAME}}
9879 !! options
9880 title=[[User:Ævar Arnfjörð Bjarmason]]
9881 !! wikitext
9882 {{PAGENAME}}
9883 !! html
9884 <p>Ævar Arnfjörð Bjarmason
9885 </p>
9886 !! end
9887
9888 !! test
9889 Magic Word: {{PAGENAME}} with metacharacters
9890 !! options
9891 title=[['foo & bar = baz']]
9892 !! wikitext
9893 ''{{PAGENAME}}''
9894 !! html/php
9895 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9896 </p>
9897 !! html+tidy
9898 <p><i>'foo &amp; bar = baz'</i></p>
9899 !! end
9900
9901 !! test
9902 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9903 !! options
9904 title=[[*RFC 1234 http://example.com/]]
9905 !! wikitext
9906 {{PAGENAME}}
9907 !! html/php
9908 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9909 </p>
9910 !! html+tidy
9911 <p>*RFC 1234 http://example.com/</p>
9912 !! end
9913
9914 !! test
9915 Magic Word: {{PAGENAMEE}}
9916 !! options
9917 title=[[User:Ævar Arnfjörð Bjarmason]]
9918 !! wikitext
9919 {{PAGENAMEE}}
9920 !! html
9921 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9927 !! options
9928 title=[[*RFC 1234 http://example.com/]]
9929 !! wikitext
9930 {{PAGENAMEE}}
9931 !! html/php
9932 <p>&#42;RFC_1234_http&#58;//example.com/
9933 </p>
9934 !! html+tidy
9935 <p>*RFC_1234_http://example.com/</p>
9936 !! end
9937
9938 !! test
9939 Magic Word: {{REVISIONID}}
9940 !! wikitext
9941 {{REVISIONID}}
9942 !! html
9943 <p>1337
9944 </p>
9945 !! end
9946
9947 !! test
9948 Magic Word: {{SCRIPTPATH}}
9949 !! wikitext
9950 {{SCRIPTPATH}}
9951 !! html
9952
9953 !! end
9954
9955 !! test
9956 Magic Word: {{STYLEPATH}}
9957 !! wikitext
9958 {{STYLEPATH}}
9959 !! html
9960 <p>/skins
9961 </p>
9962 !! end
9963
9964 !! test
9965 Magic Word: {{SERVER}}
9966 !! wikitext
9967 {{SERVER}}
9968 !! html
9969 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9970 </p>
9971 !! end
9972
9973 !! test
9974 Magic Word: {{SERVERNAME}}
9975 !! wikitext
9976 {{SERVERNAME}}
9977 !! html
9978 <p>example.org
9979 </p>
9980 !! end
9981
9982 !! test
9983 Magic Word: {{SITENAME}}
9984 !! wikitext
9985 {{SITENAME}}
9986 !! html
9987 <p>MediaWiki
9988 </p>
9989 !! end
9990
9991 !! test
9992 Case-sensitive magic words, when cased differently, should just be template transclusions
9993 !! wikitext
9994 {{CurrentMonth}}
9995 {{currentday}}
9996 {{cURreNTweEK}}
9997 {{currentHour}}
9998 !! html
9999 <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>
10000 <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>
10001 <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>
10002 <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>
10003 </p>
10004 !! end
10005
10006 !! test
10007 Case-insensitive magic words should still work with weird casing.
10008 !! wikitext
10009 {{sErVeRNaMe}}
10010 {{LCFirst:AOEU}}
10011 {{ucFIRST:aoeu}}
10012 {{SERver}}
10013 !! html
10014 <p>example.org
10015 aOEU
10016 Aoeu
10017 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10018 </p>
10019 !! end
10020
10021 # From plwiki:PLOS_ONE
10022 !! test
10023 Parsoid: Page property magic word with magic word contents
10024 !! wikitext
10025 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10026 !! html/parsoid
10027 <meta property="mw:PageProp/displaytitle" content="Main_Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main_Page&lt;/span>&lt;/i>"}]]}'/>
10028 !! end
10029
10030 !! test
10031 Parsoid: Template-generated DISPLAYTITLE
10032 !! wikitext
10033 {{{{echo|DISPLAYTITLE}}:Foo}}
10034 !! html/parsoid
10035 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10036 !! end
10037
10038 !! test
10039 Namespace 1 {{ns:1}}
10040 !! wikitext
10041 {{ns:1}}
10042 !! html
10043 <p>Talk
10044 </p>
10045 !! end
10046
10047 !! test
10048 Namespace 1 {{ns:01}}
10049 !! wikitext
10050 {{ns:01}}
10051 !! html
10052 <p>Talk
10053 </p>
10054 !! end
10055
10056 !! test
10057 Namespace 0 {{ns:0}} (bug 4783)
10058 !! wikitext
10059 {{ns:0}}
10060 !! html
10061
10062 !! end
10063
10064 !! test
10065 Namespace 0 {{ns:00}} (bug 4783)
10066 !! wikitext
10067 {{ns:00}}
10068 !! html
10069
10070 !! end
10071
10072 !! test
10073 Namespace -1 {{ns:-1}}
10074 !! wikitext
10075 {{ns:-1}}
10076 !! html
10077 <p>Special
10078 </p>
10079 !! end
10080
10081 !! test
10082 Namespace User {{ns:User}}
10083 !! wikitext
10084 {{ns:User}}
10085 !! html
10086 <p>User
10087 </p>
10088 !! end
10089
10090 !! test
10091 Namespace User talk {{ns:User_talk}}
10092 !! wikitext
10093 {{ns:User_talk}}
10094 !! html
10095 <p>User talk
10096 </p>
10097 !! end
10098
10099 !! test
10100 Namespace User talk {{ns:uSeR tAlK}}
10101 !! wikitext
10102 {{ns:uSeR tAlK}}
10103 !! html
10104 <p>User talk
10105 </p>
10106 !! end
10107
10108 !! test
10109 Namespace File {{ns:File}}
10110 !! wikitext
10111 {{ns:File}}
10112 !! html
10113 <p>File
10114 </p>
10115 !! end
10116
10117 !! test
10118 Namespace File {{ns:Image}}
10119 !! wikitext
10120 {{ns:Image}}
10121 !! html
10122 <p>File
10123 </p>
10124 !! end
10125
10126 !! test
10127 Namespace (lang=de) Benutzer {{ns:User}}
10128 !! options
10129 language=de
10130 !! wikitext
10131 {{ns:User}}
10132 !! html
10133 <p>Benutzer
10134 </p>
10135 !! end
10136
10137 !! test
10138 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10139 !! options
10140 language=de
10141 !! wikitext
10142 {{ns:3}}
10143 !! html
10144 <p>Benutzer Diskussion
10145 </p>
10146 !! end
10147
10148
10149 !! test
10150 Urlencode
10151 !! wikitext
10152 {{urlencode:hi world?!}}
10153 {{urlencode:hi world?!|WIKI}}
10154 {{urlencode:hi world?!|PATH}}
10155 {{urlencode:hi world?!|QUERY}}
10156 !! html
10157 <p>hi+world%3F%21
10158 hi_world%3F!
10159 hi%20world%3F%21
10160 hi+world%3F%21
10161 </p>
10162 !! end
10163
10164 !! test
10165 Magic Word: prioritize type info over data-parsoid
10166 !! options
10167 parsoid=html2wt
10168 !! html/parsoid
10169 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10170 !! wikitext
10171 __FORCETOC__
10172 !! end
10173
10174 !! test
10175 Magic Word: serialize on separate line (parsoid)
10176 !! options
10177 parsoid=wt2wt,html2wt
10178 !! wikitext
10179 foo
10180 __NOTOC__
10181 bar
10182 !! html/parsoid
10183 foo<meta property="mw:PageProp/notoc"/>bar
10184 !! end
10185
10186 !! test
10187 Magic Word: rt non-english wikis
10188 !! options
10189 parsoid=wt2wt
10190 language=de
10191 !! wikitext
10192 __NOEDITSECTION__
10193 !! html/parsoid
10194 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10195 !! end
10196
10197 !!test
10198 __proto__ is treated as normal wikitext (T105997)
10199 !!wikitext
10200 __proto__
10201 !!html
10202 <p>__proto__
10203 </p>
10204 !!end
10205
10206 ###
10207 ### Magic links
10208 ###
10209 !! test
10210 Magic links: internal link to RFC (bug 479)
10211 !! wikitext
10212 [[RFC 123]]
10213 !! html/php
10214 <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>
10215 </p>
10216 !! html/parsoid
10217 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10218 !! end
10219
10220 !! test
10221 Magic links: RFC (bug 479)
10222 !! wikitext
10223 RFC 822
10224 !! html/php
10225 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10226 </p>
10227 !! html/parsoid
10228 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10229 !! end
10230
10231 !! test
10232 Magic links: RFC (bug 65278)
10233 !! wikitext
10234 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10235 !! html/php
10236 <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.
10237 </p>
10238 !! html/parsoid
10239 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10240 !! end
10241
10242 !! test
10243 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10244 !! wikitext
10245 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10246 RFC
10247 822
10248 !! html/php
10249 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10250 RFC
10251 822
10252 </p>
10253 !! html/parsoid
10254 <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>
10255 RFC
10256 822</p>
10257 !! end
10258
10259 !! test
10260 Magic links: ISBN (bug 1937)
10261 !! wikitext
10262 ISBN 0-306-40615-2
10263 !! html/php
10264 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10265 </p>
10266 !! html/parsoid
10267 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10268 !! end
10269
10270 !! test
10271 Magic links: ISBN (bug 65278)
10272 !! wikitext
10273 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10274 !! html/php
10275 <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.
10276 </p>
10277 !! html/parsoid
10278 <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>
10279 !! end
10280
10281 !! test
10282 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10283 !! wikitext
10284 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10285 ISBN
10286 9780316098113
10287 ISBN 978
10288 0316098113
10289 !! html/php
10290 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10291 ISBN
10292 9780316098113
10293 ISBN 978
10294 0316098113
10295 </p>
10296 !! html/parsoid
10297 <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>
10298 ISBN
10299 9780316098113
10300 ISBN 978
10301 0316098113</p>
10302 !! end
10303
10304 !! test
10305 Magic links: PMID incorrectly converts space to underscore
10306 !! wikitext
10307 PMID 1234
10308 !! html/php
10309 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10310 </p>
10311 !! html/parsoid
10312 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10313 !! end
10314
10315 !! test
10316 Magic links: PMID (bug 65278)
10317 !! wikitext
10318 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10319 !! html/php
10320 <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.
10321 </p>
10322 !! html/parsoid
10323 <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>
10324 !! end
10325
10326 !! test
10327 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10328 !! wikitext
10329 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10330 PMID
10331 1234
10332 !! html/php
10333 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10334 PMID
10335 1234
10336 </p>
10337 !! html/parsoid
10338 <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>
10339 PMID
10340 1234</p>
10341 !! end
10342
10343 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10344 # since these are ExtLinkText, not MagicLinkText
10345 !! test
10346 Magic links: use appropriate serialization for "almost" magic links.
10347 !! wikitext
10348 X[[Special:BookSources/0978739256|foo]]
10349
10350 X[//tools.ietf.org/html/rfc1234 foo]
10351 !! html/php
10352 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10353 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10354 </p>
10355 !! html/parsoid
10356 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10357 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10358 !! end
10359
10360 ###
10361 ### Templates
10362 ####
10363
10364 !! test
10365 Nonexistent template
10366 !! wikitext
10367 {{thistemplatedoesnotexist}}
10368 !! html
10369 <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>
10370 </p>
10371 !! end
10372
10373 !! test
10374 Template with invalid target containing tags
10375 !! wikitext
10376 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10377 !! html
10378 <p>{{a<b>b</b>|foo|a=b|a = b}}
10379 </p>
10380 !! end
10381
10382 !! test
10383 Template with invalid target containing unclosed tag
10384 !! wikitext
10385 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10386 !! html
10387 <p>{{a<b>|foo|a=b|a = b}}</b>
10388 </p>
10389 !! end
10390
10391 !! test
10392 Template with invalid target containing wikilink
10393 !! wikitext
10394 {{[[Main Page]]}}
10395 !! html/php
10396 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10397 </p>
10398 !! html/parsoid
10399 <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>
10400 !! end
10401
10402 !! test
10403 Template with just whitespace in it, bug #68421
10404 !! wikitext
10405 {{echo|{{ }}}}
10406 !! html/parsoid
10407 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10408 !! end
10409
10410 !! article
10411 Template:test
10412 !! text
10413 This is a test template
10414 !! endarticle
10415
10416 !! test
10417 Simple template
10418 !! wikitext
10419 {{test}}
10420 !! html
10421 <p>This is a test template
10422 </p>
10423 !! end
10424
10425 !! test
10426 Template with explicit namespace
10427 !! wikitext
10428 {{Template:test}}
10429 !! html
10430 <p>This is a test template
10431 </p>
10432 !! end
10433
10434
10435 !! article
10436 Template:paramtest
10437 !! text
10438 This is a test template with parameter {{{param}}}
10439 !! endarticle
10440
10441 !! test
10442 Template parameter
10443 !! wikitext
10444 {{paramtest|param=foo}}
10445 !! html
10446 <p>This is a test template with parameter foo
10447 </p>
10448 !! end
10449
10450 !! article
10451 Template:paramtestnum
10452 !! text
10453 [[{{{1}}}|{{{2}}}]]
10454 !! endarticle
10455
10456 !! test
10457 Template unnamed parameter
10458 !! wikitext
10459 {{paramtestnum|Main Page|the main page}}
10460 !! html
10461 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10462 </p>
10463 !! end
10464
10465 !! article
10466 Template:templatesimple
10467 !! text
10468 (test)
10469 !! endarticle
10470
10471 !! article
10472 Template:templateredirect
10473 !! text
10474 #redirect [[Template:templatesimple]]
10475 !! endarticle
10476
10477 !! article
10478 Template:templateasargtestnum
10479 !! text
10480 {{{{{1}}}}}
10481 !! endarticle
10482
10483 !! article
10484 Template:templateasargtest
10485 !! text
10486 {{template{{{templ}}}}}
10487 !! endarticle
10488
10489 !! article
10490 Template:templateasargtest2
10491 !! text
10492 {{{{{templ}}}}}
10493 !! endarticle
10494
10495 !! test
10496 Template with template name as unnamed argument
10497 !! wikitext
10498 {{templateasargtestnum|templatesimple}}
10499 !! html
10500 <p>(test)
10501 </p>
10502 !! end
10503
10504 !! test
10505 Template with template name as argument
10506 !! wikitext
10507 {{templateasargtest|templ=simple}}
10508 !! html
10509 <p>(test)
10510 </p>
10511 !! end
10512
10513 !! test
10514 Template with template name as argument (2)
10515 !! wikitext
10516 {{templateasargtest2|templ=templatesimple}}
10517 !! html
10518 <p>(test)
10519 </p>
10520 !! end
10521
10522 !! article
10523 Template:templateasargtestdefault
10524 !! text
10525 {{{{{templ|templatesimple}}}}}
10526 !! endarticle
10527
10528 !! article
10529 Template:templa
10530 !! text
10531 '''templ'''
10532 !! endarticle
10533
10534 !! test
10535 Template with default value
10536 !! wikitext
10537 {{templateasargtestdefault}}
10538 !! html
10539 <p>(test)
10540 </p>
10541 !! end
10542
10543 !! test
10544 Template with default value (value set)
10545 !! wikitext
10546 {{templateasargtestdefault|templ=templa}}
10547 !! html
10548 <p><b>templ</b>
10549 </p>
10550 !! end
10551
10552 !! test
10553 Template redirect
10554 !! wikitext
10555 {{templateredirect}}
10556 !! html/php
10557 <p>(test)
10558 </p>
10559 !! html/parsoid
10560 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10561 !! end
10562
10563 !! test
10564 Template with argument in separate line
10565 !! wikitext
10566 {{ templateasargtest |
10567 templ = simple }}
10568 !! html
10569 <p>(test)
10570 </p>
10571 !! end
10572
10573 !! test
10574 Template with complex template as argument
10575 !! wikitext
10576 {{paramtest|
10577 param ={{ templateasargtest |
10578 templ = simple }}}}
10579 !! html
10580 <p>This is a test template with parameter (test)
10581 </p>
10582 !! end
10583
10584 !! test
10585 Template with thumb image (with link in description)
10586 !! wikitext
10587 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10588 !! html/php
10589 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>
10590
10591 !! html+tidy
10592 <p>This is a test template with parameter</p>
10593 <div class="thumb tright">
10594 <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>
10595 <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>
10596 </div>
10597 </div>
10598 !! html/parsoid
10599 <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>
10600 !! end
10601
10602 !! article
10603 Template:complextemplate
10604 !! text
10605 {{{1}}} {{paramtest|
10606 param ={{{param}}}}}
10607 !! endarticle
10608
10609 !! test
10610 Template with complex arguments
10611 !! wikitext
10612 {{complextemplate|
10613 param ={{ templateasargtest |
10614 templ = simple }}|[[Template:complextemplate|link]]}}
10615 !! html
10616 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10617 </p>
10618 !! end
10619
10620 !! test
10621 BUG 553: link with two variables in a piped link
10622 !! wikitext
10623 {|
10624 |[[{{{1}}}|{{{2}}}]]
10625 |}
10626 !! html/php
10627 <table>
10628 <tr>
10629 <td>[[{{{1}}}|{{{2}}}]]
10630 </td></tr></table>
10631
10632 !! html/parsoid
10633 <table>
10634 <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>
10635 !! end
10636
10637 # See: T2553
10638 !! test
10639 Abort table cell attribute parsing on wikilink
10640 !! wikitext
10641 {|
10642 | testing [[one|two]] | three || four
10643 | testing one two | three || four
10644 | testing="[[one|two]]" | three || four
10645 |}
10646 !! html/php
10647 <table>
10648 <tr>
10649 <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>
10650 <td> four
10651 </td>
10652 <td> three </td>
10653 <td> four
10654 </td>
10655 <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>
10656 <td> four
10657 </td></tr></table>
10658
10659 !! html/parsoid
10660 <table>
10661 <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>
10662 <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>
10663 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10664 </tbody></table>
10665 !! end
10666
10667 !! test
10668 Don't abort table cell attribute parsing if wikilink is found in template arg
10669 !! wikitext
10670 {|
10671 | Test {{#tag:ref|One two "[[three]]" four}}
10672 |}
10673 !! html/parsoid
10674 <table>
10675 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10676 </tbody></table>
10677 !! end
10678
10679 !! test
10680 Magic variable as template parameter
10681 !! wikitext
10682 {{paramtest|param={{SITENAME}}}}
10683 !! html
10684 <p>This is a test template with parameter MediaWiki
10685 </p>
10686 !! end
10687
10688 !! article
10689 Template:linktest
10690 !! text
10691 [[{{{param}}}|link]]
10692 !! endarticle
10693
10694 !! test
10695 Template parameter as link source
10696 !! wikitext
10697 {{linktest|param=Main Page}}
10698 !! html
10699 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10700 </p>
10701 !! end
10702
10703 !!article
10704 Template:paramtest2
10705 !! text
10706 including another template, {{paramtest|param={{{arg}}}}}
10707 !! endarticle
10708
10709 !! test
10710 Template passing argument to another template
10711 !! wikitext
10712 {{paramtest2|arg='hmm'}}
10713 !! html
10714 <p>including another template, This is a test template with parameter 'hmm'
10715 </p>
10716 !! end
10717
10718 !! article
10719 Template:Linktest2
10720 !! text
10721 Main Page
10722 !! endarticle
10723
10724 !! test
10725 Template as link source
10726 !! wikitext
10727 [[{{linktest2}}]]
10728
10729 [[{{linktest2}}|Main Page]]
10730
10731 [[{{linktest2}}]]Page
10732 !! html
10733 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10734 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10735 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10736 </p>
10737 !! end
10738
10739
10740 !! article
10741 Template:loop1
10742 !! text
10743 {{loop2}}
10744 !! endarticle
10745
10746 !! article
10747 Template:loop2
10748 !! text
10749 {{loop1}}
10750 !! endarticle
10751
10752 !! test
10753 Template infinite loop
10754 !! wikitext
10755 {{loop1}}
10756 !! html
10757 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10758 </p>
10759 !! end
10760
10761 !! test
10762 Template from main namespace
10763 !! wikitext
10764 {{:Main Page}}
10765 !! html
10766 <p>blah blah
10767 </p>
10768 !! end
10769
10770 !! article
10771 Template:table
10772 !! text
10773 {|
10774 | 1 || 2
10775 |-
10776 | 3 || 4
10777 |}
10778 !! endarticle
10779
10780 !! test
10781 BUG 529: Template with table, not included at beginning of line
10782 !! wikitext
10783 foo {{table}}
10784 !! html
10785 <p>foo
10786 </p>
10787 <table>
10788 <tr>
10789 <td> 1 </td>
10790 <td> 2
10791 </td></tr>
10792 <tr>
10793 <td> 3 </td>
10794 <td> 4
10795 </td></tr></table>
10796
10797 !! end
10798
10799 !! test
10800 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10801 !! wikitext
10802 foo
10803 {{table}}
10804 !! html
10805 <p>foo
10806 </p>
10807 <table>
10808 <tr>
10809 <td> 1 </td>
10810 <td> 2
10811 </td></tr>
10812 <tr>
10813 <td> 3 </td>
10814 <td> 4
10815 </td></tr></table>
10816
10817 !! end
10818
10819 !! test
10820 BUG 41: Template parameters shown as broken links
10821 !! wikitext
10822 {{{parameter}}}
10823 !! html
10824 <p>{{{parameter}}}
10825 </p>
10826 !! end
10827
10828 !! test
10829 Template with targets containing wikilinks
10830 !! wikitext
10831 {{[[foo]]}}
10832
10833 {{[[{{echo|foo}}]]}}
10834
10835 {{{{echo|[[foo}}]]}}
10836 !! html
10837 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10838 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10839 </p><p>{{[[foo}}]]
10840 </p>
10841 !! end
10842
10843 !! article
10844 Template:''
10845 !! text
10846 bar
10847 !! endarticle
10848
10849 !! test
10850 Templates: Double quotes as template target
10851 !! wikitext
10852 foo {{''}} baz
10853 !! html/php
10854 <p>foo bar baz
10855 </p>
10856 !! html/parsoid
10857 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10858 </p>
10859 !! end
10860
10861 ## This test is about making sure Parsoid's data-mw is well formed in the
10862 ## face of multiple templates with intersecting and overlapping ranges. The
10863 ## wikitext itself is wretched.
10864 !! test
10865 Templates with intersecting and overlapping ranges
10866 !! wikitext
10867 {|{{echo|
10868 <p>ha</p>}}
10869 {|{{echo|
10870 <p>ho</p>}}
10871 {{echo|{{!}}hi}}
10872 |}
10873 !! html/php+tidy
10874 <p>ha</p>
10875 <p>ho</p>
10876 <table>
10877 <tr>
10878 <td></td>
10879 </tr>
10880 <tr>
10881 <td>hi</td>
10882 </tr>
10883 </table>
10884 <table>
10885 <tr>
10886 <td></td>
10887 </tr>
10888 </table>
10889 !! html/parsoid
10890 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10891
10892 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10893
10894 <tbody><tr><td>hi</td></tr>
10895 </tbody></table>
10896 !! end
10897
10898 !! article
10899 Template:MSGNW test
10900 !! text
10901 ''None'' of '''this''' should be
10902 * interpreted
10903 but rather passed unmodified
10904 {{test}}
10905 <gallery>
10906 File:Foobar.jpg
10907 </gallery>
10908 <!-- comment -->
10909 !! endarticle
10910
10911 # hmm, fix this or just deprecate msgnw and document its behavior?
10912 !! test
10913 msgnw keyword
10914 !! wikitext
10915 {{msgnw:MSGNW test}}
10916 !! html/php
10917 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10918 &#42; interpreted
10919 &#32;but rather passed unmodified
10920 &#123;&#123;test&#125;&#125;
10921 &#60;gallery&#62;
10922 File:Foobar.jpg
10923 &#60;/gallery&#62;
10924 &#60;!-- comment --&#62;
10925 </p>
10926 !! end
10927
10928 !! test
10929 int keyword
10930 !! wikitext
10931 {{int:youhavenewmessages|lots of money|not!}}
10932 !! html
10933 <p>You have lots of money (not!).
10934 </p>
10935 !! end
10936
10937 !! test
10938 int keyword - non-existing message
10939 !! wikitext
10940 {{int:var}}
10941 !! html
10942 <p>&lt;var&gt;
10943 </p>
10944 !! end
10945
10946 !! article
10947 Template:Includes
10948 !! text
10949 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10950 !! endarticle
10951
10952 !! test
10953 <includeonly> and <noinclude> being included
10954 !! wikitext
10955 {{Includes}}
10956 !! html
10957 <p>Foobar
10958 </p>
10959 !! end
10960
10961 !! article
10962 Template:Includes2
10963 !! text
10964 <onlyinclude>Foo</onlyinclude>bar
10965 !! endarticle
10966
10967 !! test
10968 <onlyinclude> being included
10969 !! wikitext
10970 {{Includes2}}
10971 !! html
10972 <p>Foo
10973 </p>
10974 !! end
10975
10976
10977 !! article
10978 Template:Includes3
10979 !! text
10980 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10981 !! endarticle
10982
10983 !! test
10984 <onlyinclude> and <includeonly> being included
10985 !! wikitext
10986 {{Includes3}}
10987 !! html
10988 <p>Foo
10989 </p>
10990 !! end
10991
10992 !! test
10993 <includeonly> and <noinclude> on a page
10994 !! wikitext
10995 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10996 !! html
10997 <p>Foozar
10998 </p>
10999 !! end
11000
11001 !! test
11002 Un-closed <noinclude>
11003 !! wikitext
11004 <noinclude>
11005 !! html
11006 !! end
11007
11008 !! test
11009 <onlyinclude> on a page
11010 !! wikitext
11011 <onlyinclude>Foo</onlyinclude>bar
11012 !! html
11013 <p>Foobar
11014 </p>
11015 !! end
11016
11017 !! test
11018 Un-closed <onlyinclude>
11019 !! wikitext
11020 <onlyinclude>
11021 !! html
11022 !! end
11023
11024 !!test
11025 Self-closed noinclude, includeonly, onlyinclude tags
11026 !! wikitext
11027 <noinclude />
11028 <includeonly />
11029 <onlyinclude />
11030 !! html
11031 <p><br />
11032 </p>
11033 !!end
11034
11035 !!test
11036 Unbalanced includeonly and noinclude tags
11037 !! wikitext
11038 {|
11039 |a</noinclude>
11040 |b</noinclude></noinclude>
11041 |c</noinclude></includeonly>
11042 |d</includeonly></includeonly>
11043 |}
11044 !! html
11045 <table>
11046 <tr>
11047 <td>a
11048 </td>
11049 <td>b
11050 </td>
11051 <td>c&lt;/includeonly&gt;
11052 </td>
11053 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11054 </td></tr></table>
11055
11056 !!end
11057
11058 !! article
11059 Template:Includeonly section
11060 !! text
11061 <includeonly>
11062 ==Includeonly section==
11063 </includeonly>
11064 ==Section T-1==
11065 !!endarticle
11066
11067 !! test
11068 Bug 6563: Edit link generation for section shown by <includeonly>
11069 !! wikitext
11070 {{includeonly section}}
11071 !! html
11072 <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>
11073 <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>
11074
11075 !! end
11076
11077 # Uses same input as the contents of [[Template:Includeonly section]]
11078 !! test
11079 Bug 6563: Section extraction for section shown by <includeonly>
11080 !! options
11081 section=T-2
11082 !! wikitext
11083 <includeonly>
11084 ==Includeonly section==
11085 </includeonly>
11086 ==Section T-2==
11087 !! html
11088 ==Section T-2==
11089 !! end
11090
11091 !! test
11092 Bug 6563: Edit link generation for section suppressed by <includeonly>
11093 !! wikitext
11094 <includeonly>
11095 ==Includeonly section==
11096 </includeonly>
11097 ==Section 1==
11098 !! html
11099 <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>
11100
11101 !! end
11102
11103 !! test
11104 Bug 6563: Section extraction for section suppressed by <includeonly>
11105 !! options
11106 section=1
11107 !! wikitext
11108 <includeonly>
11109 ==Includeonly section==
11110 </includeonly>
11111 ==Section 1==
11112 !! html
11113 ==Section 1==
11114 !! end
11115
11116 !! test
11117 Un-closed <includeonly>
11118 !! wikitext
11119 <includeonly>
11120 !! html/php
11121 !! html/parsoid
11122 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11123 !! end
11124
11125 ## We used to, but no longer wt2wt this test since the default serializer
11126 ## will normalize the include directives to serialize on their own line.
11127 ## Selser will take care of preserving formatting in scenarios where they
11128 ## intermingled with other wikitext.
11129 !! test
11130 Includes and comments at SOL
11131 !! options
11132 parsoid=wt2html,html2html
11133 !! wikitext
11134 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11135
11136 <noinclude>
11137 some
11138 </noinclude>* stuff
11139 * here
11140
11141 <includeonly>can have stuff</includeonly>=== here ===
11142
11143 !! html/php
11144 <h2><span class="mw-headline" id="hu">hu</span></h2>
11145 <p>some
11146 </p>
11147 <ul><li> stuff</li>
11148 <li> here</li></ul>
11149 <h3><span class="mw-headline" id="here">here</span></h3>
11150
11151 !! html/parsoid
11152 <!-- 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>
11153
11154 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11155 <p>some</p>
11156 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11157 <li> here</li></ul>
11158
11159 <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>
11160
11161 !! end
11162
11163 # TODO: test with DOM fragment reuse!
11164 !! test
11165 Parsoid: DOM fragment reuse
11166 !! options
11167 parsoid=wt2wt,wt2html
11168 !! wikitext
11169 a{{echo|b<table></table>c}}d
11170
11171 a{{echo|b
11172 <table></table>
11173 c}}d
11174
11175 {{echo|a
11176
11177 <table></table>
11178
11179 b}}
11180 !! html
11181 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11182
11183 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11184 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11185 </span><p about="#mwt2">cd</p>
11186
11187 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11188
11189 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11190
11191 </span><p about="#mwt3">b</p>
11192 !! end
11193
11194 !! test
11195 Parsoid: Merge double tds (T52603)
11196 !! options
11197 parsoid
11198 !! wikitext
11199 {|
11200 |{{echo|{{!}} foo}}
11201 |}
11202 !! html
11203 <table><tbody>
11204 <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>
11205 </tbody></table>
11206 !! end
11207
11208 !! test
11209 Parsoid: Merge double tds in nested transclusion content (T52603)
11210 !! options
11211 parsoid
11212 !! wikitext
11213 {{echo|<div>}}
11214 {|
11215 |{{echo|{{!}} foo}}
11216 |}
11217 {{echo|</div>}}
11218 !! html
11219 <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}}]}'>
11220 <table><tbody>
11221 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11222 </tbody></table>
11223 </div>
11224 !! end
11225
11226 ###
11227 ### <includeonly> and <noinclude> in attributes
11228 ###
11229 !!test
11230 0. includeonly around the entire attribute
11231 !! wikitext
11232 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11233 !! html
11234 <p><span id="v2">bar</span>
11235 </p>
11236 !!end
11237
11238 !!test
11239 1. includeonly in html attr key
11240 !! wikitext
11241 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11242 !! html
11243 <p><span id="foo">bar</span>
11244 </p>
11245 !!end
11246
11247 !!test
11248 2. includeonly in html attr value
11249 !! wikitext
11250 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11251 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11252 !! html
11253 <p><span id="v1">bar</span>
11254 <span id="v1">bar</span>
11255 </p>
11256 !!end
11257
11258 !!test
11259 3. includeonly in part of an attr value
11260 !! wikitext
11261 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11262 !! html
11263 <p><span style="color:red;">bar</span>
11264 </p>
11265 !!end
11266
11267 !!test
11268 4. includeonly in table attributes
11269 !! wikitext
11270 {|
11271 |- <noinclude>
11272 |-
11273 |a
11274 </noinclude>
11275 |- <includeonly>
11276 |-
11277 |b
11278 </includeonly>
11279 |}
11280 !! html
11281 <table>
11282
11283
11284 <tr>
11285 <td>a
11286 </td></tr>
11287 </table>
11288
11289 !!end
11290
11291 ###
11292 ### Token Stream Patcher tests
11293 ###
11294 ### These tests won't always pass wt2wt and other modes because
11295 ### on serialization, the table will be output on a new line.
11296 ### For now, we are blacklisting them, and using this to test selser.
11297 ###
11298
11299 !!test
11300 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11301 !!options
11302 parsoid=wt2html,wt2wt
11303 !!wikitext
11304 {{echo|}}{| width = '100%'
11305 |foo
11306 |}
11307 !!html/parsoid
11308 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11309 <tbody><tr><td>foo</td></tr>
11310 </tbody></table>
11311 !!end
11312
11313 ## We used to, but no longer wt2wt this test since the default serializer
11314 ## will normalize the include directives to serialize on their own line.
11315 ## Selser will take care of preserving formatting in scenarios where they
11316 ## intermingled with other wikitext.
11317 !!test
11318 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11319 !!options
11320 parsoid=wt2html
11321 !!wikitext
11322 <includeonly>a</includeonly>{| {{{b}}}
11323 |c
11324 |}
11325 !!html/parsoid
11326 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11327 <tbody><tr><td>c</td></tr>
11328 </tbody></table>
11329 !!end
11330
11331 ###
11332 ### Testing parsing of templates where a template arg
11333 ### has the same name as the template itself.
11334 ###
11335
11336 !! article
11337 Template:quote
11338 !! text
11339 {{{quote|{{{1}}}}}}
11340 !! endarticle
11341
11342 !!test
11343 Templates: Template Name/Arg clash: 1. Use of positional param
11344 !! wikitext
11345 {{quote|foo}}
11346 !! html
11347 <p>foo
11348 </p>
11349 !!end
11350
11351 !!test
11352 Templates: Template Name/Arg clash: 2. Use of named param
11353 !! wikitext
11354 {{quote|quote=foo}}
11355 !! html
11356 <p>foo
11357 </p>
11358 !!end
11359
11360 !!test
11361 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11362 !! wikitext
11363 {{quote|quote}}
11364 !! html
11365 <p>quote
11366 </p>
11367 !!end
11368
11369 ###
11370 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11371 ###
11372
11373 !!test
11374 Templates: 1. Simple use
11375 !! wikitext
11376 {{echo|Foo}}
11377 !! html
11378 <p>Foo
11379 </p>
11380 !!end
11381
11382 !!test
11383 Templates: 2. Inside a block tag
11384 !! wikitext
11385 <div>{{echo|Foo}}</div>
11386 <blockquote>{{echo|Foo}}</blockquote>
11387 !! html
11388 <div>Foo</div>
11389 <blockquote>Foo</blockquote>
11390
11391 !! html+tidy
11392 <div>Foo</div>
11393 <blockquote>
11394 <p>Foo</p>
11395 </blockquote>
11396 !!end
11397
11398 !!test
11399 Templates: P-wrapping: 1a. Templates on consecutive lines
11400 !! wikitext
11401 {{echo|Foo}}
11402 {{echo|bar}}
11403 !! html
11404 <p>Foo
11405 bar
11406 </p>
11407 !!end
11408
11409 !!test
11410 Templates: P-wrapping: 1b. Templates on consecutive lines
11411 !! wikitext
11412 Foo
11413
11414 {{echo|bar}}
11415 {{echo|baz}}
11416 !! html
11417 <p>Foo
11418 </p><p>bar
11419 baz
11420 </p>
11421 !!end
11422
11423 !!test
11424 Templates: P-wrapping: 1c. Templates on consecutive lines
11425 !! wikitext
11426 {{echo|Foo}}
11427 {{echo|bar}} <div>baz</div>
11428 !! html
11429 <p>Foo
11430 </p>
11431 bar <div>baz</div>
11432
11433 !! html+tidy
11434 <p>Foo</p>
11435 <p>bar</p>
11436 <div>baz</div>
11437 !! end
11438
11439 !!test
11440 Templates: P-wrapping: 1d. Template preceded by comment-only line
11441 !!options
11442 parsoid
11443 !! wikitext
11444 <!-- foo -->
11445 {{echo|Bar}}
11446 !! html
11447 <!-- foo -->
11448
11449 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11450 !!end
11451
11452 !!test
11453 Templates: Inline Text: 1. Multiple template uses
11454 !! wikitext
11455 {{echo|Foo}}bar{{echo|baz}}
11456 !! html
11457 <p>Foobarbaz
11458 </p>
11459 !!end
11460
11461 !!test
11462 Templates: Inline Text: 2. Back-to-back template uses
11463 !! wikitext
11464 {{echo|Foo}}{{echo|bar}}
11465 !! html
11466 <p>Foobar
11467 </p>
11468 !!end
11469
11470 !!test
11471 Templates: Block Tags: 1. Multiple template uses
11472 !! wikitext
11473 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11474 !! html
11475 <div>Foo</div><div>bar</div><div>baz</div>
11476
11477 !!end
11478
11479 !!test
11480 Templates: Block Tags: 2. Back-to-back template uses
11481 !! wikitext
11482 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11483 !! html
11484 <div>Foo</div><div>bar</div>
11485
11486 !!end
11487
11488 # This is an edge case relating to paragraph wrapping.
11489 !!test
11490 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11491 !! wikitext
11492 {{echo|a
11493 b</p>}}
11494 !! html/parsoid
11495 <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
11496 b</p>
11497 !!end
11498
11499 !!test
11500 Templates: Links: 1. Simple example
11501 !! wikitext
11502 {{echo|[[Foo|bar]]}}
11503 !! html
11504 <p><a href="/wiki/Foo" title="Foo">bar</a>
11505 </p>
11506 !!end
11507
11508 !!test
11509 Templates: Links: 2. Generation of link href
11510 !! wikitext
11511 [[{{echo|Foo}}|bar]]
11512 !! html
11513 <p><a href="/wiki/Foo" title="Foo">bar</a>
11514 </p>
11515 !!end
11516
11517 !!test
11518 Templates: Links: 3. Generation of part of a link href
11519 !! wikitext
11520 [[Fo{{echo|o}}|bar]]
11521
11522 [[Foo{{echo|bar}}]]
11523
11524 [[Foo{{echo|bar}}baz]]
11525
11526 [[Foo{{echo|bar}}|bar]]
11527
11528 [[:Foo{{echo|bar}}]]
11529
11530 [[:Foo{{echo|bar}}|bar]]
11531 !! html
11532 <p><a href="/wiki/Foo" title="Foo">bar</a>
11533 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11534 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11535 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11536 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11537 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11538 </p>
11539 !!end
11540
11541 !!test
11542 Templates: Links: 4. Multiple templates generating link href
11543 !! wikitext
11544 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11545 !! html
11546 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11547 </p>
11548 !!end
11549
11550 !!test
11551 Templates: Links: 5. Generation of link text
11552 !! wikitext
11553 [[Foo|{{echo|bar}}]]
11554 !! html
11555 <p><a href="/wiki/Foo" title="Foo">bar</a>
11556 </p>
11557 !!end
11558
11559 !!test
11560 Templates: Links: 5. Nested templates (only outermost template should be marked)
11561 !! wikitext
11562 {{echo|[[{{echo|Foo}}|bar]]}}
11563 !! html
11564 <p><a href="/wiki/Foo" title="Foo">bar</a>
11565 </p>
11566 !!end
11567
11568 !!test
11569 Templates: HTML Tag: 1. Generation of HTML attr. key
11570 !! wikitext
11571 <div {{echo|style}}="color:red;">foo</div>
11572 !! html
11573 <div style="color:red;">foo</div>
11574
11575 !!end
11576
11577 !!test
11578 Templates: HTML Tag: 2. Generation of HTML attr. value
11579 !! wikitext
11580 <div style={{echo|'color:red;'}}>foo</div>
11581 !! html
11582 <div style="color:red;">foo</div>
11583
11584 !!end
11585
11586 !!test
11587 Templates: HTML Tag: 3. Generation of HTML attr key and value
11588 !! wikitext
11589 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11590 !! html
11591 <div style="color:red;">foo</div>
11592
11593 !!end
11594
11595 !!test
11596 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11597 !! wikitext
11598 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11599 !! html
11600 <div title="This is a long title with just one piece templated">foo</div>
11601
11602 !!end
11603
11604 !!test
11605 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11606 !! wikitext
11607 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11608 !! html
11609 <div title="This is a long title with just one piece templated">foo</div>
11610
11611 !!end
11612
11613 !!test
11614 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11615 !! wikitext
11616 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11617 !! html
11618 <div title="This is a long title with just one piece templated">foo</div>
11619
11620 !!end
11621
11622 # SSS FIXME: While it is great we added support for all this,
11623 # do we want to make this part of the spec? Maybe we want to
11624 # deprecate this kind of usage in the future?
11625 !!test
11626 Templates: HTML Tag: 7. Generation of partial attribute key string
11627 !! wikitext
11628 <div st{{echo|yle}}="color:red;">foo</div>
11629 !! html
11630 <div style="color:red;">foo</div>
11631
11632 !!end
11633
11634 !! test
11635 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11636 !! wikitext
11637 <div {{echo|1=id="v1"}}>bar</div>
11638 !! html
11639 <div id="v1">bar</div>
11640
11641 !!end
11642
11643 !! test
11644 Templates: HTML Tag: 9. Multiple template-generated attributes
11645 !! wikitext
11646 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11647 !! html
11648 <div id="v1" title="foo">bar</div>
11649
11650 !!end
11651
11652 !! test
11653 Templates: Support for templates generating attributes and content
11654 !! wikitext
11655 {| {{mixed_attr_content_template}}
11656 |-
11657 |bar
11658 |}
11659 !! html/php
11660 <table style="color:red;" title="T48811">
11661
11662 <tr>
11663 <td>foo
11664 </td></tr>
11665 <tr>
11666 <td>bar
11667 </td></tr></table>
11668
11669 !! html/parsoid
11670 <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|}"]}'>
11671 <tbody><tr>
11672 <td>foo</td></tr>
11673 <tr>
11674 <td>bar</td></tr>
11675 </tbody></table>
11676 !!end
11677
11678 !! test
11679 1. Entities and nowikis inside templated attributes should be handled correctly
11680 !! wikitext
11681 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11682 !! html/php
11683 <div style="background:#f9f9f9;">foo</div>
11684
11685 !! html/parsoid
11686 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11687 !! end
11688
11689 !! test
11690 2. Entities and nowikis inside templated attributes should be handled correctly
11691 !! wikitext
11692 {|
11693 |{{table_attribs_3}}
11694 |}
11695 !! html/php
11696 <table>
11697 <tr>
11698 <td style="background:#f9f9f9;">Foo
11699 </td></tr></table>
11700
11701 !! html/parsoid
11702 <table>
11703 <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>
11704 </tbody></table>
11705 !! end
11706
11707 !! test
11708 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11709 !! wikitext
11710 {{tbl-start}}
11711 |{{table_attribs_3}}
11712 {{tbl-end}}
11713 !! html/php
11714 <table>
11715 <tr>
11716 <td style="background:#f9f9f9;">Foo
11717 </td></tr></table>
11718
11719 !! html/parsoid
11720 <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}}]}'>
11721 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11722 </tbody></table>
11723 !! end
11724
11725 # T107622
11726 !! test
11727 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11728 !! wikitext
11729 {|
11730 | {{table_attribs_6}} hi
11731 |}
11732 !! html/php
11733 <table>
11734 <tr>
11735 <td style="background: red;"> hi
11736 </td></tr></table>
11737
11738 !! html/parsoid
11739 <table>
11740 <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>
11741 </tbody></table>
11742 !! end
11743
11744 !!test
11745 Templates: HTML Tables: 1. Generating start of a HTML table
11746 !! wikitext
11747 {{echo|<table><tr><td>foo</td>}}</tr></table>
11748 !! html
11749 <table><tr><td>foo</td></tr></table>
11750
11751 !!end
11752
11753 !!test
11754 Templates: HTML Tables: 2a. Generating middle of a HTML table
11755 !! wikitext
11756 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11757 !! html
11758 <table><tr><td>foo</td></tr></table>
11759
11760 !!end
11761
11762 !!test
11763 Templates: HTML Tables: 2b. Generating middle of a HTML table
11764 !! wikitext
11765 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11766 !! html
11767 <table><tr><td>foo</td></tr></table>
11768
11769 !!end
11770
11771 !!test
11772 Templates: HTML Tables: 3. Generating end of a HTML table
11773 !! wikitext
11774 <table><tr>{{echo|<td>foo</td></tr></table>}}
11775 !! html
11776 <table><tr><td>foo</td></tr></table>
11777
11778 !!end
11779
11780 !!test
11781 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11782 !! wikitext
11783 {{echo|<table>}}<tr><td>foo</td></tr></table>
11784 !! html
11785 <table><tr><td>foo</td></tr></table>
11786
11787 !!end
11788
11789 !!test
11790 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11791 !! wikitext
11792 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11793 !! html
11794 <table><tr><td>foo</td></tr></table>
11795
11796 !!end
11797
11798 !!test
11799 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11800 !! wikitext
11801 <table><tr>{{echo|<td>}}foo</td></tr></table>
11802 !! html
11803 <table><tr><td>foo</td></tr></table>
11804
11805 !!end
11806
11807 !!test
11808 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11809 !! wikitext
11810 <table><tr><td>foo{{echo|</td>}}</tr></table>
11811 !! html
11812 <table><tr><td>foo</td></tr></table>
11813
11814 !!end
11815
11816 !!test
11817 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11818 !! wikitext
11819 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11820 !! html
11821 <table><tr><td>foo</td></tr></table>
11822
11823 !!end
11824
11825 !!test
11826 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11827 !! wikitext
11828 <table><tr><td>foo</td></tr>{{echo|</table>}}
11829 !! html
11830 <table><tr><td>foo</td></tr></table>
11831
11832 !!end
11833
11834 !!test
11835 Templates: HTML Tables: 5. Proper fostering of categories from inside
11836 !!options
11837 parsoid=wt2html,wt2wt
11838 !! wikitext
11839 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11840 <!--Two categories (Bug 50330)-->
11841 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11842 !! html
11843 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11844 <!--Two categories (Bug 50330)-->
11845 <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>
11846 !!end
11847
11848 !!test
11849 Templates: Wiki Tables: 1a. Fostering of entire template content
11850 !! wikitext
11851 {|
11852 {{echo|a}}
11853 |}
11854 !! html
11855 <table>
11856 a
11857 <tr><td></td></tr></table>
11858
11859 !! html+tidy
11860 <p>a</p>
11861 <table>
11862 <tr>
11863 <td></td>
11864 </tr>
11865 </table>
11866 !! end
11867
11868 !!test
11869 Templates: Wiki Tables: 1b. Fostering of entire template content
11870 !! wikitext
11871 {|
11872 {{echo|<div>}}
11873 foo
11874 {{echo|</div>}}
11875 |}
11876 !! html
11877 <table>
11878 <div>
11879 <p>foo
11880 </p>
11881 </div>
11882 <tr><td></td></tr></table>
11883
11884 !! html+tidy
11885 <div>
11886 <p>foo</p>
11887 </div>
11888 <table>
11889 <tr>
11890 <td></td>
11891 </tr>
11892 </table>
11893 !! end
11894
11895 !!test
11896 Templates: Wiki Tables: 2. Fostering of partial template content
11897 !! wikitext
11898 {|
11899 {{echo|a
11900 <div>b</div>}}
11901 |}
11902 !! html
11903 <table>
11904 a
11905 <div>b</div>
11906 <tr><td></td></tr></table>
11907
11908 !! html+tidy
11909 <p>a</p>
11910 <div>b</div>
11911 <table>
11912 <tr>
11913 <td></td>
11914 </tr>
11915 </table>
11916 !! end
11917
11918 !!test
11919 Templates: Wiki Tables: 3. td-content via multiple templates
11920 !! wikitext
11921 {|
11922 {{echo|{{pipe}}a}}{{echo|b}}
11923 |}
11924 !! html
11925 <table>
11926 <tr>
11927 <td>ab
11928 </td></tr></table>
11929
11930 !!end
11931
11932 !!test
11933 Templates: Wiki Tables: 4. Templated tags, no content
11934 !! wikitext
11935 {{tbl-start}}
11936 {{tbl-end}}
11937 !! html
11938 <table>
11939 <tr><td></td></tr></table>
11940
11941 !!end
11942
11943 !!test
11944 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11945 !! wikitext
11946 {{tbl-start}}
11947 |foo
11948 {{tbl-end}}
11949 !! html
11950 <table>
11951 <tr>
11952 <td>foo
11953 </td></tr></table>
11954
11955 !!end
11956
11957 !!test
11958 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11959 !! wikitext
11960 {{tbl-start}}
11961 {{!}}foo
11962 {{tbl-end}}
11963 !! html
11964 <table>
11965 <tr>
11966 <td>foo
11967 </td></tr></table>
11968
11969 !!end
11970
11971 ## This test case is very specific to Parsoid's internals
11972 ## and is hence only tested for Parsoid's code. Parsoid uses
11973 ## a <meta> marker tag for <ref> tags and they are expanded
11974 ## much later. We are verifying that this <meta> tag usage
11975 ## doesn't prevent foster parenting.
11976 !!test
11977 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11978 !!wikitext
11979 {{PartialTable}}<ref>foo</ref>
11980 |}
11981
11982 <references />
11983 !!html/parsoid
11984 <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">
11985 <tbody>
11986 </tbody></table>
11987
11988 <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>
11989 !!end
11990
11991 !! test
11992 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11993 !! wikitext
11994 {{echo|
11995 {{{!}}
11996 {{!}}-}}
11997 <onlyinclude>
11998 |foo
11999 </onlyinclude>
12000 {{!}}}
12001 !! html/parsoid
12002 <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{{!}}}"]}'>
12003 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12004 <tbody><tr>
12005
12006 <td>foo
12007 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12008 </tbody></table>
12009 !! end
12010
12011 !!test
12012 Templates: Lists: Multi-line list-items via templates
12013 !! wikitext
12014 *{{echo|a {{nonexistent|
12015 unused}}}}
12016 *{{echo|b {{nonexistent|
12017 unused}}}}
12018 !! html
12019 <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>
12020 <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>
12021
12022 !!end
12023
12024 !!test
12025 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12026 !! wikitext
12027 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12028 !! html
12029 <p><i>ab</i>c<i>d</i>e
12030 </p>
12031 !!end
12032
12033 !!test
12034 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12035 (PHP parser generates misnested html)
12036 !! wikitext
12037 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12038 !! html/parsoid
12039 <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>
12040 !!end
12041
12042 !!test
12043 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12044 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12045 !! options
12046 parsoid=wt2html,wt2wt
12047 !! wikitext
12048 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12049 !! html
12050 <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>
12051 <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>
12052 <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>
12053 !!end
12054
12055 !!test
12056 Templates: Ugly nesting: 4. Divs opened/closed across templates
12057 !! wikitext
12058 a<div>b{{echo|c</div>d}}e
12059 !! html
12060 a<div>bc</div>de
12061
12062 !! html+tidy
12063 <p>a</p>
12064 <div>bc</div>
12065 <p>de</p>
12066 !! end
12067
12068 !!test
12069 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12070 (Parsoid-centric)
12071 !! options
12072 parsoid
12073 !! wikitext
12074 {|
12075 |{{echo|foo</table>}}
12076 |bar
12077 |}
12078 !! html
12079 <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|}"]}'>
12080
12081 <tbody>
12082 <tr>
12083 <td>foo</td></tr></tbody></table><span about="#mwt1">
12084 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12085 |}</span>
12086 !!end
12087
12088 !!test
12089 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12090 (Parsoid-centric)
12091 !! options
12092 parsoid
12093 !! wikitext
12094 <table>
12095 <tr>
12096 <td>
12097 <table>
12098 <tr>
12099 <td>1. {{echo|foo </table>}}</td>
12100 <td> bar </td>
12101 <td>2. {{echo|baz </table>}}</td>
12102 </tr>
12103 <tr>
12104 <td>abc</td>
12105 </tr>
12106 </table>
12107 </td>
12108 </tr>
12109 <tr>
12110 <td>xyz</td>
12111 </tr>
12112 </table>
12113 !! html
12114 <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>"]}'>
12115 <tbody><tr>
12116 <td>
12117 <table>
12118 <tbody><tr>
12119 <td>1. foo </td></tr></tbody></table></td>
12120 <td> bar </td>
12121 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12122 </span><span about="#mwt2">
12123 </span><span about="#mwt2">
12124 </span><span about="#mwt2">abc</span><span about="#mwt2">
12125 </span><span about="#mwt2">
12126 </span><span about="#mwt2">
12127 </span><span about="#mwt2">
12128 </span><span about="#mwt2">
12129 </span><span about="#mwt2">
12130 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12131 </span><span about="#mwt2">
12132 </span>
12133 !!end
12134
12135 !! test
12136 Templates: Ugly templates: 3. newline-only template parameter
12137 !! wikitext
12138 foo {{echo|
12139 }}
12140 !! html
12141 <p>foo
12142 </p>
12143 !! end
12144
12145 # This looks like a bug: a single newline triggers p/br for some reason.
12146 !! test
12147 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12148 !! wikitext
12149 {{echo|
12150 }}
12151 !! html
12152 <p><br />
12153 </p>
12154 !! end
12155
12156 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12157 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12158 !! test
12159 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12160 !! wikitext
12161 {{echo|<table>}}
12162 {{echo|<div>foo}}
12163 {{echo|</table>}}
12164 !! html/parsoid
12165 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12166 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12167 </table>
12168 !! end
12169
12170 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12171 # that are "identical" and generate nesting cycles in the algorithm
12172 !! test
12173 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12174 !! wikitext
12175 {{echo|<table><tr><td><table>}}
12176 {{echo|<div>}}
12177 {{echo|</div>}}
12178 !! html/parsoid
12179 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12180 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12181 </table></td></tr></tbody></table>
12182 !! end
12183
12184 !! test
12185 Templates: Parameters substituted at the top-level
12186 !! wikitext
12187 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12188 !! html/php
12189 <p><i>who</i> me? <b>never!</b>
12190 </p>
12191 !! html/parsoid
12192 <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>
12193 !! end
12194
12195 !!test
12196 Parser Functions: 1. Simple example
12197 !! wikitext
12198 {{uc:foo}}
12199 !! html
12200 <p>FOO
12201 </p>
12202 !!end
12203
12204 !!test
12205 Parser Functions: 2. Nested use (only outermost should be marked up)
12206 !! wikitext
12207 {{uc:{{lc:FOO}}}}
12208 !! html
12209 <p>FOO
12210 </p>
12211 !!end
12212
12213 ###
12214 ### Pre-save transform tests
12215 ###
12216 !! test
12217 pre-save transform: subst:
12218 !! options
12219 pst
12220 !! wikitext
12221 {{subst:test}}
12222 !! html/php
12223 This is a test template
12224 !! end
12225
12226 !! test
12227 pre-save transform: normal template
12228 !! options
12229 pst
12230 !! wikitext
12231 {{test}}
12232 !! html/php
12233 {{test}}
12234 !! end
12235
12236 !! test
12237 pre-save transform: nonexistent template
12238 !! options
12239 pst
12240 !! wikitext
12241 {{thistemplatedoesnotexist}}
12242 !! html/php
12243 {{thistemplatedoesnotexist}}
12244 !! end
12245
12246 !! test
12247 pre-save transform: subst magic variables
12248 !! options
12249 pst
12250 !! wikitext
12251 {{subst:SITENAME}}
12252 !! html/php
12253 MediaWiki
12254 !! end
12255
12256 # This is bug 89, which I fixed. -- wtm
12257 !! test
12258 pre-save transform: subst: templates with parameters
12259 !! options
12260 pst
12261 !! wikitext
12262 {{subst:paramtest|param="something else"}}
12263 !! html/php
12264 This is a test template with parameter "something else"
12265 !! end
12266
12267 !! article
12268 Template:nowikitest
12269 !! text
12270 <nowiki>'''not wiki'''</nowiki>
12271 !! endarticle
12272
12273 !! test
12274 pre-save transform: nowiki in subst (bug 1188)
12275 !! options
12276 pst
12277 !! wikitext
12278 {{subst:nowikitest}}
12279 !! html/php
12280 <nowiki>'''not wiki'''</nowiki>
12281 !! end
12282
12283 !! article
12284 Template:commenttest
12285 !! text
12286 This template has <!-- a comment --> in it.
12287 !! endarticle
12288
12289 !! test
12290 pre-save transform: comment in subst (bug 1936)
12291 !! options
12292 pst
12293 !! wikitext
12294 {{subst:commenttest}}
12295 !! html/php
12296 This template has <!-- a comment --> in it.
12297 !! end
12298
12299 !! test
12300 pre-save transform: unclosed tag
12301 !! options
12302 pst
12303 !! wikitext
12304 <nowiki>'''not wiki'''
12305 !! html/php
12306 <nowiki>'''not wiki'''
12307 !! end
12308
12309 !! test
12310 pre-save transform: mixed tag case
12311 !! options
12312 pst
12313 !! wikitext
12314 <NOwiki>'''not wiki'''</noWIKI>
12315 !! html/php
12316 <NOwiki>'''not wiki'''</noWIKI>
12317 !! end
12318
12319 !! test
12320 pre-save transform: unclosed comment in <nowiki>
12321 !! options
12322 pst
12323 !! wikitext
12324 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12325 !! html/php
12326 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12327 !!end
12328
12329 # Leading @ in this template definition works around a limitation
12330 # in parsoid's parserTests which otherwise strips the <span> from the
12331 # result (confusing it for a template wrapper)
12332 !! article
12333 Template:dangerous
12334 !!text
12335 @<span onmouseover="alert('crap')">Oh no</span>
12336 !!endarticle
12337
12338 !!test
12339 (confirming safety of fix for subst bug 1936)
12340 !! wikitext
12341 {{Template:dangerous}}
12342 !! html
12343 <p>@<span>Oh no</span>
12344 </p>
12345 !! end
12346
12347 !! test
12348 pre-save transform: comment containing gallery (bug 5024)
12349 !! options
12350 pst
12351 !! wikitext
12352 <!-- <gallery>data</gallery> -->
12353 !! html/php
12354 <!-- <gallery>data</gallery> -->
12355 !!end
12356
12357 !! test
12358 pre-save transform: comment containing extension
12359 !! options
12360 pst
12361 !! wikitext
12362 <!-- <tag>data</tag> -->
12363 !! html/php
12364 <!-- <tag>data</tag> -->
12365 !!end
12366
12367 !! test
12368 pre-save transform: comment containing nowiki
12369 !! options
12370 pst
12371 !! wikitext
12372 <!-- <nowiki>data</nowiki> -->
12373 !! html/php
12374 <!-- <nowiki>data</nowiki> -->
12375 !!end
12376
12377 !! test
12378 pre-save transform: <noinclude> in subst (bug 3298)
12379 !! options
12380 pst
12381 !! wikitext
12382 {{subst:Includes}}
12383 !! html/php
12384 Foobar
12385 !! end
12386
12387 !! test
12388 pre-save transform: <onlyinclude> in subst (bug 3298)
12389 !! options
12390 pst
12391 !! wikitext
12392 {{subst:Includes2}}
12393 !! html/php
12394 Foo
12395 !! end
12396
12397 !! article
12398 Template:SubstTest
12399 !!text
12400 {{<includeonly>subst:</includeonly>Includes}}
12401 !! endarticle
12402
12403 !! article
12404 Template:SafeSubstTest
12405 !! text
12406 {{<includeonly>safesubst:</includeonly>Includes}}
12407 !! endarticle
12408
12409 !! test
12410 bug 22297: safesubst: works during PST
12411 !! options
12412 pst
12413 !! wikitext
12414 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12415 !! html/php
12416 FoobarFoobar
12417 !! end
12418
12419 !! test
12420 bug 22297: safesubst: works during normal parse
12421 !! wikitext
12422 {{SafeSubstTest}}
12423 !! html
12424 <p>Foobar
12425 </p>
12426 !! end
12427
12428 !! test
12429 subst: does not work during normal parse
12430 !! wikitext
12431 {{SubstTest}}
12432 !! html
12433 <p>{{subst:Includes}}
12434 </p>
12435 !! end
12436
12437 !! test
12438 pre-save transform: context links ("pipe trick")
12439 !! options
12440 pst
12441 !! wikitext
12442 [[Article (context)|]]
12443 [[Bar:Article|]]
12444 [[:Bar:Article|]]
12445 [[Bar:Article (context)|]]
12446 [[:Bar:Article (context)|]]
12447 [[|Article]]
12448 [[|Article (context)]]
12449 [[Bar:X (Y) Z|]]
12450 [[:Bar:X (Y) Z|]]
12451 !! html/php
12452 [[Article (context)|Article]]
12453 [[Bar:Article|Article]]
12454 [[:Bar:Article|Article]]
12455 [[Bar:Article (context)|Article]]
12456 [[:Bar:Article (context)|Article]]
12457 [[Article]]
12458 [[Article (context)]]
12459 [[Bar:X (Y) Z|X (Y) Z]]
12460 [[:Bar:X (Y) Z|X (Y) Z]]
12461 !! end
12462
12463 !! test
12464 pre-save transform: context links ("pipe trick") with interwiki prefix
12465 !! options
12466 pst
12467 !! wikitext
12468 [[interwiki:Article|]]
12469 [[:interwiki:Article|]]
12470 [[interwiki:Bar:Article|]]
12471 [[:interwiki:Bar:Article|]]
12472 !! html/php
12473 [[interwiki:Article|Article]]
12474 [[:interwiki:Article|Article]]
12475 [[interwiki:Bar:Article|Bar:Article]]
12476 [[:interwiki:Bar:Article|Bar:Article]]
12477 !! end
12478
12479 !! test
12480 pre-save transform: context links ("pipe trick") with parens in title
12481 !! options
12482 pst title=[[Somearticle (context)]]
12483 !! wikitext
12484 [[|Article]]
12485 !! html/php
12486 [[Article (context)|Article]]
12487 !! end
12488
12489 !! test
12490 pre-save transform: context links ("pipe trick") with comma in title
12491 !! options
12492 pst title=[[Someplace, Somewhere]]
12493 !! wikitext
12494 [[|Otherplace]]
12495 [[Otherplace, Elsewhere|]]
12496 [[Otherplace, Elsewhere, Anywhere|]]
12497 !! html/php
12498 [[Otherplace, Somewhere|Otherplace]]
12499 [[Otherplace, Elsewhere|Otherplace]]
12500 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12501 !! end
12502
12503 !! test
12504 pre-save transform: context links ("pipe trick") with parens and comma
12505 !! options
12506 pst title=[[Someplace (IGNORED), Somewhere]]
12507 !! wikitext
12508 [[|Otherplace]]
12509 [[Otherplace (place), Elsewhere|]]
12510 !! html/php
12511 [[Otherplace, Somewhere|Otherplace]]
12512 [[Otherplace (place), Elsewhere|Otherplace]]
12513 !! end
12514
12515 !! test
12516 pre-save transform: context links ("pipe trick") with comma and parens
12517 !! options
12518 pst title=[[Who, me? (context)]]
12519 !! wikitext
12520 [[|Yes, you.]]
12521 [[Me, Myself, and I (1937 song)|]]
12522 !! html/php
12523 [[Yes, you. (context)|Yes, you.]]
12524 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12525 !! end
12526
12527 !! test
12528 pre-save transform: context links ("pipe trick") with namespace
12529 !! options
12530 pst title=[[Ns:Somearticle]]
12531 !! wikitext
12532 [[|Article]]
12533 !! html/php
12534 [[Ns:Article|Article]]
12535 !! end
12536
12537 !! test
12538 pre-save transform: context links ("pipe trick") with namespace and parens
12539 !! options
12540 pst title=[[Ns:Somearticle (context)]]
12541 !! wikitext
12542 [[|Article]]
12543 !! html/php
12544 [[Ns:Article (context)|Article]]
12545 !! end
12546
12547 !! test
12548 pre-save transform: context links ("pipe trick") with namespace and comma
12549 !! options
12550 pst title=[[Ns:Somearticle, Context, Whatever]]
12551 !! wikitext
12552 [[|Article]]
12553 !! html/php
12554 [[Ns:Article, Context, Whatever|Article]]
12555 !! end
12556
12557 !! test
12558 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12559 !! options
12560 pst title=[[Ns:Somearticle, Context (context)]]
12561 !! wikitext
12562 [[|Article]]
12563 !! html/php
12564 [[Ns:Article (context)|Article]]
12565 !! end
12566
12567 !! test
12568 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12569 !! options
12570 pst title=[[Ns:Somearticle (IGNORED), Context]]
12571 !! wikitext
12572 [[|Article]]
12573 !! html/php
12574 [[Ns:Article, Context|Article]]
12575 !! end
12576
12577 !! test
12578 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12579 !! options
12580 pst
12581 !! wikitext
12582 [[Article(context)|]]
12583 [[Bar:Article(context)|]]
12584 [[:Bar:Article(context)|]]
12585 [[|Article(context)]]
12586 [[Bar:X(Y)Z|]]
12587 [[:Bar:X(Y)Z|]]
12588 !! html/php
12589 [[Article(context)|Article]]
12590 [[Bar:Article(context)|Article]]
12591 [[:Bar:Article(context)|Article]]
12592 [[Article(context)]]
12593 [[Bar:X(Y)Z|X(Y)Z]]
12594 [[:Bar:X(Y)Z|X(Y)Z]]
12595 !! end
12596
12597 !! test
12598 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12599 !! options
12600 pst
12601 !! wikitext
12602 [[Article (context)|]]
12603 [[Bar:Article (context)|]]
12604 [[:Bar:Article (context)|]]
12605 [[|Article (context)]]
12606 [[Bar:X (Y) Z|]]
12607 [[:Bar:X (Y) Z|]]
12608 !! html/php
12609 [[Article (context)|Article]]
12610 [[Bar:Article (context)|Article]]
12611 [[:Bar:Article (context)|Article]]
12612 [[Article (context)]]
12613 [[Bar:X (Y) Z|X (Y) Z]]
12614 [[:Bar:X (Y) Z|X (Y) Z]]
12615 !! end
12616
12617 !! test
12618 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12619 !! options
12620 pst
12621 !! wikitext
12622 [[Article(context)|]]
12623 [[Bar:Article(context)|]]
12624 [[:Bar:Article(context)|]]
12625 [[|Article(context)]]
12626 [[Bar:X(Y)Z|]]
12627 [[:Bar:X(Y)Z|]]
12628 !! html/php
12629 [[Article(context)|Article]]
12630 [[Bar:Article(context)|Article]]
12631 [[:Bar:Article(context)|Article]]
12632 [[Article(context)]]
12633 [[Bar:X(Y)Z|X(Y)Z]]
12634 [[:Bar:X(Y)Z|X(Y)Z]]
12635 !! end
12636
12637 !! test
12638 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12639 !! options
12640 pst
12641 !! wikitext
12642 [[Article (context), context|]]
12643 [[Article (context),context|]]
12644 [[Bar:Article (context), context|]]
12645 [[Bar:Article (context),context|]]
12646 [[:Bar:Article (context), context|]]
12647 [[:Bar:Article (context),context|]]
12648 !! html/php
12649 [[Article (context), context|Article]]
12650 [[Article (context),context|Article]]
12651 [[Bar:Article (context), context|Article]]
12652 [[Bar:Article (context),context|Article]]
12653 [[:Bar:Article (context), context|Article]]
12654 [[:Bar:Article (context),context|Article]]
12655 !! end
12656
12657 !! test
12658 pre-save transform: trim trailing empty lines
12659 !! options
12660 pst
12661 !! wikitext
12662 Empty lines are trimmed
12663
12664
12665
12666
12667 !! html/php
12668 Empty lines are trimmed
12669 !! end
12670
12671 !! test
12672 pre-save transform: Signature expansion
12673 !! options
12674 pst
12675 !! wikitext
12676 * ~~~
12677 * <noinclude>~~~</noinclude>
12678 * <includeonly>~~~</includeonly>
12679 * <onlyinclude>~~~</onlyinclude>
12680 !! html/php
12681 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12682 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12683 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12684 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12685 !! end
12686
12687
12688 !! test
12689 pre-save transform: Signature expansion in nowiki tags (bug 93)
12690 !! options
12691 pst disabled
12692 !! wikitext
12693 Shall not expand:
12694
12695 <nowiki>~~~~</nowiki>
12696
12697 <includeonly><nowiki>~~~~</nowiki></includeonly>
12698
12699 <noinclude><nowiki>~~~~</nowiki></noinclude>
12700
12701 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12702
12703 {{subst:Foo}} shall be converted to FOO
12704
12705 As well as inside noinclude/onlyinclude
12706 <noinclude>{{subst:Foo}}</noinclude>
12707 <onlyinclude>{{subst:Foo}}</onlyinclude>
12708
12709 But not inside includeonly
12710 <includeonly>{{subst:Foo}}</includeonly>
12711 !! html/php
12712 Shall not expand:
12713
12714 <nowiki>~~~~</nowiki>
12715
12716 <includeonly><nowiki>~~~~</nowiki></includeonly>
12717
12718 <noinclude><nowiki>~~~~</nowiki></noinclude>
12719
12720 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12721
12722 FOO shall be converted to FOO
12723
12724 As well as inside noinclude/onlyinclude
12725 <noinclude>FOO</noinclude>
12726 <onlyinclude>FOO</onlyinclude>
12727
12728 But not inside includeonly
12729 <includeonly>{{subst:Foo}}</includeonly>
12730 !! end
12731
12732 !! test
12733 Parsoid: Recognize nowiki with trailing space in tags
12734 !! options
12735 parsoid=wt2html
12736 !! wikitext
12737 <nowiki ><div>[[foo]]</nowiki >
12738
12739 a<nowiki / >b
12740
12741 c<nowiki />d
12742
12743 e<nowiki/ >f
12744 !! html
12745 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12746 <p>ab</p>
12747 <p>cd</p>
12748 <p>ef</p>
12749 !! end
12750
12751 !! test
12752 Parsoid: Recognize nowiki with odd capitalization
12753 !! options
12754 parsoid=wt2html
12755 !! wikitext
12756 <noWikI ><div>[[foo]]</Nowiki >
12757 !! html
12758 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12759 !! end
12760
12761
12762 !! test
12763 Parsoid: Escape nowiki with trailing space in tags
12764 !! options
12765 parsoid=html2wt
12766 !! html/parsoid
12767 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12768 <p>a&lt;nowiki /&gt;b</p>
12769 <p>c&lt;nowiki/ &gt;d</p>
12770 !! wikitext
12771 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12772
12773 a&lt;nowiki /&gt;b
12774
12775 c&lt;nowiki/ &gt;d
12776 !! end
12777
12778 !! test
12779 Parsoid: Escape weird noWikI capitalizations
12780 !! options
12781 parsoid=html2wt
12782 !! html/parsoid
12783 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12784 !! wikitext
12785 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12786 !! end
12787
12788 ###
12789 ### Message transform tests
12790 ###
12791 !! test
12792 message transform: magic variables
12793 !! options
12794 msg
12795 !! wikitext
12796 {{SITENAME}}
12797 !! html
12798 MediaWiki
12799 !! end
12800
12801 !! test
12802 message transform: should not transform wiki markup
12803 !! options
12804 msg
12805 !! wikitext
12806 ''test''
12807 !! html
12808 ''test''
12809 !! end
12810
12811 !! test
12812 message transform: <noinclude> in transcluded template (bug 4926)
12813 !! options
12814 msg
12815 !! wikitext
12816 {{Includes}}
12817 !! html
12818 Foobar
12819 !! end
12820
12821 !! test
12822 message transform: <onlyinclude> in transcluded template (bug 4926)
12823 !! options
12824 msg
12825 !! wikitext
12826 {{Includes2}}
12827 !! html
12828 Foo
12829 !! end
12830
12831 !! test
12832 {{#special:}} page name, known
12833 !! options
12834 msg
12835 !! wikitext
12836 {{#special:Recentchanges}}
12837 !! html
12838 Special:RecentChanges
12839 !! end
12840
12841 !! test
12842 {{#special:}} page name with subpage, known
12843 !! options
12844 msg
12845 !! wikitext
12846 {{#special:Recentchanges/param}}
12847 !! html
12848 Special:RecentChanges/param
12849 !! end
12850
12851 !! test
12852 {{#special:}} page name, unknown
12853 !! options
12854 msg
12855 !! wikitext
12856 {{#special:foobar nonexistent}}
12857 !! html
12858 Special:Foobar nonexistent
12859 !! end
12860
12861 !! test
12862 {{#speciale:}} page name, known
12863 !! options
12864 msg
12865 !! wikitext
12866 {{#speciale:Recentchanges}}
12867 !! html
12868 Special:RecentChanges
12869 !! end
12870
12871 !! test
12872 {{#speciale:}} page name with subpage, known
12873 !! options
12874 msg
12875 !! wikitext
12876 {{#speciale:Recentchanges/param}}
12877 !! html
12878 Special:RecentChanges/param
12879 !! end
12880
12881 !! test
12882 {{#speciale:}} page name, unknown
12883 !! options
12884 msg
12885 !! wikitext
12886 {{#speciale:foobar nonexistent}}
12887 !! html
12888 Special:Foobar_nonexistent
12889 !! end
12890
12891 ###
12892 ### Images
12893 ###
12894 ### For Parsoid-specific tests, see
12895 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12896
12897 !! test
12898 Simple image
12899 !! options
12900 parsoid=wt2html,wt2wt,html2html
12901 !! wikitext
12902 [[Image:foobar.jpg]]
12903 !! html/php
12904 <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>
12905 </p>
12906 !! html/parsoid
12907 <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>
12908 !! end
12909
12910 !! test
12911 Simple image (using File: namespace, now canonical)
12912 !! wikitext
12913 [[File:Foobar.jpg]]
12914 !! html/php
12915 <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>
12916 </p>
12917 !! html/parsoid
12918 <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>
12919 !! end
12920
12921 !! test
12922 Right-aligned image
12923 !! wikitext
12924 [[File:Foobar.jpg|right]]
12925 !! html/php
12926 <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>
12927
12928 !! html/parsoid
12929 <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>
12930 !! end
12931
12932 !! test
12933 Image with caption
12934 !! wikitext
12935 [[File:Foobar.jpg|right|Caption text]]
12936 !! html/php
12937 <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>
12938
12939 !! html/parsoid
12940 <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>
12941 !! end
12942
12943 !! test
12944 Image with caption, bug 53312 #1
12945 !! wikitext
12946 [[File:Foobar.jpg|right|Caption page stuff]]
12947 !! html/php
12948 <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>
12949
12950 !! html/parsoid
12951 <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>
12952 !! end
12953
12954 !! test
12955 Image with caption, bug 53312 #2
12956 !! wikitext
12957 [[File:Foobar.jpg|right|Caption page=]]
12958 !! html/php
12959 <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>
12960
12961 !! html/parsoid
12962 <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>
12963 !! end
12964
12965 !! test
12966 Image with caption, bug 53312 #3
12967 !! wikitext
12968 [[File:Foobar.jpg|right|Caption page=stuff]]
12969 !! html/php
12970 <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>
12971
12972 !! html/parsoid
12973 <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>
12974 !! end
12975
12976 !! test
12977 Allow empty links in image captions (Bug 60753)
12978 !! options
12979 thumbsize=220
12980 !! wikitext
12981 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12982 [[]]
12983 [[Link2]]
12984 ]]
12985 !! html/php
12986 <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>
12987
12988 !! html/parsoid
12989 <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>
12990 [[]]
12991 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12992 </figcaption></figure>
12993 !! end
12994
12995 !! test
12996 Titles in unlinked images (T23454)
12997 !! wikitext
12998 [[File:Foobar.jpg|link=|stuff]]
12999 !! html/php
13000 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13001 </p>
13002 !! end
13003
13004 !! test
13005 Link with empty target
13006 !! wikitext
13007 [[]]
13008 !! html
13009 <p>[[]]
13010 </p>
13011 !! end
13012
13013 !! test
13014 Image with link trail
13015 !! wikitext
13016 Linktrails should not work for images: [[File:Foobar.jpg]]s
13017 !! html/php
13018 <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
13019 </p>
13020 !! html/parsoid
13021 <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>
13022 !! end
13023
13024 !! test
13025 Image with empty attribute
13026 !! options
13027 parsoid=wt2html,wt2wt,html2html
13028 !! wikitext
13029 [[File:Foobar.jpg|right||Caption text]]
13030 !! html/php
13031 <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>
13032
13033 !! html/parsoid
13034 <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>
13035 !! end
13036
13037 !! test
13038 1. Block image with individual attributes from templates
13039 !! wikitext
13040 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13041 !! html/php
13042 <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>
13043
13044 !! html/parsoid
13045 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13046 !! end
13047
13048 !! test
13049 2. Block Image with individual attributes from templates
13050 !! wikitext
13051 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13052 !! html/php
13053 <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>
13054
13055 !! html/parsoid
13056 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13057 !! end
13058
13059 !! test
13060 3. Inline image with individual attributes from templates
13061 !! wikitext
13062 [[File:Foobar.jpg|{{echo|50px}}]]
13063 !! html/php
13064 <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>
13065 </p>
13066 !! html/parsoid
13067 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13068 !! end
13069
13070 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13071 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13072 !! test
13073 Image with multiple attributes from the same template
13074 !! wikitext
13075 [[File:Foobar.jpg|{{image_attribs}}]]
13076 !! html/php
13077 <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>
13078
13079 !! html/parsoid
13080 <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>
13081 !! end
13082
13083 !! test
13084 Image with link tails
13085 !! options
13086 thumbsize=220
13087 !! wikitext
13088 123[[File:Foobar.jpg]]456
13089 123[[File:Foobar.jpg|right]]456
13090 123[[File:Foobar.jpg|thumb]]456
13091 !! html/php
13092 <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
13093 </p>
13094 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
13095 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
13096
13097 !! html/php+tidy
13098 <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>
13099 <p>123</p>
13100 <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>
13101 <p>456 123</p>
13102 <div class="thumb tright">
13103 <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>
13104 <div class="thumbcaption">
13105 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13106 </div>
13107 </div>
13108 </div>
13109 <p>456</p>
13110 !! html/parsoid
13111 <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>
13112 <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>
13113 <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>
13114 !! end
13115
13116 !! test
13117 Image with multiple captions -- only last one is accepted
13118 !! wikitext
13119 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13120 !! html/php
13121 <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>
13122
13123 !! html/parsoid
13124 <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>
13125 !! end
13126
13127 !! test
13128 Image with multiple widths -- use last
13129 !! wikitext
13130 [[File:Foobar.jpg|200px|300px|caption]]
13131 !! html/php
13132 <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>
13133 </p>
13134 !! html/parsoid
13135 <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>
13136 !! end
13137
13138 !! test
13139 Image with multiple alignments -- use first (bug 48664)
13140 !! options
13141 thumbsize=220
13142 !! wikitext
13143 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13144
13145 [[File:Foobar.jpg|middle|text-top|caption]]
13146 !! html/php
13147 <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>
13148 <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>
13149 </p>
13150 !! html/parsoid
13151 <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>
13152 <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>
13153 !! end
13154
13155 !! test
13156 Image with width attribute at different positions
13157 !! wikitext
13158 [[File:Foobar.jpg|200px|right|Caption]]
13159 [[File:Foobar.jpg|right|200px|Caption]]
13160 [[File:Foobar.jpg|right|Caption|200px]]
13161 !! html/php
13162 <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>
13163 <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>
13164 <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>
13165
13166 !! html/parsoid
13167 <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>
13168 <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>
13169 <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>
13170 !! end
13171
13172 # a sad bit of backward-compatibility
13173 !! test
13174 Image with size specified with pxpx (bug 13500, 51628)
13175 !! options
13176 parsoid=wt2html,wt2wt,html2html
13177 !! wikitext
13178 [[File:Foobar.jpg|20pxpx]]
13179 [[File:Foobar.jpg|200x20pxpx]]
13180 !! html/php
13181 <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>
13182 <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>
13183 </p>
13184 !! html/parsoid
13185 <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>
13186 !! end
13187
13188 !! test
13189 Image with link parameter, wiki target
13190 !! wikitext
13191 [[File:Foobar.jpg|link=Main Page]]
13192 !! html/php
13193 <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>
13194 </p>
13195 !! html/parsoid
13196 <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>
13197 !! end
13198
13199 # parsoid bug 49293 (part 1)
13200 !! test
13201 Image with link parameter, URL target
13202 !! wikitext
13203 [[File:Foobar.jpg|link=http://example.com/]]
13204 !! html/php
13205 <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>
13206 </p>
13207 !! html/parsoid
13208 <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>
13209 !! end
13210
13211 # parsoid bug 49293 (part 2)
13212 !! test
13213 Image with link parameter, protocol-less URL target
13214 !! wikitext
13215 [[File:Foobar.jpg|link=//example.com/]]
13216 !! html/php
13217 <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>
13218 </p>
13219 !! html/parsoid
13220 <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>
13221 !! end
13222
13223 !! test
13224 Escaping non-block captions (T107435)
13225 !! options
13226 parsoid={
13227 "modes": ["wt2wt"],
13228 "changes": [
13229 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13230 ]
13231 }
13232 !! wikitext
13233 [[Image:Foobar.jpg|caption]]
13234 !! wikitext/edited
13235 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13236 !! end
13237
13238 # wgExternalLinkTarget not supported by Parsoid
13239 !! test
13240 Image with link parameter, wgExternalLinkTarget
13241 !! wikitext
13242 [[Image:foobar.jpg|link=http://example.com/]]
13243 !! config
13244 wgExternalLinkTarget='foobar'
13245 !! html/php
13246 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13247 </p>
13248 !! end
13249
13250 !! test
13251 Image with link parameter, wgNoFollowLinks set to false
13252 !! wikitext
13253 [[Image:foobar.jpg|link=http://example.com/]]
13254 !! config
13255 wgNoFollowLinks=false
13256 !! html
13257 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13258 </p>
13259 !! end
13260
13261 !! test
13262 Image with link parameter, wgNoFollowDomainExceptions
13263 !! wikitext
13264 [[Image:foobar.jpg|link=http://example.com/]]
13265 !! config
13266 wgNoFollowDomainExceptions='example.com'
13267 !! html
13268 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13269 </p>
13270 !! end
13271
13272 # wgExternalLinkTarget not supported by Parsoid
13273 !! test
13274 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13275 !! wikitext
13276 [[Image:foobar.jpg|link=http://example.com/|Title]]
13277 !! config
13278 wgExternalLinkTarget='foobar'
13279 !! html/php
13280 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13281 </p>
13282 !! end
13283
13284 !! test
13285 Image with empty link parameter
13286 !! wikitext
13287 [[File:Foobar.jpg|link=]]
13288 !! html/php
13289 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13290 </p>
13291 !! html/parsoid
13292 <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>
13293 !! end
13294
13295 !! test
13296 Image with link parameter (wiki target) and unnamed parameter
13297 !! wikitext
13298 [[File:Foobar.jpg|link=Main_Page|Title]]
13299 !! html/php
13300 <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>
13301 </p>
13302 !! html/parsoid
13303 <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>
13304 !! end
13305
13306 !! test
13307 Image with link parameter (URL target) and unnamed parameter
13308 !! wikitext
13309 [[File:Foobar.jpg|link=http://example.com/|Title]]
13310 !! html/php
13311 <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>
13312 </p>
13313 !! html/parsoid
13314 <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>
13315 !! end
13316
13317 !! test
13318 Thumbnail image with link parameter
13319 !! options
13320 thumbsize=220
13321 parsoid=wt2html,wt2wt,html2html
13322 !! wikitext
13323 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13324 !! html/php
13325 <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>
13326
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 Manually-specified thumbnail image
13333 !! options
13334 thumbsize=220
13335 !! wikitext
13336 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13337 !! html/php
13338 <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>
13339
13340 !! html/parsoid
13341 <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>
13342 !! end
13343
13344 !! test
13345 Manually-specified thumbnail image with explicit link to wiki page
13346 !! options
13347 thumbsize=220
13348 parsoid=wt2html,wt2wt,html2html
13349 !! wikitext
13350 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13351 !! html/php
13352 <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>
13353
13354 !! html/parsoid
13355 <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>
13356 !! end
13357
13358 !! test
13359 Manually-specified thumbnail image with explicit link to url
13360 !! options
13361 thumbsize=220
13362 parsoid=wt2html,wt2wt,html2html
13363 !! wikitext
13364 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13365 !! html/php
13366 <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>
13367
13368 !! html/parsoid
13369 <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>
13370 !! end
13371
13372 !! test
13373 Manually-specified thumbnail image with explicit no link
13374 !! options
13375 thumbsize=220
13376 parsoid=wt2html,wt2wt,html2html
13377 !! wikitext
13378 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13379 !! html/php
13380 <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>
13381
13382 !! html/parsoid
13383 <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>
13384 !! end
13385
13386 !! test
13387 Manually-specified thumbnail image with explicit link and alt text
13388 !! options
13389 thumbsize=220
13390 parsoid=wt2html,wt2wt,html2html
13391 !! wikitext
13392 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13393 !! html/php
13394 <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>
13395
13396 !! html/parsoid
13397 <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>
13398 !! end
13399
13400 !! test
13401 Image with frame and link
13402 !! options
13403 parsoid=wt2html,wt2wt,html2html
13404 !! wikitext
13405 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13406 !! html/php
13407 <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>
13408
13409 !! html/parsoid
13410 <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>
13411 !! end
13412
13413 !! test
13414 Image with frame and link and explicit alt
13415 !! options
13416 parsoid=wt2html,wt2wt,html2html
13417 !! wikitext
13418 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13419 !! html/php
13420 <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>
13421
13422 !! html/parsoid
13423 <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>
13424 !! end
13425
13426 !! test
13427 Image with wiki markup in implicit alt
13428 !! wikitext
13429 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13430
13431 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13432 !! html/php
13433 <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>
13434 </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>
13435 </p>
13436 !! html/parsoid
13437 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13438
13439 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13440 !! end
13441
13442 !! test
13443 Alt image option should handle most kinds of wikitext without barfing
13444 !! wikitext
13445 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13446 !! html/php
13447 <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>
13448
13449 !! html/parsoid
13450 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13451 !! end
13452
13453 ###################
13454 # Conflicting image format options.
13455 # First option specified should 'win'.
13456 # All three cases in each test should be identical.
13457
13458 !! test
13459 Image with 'frameless' first.
13460 !! options
13461 parsoid=wt2html,wt2wt,html2html
13462 !! wikitext
13463 [[File:Foobar.jpg|frameless|caption]]
13464
13465 [[File:Foobar.jpg|frameless|frame|caption]]
13466
13467 [[File:Foobar.jpg|frameless|thumb|caption]]
13468 !! html/php
13469 <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>
13470 </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>
13471 </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>
13472 </p>
13473 !! html/parsoid
13474 <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>
13475 <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>
13476 <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>
13477 !! end
13478
13479 !! test
13480 Image with 'frame' first.
13481 !! options
13482 parsoid=wt2html,wt2wt,html2html
13483 !! wikitext
13484 [[File:Foobar.jpg|frame|caption]]
13485 [[File:Foobar.jpg|frame|frameless|caption]]
13486 [[File:Foobar.jpg|frame|thumb|caption]]
13487 !! html/php
13488 <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>
13489 <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>
13490 <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>
13491
13492 !! html/parsoid
13493 <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>
13494 <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>
13495 <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>
13496 !! end
13497
13498 !! test
13499 Image with 'thumb' first.
13500 !! options
13501 parsoid=wt2html,wt2wt,html2html
13502 !! wikitext
13503 [[File:Foobar.jpg|thumb|caption]]
13504 [[File:Foobar.jpg|thumb|frameless|caption]]
13505 [[File:Foobar.jpg|thumb|frame|caption]]
13506 !! html/php
13507 <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>
13508 <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>
13509 <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>
13510
13511 !! html/parsoid
13512 <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>
13513 <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>
13514 <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>
13515 !! end
13516
13517 ###################
13518 # Image sizing.
13519 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13520 # and https://phabricator.wikimedia.org/T64258
13521 # Foobar has actual size of 1941x220
13522 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13523 # a scalable format.
13524 # 2. Framed images always ignore size options; always render at default size.
13525 # 3. "Unspecified format" and border are the only types which can be
13526 # enlarged.
13527
13528 !! test
13529 Image: "unspecified format" and border enlarge
13530 !! options
13531 parsoid=wt2html,wt2wt,html2html
13532 !! wikitext
13533 [[File:Foobar.jpg|2000px]]
13534
13535 [[File:Foobar.jpg|border|2000px]]
13536 !! html/php
13537 <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>
13538 </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>
13539 </p>
13540 !! html/parsoid
13541 <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>
13542 <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>
13543 !! end
13544
13545 !! test
13546 Image: "unspecified format" and border reduce
13547 !! options
13548 parsoid=wt2html,wt2wt,html2html
13549 !! wikitext
13550 [[File:Foobar.jpg|1000px]]
13551
13552 [[File:Foobar.jpg|border|1000px]]
13553 !! html/php
13554 <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>
13555 </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>
13556 </p>
13557 !! html/parsoid
13558 <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>
13559 <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>
13560 !! end
13561
13562 !! test
13563 Image: thumbs reduce
13564 !! options
13565 parsoid=wt2html,wt2wt,html2html
13566 !! wikitext
13567 [[File:Foobar.jpg|thumb|50px]]
13568 !! html/php
13569 <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>
13570
13571 !! html/parsoid
13572 <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>
13573 !! end
13574
13575 !! test
13576 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13577 !! options
13578 parsoid=wt2html,wt2wt,html2html
13579 !! wikitext
13580 [[File:Foobar.jpg|thumb|2000px]]
13581
13582 [[File:Foobar.svg|thumb|2000px]]
13583 !! html/php
13584 <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>
13585 <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>
13586
13587 !! html/parsoid
13588 <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>
13589 <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>
13590 !! end
13591
13592 !! test
13593 Image: frameless can reduce in size
13594 !! options
13595 parsoid=wt2html,wt2wt,html2html
13596 !! wikitext
13597 [[File:Foobar.jpg|frameless|50px]]
13598 !! html/php
13599 <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>
13600 </p>
13601 !! html/parsoid
13602 <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>
13603 !! end
13604
13605 !! test
13606 Image: bitmap frameless can't be enlarged past original size, but vector can
13607 !! options
13608 parsoid=wt2html,wt2wt,html2html
13609 !! wikitext
13610 [[File:Foobar.jpg|frameless|2000px]]
13611
13612 [[File:Foobar.svg|frameless|2000px]]
13613 !! html/php
13614 <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>
13615 </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>
13616 </p>
13617 !! html/parsoid
13618 <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>
13619 <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>
13620 !! end
13621
13622 !! test
13623 Image: framed images are always unscaled.
13624 !! options
13625 parsoid=wt2html,wt2wt,html2html
13626 !! wikitext
13627 [[File:Foobar.jpg|frame]]
13628
13629 [[File:Foobar.jpg|frame|50px]]
13630
13631 [[File:Foobar.jpg|frame|50x50px]]
13632
13633 [[File:Foobar.jpg|frame|2000px]]
13634 !! html/php
13635 <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>
13636 <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>
13637 <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>
13638 <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>
13639
13640 !! html/parsoid
13641 <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>
13642 <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>
13643 <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>
13644 <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>
13645 !! end
13646
13647 ###################
13648
13649 !! test
13650 Link to image page- image page normally doesn't exists, hence edit link
13651 Add test with existing image page
13652 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13653 !! wikitext
13654 [[:Image:test]]
13655 !! html
13656 <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>
13657 </p>
13658 !! end
13659
13660 !! test
13661 bug 18784 Link to non-existent image page with caption should use caption as link text
13662 !! wikitext
13663 [[:Image:test|caption]]
13664 !! html
13665 <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>
13666 </p>
13667 !! end
13668
13669 !! test
13670 Frameless image caption with a free URL
13671 !! wikitext
13672 [[File:Foobar.jpg|http://example.com]]
13673 !! html/php
13674 <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>
13675 </p>
13676 !! html/parsoid
13677 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13678 !! end
13679
13680 !! test
13681 Thumbnail image caption with a free URL
13682 !! options
13683 thumbsize=220
13684 !! wikitext
13685 [[File:Foobar.jpg|thumb|http://example.com]]
13686 !! html/php
13687 <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>
13688
13689 !! html/parsoid
13690 <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>
13691 !! end
13692
13693 !! test
13694 Thumbnail image caption with a free URL and explicit alt
13695 !! options
13696 thumbsize=220
13697 parsoid=wt2html,wt2wt,html2html
13698 !! wikitext
13699 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13700 !! html/php
13701 <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>
13702
13703 !! html/parsoid
13704 <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>
13705 !! end
13706
13707 !! test
13708 SVG thumbnails with no language set
13709 !! options
13710 !! wikitext
13711 [[File:Foobar.svg|thumb|caption]]
13712 !! html/php
13713 <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>
13714
13715 !! html/parsoid
13716 <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>
13717 !! end
13718
13719 !! test
13720 SVG thumbnails with language de
13721 !! options
13722 parsoid=wt2html,wt2wt,html2html
13723 !! wikitext
13724 [[File:Foobar.svg|thumb|caption|lang=de]]
13725 !! html/php
13726 <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>
13727
13728 !! html/parsoid
13729 <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>
13730 !! end
13731
13732 !! test
13733 SVG thumbnails with invalid language code
13734 !! options
13735 parsoid=wt2html,wt2wt,html2html
13736 !! wikitext
13737 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13738 !! html/php
13739 <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>
13740
13741 !! html/parsoid
13742 <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>
13743 !! end
13744
13745 !! test
13746 BUG 1887: A ISBN with a thumbnail
13747 !! wikitext
13748 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13749 !! html/php
13750 <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>
13751
13752 !! html/parsoid
13753 <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>
13754 !! end
13755
13756 !! test
13757 BUG 1887: A RFC with a thumbnail
13758 !! wikitext
13759 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13760 !! html/php
13761 <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>
13762
13763 !! html/parsoid
13764 <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>
13765 !! end
13766
13767 !! test
13768 BUG 1887: A mailto link with a thumbnail
13769 !! wikitext
13770 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13771 !! html/php
13772 <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>
13773
13774 !! html/parsoid
13775 <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>
13776 !! end
13777
13778 # Pending resolution to bug 368
13779 !! test
13780 BUG 648: Frameless image caption with a link
13781 !! wikitext
13782 [[File:Foobar.jpg|text with a [[link]] in it]]
13783 !! html/php
13784 <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>
13785 </p>
13786 !! html/parsoid
13787 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13788 !! end
13789
13790 !! test
13791 BUG 648: Frameless image caption with a link (suffix)
13792 !! wikitext
13793 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13794 !! html/php
13795 <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>
13796 </p>
13797 !! html/parsoid
13798 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13799 !! end
13800
13801 !! test
13802 BUG 648: Frameless image caption with an interwiki link
13803 !! wikitext
13804 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13805 !! html/php
13806 <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>
13807 </p>
13808 !! html/parsoid
13809 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13810 !! end
13811
13812 !! test
13813 BUG 648: Frameless image caption with a piped interwiki link
13814 !! wikitext
13815 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13816 !! html/php
13817 <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>
13818 </p>
13819 !! html/parsoid
13820 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13821 !! end
13822
13823 !! test
13824 T107474: Frameless image caption with <nowiki>
13825 !! wikitext
13826 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13827 !! html/parsoid
13828 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13829 !! end
13830
13831 !! test
13832 Escape HTML special chars in image alt text
13833 !! wikitext
13834 [[File:Foobar.jpg|& < > "]]
13835 !! html/php
13836 <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>
13837 </p>
13838 !! html/parsoid
13839 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13840 !! end
13841
13842 !! test
13843 BUG 499: Alt text should have &#1234;, not &amp;1234;
13844 !! wikitext
13845 [[File:Foobar.jpg|&#9792;]]
13846 !! html/php
13847 <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>
13848 </p>
13849 !! html/parsoid
13850 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13851 !! end
13852
13853 !! test
13854 Broken image caption with link
13855 !! options
13856 parsoid=wt2html,wt2wt,html2html
13857 !! wikitext
13858 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13859 !! html/php
13860 <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.
13861 </p>
13862 !! html/parsoid
13863 <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>
13864 !! end
13865
13866 !! test
13867 Image caption containing another image
13868 !! wikitext
13869 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13870 !! html/php
13871 <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>
13872
13873 !! html/parsoid
13874 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>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>
13875 !! end
13876
13877 !! test
13878 Image: caption containing a newline
13879 !! wikitext
13880 [[File:Foobar.jpg|This
13881 *is some text]]
13882 !! html/php
13883 <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>
13884 </p>
13885 !! html/parsoid
13886 <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>
13887 !!end
13888
13889 !!test
13890 Image: caption containing leading space
13891 (The leading space should not trigger nowiki escaping in wt2wt mode)
13892 !! wikitext
13893 [[File:Foobar.jpg|thumb| bar]]
13894 !! html/php
13895 <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>
13896
13897 !! html/parsoid
13898 <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>
13899 !!end
13900
13901 !! test
13902 Image: caption containing a table
13903 !! options
13904 parsoid=wt2html,wt2wt,html2html
13905 !! wikitext
13906 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13907 {|
13908 ! Foo !! Bar
13909 |-
13910 | Foo1 || Bar1
13911 |}
13912 and some more text.]]
13913 !! html/php
13914 <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>
13915
13916 !! html/parsoid
13917 <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
13918 <table>
13919 <tbody>
13920 <tr><th>Foo </th><th>Bar</th></tr>
13921 <tr>
13922 <td>Foo1 </td>
13923 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13924 !! end
13925
13926 !! test
13927 Bug 3090: External links other than http: in image captions
13928 !! wikitext
13929 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13930 !! html/php
13931 <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>
13932
13933 !! html/parsoid
13934 <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>
13935 !! end
13936
13937 !! test
13938 Custom class
13939 !! options
13940 parsoid=wt2html,wt2wt,html2html
13941 !! wikitext
13942 [[Image:foobar.jpg|a|class=b]]
13943 !! html/php
13944 <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>
13945 </p>
13946 !! html/parsoid
13947 <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>
13948 !! end
13949
13950 !! test
13951 Localized image handling (1).
13952 !! options
13953 parsoid=wt2html,wt2wt,html2html
13954 language=es
13955 !! wikitext
13956 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13957 !! html/php
13958 <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>
13959
13960 !! html/parsoid
13961 <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>
13962 !! end
13963
13964 !! test
13965 Localized image handling (2).
13966 !! options
13967 thumbsize=220
13968 parsoid=wt2html,wt2wt,html2html
13969 language=es
13970 !! wikitext
13971 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13972 !! html/php
13973 <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>
13974
13975 !! html/parsoid
13976 <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>
13977 !! end
13978
13979 !! test
13980 Localized image handling (3).
13981 !! options
13982 language=fa
13983 parsoid=html2wt
13984 !! html/parsoid
13985 <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>
13986 !! wikitext
13987 [[File:Foobar.jpg|بندانگشتی]]
13988 !! end
13989
13990 !! test
13991 "border", "frameless" and "class" attributes on an image.
13992 !! options
13993 thumbsize=220
13994 parsoid=wt2html,wt2wt,html2html
13995 !! wikitext
13996 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13997 !! html/php
13998 <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>
13999 </p>
14000 !! html/parsoid
14001 <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>
14002 !! end
14003
14004 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14005 !! test
14006 Invalid image attributes (bug 62500)
14007 !! options
14008 thumbsize=220
14009 parsoid=wt2html,wt2wt,html2html
14010 !! wikitext
14011 [[File:Foobar.jpg|thumb|float|left|caption]]
14012
14013 [[File:Foobar.jpg|thumb|righ|caption]]
14014
14015 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14016 !! html/php
14017 <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>
14018 <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>
14019 <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>
14020
14021 !! html/parsoid
14022 <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>
14023 <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>
14024 <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>
14025 !! end
14026
14027 !! article
14028 File:Barfoo.jpg
14029 !! text
14030 #REDIRECT [[File:Barfoo.jpg]]
14031 !! endarticle
14032
14033 # FIXME: Parsoid should run this test -- but we'd need to teach the
14034 # mockAPI about the redirected Barfoo.jpg image.
14035 !! test
14036 Redirected image
14037 !! wikitext
14038 [[Image:Barfoo.jpg]]
14039 !! html/php
14040 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14041 </p>
14042 !! end
14043
14044 !! test
14045 Missing image with uploads disabled
14046 !! options
14047 wgEnableUploads=0
14048 !! wikitext
14049 [[File:Foobaz.jpg]]
14050 !! html/php
14051 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14052 </p>
14053 !! html/parsoid
14054 <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>
14055 !! end
14056
14057 # Parsoid-specific testing for images
14058 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14059 # Currently imperfect due to a flaw in the Parsoid testrunner
14060 # Work in progress
14061 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14062 # image tests.
14063
14064 !! test
14065 Parsoid-specific image handling - simple image with size and middle alignment
14066 !! wikitext
14067 [[File:Foobar.jpg|middle|50px]]
14068 !! html/parsoid
14069 <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>
14070 !! end
14071
14072 !! test
14073 Parsoid-specific image handling - simple image with size, middle alignment,
14074 non-standard namespace alias
14075 !! options
14076 parsoid=wt2wt,wt2html,html2html
14077 !! wikitext
14078 [[Image:Foobar.jpg|middle|50px]]
14079 !! html/parsoid
14080 <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>
14081 !! end
14082
14083 !! test
14084 Parsoid-specific image handling - simple image with size and middle alignment
14085 (existing content)
14086 !! wikitext
14087 [[File:Foobar.jpg|50px|middle]]
14088 !! html/parsoid
14089 <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>
14090 !! end
14091
14092 !! test
14093 Parsoid-specific image handling - simple image with size and middle alignment
14094 and non-standard namespace name
14095 !! options
14096 parsoid=wt2html,wt2wt,html2html
14097 !! wikitext
14098 [[Image:Foobar.jpg|50px|middle]]
14099 !! html/parsoid
14100 <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>
14101 !! end
14102
14103 !! test
14104 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14105 !! wikitext
14106 [[File:Foobar.jpg|500x10px|baseline|caption]]
14107 !! html/parsoid
14108 <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>
14109 !! end
14110
14111 !! test
14112 Parsoid-specific image handling - simple image with border and size spec
14113 !! wikitext
14114 [[File:Foobar.jpg|50px|border|caption]]
14115 !! html/parsoid
14116 <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>
14117 !! end
14118
14119 !! test
14120 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14121 !! wikitext
14122 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14123 !! html/parsoid
14124 <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>
14125 !! end
14126
14127 !! test
14128 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14129 (existing content)
14130 !! wikitext
14131 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14132 !! html/parsoid
14133 <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>
14134 !! end
14135
14136 !! test
14137 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14138 !! wikitext
14139 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14140 !! html/parsoid
14141 <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>
14142 !! end
14143
14144 !! test
14145 Parsoid-specific image handling - thumbnail with specific size, halign,
14146 valign, and caption (existing content)
14147 !! wikitext
14148 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14149 !! html/parsoid
14150 <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>
14151 !! end
14152
14153 !! test
14154 Parsoid-specific image handling - framed image with specific size and caption
14155 (size is ignored)
14156 !! options
14157 parsoid=wt2html,wt2wt,html2html
14158 !! wikitext
14159 [[File:Foobar.jpg|frame|500x50px|caption]]
14160 !! html/parsoid
14161 <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>
14162 !! end
14163
14164 !! test
14165 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14166 (size is ignored)
14167 !! options
14168 parsoid=wt2html,wt2wt,html2html
14169 !! wikitext
14170 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14171 !! html/parsoid
14172 <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>
14173 !! end
14174
14175 !! test
14176 Parsoid-specific image handling - frameless image with specific size, border, and caption
14177 !! wikitext
14178 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14179 !! html/parsoid
14180 <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>
14181 !! end
14182
14183 !! test
14184 Parsoid-specific image handling - simple image with a formatted caption
14185 !! wikitext
14186 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14187 !! html/parsoid
14188 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14189 !! end
14190
14191 !! test
14192 Parsoid-specific image handling - caption with a template in it
14193 !! wikitext
14194 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14195 !! html/parsoid
14196 <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>
14197 !! end
14198
14199 !! test
14200 Parsoid-specific image handling - caption with unbalanced tags in it
14201 !! options
14202 parsoid=wt2html,wt2wt,html2html
14203 !! wikitext
14204 foo
14205 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14206 bar
14207 !! html/parsoid
14208 <p>foo</p>
14209 <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>
14210 <p>bar</p>
14211 !! end
14212
14213 !! test
14214 Parsoid-specific image handling - empty caption (1)
14215 !! options
14216 parsoid=wt2html,wt2wt
14217 !! wikitext
14218 [[File:Foobar.jpg|thumb|]]
14219 !! html/parsoid
14220 <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>
14221 !! end
14222
14223 # empty captions don't get serialized unless we're in the "round trip" case
14224 !! test
14225 Parsoid-specific image handling - empty caption (2)
14226 !! options
14227 parsoid=html2wt
14228 !! html/parsoid
14229 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14230 <a href="./File:Foobar.jpg">
14231 <img resource="./File:Foobar.jpg"
14232 src="//example.com/images/3/3a/Foobar.jpg"
14233 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14234 height="25" width="220"/>
14235 </a>
14236 <figcaption></figcaption>
14237 </figure>
14238 !! wikitext
14239 [[File:Foobar.jpg|thumb]]
14240 !! end
14241
14242 !! test
14243 Parsoid-specific image handling - whitespace caption
14244 !! wikitext
14245 [[File:Foobar.jpg|thumb| ]]
14246 !! html/parsoid
14247 <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>
14248 !! end
14249
14250 !! test
14251 Parsoid-specific image handling - lang option
14252 !! wikitext
14253 foo
14254 [[File:Foobar.svg|lang=de|caption]]
14255 bar
14256 !! html/parsoid
14257 <p>foo
14258 <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>
14259 bar</p>
14260 !! end
14261
14262 ## Edge case bugs in Parsoid from T93580
14263 !! test
14264 T93580: 1. Templated <ref> inside block images
14265 !! wikitext
14266 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14267
14268 <references />
14269 !! html/parsoid
14270 <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>
14271
14272 <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>
14273 !! end
14274
14275 !! test
14276 T93580: 2. <ref> inside inline images
14277 !! wikitext
14278 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14279
14280 <references />
14281 !! html/parsoid
14282 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14283
14284 <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>
14285 !! end
14286
14287 !! test
14288 T93580: 3. Templated <ref> inside inline images
14289 !! wikitext
14290 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14291
14292 <references />
14293 !! html/parsoid
14294 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14295
14296 <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>
14297 !! end
14298
14299 ###
14300 ### Subpages
14301 ###
14302 !! article
14303 Subpage test/subpage
14304 !! text
14305 foo
14306 !! endarticle
14307
14308 !! test
14309 Subpage link
14310 !! options
14311 subpage title=[[Subpage test]]
14312 !! wikitext
14313 [[/subpage]]
14314 !! html
14315 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14316 </p>
14317 !! end
14318
14319 !! test
14320 Subpage noslash link
14321 !! options
14322 subpage title=[[Subpage test]]
14323 !! wikitext
14324 [[/subpage/]]
14325 !! html
14326 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14327 </p>
14328 !! end
14329
14330 !! article
14331 Subpage test/1/2/subpage
14332 !! text
14333 blah
14334 !! endarticle
14335
14336 !! test
14337 Relative subpage noslash link
14338 !! options
14339 parsoid=wt2wt,wt2html,html2html
14340 subpage title=[[Subpage test/1/2/3/4]]
14341 !! wikitext
14342 [[../../subpage/]]
14343
14344 [[../../subpage]]
14345 !! html/php
14346 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14347 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14348 </p>
14349 !! html/parsoid
14350 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14351 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14352 !! end
14353
14354 !! test
14355 Parsoid: dot-slash prefixed wikilinks
14356 !! wikitext
14357 [[./foo]]
14358
14359 [[././bar]]
14360
14361 [[././baz/]]
14362 !! html/php
14363 <p>[[./foo]]
14364 </p><p>[[././bar]]
14365 </p><p>[[././baz/]]
14366 </p>
14367 !! html/parsoid
14368 <p>[[./foo]]
14369 </p><p>[[././bar]]
14370 </p><p>[[././baz/]]
14371 </p>
14372 !! end
14373
14374 !! test
14375 Render invalid page names as plain text (bug 51090)
14376 !! wikitext
14377 [[./../foo|bar]]
14378 [[foo�|bar]]
14379 [[foo/.|bar]]
14380 [[foo/..|bar]]
14381 [[foo~~~bar]]
14382 [[foo>bar]]
14383 [[foo[bar]]
14384 [[.]]
14385 [[..]]
14386 [[foo././bar]]
14387
14388 [[{{echo|./../foo}}|bar]]
14389 [[{{echo|foo/.}}|bar]]
14390 [[{{echo|foo/..}}|bar]]
14391 [[{{echo|foo~~~~bar}}]]
14392 [[{{echo|foo>bar}}]]
14393 [[{{echo|foo././bar}}]]
14394 [[{{echo|foo{bar}}]]
14395 [[{{echo|foo}bar}}]]
14396 [[{{echo|foo[bar}}]]
14397 [[{{echo|foo]bar}}]]
14398 [[{{echo|foo<bar}}]]
14399 !!html/php
14400 <p>[[./../foo|bar]]
14401 [[foo�|bar]]
14402 [[foo/.|bar]]
14403 [[foo/..|bar]]
14404 [[foo~~~bar]]
14405 [[foo&gt;bar]]
14406 [[foo[bar]]
14407 [[.]]
14408 [[..]]
14409 [[foo././bar]]
14410 </p><p>[[./../foo|bar]]
14411 [[foo/.|bar]]
14412 [[foo/..|bar]]
14413 [[foo~~~~bar]]
14414 [[foo&gt;bar]]
14415 [[foo././bar]]
14416 [[foo{bar]]
14417 [[foo}bar]]
14418 [[foo[bar]]
14419 [[foo]bar]]
14420 [[foo&lt;bar]]
14421 </p>
14422 !!html/parsoid
14423 <p>[[./../foo|bar]]
14424 [[foo�|bar]]
14425 [[foo/.|bar]]
14426 [[foo/..|bar]]
14427 [[foo~~~bar]]
14428 [[foo>bar]]
14429 [[foo[bar]]
14430 [[.]]
14431 [[..]]
14432 [[foo././bar]]</p>
14433
14434 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14435 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14436 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14437 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14438 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14439 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14440 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14441 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14442 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14443 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14444 [[<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>
14445 !!end
14446
14447 !! test
14448 Disabled subpages
14449 !! wikitext
14450 [[/subpage]]
14451 !! html
14452 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14453 </p>
14454 !! end
14455
14456 !! test
14457 BUG 561: {{/Subpage}}
14458 !! options
14459 subpage title=[[Page]]
14460 !! wikitext
14461 {{/Subpage}}
14462 !! html
14463 <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>
14464 </p>
14465 !! end
14466
14467 ###
14468 ### Categories
14469 ###
14470 !! article
14471 Category:MediaWiki User's Guide
14472 !! text
14473 blah
14474 !! endarticle
14475
14476 !! test
14477 Link to category
14478 !! wikitext
14479 [[:Category:MediaWiki User's Guide]]
14480 !! html
14481 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14482 </p>
14483 !! end
14484
14485 !! test
14486 Simple category
14487 !! options
14488 cat
14489 !! wikitext
14490 [[Category:MediaWiki User's Guide]]
14491 !! html
14492 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14493 !! end
14494
14495 !! test
14496 PAGESINCATEGORY invalid title fatal (r33546 fix)
14497 !! wikitext
14498 {{PAGESINCATEGORY:<bogus>}}
14499 !! html
14500 <p>0
14501 </p>
14502 !! end
14503
14504 !! test
14505 Category with different sort key
14506 !! options
14507 cat
14508 !! wikitext
14509 [[Category:MediaWiki User's Guide|Foo]]
14510 !! html
14511 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14512 !! end
14513
14514 !! test
14515 Category with identical sort key
14516 !! options
14517 cat
14518 !! wikitext
14519 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14520 !! html
14521 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14522 !! end
14523
14524 !! test
14525 Category with empty sort key
14526 !! options
14527 cat
14528 pst
14529 !! wikitext
14530 [[Category:MediaWiki User's Guide|]]
14531 !! html/php
14532 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14533 !! end
14534
14535 !! test
14536 Category with empty sort key and parentheses
14537 !! options
14538 cat
14539 pst
14540 !! wikitext
14541 [[Category:Foo (bar)|]]
14542 !! html/php
14543 [[Category:Foo (bar)|Foo]]
14544 !! end
14545
14546 ## We used to, but no longer wt2wt this test since the default serializer
14547 ## will normalize all categories to serialize on their own line.
14548 ## This wikitext usage is going to be fairly uncommon in production and
14549 ## selser will take care of preserving formatting in those scenarios.
14550 !! test
14551 Category with link tail
14552 !! options
14553 cat
14554 pst
14555 parsoid=wt2html
14556 !! wikitext
14557 123[[Category:Foo]]456
14558 !! html/php
14559 123[[Category:Foo]]456
14560 !! html/parsoid
14561 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14562 !! end
14563
14564 !! test
14565 Category with template
14566 !! options
14567 cat
14568 pst
14569 !! wikitext
14570 [[Category:{{echo|Foo}}]]
14571 !! html/php
14572 [[Category:{{echo|Foo}}]]
14573 !! end
14574
14575 !! test
14576 Category with template in sort key
14577 !! options
14578 cat
14579 pst
14580 !! wikitext
14581 [[Category:Foo|{{echo|Bar}}]]
14582 !! html/php
14583 [[Category:Foo|{{echo|Bar}}]]
14584 !! end
14585
14586 !! test
14587 Category with template in sort key and title
14588 !! options
14589 cat
14590 pst
14591 !! wikitext
14592 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14593 !! html/php
14594 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14595 !! end
14596
14597 ## We used to, but no longer wt2wt this test since the default serializer
14598 ## will normalize all categories to serialize on their own line.
14599 ## This wikitext usage is going to be fairly uncommon in production and
14600 ## selser will take care of preserving formatting in those scenarios.
14601 !! test
14602 Category / paragraph interactions
14603 !! options
14604 parsoid=wt2html
14605 !! wikitext
14606 Foo [[Category:Baz]] Bar
14607
14608 Foo [[Category:Baz]]
14609 Bar
14610
14611 Foo
14612 [[Category:Baz]]
14613 Bar
14614
14615 Foo
14616 [[Category:Baz]] Bar
14617
14618 Foo
14619 [[Category:Baz]]
14620 [[Category:Baz]]
14621 [[Category:Baz]]
14622 Bar
14623
14624 [[Category:Baz]]
14625 [[Category:Baz]]
14626 [[Category:Baz]]
14627
14628 [[Category:Baz]]
14629 {{echo|[[Category:Baz]]}}
14630 [[Category:Baz]]
14631 !! html/php
14632 <p>Foo Bar
14633 </p><p>Foo
14634 Bar
14635 </p><p>Foo
14636 Bar
14637 </p><p>Foo Bar
14638 </p><p>Foo
14639 Bar
14640 </p>
14641 !! html/parsoid
14642 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14643 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14644 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14645 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14646 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
14647 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14648 !! end
14649
14650 ## We used to, but no longer wt2wt this test since the default serializer
14651 ## will normalize all categories to serialize on their own line.
14652 ## This wikitext usage is going to be fairly uncommon in production and
14653 ## selser will take care of preserving formatting in those scenarios.
14654 ##
14655 ## The whitespace on the empty line is part of the test. Please do not delete
14656 !! test
14657 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14658 !! options
14659 parsoid=wt2html
14660 !! wikitext
14661 This
14662
14663 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14664
14665 {{echo|[[Category:Foo]] and so should this!}}
14666 !! html/php
14667 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14668 </p>
14669 !! html/parsoid
14670 <p>This
14671
14672 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14673
14674 <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>
14675 !! end
14676
14677 ## Parsoid will not try to wt2wt this while preserving newlines because
14678 ## it suppresses excess newlines within list items -- and we don't want to
14679 ## introduce a special case just for categories, which is, in reality somewhat
14680 ## odd behavior -- categories are unlikely to be used in list items like this
14681 ## in top-level pages and are only likely to show up in template-generated
14682 ## list items where this RT-ing is a non-issue.
14683 ##
14684 ## The whitespace on the empty line is part of the test. Please do not delete
14685 !! test
14686 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14687 !! options
14688 parsoid=wt2html
14689 !! wikitext
14690 * This
14691
14692 [[Category:Foo]] and this should be part of the same list item
14693 * So should this
14694
14695 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14696 !! html
14697 <ul><li>This and this should be part of the same list item</li>
14698 <li>So should this and this should be part of the same list item</li></ul>
14699 !! html/parsoid
14700 <ul>
14701 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14702 <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>
14703 </ul>
14704 !! end
14705
14706 ## Newlines and categories that follow the last item of a list
14707 ## are treated differently because this (list followed by categories)
14708 ## is an extremely common pattern on wikis.
14709 !! test
14710 3. Categories and newlines: newline suppression for last list item should RT properly
14711 !! wikitext
14712 * a
14713 * b
14714
14715 [[Category:Foo]]
14716
14717 [[Category:Bar]]
14718 [[Category:Baz]]
14719 !! html/parsoid
14720 <ul><li> a</li>
14721 <li> b</li></ul>
14722
14723 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14724
14725 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14726 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14727 !! end
14728
14729 !! test
14730 4. Categories and newlines: newline suppression for last list item should RT properly
14731 !! wikitext
14732 * a
14733 **** b
14734
14735 [[Category:Foo]]
14736 !! html/parsoid
14737 <ul><li> a
14738 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14739
14740 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14741 !! end
14742
14743 ## only wt2html for this to make sure the algo only applies to the rightmost path
14744 !! test
14745 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14746 !! options
14747 parsoid=wt2html
14748 !! wikitext
14749 * a
14750 ** b
14751 [[Category:Foo]]
14752 * c
14753 ** d
14754 [[Category:Foo]]
14755 !! html/parsoid
14756 <ul><li> a
14757 <ul><li> b
14758 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14759 <li> c
14760 <ul><li> d</li></ul></li></ul>
14761 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14762 !! end
14763
14764 ## We used to, but no longer wt2wt this test since the default serializer
14765 ## will normalize all categories to serialize on their own line.
14766 ## This wikitext usage is going to be fairly uncommon in production and
14767 ## selser will take care of preserving formatting in those scenarios.
14768 !! test
14769 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14770 !! options
14771 parsoid=wt2html
14772 !! wikitext
14773 * a [[Category:Foo]]
14774 !! html/parsoid
14775 <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>
14776 !! end
14777
14778 # This test also demonstrates because of newline+category tunneling
14779 # through the list hander, template wrapping doesn't expand to the
14780 # containing list when the list item swallows the category.
14781 !! test
14782 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14783 !! wikitext
14784 * {{echo|a
14785 [[Category:Foo]]}}
14786 !! html/parsoid
14787 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
14788 </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>
14789 !! end
14790
14791 !! test
14792 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14793 !! wikitext
14794 * a
14795
14796 {{echo|[[Category:Foo]]
14797 [[Category:Bar]]}}
14798 [[Category:Baz]]
14799 !! html/parsoid
14800 <ul><li> a</li></ul>
14801
14802 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14803 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14804 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14805 !! end
14806
14807 !! test
14808 Parsoid: Serialize link to category page with colon escape
14809 !! options
14810 parsoid
14811 !! wikitext
14812
14813 [[:Category:Foo]]
14814 [[:Category:Foo|Bar]]
14815 !! html
14816 <p>
14817 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14818 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14819 </p>
14820 !! end
14821
14822 # We used to, but no longer wt2wt this test since the default serializer
14823 # will normalize all categories to serialize on their own line.
14824 # This wikitext usage is going to be fairly uncommon in production and
14825 # selser will take care of preventing whitespace insertion if this
14826 # occurs in an article.
14827 #
14828 # html2html disabled for the same reason (whitespace insertion between
14829 # x and y).
14830 #
14831 # html2wt disabled because it localizes the "Category" namespace.
14832 !! test
14833 Link prefix/suffixes aren't applied to category links
14834 !! options
14835 parsoid=wt2html
14836 language=is
14837 !! wikitext
14838 x[[Category:Foo]]y
14839 !! html/php
14840 <p>xy
14841 </p>
14842 !! html/parsoid
14843 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14844 !! end
14845
14846 !! test
14847 Parsoid: Serialize link to file page with colon escape
14848 !! options
14849 parsoid
14850 !! wikitext
14851
14852 [[:File:Foo.png]]
14853 [[:File:Foo.png|Bar]]
14854 !! html
14855 <p>
14856 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14857 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14858 </p>
14859 !! end
14860
14861 !! test
14862 Parsoid: Serialize a genuine category link without colon escape
14863 !! options
14864 parsoid
14865 !! wikitext
14866 [[Category:Foo]]
14867 [[Category:Foo|Bar]]
14868 !! html
14869 <link rel="mw:PageProp/Category" href="./Category:Foo">
14870 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14871 !! end
14872
14873 !! test
14874 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14875 !! options
14876 parsoid=html2wt
14877 !! html/parsoid
14878 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14879 !! wikitext
14880 [[Category:Toxine bactérienne]]
14881 !! end
14882
14883 !! test
14884 Parsoid: Defaultsort
14885 !! wikitext
14886 {{DEFAULTSORT:Foo}}
14887 !! html/parsoid
14888 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14889 !! end
14890
14891 !! test
14892 Parsoid: Defaultsort (template-generated)
14893 !! wikitext
14894 {{{{echo|DEFAULTSORT}}:Foo}}
14895 !! html/parsoid
14896 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14897 !! end
14898
14899 ###
14900 ### Inter-language links
14901 ###
14902 !! test
14903 Interlanguage links
14904 !! options
14905 ill
14906 !! wikitext
14907 [[es:Alimento]]
14908 [[fr:Nourriture]]
14909 [[zh:食品]]
14910 !! html/php
14911 es:Alimento fr:Nourriture zh:食品
14912 !! html/parsoid
14913 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14914 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14915 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14916 !! end
14917
14918 !! test
14919 Duplicate interlanguage links (bug 24502)
14920 !! options
14921 ill
14922 !! wikitext
14923 [[es:1]]
14924 [[es:2]]
14925 [[fr:1]]
14926 [[fr:2]]
14927 !! html/php
14928 es:1 fr:1
14929 !! html/parsoid
14930 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14931 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14932 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14933 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14934 !! end
14935
14936 ###
14937 ### Sections
14938 ###
14939 !! test
14940 Basic section headings
14941 !! wikitext
14942 == Headline 1 ==
14943 Some text
14944
14945 ==Headline 2==
14946 More
14947 ===Smaller headline===
14948 Blah blah
14949 !! html
14950 <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>
14951 <p>Some text
14952 </p>
14953 <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>
14954 <p>More
14955 </p>
14956 <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>
14957 <p>Blah blah
14958 </p>
14959 !! end
14960
14961 !! test
14962 Section headings with TOC
14963 !! wikitext
14964 == Headline 1 ==
14965 === Subheadline 1 ===
14966 ===== Skipping a level =====
14967 ====== Skipping a level ======
14968
14969 == Headline 2 ==
14970 Some text
14971 ===Another headline===
14972 !! html
14973 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14974 <ul>
14975 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14976 <ul>
14977 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14978 <ul>
14979 <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>
14980 <ul>
14981 <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>
14982 </ul>
14983 </li>
14984 </ul>
14985 </li>
14986 </ul>
14987 </li>
14988 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14989 <ul>
14990 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14991 </ul>
14992 </li>
14993 </ul>
14994 </div>
14995
14996 <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>
14997 <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>
14998 <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>
14999 <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>
15000 <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>
15001 <p>Some text
15002 </p>
15003 <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>
15004
15005 !! end
15006
15007 !! test
15008 TOC anchors don't collide
15009 !! wikitext
15010 __FORCETOC__
15011 == Headline 2 ==
15012 == Headline ==
15013 == Headline 2 ==
15014 == Headline ==
15015 !! html/php
15016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15017 <ul>
15018 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15019 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15020 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15021 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15022 </ul>
15023 </div>
15024
15025 <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>
15026 <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>
15027 <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>
15028 <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>
15029
15030 !! end
15031
15032 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15033 !! test
15034 Handling of sections up to level 6 and beyond
15035 !! wikitext
15036 = Level 1 Heading=
15037 == Level 2 Heading==
15038 === Level 3 Heading===
15039 ==== Level 4 Heading====
15040 ===== Level 5 Heading=====
15041 ====== Level 6 Heading======
15042 ======= Level 7 Heading=======
15043 ======== Level 8 Heading========
15044 ========= Level 9 Heading=========
15045 ========== Level 10 Heading==========
15046 !! html
15047 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15048 <ul>
15049 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15050 <ul>
15051 <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>
15052 <ul>
15053 <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>
15054 <ul>
15055 <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>
15056 <ul>
15057 <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>
15058 <ul>
15059 <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>
15060 <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>
15061 <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>
15062 <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>
15063 <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>
15064 </ul>
15065 </li>
15066 </ul>
15067 </li>
15068 </ul>
15069 </li>
15070 </ul>
15071 </li>
15072 </ul>
15073 </li>
15074 </ul>
15075 </div>
15076
15077 <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>
15078 <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>
15079 <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>
15080 <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>
15081 <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>
15082 <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>
15083 <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>
15084 <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>
15085 <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>
15086 <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>
15087
15088 !! end
15089
15090 !! test
15091 TOC regression (T11764)
15092 !! wikitext
15093 == title 1 ==
15094 === title 1.1 ===
15095 ==== title 1.1.1 ====
15096 === title 1.2 ===
15097 == title 2 ==
15098 === title 2.1 ===
15099 !! html
15100 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15101 <ul>
15102 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15103 <ul>
15104 <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>
15105 <ul>
15106 <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>
15107 </ul>
15108 </li>
15109 <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>
15110 </ul>
15111 </li>
15112 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15113 <ul>
15114 <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>
15115 </ul>
15116 </li>
15117 </ul>
15118 </div>
15119
15120 <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>
15121 <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>
15122 <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>
15123 <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>
15124 <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>
15125 <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>
15126
15127 !! end
15128
15129 !! test
15130 TOC for heading containing <span id="..."></span> (T96153)
15131 !! wikitext
15132 __FORCETOC__
15133 ==<span id="old-anchor"></span>New title==
15134 !! html/php
15135 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15136 <ul>
15137 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15138 </ul>
15139 </div>
15140
15141 <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>
15142
15143 !! end
15144
15145 !! test
15146 TOC with wgMaxTocLevel=3 (bug 6204)
15147 !! options
15148 wgMaxTocLevel=3
15149 !! wikitext
15150 == title 1 ==
15151 === title 1.1 ===
15152 ==== title 1.1.1 ====
15153 === title 1.2 ===
15154 == title 2 ==
15155 === title 2.1 ===
15156 !! html
15157 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15158 <ul>
15159 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15160 <ul>
15161 <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>
15162 <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>
15163 </ul>
15164 </li>
15165 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15166 <ul>
15167 <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>
15168 </ul>
15169 </li>
15170 </ul>
15171 </div>
15172
15173 <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>
15174 <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>
15175 <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>
15176 <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>
15177 <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>
15178 <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>
15179
15180 !! end
15181
15182 !! test
15183 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15184 !! options
15185 wgMaxTocLevel=3
15186 !! wikitext
15187 ==Section 1==
15188 ===Section 1.1===
15189 ====Section 1.1.1====
15190 ====Section 1.1.1.1====
15191 ==Section 2==
15192 !! html
15193 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15194 <ul>
15195 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15196 <ul>
15197 <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>
15198 </ul>
15199 </li>
15200 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15201 </ul>
15202 </div>
15203
15204 <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>
15205 <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>
15206 <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>
15207 <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>
15208 <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>
15209
15210 !! end
15211
15212
15213 !! test
15214 Resolving duplicate section names
15215 !! wikitext
15216 == Foo bar ==
15217 == Foo bar ==
15218 !! html
15219 <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>
15220 <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>
15221
15222 !! end
15223
15224 !! test
15225 Resolving duplicate section names with differing case (bug 10721)
15226 !! wikitext
15227 == Foo bar ==
15228 == Foo Bar ==
15229 !! html
15230 <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>
15231 <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>
15232
15233 !! end
15234
15235 !! article
15236 Template:sections
15237 !! text
15238 ===Section 1===
15239 ==Section 2==
15240 !! endarticle
15241
15242 !! test
15243 Template with sections, __NOTOC__
15244 !! wikitext
15245 __NOTOC__
15246 ==Section 0==
15247 {{sections}}
15248 ==Section 4==
15249 !! html
15250 <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>
15251 <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>
15252 <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>
15253 <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>
15254
15255 !! end
15256
15257 !! test
15258 __NOEDITSECTION__ keyword
15259 !! wikitext
15260 __NOEDITSECTION__
15261 ==Section 1==
15262 ==Section 2==
15263 !! html
15264 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15265 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15266
15267 !! end
15268
15269 !! test
15270 Link inside a section heading
15271 !! wikitext
15272 ==Section with a [[Main Page|link]] in it==
15273 !! html
15274 <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>
15275
15276 !! end
15277
15278 !! test
15279 TOC regression (T14077)
15280 !! wikitext
15281 __TOC__
15282 == title 1 ==
15283 === title 1.1 ===
15284 == title 2 ==
15285 !! html
15286 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15287 <ul>
15288 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15289 <ul>
15290 <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>
15291 </ul>
15292 </li>
15293 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15294 </ul>
15295 </div>
15296
15297 <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>
15298 <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>
15299 <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>
15300
15301 !! end
15302
15303 !! test
15304 BUG 1219 URL next to image (good)
15305 !! wikitext
15306 http://example.com [[File:Foobar.jpg]]
15307 !! html/php
15308 <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>
15309 </p>
15310 !! html/parsoid
15311 <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>
15312 !!end
15313
15314 !! test
15315 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15316 !! wikitext
15317 ===
15318 The line above must have a trailing space!
15319 === <!--
15320 --> <!-- -->
15321 But just in case it doesn't...
15322 !! html
15323 <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>
15324 <p>The line above must have a trailing space!
15325 </p>
15326 <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>
15327 <p>But just in case it doesn't...
15328 </p>
15329 !! end
15330
15331 !! test
15332 Header with special characters (bug 25462)
15333 !! wikitext
15334 The tooltips shall not show entities to the user (ie. be double escaped)
15335
15336 == text > text ==
15337 section 1
15338
15339 == text < text ==
15340 section 2
15341
15342 == text & text ==
15343 section 3
15344
15345 == text ' text ==
15346 section 4
15347
15348 == text " text ==
15349 section 5
15350 !! html
15351 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15352 </p>
15353 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15354 <ul>
15355 <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>
15356 <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>
15357 <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>
15358 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15359 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15360 </ul>
15361 </div>
15362
15363 <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>
15364 <p>section 1
15365 </p>
15366 <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>
15367 <p>section 2
15368 </p>
15369 <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>
15370 <p>section 3
15371 </p>
15372 <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>
15373 <p>section 4
15374 </p>
15375 <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>
15376 <p>section 5
15377 </p>
15378 !! end
15379
15380 !! test
15381 Header with space, plus and underscore as entity
15382 !! wikitext
15383 Id should not contain + for spaces
15384
15385 == Space between Text ==
15386 section 1
15387
15388 == Space-Entity&#32;between&#32;Text ==
15389 section 2
15390
15391 == Plus+between+Text ==
15392 section 3
15393
15394 == Plus-Entity&#43;between&#43;Text ==
15395 section 4
15396
15397 == Underscore_between_Text ==
15398 section 5
15399
15400 == Underscore-Entity&#95;between&#95;Text ==
15401 section 6
15402
15403 [[#Space between Text]]
15404 [[#Space-Entity&#32;between&#32;Text]]
15405 [[#Plus+between+Text]]
15406 [[#Plus-Entity&#43;between&#43;Text]]
15407 [[#Underscore_between_Text]]
15408 [[#Underscore-Entity&#95;between&#95;Text]]
15409 !! html
15410 <p>Id should not contain + for spaces
15411 </p>
15412 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15413 <ul>
15414 <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>
15415 <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>
15416 <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>
15417 <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>
15418 <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>
15419 <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>
15420 </ul>
15421 </div>
15422
15423 <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>
15424 <p>section 1
15425 </p>
15426 <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>
15427 <p>section 2
15428 </p>
15429 <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>
15430 <p>section 3
15431 </p>
15432 <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>
15433 <p>section 4
15434 </p>
15435 <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>
15436 <p>section 5
15437 </p>
15438 <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>
15439 <p>section 6
15440 </p><p><a href="#Space_between_Text">#Space between Text</a>
15441 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15442 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15443 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15444 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15445 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15446 </p>
15447 !! end
15448
15449 !! test
15450 Headers with excess '=' characters
15451 (Are similar tests necessary beyond the 1st level?)
15452 !! wikitext
15453 =foo==
15454 ==foo=
15455 =''italic'' heading==
15456 ==''italic'' heading=
15457 !! html
15458 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15459 <ul>
15460 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15461 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15462 <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>
15463 <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>
15464 </ul>
15465 </div>
15466
15467 <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>
15468 <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>
15469 <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>
15470 <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>
15471
15472 !! end
15473
15474 !! test
15475 HTML headers vs TOC (bug 23393)
15476 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15477 !! wikitext
15478 <h1>Header 1</h1>
15479 == Header 1.1 ==
15480 == Header 1.2 ==
15481
15482 <h1>Header 2
15483 </h1>
15484 == Header 2.1 ==
15485 == Header 2.2 ==
15486 __NOEDITSECTION__
15487 !! html
15488 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15489 <ul>
15490 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15491 <ul>
15492 <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>
15493 <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>
15494 </ul>
15495 </li>
15496 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15497 <ul>
15498 <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>
15499 <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>
15500 </ul>
15501 </li>
15502 </ul>
15503 </div>
15504
15505 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15506 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15507 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15508 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15509 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15510 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15511
15512 !! end
15513
15514 !! test
15515 Single-line or multiline-comments can follow headings
15516 !! options
15517 parsoid=wt2html,wt2wt
15518 !! wikitext
15519 ==foo==<!---->
15520 ==bar==<!--c1-->
15521 ==baz==<!--
15522 c2
15523 c3-->
15524 !! html
15525 <h2><span class="mw-headline" id="foo">foo</span></h2>
15526 <h2><span class="mw-headline" id="bar">bar</span></h2>
15527 <h2><span class="mw-headline" id="baz">baz</span></h2>
15528
15529 !! end
15530
15531 !! test
15532 BUG 1219 URL next to image (broken)
15533 !! wikitext
15534 http://example.com[[File:Foobar.jpg]]
15535 !! html/php
15536 <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>
15537 </p>
15538 !! html/parsoid
15539 <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>
15540 !!end
15541
15542 !! test
15543 Bug 1186 news: in the middle of text
15544 !! wikitext
15545 http://en.wikinews.org/wiki/Wikinews:Workplace
15546 !! html
15547 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15548 </p>
15549 !!end
15550
15551
15552 !! test
15553 Namespaced link must have a title
15554 !! wikitext
15555 [[Project:]]
15556 !! html
15557 <p>[[Project:]]
15558 </p>
15559 !!end
15560
15561 !! test
15562 Namespaced link must have a title (bad fragment version)
15563 !! wikitext
15564 [[Project:#fragment]]
15565 !! html
15566 <p>[[Project:#fragment]]
15567 </p>
15568 !!end
15569
15570
15571 ###
15572 ### HTML tags and HTML attributes
15573 ###
15574
15575 !! test
15576 div with no attributes
15577 !! wikitext
15578 <div>HTML rocks</div>
15579 !! html
15580 <div>HTML rocks</div>
15581
15582 !! end
15583
15584 !! test
15585 div with double-quoted attribute
15586 !! wikitext
15587 <div id="rock">HTML rocks</div>
15588 !! html
15589 <div id="rock">HTML rocks</div>
15590
15591 !! end
15592
15593 !! test
15594 div with single-quoted attribute
15595 !! wikitext
15596 <div id='rock'>HTML rocks</div>
15597 !! html
15598 <div id="rock">HTML rocks</div>
15599
15600 !! end
15601
15602 !! test
15603 div with unquoted attribute
15604 !! wikitext
15605 <div id=rock>HTML rocks</div>
15606 !! html
15607 <div id="rock">HTML rocks</div>
15608
15609 !! end
15610
15611 !! test
15612 div with illegal double attributes
15613 !! wikitext
15614 <div id="a" id="b">HTML rocks</div>
15615 !! html
15616 <div id="b">HTML rocks</div>
15617
15618 !!end
15619
15620 !! test
15621 div with empty attribute value, space before equals
15622 !! options
15623 parsoid=wt2html,html2html
15624 !! wikitext
15625 <div class =>HTML rocks</div>
15626 !! html/php
15627 <div class="">HTML rocks</div>
15628
15629 !! html/parsoid
15630 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15631 !! end
15632
15633 !! test
15634 div with multiple empty attribute values
15635 !! options
15636 parsoid=wt2html,html2html
15637 !! wikitext
15638 <div id= title=>HTML rocks</div>
15639 !! html/php
15640 <div id="title.3D">HTML rocks</div>
15641
15642 !! html/parsoid
15643 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15644 !! end
15645
15646 !! test
15647 table with multiple empty attribute values
15648 !! options
15649 parsoid=wt2html,html2html
15650 !! wikitext
15651 {| title= id=
15652 | hi
15653 |}
15654 !! html/php
15655 <table title="id=">
15656 <tr>
15657 <td> hi
15658 </td></tr></table>
15659
15660 !! html/parsoid
15661 <table title="id=">
15662 <tbody><tr><td> hi</td></tr>
15663 </tbody></table>
15664 !! end
15665
15666 !! test
15667 div with braces in attribute value
15668 !! wikitext
15669 <div title="{}">Foo</div>
15670 !! html/php
15671 <div title="&#123;}">Foo</div>
15672
15673 !! html/parsoid
15674 <div title="{}">Foo</div>
15675 !! end
15676
15677 !! test
15678 div with empty attribute value, no space before equals
15679 !! options
15680 parsoid=wt2html,html2html
15681 !! wikitext
15682 <div class=>HTML rocks</div>
15683 !! html/php
15684 <div class="">HTML rocks</div>
15685
15686 !! html/parsoid
15687 <div class="">HTML rocks</div>
15688 !! end
15689
15690 !! test
15691 HTML multiple attributes correction
15692 !! wikitext
15693 <p class="error" class="awesome">Awesome!</p>
15694 !! html
15695 <p class="awesome">Awesome!</p>
15696
15697 !!end
15698
15699 !! test
15700 Table multiple attributes correction
15701 !! wikitext
15702 {|
15703 !+ class="error" class="awesome"| status
15704 |}
15705 !! html
15706 <table>
15707 <tr>
15708 <th class="awesome"> status
15709 </th></tr></table>
15710
15711 !!end
15712
15713 !! test
15714 DIV IN UPPERCASE
15715 !! wikitext
15716 <DIV ID="x">HTML ROCKS</DIV>
15717 !! html
15718 <div id="x">HTML ROCKS</div>
15719
15720 !!end
15721
15722 !! test
15723 Non-ASCII pseudo-tags are rendered as text
15724 !! wikitext
15725 <khyô>
15726 !! html
15727 <p>&lt;khyô&gt;
15728 </p>
15729 !! end
15730
15731 !! test
15732 Pseudo-tag with URL 'name' renders as url link
15733 !! wikitext
15734 <http://example.com/>
15735 !! html
15736 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15737 </p>
15738 !! end
15739
15740 !! test
15741 text with amp in the middle of nowhere
15742 !! wikitext
15743 Remember AT&T?
15744 !! html
15745 <p>Remember AT&amp;T?
15746 </p>
15747 !! end
15748
15749 !! test
15750 text with character entity: eacute
15751 !! wikitext
15752 I always thought &eacute; was a cute letter.
15753 !! html
15754 <p>I always thought &#233; was a cute letter.
15755 </p>
15756 !! html+tidy
15757 <p>I always thought é was a cute letter.</p>
15758 !! end
15759
15760 !! test
15761 text with entity-escaped character entity-like string: eacute
15762 !! wikitext
15763 I always thought &amp;eacute; was a cute letter.
15764 !! html
15765 <p>I always thought &amp;eacute; was a cute letter.
15766 </p>
15767 !! end
15768
15769 !! test
15770 text with undefined character entity: xacute
15771 !! wikitext
15772 I always thought &xacute; was a cute letter.
15773 !! html
15774 <p>I always thought &amp;xacute; was a cute letter.
15775 </p>
15776 !! end
15777
15778 !! test
15779 HTML5 tags
15780 !! wikitext
15781 <data value="5">five</data>
15782 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15783 <mark>This highlighted text</mark>
15784 !! html
15785 <p><data value="5">five</data>
15786 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15787 <mark>This highlighted text</mark>
15788 </p>
15789 !! end
15790
15791 !! test
15792 HTML tag with leading space is parsed as text
15793 !! wikitext
15794 < div>foo< /div>
15795 !! html
15796 <p>&lt; div&gt;foo&lt; /div&gt;
15797 </p>
15798 !! end
15799
15800 ###
15801 ### Nesting tests (see bug 41545, 50604, 51081)
15802 ###
15803
15804 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15805 # Note that html2wt is considerably more difficult if we use <b> in
15806 # the test case, instead of <big>
15807 !! test
15808 Ensure that HTML adoption agency algorithm is properly implemented.
15809 !! wikitext
15810 <big>X<big>Y</big>Z</big>
15811 !! html
15812 <p><big>X<big>Y</big>Z</big>
15813 </p>
15814 !! end
15815
15816 # This was bug 41545 in the PHP parser.
15817 # Note that tidy doesn't handle this correctly.
15818 !! test
15819 Nesting of <kbd>
15820 !! wikitext
15821 <kbd>X<kbd>Y</kbd>Z</kbd>
15822 !! html
15823 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15824 </p>
15825 !! end
15826
15827 # The following cases were bug 51081 in the PHP parser.
15828 # Note that there are some other nestable tags (b, i, etc) which are
15829 # not covered; see bug 51081 for discussion.
15830
15831 # Note that tidy doesn't handle this correctly.
15832 !! test
15833 Nesting of <em>
15834 !! wikitext
15835 <em>X<em>Y</em>Z</em>
15836 !! html
15837 <p><em>X<em>Y</em>Z</em>
15838 </p>
15839 !! end
15840
15841 # Note that tidy doesn't handle this correctly.
15842 !! test
15843 Nesting of <strong>
15844 !! wikitext
15845 <strong>X<strong>Y</strong>Z</strong>
15846 !! html
15847 <p><strong>X<strong>Y</strong>Z</strong>
15848 </p>
15849 !! end
15850
15851 !! test
15852 Nesting of <q>
15853 !! wikitext
15854 <q>X<q>Y</q>Z</q>
15855 !! html+tidy
15856 <p><q>X<q>Y</q>Z</q></p>
15857 !! end
15858
15859 # Note that tidy doesn't handle this correctly.
15860 !! test
15861 Nesting of <ruby>
15862 !! wikitext
15863 <ruby>X<ruby>Y</ruby>Z</ruby>
15864 !! html
15865 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15866 </p>
15867 !! end
15868
15869 # Note that tidy doesn't handle this correctly.
15870 !! test
15871 Nesting of <bdo>
15872 !! wikitext
15873 <bdo>X<bdo>Y</bdo>Z</bdo>
15874 !! html
15875 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15876 </p>
15877 !! end
15878
15879
15880 ###
15881 ### Media links
15882 ###
15883
15884 !! test
15885 Media link
15886 !! wikitext
15887 [[Media:Foobar.jpg]]
15888 !! html
15889 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15890 </p>
15891 !! end
15892
15893 !! test
15894 Media link with text
15895 !! wikitext
15896 [[Media:Foobar.jpg|A neat file to look at]]
15897 !! html
15898 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15899 </p>
15900 !! end
15901
15902 # FIXME: this is still bad HTML tag nesting
15903 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15904 !! test
15905 Media link with nasty text
15906 !! wikitext
15907 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15908 !! html
15909 <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>
15910
15911 !! html+tidy
15912 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15913 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15914 !! end
15915
15916 !! test
15917 Media link to nonexistent file (bug 1702)
15918 !! wikitext
15919 [[Media:No such.jpg]]
15920 !! html
15921 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15922 </p>
15923 !! end
15924
15925 !! test
15926 Image link to nonexistent file (bug 1850 - good)
15927 !! wikitext
15928 [[File:No_such.jpg]]
15929 !! html/php
15930 <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>
15931 </p>
15932 !! html/parsoid
15933 <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>
15934 !! end
15935
15936 !! test
15937 :Image link to nonexistent file (bug 1850 - bad)
15938 !! wikitext
15939 [[:Image:No such.jpg]]
15940 !! html/php
15941 <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>
15942 </p>
15943 !! html/parsoid
15944 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15945 !! end
15946
15947
15948
15949 !! test
15950 Character reference normalization in link text (bug 1938)
15951 !! wikitext
15952 [[Main Page|this&that]]
15953 !! html
15954 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15955 </p>
15956 !!end
15957
15958 !! article
15959 אַ
15960 !! text
15961 Test for unicode normalization
15962
15963 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15964 !! endarticle
15965
15966 !! test
15967 (bug 19451) Links should refer to the normalized form.
15968 !! wikitext
15969 [[&#xFB2E;]]
15970 [[&#x5d0;&#x5b7;]]
15971 [[&#x5d0;ַ]]
15972 [[א&#x5b7;]]
15973 [[אַ]]
15974 !! html
15975 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15976 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15977 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15978 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15979 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15980 </p>
15981 !! end
15982
15983 !! test
15984 Empty attribute crash test (bug 2067)
15985 !! wikitext
15986 <font color="">foo</font>
15987 !! html
15988 <p><font color="">foo</font>
15989 </p>
15990 !! end
15991
15992 !! test
15993 Empty attribute crash test single-quotes (bug 2067)
15994 !! wikitext
15995 <font color=''>foo</font>
15996 !! html
15997 <p><font color="">foo</font>
15998 </p>
15999 !! end
16000
16001 !! test
16002 Attribute test: equals, then nothing
16003 !! options
16004 parsoid=wt2html,html2html
16005 !! wikitext
16006 <font color=>foo</font>
16007 !! html/php
16008 <p><font color="">foo</font>
16009 </p>
16010 !! html/parsoid
16011 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16012 !! end
16013
16014 !! test
16015 Attribute test: unquoted value
16016 !! options
16017 parsoid=wt2html,html2html
16018 !! wikitext
16019 <font color=x>foo</font>
16020 !! html/php
16021 <p><font color="x">foo</font>
16022 </p>
16023 !! html/parsoid
16024 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16025 !! end
16026
16027 !! test
16028 Attribute test: unquoted but illegal value (hash)
16029 !! wikitext
16030 <font color=#x>foo</font>
16031 !! html
16032 <p><font color="#x">foo</font>
16033 </p>
16034 !! end
16035
16036 # Parsoid does not serialize to empty attribute syntax,
16037 # so wt2wt and html2wt cases are skipped
16038 !! test
16039 Attribute test: no value (T54330)
16040 !! options
16041 parsoid=wt2html,html2html
16042 !! wikitext
16043 <font color>foo</font>
16044 !! html/php
16045 <p><font color="">foo</font>
16046 </p>
16047 !! html/parsoid
16048 <p><font color="">foo</font></p>
16049 !! end
16050
16051 !! test
16052 Bug 2095: link with three closing brackets
16053 !! wikitext
16054 [[Main Page]]]
16055 !! html/php
16056 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16057 </p>
16058 !! html/parsoid
16059 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16060 !! end
16061
16062 !! test
16063 Bug 2095: link with pipe and three closing brackets
16064 !! wikitext
16065 [[Main Page|link]]]
16066 !! html/php
16067 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16068 </p>
16069 !! html/parsoid
16070 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16071 !! end
16072
16073 !! test
16074 Bug 2095: link with pipe and three closing brackets, version 2
16075 !! wikitext
16076 [[Main Page|[http://example.com/]]]
16077 !! html/php
16078 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16079 </p>
16080 !! html/parsoid
16081 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16082 !! end
16083
16084
16085 ###
16086 ### Safety
16087 ###
16088
16089 !! article
16090 Template:Dangerous attribute
16091 !! text
16092 " onmouseover="alert(document.cookie)
16093 !! endarticle
16094
16095 !! article
16096 Template:Dangerous style attribute
16097 !! text
16098 border-size: expression(alert(document.cookie))
16099 !! endarticle
16100
16101 !! article
16102 Template:Div style
16103 !! text
16104 <div style="float: right; {{{1}}}">Magic div</div>
16105 !! endarticle
16106
16107 !! test
16108 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16109 !! wikitext
16110 <div title="{{test}}"></div>
16111 !! html
16112 <div title="This is a test template"></div>
16113
16114 !! end
16115
16116 # Parsoid has enough context to handle this case
16117 !! test
16118 Bug 2304: HTML attribute safety (dangerous template; 2309)
16119 !! wikitext
16120 <div title="{{dangerous attribute}}"></div>
16121 !! html/php
16122 <div title=""></div>
16123
16124 !! html/parsoid
16125 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16126 !! end
16127
16128 !! test
16129 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16130 !! wikitext
16131 <div style="{{dangerous style attribute}}"></div>
16132 !! html
16133 <div style="/* insecure input */"></div>
16134
16135 !! end
16136
16137 !! test
16138 Bug 2304: HTML attribute safety (safe parameter; 2309)
16139 !! wikitext
16140 {{div style|width: 200px}}
16141 !! html
16142 <div style="float: right; width: 200px">Magic div</div>
16143
16144 !! end
16145
16146 !! test
16147 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16148 !! wikitext
16149 {{div style|width: expression(alert(document.cookie))}}
16150 !! html
16151 <div style="/* insecure input */">Magic div</div>
16152
16153 !! end
16154
16155 !! test
16156 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16157 !! wikitext
16158 {{div style|"><script>alert(document.cookie)</script>}}
16159 !! html
16160 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16161
16162 !! end
16163
16164 !! test
16165 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16166 !! wikitext
16167 {{div style|" ><script>alert(document.cookie)</script>}}
16168 !! html
16169 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16170
16171 !! end
16172
16173 !! test
16174 Bug 2304: HTML attribute safety (link)
16175 !! wikitext
16176 <div title="[[Main Page]]"></div>
16177 !! html
16178 <div title="&#91;&#91;Main Page]]"></div>
16179
16180 !! end
16181
16182 !! test
16183 Bug 2304: HTML attribute safety (italics)
16184 !! wikitext
16185 <div title="''foobar''"></div>
16186 !! html
16187 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16188
16189 !! end
16190
16191 !! test
16192 Bug 2304: HTML attribute safety (bold)
16193 !! wikitext
16194 <div title="'''foobar'''"></div>
16195 !! html
16196 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16197
16198 !! end
16199
16200
16201 !! test
16202 Bug 2304: HTML attribute safety (ISBN)
16203 !! wikitext
16204 <div title="ISBN 1234567890"></div>
16205 !! html
16206 <div title="&#73;SBN 1234567890"></div>
16207
16208 !! end
16209
16210 !! test
16211 Bug 2304: HTML attribute safety (RFC)
16212 !! wikitext
16213 <div title="RFC 1234"></div>
16214 !! html
16215 <div title="&#82;FC 1234"></div>
16216
16217 !! end
16218
16219 !! test
16220 Bug 2304: HTML attribute safety (PMID)
16221 !! wikitext
16222 <div title="PMID 1234567890"></div>
16223 !! html
16224 <div title="&#80;MID 1234567890"></div>
16225
16226 !! end
16227
16228 !! test
16229 Bug 2304: HTML attribute safety (web link)
16230 !! wikitext
16231 <div title="http://example.com/"></div>
16232 !! html
16233 <div title="http&#58;//example.com/"></div>
16234
16235 !! end
16236
16237 !! test
16238 Bug 2304: HTML attribute safety (named web link)
16239 !! wikitext
16240 <div title="[http://example.com/ link]"></div>
16241 !! html
16242 <div title="&#91;http&#58;//example.com/ link]"></div>
16243
16244 !! end
16245
16246 !! test
16247 Bug 3244: HTML attribute safety (extension; safe)
16248 !! wikitext
16249 <div style="<nowiki>background:blue</nowiki>"></div>
16250 !! html
16251 <div style="background:blue"></div>
16252
16253 !! end
16254
16255 !! test
16256 Bug 3244: HTML attribute safety (extension; unsafe)
16257 !! wikitext
16258 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16259 !! html
16260 <div style="/* insecure input */"></div>
16261
16262 !! end
16263
16264 # More MSIE fun discovered by Tom Gilder
16265
16266 !! test
16267 MSIE CSS safety test: spurious slash
16268 !! wikitext
16269 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16270 !! html
16271 <div style="/* insecure input */">evil</div>
16272
16273 !! end
16274
16275 !! test
16276 MSIE CSS safety test: hex code
16277 !! wikitext
16278 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16279 !! html
16280 <div style="/* insecure input */">evil</div>
16281
16282 !! end
16283
16284 !! test
16285 MSIE CSS safety test: comment in url
16286 !! wikitext
16287 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16288 !! html
16289 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16290
16291 !! end
16292
16293 !! test
16294 MSIE CSS safety test: comment in expression
16295 !! wikitext
16296 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16297 !! html
16298 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16299
16300 !! end
16301
16302 !! test
16303 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16304 !! wikitext
16305 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16306 !! html
16307 <p style="/* invalid control char */">A</p>
16308
16309 !! end
16310
16311 !! test
16312 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16313 !! wikitext
16314 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16315 <div style="top:EXPRESSION(alert())">B</div>
16316 !! html
16317 <p style="/* insecure input */">A</p>
16318 <div style="/* insecure input */">B</div>
16319
16320 !! end
16321
16322 !! test
16323 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16324 !! wikitext
16325 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16326 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16327 !! html
16328 <div style="/* insecure input */">A</div>
16329 <p style="/* insecure input */">B</p>
16330
16331 !! end
16332
16333 !! test
16334 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16335 !! wikitext
16336 <div style="background-image:url⁽javascript:alert())">A</div>
16337 <div style="background-image:url₍javascript:alert())">B</div>
16338 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16339 !! html
16340 <div style="/* insecure input */">A</div>
16341 <div style="/* insecure input */">B</div>
16342 <p style="/* insecure input */">C</p>
16343
16344 !! end
16345
16346 # FIXME: Parsoid fails to sanitize this! See T58846.
16347 !! test
16348 Opera -o-link CSS
16349 !! wikitext
16350 <div
16351 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;"
16352 style="-o-link:attr(title);-o-link-source:current">X</div>
16353 !! html
16354 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16355
16356 !! end
16357
16358 !! test
16359 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16360 !! wikitext
16361 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16362 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16363 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16364 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16365 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16366 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16367 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16368 !! html
16369 <p style="/* insecure input */">A</p>
16370 <p style="/* insecure input */">B</p>
16371 <p style="/* insecure input */">C</p>
16372 <p style="/* insecure input */">D</p>
16373 <p style="/* insecure input */">E</p>
16374 <p style="/* insecure input */">F</p>
16375 <p style="/* insecure input */">G</p>
16376
16377 !! end
16378
16379 !! test
16380 Table attribute legitimate extension
16381 !! wikitext
16382 {|
16383 !+ style="<nowiki>color:blue</nowiki>"| status
16384 |}
16385 !! html
16386 <table>
16387 <tr>
16388 <th style="color:blue"> status
16389 </th></tr></table>
16390
16391 !!end
16392
16393 !! test
16394 Table attribute safety
16395 !! wikitext
16396 {|
16397 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16398 |}
16399 !! html
16400 <table>
16401 <tr>
16402 <th style="/* insecure input */"> status
16403 </th></tr></table>
16404
16405 !! end
16406
16407 !! test
16408 CSS line continuation 1
16409 !! wikitext
16410 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16411 !! html
16412 <div style="/* insecure input */"></div>
16413
16414 !! end
16415
16416 !! test
16417 CSS line continuation 2
16418 !! wikitext
16419 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16420 !! html
16421 <div style="/* invalid control char */"></div>
16422
16423 !! end
16424
16425 !! article
16426 Template:Identity
16427 !! text
16428 {{{1}}}
16429 !! endarticle
16430
16431 !! test
16432 Expansion of multi-line templates in attribute values (bug 6255)
16433 !! wikitext
16434 <div style="background: {{identity|#00FF00}}">-</div>
16435 !! html
16436 <div style="background: #00FF00">-</div>
16437
16438 !! end
16439
16440
16441 !! test
16442 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16443 !! wikitext
16444 <div style="background:
16445 #00FF00">-</div>
16446 !! html/php
16447 <div style="background: #00FF00">-</div>
16448
16449 !! html/parsoid
16450 <div style="background:
16451 #00FF00">-</div>
16452 !! end
16453
16454 !! test
16455 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16456 !! wikitext
16457 <div style="background: &#10;#00FF00">-</div>
16458 !! html
16459 <div style="background: &#10;#00FF00">-</div>
16460
16461 !! end
16462
16463 !! test
16464 evil <math>-wiki-tags without Extension:Math enabled
16465 !! wikitext
16466 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16467 !! html+tidy
16468 <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>
16469 !! end
16470
16471 ###
16472 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16473 ###
16474 !! test
16475 Parser hook: empty input
16476 !! wikitext
16477 <tag></tag>
16478 !! html/php
16479 <pre>
16480 ''
16481 array (
16482 )
16483 </pre>
16484
16485 !! html/parsoid
16486 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16487 !! end
16488
16489 ## Don't expect parsoid to rt this form.
16490 !! test
16491 Parser hook: empty input using terminated empty elements
16492 !! options
16493 parsoid=wt2html,html2html
16494 !! wikitext
16495 <tag/>
16496 !! html/php
16497 <pre>
16498 NULL
16499 array (
16500 )
16501 </pre>
16502
16503 !! html/parsoid
16504 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16505 !! end
16506
16507 !! test
16508 Parser hook: empty input using terminated empty elements (space before)
16509 !! wikitext
16510 <tag />
16511 !! html/php
16512 <pre>
16513 NULL
16514 array (
16515 )
16516 </pre>
16517
16518 !! html/parsoid
16519 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16520 !! end
16521
16522 !! test
16523 Parser hook: basic input
16524 !! wikitext
16525 <tag>input</tag>
16526 !! html/php
16527 <pre>
16528 'input'
16529 array (
16530 )
16531 </pre>
16532
16533 !! html/parsoid
16534 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16535 !! end
16536
16537 ## Don't expect parsoid to rt this form.
16538 !! test
16539 Parser hook: case insensitive
16540 !! options
16541 parsoid=wt2html,html2html
16542 !! wikitext
16543 <TAG>input</TAG>
16544 !! html/php
16545 <pre>
16546 'input'
16547 array (
16548 )
16549 </pre>
16550
16551 !! html/parsoid
16552 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16553 !! end
16554
16555 ## Don't expect parsoid to rt this form.
16556 !! test
16557 Parser hook: case insensitive, redux
16558 !! options
16559 parsoid=wt2html,html2html
16560 !! wikitext
16561 <TaG>input</TAg>
16562 !! html/php
16563 <pre>
16564 'input'
16565 array (
16566 )
16567 </pre>
16568
16569 !! html/parsoid
16570 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16571 !! end
16572
16573 !! test
16574 Parser hook: nested tags
16575 !! wikitext
16576 <tag><tag></tag></tag>
16577 !! html/php
16578 <pre>
16579 '<tag>'
16580 array (
16581 )
16582 </pre>&lt;/tag&gt;
16583
16584 !! html/parsoid
16585 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16586 !! end
16587
16588 !! test
16589 Parser hook: basic arguments
16590 !! wikitext
16591 <tag width="200" height="100" depth="50" square=""></tag>
16592 !! html/php
16593 <pre>
16594 ''
16595 array (
16596 'width' => '200',
16597 'height' => '100',
16598 'depth' => '50',
16599 'square' => '',
16600 )
16601 </pre>
16602
16603 !! html/parsoid
16604 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16605 !! end
16606
16607 ## Don't expect parsoid to rt this form.
16608 !! test
16609 Parser hook: basic arguments, variations
16610 !! options
16611 parsoid=wt2html,html2html
16612 !! wikitext
16613 <tag width=200 height = "100" depth = '50' square></tag>
16614 !! html/php
16615 <pre>
16616 ''
16617 array (
16618 'width' => '200',
16619 'height' => '100',
16620 'depth' => '50',
16621 'square' => '',
16622 )
16623 </pre>
16624
16625 !! html/parsoid
16626 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16627 !! end
16628
16629 !! test
16630 Parser hook: argument containing a forward slash (bug 5344)
16631 !! wikitext
16632 <tag filename="/tmp/bla"></tag>
16633 !! html/php
16634 <pre>
16635 ''
16636 array (
16637 'filename' => '/tmp/bla',
16638 )
16639 </pre>
16640
16641 !! html/parsoid
16642 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16643 !! end
16644
16645 ## Don't expect parsoid to rt this form.
16646 !! test
16647 Parser hook: empty input using terminated empty elements (bug 2374)
16648 !! options
16649 parsoid=wt2html,html2html
16650 !! wikitext
16651 <tag foo=bar/>text
16652 !! html/php
16653 <pre>
16654 NULL
16655 array (
16656 'foo' => 'bar',
16657 )
16658 </pre>text
16659
16660 !! html/parsoid
16661 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16662 !! end
16663
16664 ## </tag> should be output literally since there is no matching tag that begins it
16665 ## Don't expect parsoid to rt this form.
16666 !! test
16667 Parser hook: basic arguments using terminated empty elements (bug 2374)
16668 !! options
16669 parsoid=wt2html
16670 !! wikitext
16671 <tag width=200 height = "100" depth = '50' square/>
16672 other stuff
16673 </tag>
16674 !! html/php
16675 <pre>
16676 NULL
16677 array (
16678 'width' => '200',
16679 'height' => '100',
16680 'depth' => '50',
16681 'square' => '',
16682 )
16683 </pre>
16684 <p>other stuff
16685 &lt;/tag&gt;
16686 </p>
16687 !! html/parsoid
16688 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
16689 &lt;/tag></p>
16690 !! end
16691
16692 ## Don't expect parsoid to rt this form.
16693 !! test
16694 Parser hook: Don't allow unclosed extension tags
16695 !! options
16696 parsoid=wt2html
16697 !! wikitext
16698 test <tag>123
16699
16700 this is a '''test'''
16701 !! html/php
16702 <p>test &lt;tag&gt;123
16703 </p><p>this is a <b>test</b>
16704 </p>
16705 !! html/parsoid
16706 <p>test &lt;tag>123</p>
16707
16708 <p>this is a <b>test</b></p>
16709 !! end
16710
16711 ###
16712 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16713 ###
16714
16715 !! test
16716 Parser hook: static parser hook not inside a comment
16717 !! wikitext
16718 <statictag>hello, world</statictag>
16719
16720 <statictag action="flush" />
16721 !! html/php
16722 <p><br />
16723 hello, world
16724 </p>
16725 !! html/parsoid
16726 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16727 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16728 !! end
16729
16730 !! test
16731 Parser hook: static parser hook inside a comment
16732 !! wikitext
16733 <!-- <statictag>hello, world</statictag> -->
16734 <statictag action="flush" />
16735 !! html/php
16736 <p><br />
16737 </p>
16738 !! html/parsoid
16739 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16740 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16741 !! end
16742
16743 # Nested template calls; this case was broken by Parser.php rev 1.506,
16744 # since reverted.
16745
16746 !! article
16747 Template:One-parameter
16748 !! text
16749 (My parameter is: {{{1}}})
16750 !! endarticle
16751
16752 !! article
16753 Template:Map-one-parameter
16754 !! text
16755 {{{{{1}}}|{{{2}}}}}
16756 !! endarticle
16757
16758 !! test
16759 Nested template calls
16760 !! wikitext
16761 {{Map-one-parameter|One-parameter|param}}
16762 !! html
16763 <p>(My parameter is: param)
16764 </p>
16765 !! end
16766
16767
16768 ###
16769 ### Sanitizer
16770 ###
16771
16772 # HTML+Tidy effectively strips out the empty tags completely
16773 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16774 # which Tidy would have done for the PHP parser had there been content inside it.
16775 !! test
16776 Sanitizer: Closing of open tags
16777 !! wikitext
16778 <s></s><table></table>
16779 !! html
16780 <s></s><table></table>
16781
16782 !! html/parsoid
16783 <p><s></s></p><table></table>
16784 !! end
16785
16786 !! test
16787 Sanitizer: Closing of open but not closed tags
16788 !! wikitext
16789 <s>foo
16790 !! html
16791 <p><s>foo</s>
16792 </p>
16793 !! end
16794
16795 !! test
16796 Sanitizer: Closing of closed but not open tags
16797 !! options
16798 parsoid=wt2html
16799 !! wikitext
16800 </s>
16801 !! html/php+tidy
16802 !! html/parsoid
16803 !! end
16804
16805 !! test
16806 Sanitizer: Closing of closed but not open table tags
16807 !! options
16808 parsoid=wt2html
16809 !! wikitext
16810 Table not started</td></tr></table>
16811 !! html/php+tidy
16812 <p>Table not started</p>
16813 !! html/parsoid
16814 <p>Table not started</p>
16815 !! end
16816
16817 !! test
16818 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16819 !! wikitext
16820 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16821 !! html
16822 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16823 </p>
16824 !! end
16825
16826 # In HTML5, the restrictions are that id must contain at least one character,
16827 # and must not contain any space characters.
16828 !! test
16829 Sanitizer: Validating the contents of the id attribute (bug 4515)
16830 !! options
16831 disabled
16832 !! wikitext
16833 <br id="" /><br id="a space" />
16834 !! html
16835 Something ...
16836 !! end
16837
16838 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16839 !! test
16840 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16841 !! options
16842 disabled
16843 !! wikitext
16844 <br id="foo" /><br id="foo" />
16845 !! html
16846 Something need to be done. foo-2 ?
16847 !! end
16848
16849 !! test
16850 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16851 !! wikitext
16852 <div itemscope>
16853 <meta itemprop="hello" content="world">
16854 <meta http-equiv="refresh" content="5">
16855 <meta itemprop="hello" http-equiv="refresh" content="5">
16856 <link itemprop="hello" href="{{SERVER}}">
16857 <link rel="stylesheet" href="{{SERVER}}">
16858 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16859 </div>
16860 !! html
16861 <div itemscope="">
16862 <p> <meta itemprop="hello" content="world" />
16863 &lt;meta http-equiv="refresh" content="5"&gt;
16864 <meta itemprop="hello" content="5" />
16865 </p>
16866 <link itemprop="hello" href="http&#58;//example.org" />
16867 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16868 <link itemprop="hello" href="http&#58;//example.org" />
16869 </div>
16870
16871 !! end
16872
16873 !! test
16874 Language converter: output gets cut off unexpectedly (bug 5757)
16875 !! options
16876 language=zh
16877 !! wikitext
16878 this bit is safe: }-
16879
16880 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16881
16882 then we get cut off here: }-
16883
16884 all additional text is vanished
16885 !! html
16886 <p>this bit is safe: }-
16887 </p><p>but if we add a conversion instance: xxx
16888 </p><p>then we get cut off here: }-
16889 </p><p>all additional text is vanished
16890 </p>
16891 !! end
16892
16893 !! test
16894 Self closed html pairs (bug 5487)
16895 !! options
16896 !! wikitext
16897 <center><font id="bug" />Centered text</center>
16898 <div><font id="bug2" />In div text</div>
16899 !! html
16900 <center>&lt;font id="bug" /&gt;Centered text</center>
16901 <div>&lt;font id="bug2" /&gt;In div text</div>
16902
16903 !! end
16904
16905 #
16906 #
16907 #
16908
16909 !! test
16910 Punctuation: nbsp before exclamation
16911 !! wikitext
16912 C'est grave !
16913 !! html
16914 <p>C'est grave&#160;!
16915 </p>
16916 !! end
16917
16918 !! test
16919 Punctuation: CSS !important (bug 11874)
16920 !! wikitext
16921 <div style="width:50% !important">important</div>
16922 !! html
16923 <div style="width:50% !important">important</div>
16924
16925 !!end
16926
16927 !! test
16928 Punctuation: CSS ! important (bug 11874; with space after)
16929 !! wikitext
16930 <div style="width:50% ! important">important</div>
16931 !! html
16932 <div style="width:50% ! important">important</div>
16933
16934 !!end
16935
16936 !! test
16937 HTML bullet list, closed tags (bug 5497)
16938 !! wikitext
16939 <ul>
16940 <li>One</li>
16941 <li>Two</li>
16942 </ul>
16943 !! html/php
16944 <ul>
16945 <li>One</li>
16946 <li>Two</li>
16947 </ul>
16948
16949 !! html/parsoid
16950 <ul data-parsoid='{"stx":"html"}'>
16951 <li data-parsoid='{"stx":"html"}'>One</li>
16952 <li data-parsoid='{"stx":"html"}'>Two</li>
16953 </ul>
16954
16955 !! end
16956
16957 !! test
16958 HTML bullet list, unclosed tags (bug 5497)
16959 !! wikitext
16960 <ul>
16961 <li>One
16962 <li>Two
16963 </ul>
16964 !! html/php+tidy
16965 <ul>
16966 <li>One</li>
16967 <li>Two</li>
16968 </ul>
16969 !! html/parsoid
16970 <ul data-parsoid='{"stx":"html"}'>
16971 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16972 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16973 </ul>
16974
16975 !! end
16976
16977 !! test
16978 HTML ordered list, closed tags (bug 5497)
16979 !! wikitext
16980 <ol>
16981 <li>One</li>
16982 <li>Two</li>
16983 </ol>
16984 !! html/php
16985 <ol>
16986 <li>One</li>
16987 <li>Two</li>
16988 </ol>
16989
16990 !! html/parsoid
16991 <ol data-parsoid='{"stx":"html"}'>
16992 <li data-parsoid='{"stx":"html"}'>One</li>
16993 <li data-parsoid='{"stx":"html"}'>Two</li>
16994 </ol>
16995
16996 !! end
16997
16998 !! test
16999 HTML ordered list, unclosed tags (bug 5497)
17000 !! options
17001 !! wikitext
17002 <ol>
17003 <li>One
17004 <li>Two
17005 </ol>
17006 !! html/php+tidy
17007 <ol>
17008 <li>One</li>
17009 <li>Two</li>
17010 </ol>
17011 !! html/parsoid
17012 <ol data-parsoid='{"stx":"html"}'>
17013 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17014 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17015 </ol>
17016
17017 !! end
17018
17019 !! test
17020 HTML nested bullet list, closed tags (bug 5497)
17021 !! wikitext
17022 <ul>
17023 <li>One</li>
17024 <li>Two:
17025 <ul>
17026 <li>Sub-one</li>
17027 <li>Sub-two</li>
17028 </ul>
17029 </li>
17030 </ul>
17031 !! html/php
17032 <ul>
17033 <li>One</li>
17034 <li>Two:
17035 <ul>
17036 <li>Sub-one</li>
17037 <li>Sub-two</li>
17038 </ul>
17039 </li>
17040 </ul>
17041
17042 !! html/parsoid
17043 <ul data-parsoid='{"stx":"html"}'>
17044 <li data-parsoid='{"stx":"html"}'>One</li>
17045 <li data-parsoid='{"stx":"html"}'>Two:
17046 <ul data-parsoid='{"stx":"html"}'>
17047 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17048 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17049 </ul>
17050 </li>
17051 </ul>
17052 !! end
17053
17054 !! test
17055 HTML nested bullet list, open tags (bug 5497)
17056 !! wikitext
17057 <ul>
17058 <li>One
17059 <li>Two:
17060 <ul>
17061 <li>Sub-one
17062 <li>Sub-two
17063 </ul>
17064 </ul>
17065 !! html/php+tidy
17066 <ul>
17067 <li>One</li>
17068 <li>Two:
17069 <ul>
17070 <li>Sub-one</li>
17071 <li>Sub-two</li>
17072 </ul>
17073 </li>
17074 </ul>
17075 !! html/parsoid
17076 <ul>
17077 <li>One
17078 </li>
17079 <li>Two:
17080 <ul>
17081 <li>Sub-one
17082 </li>
17083 <li>Sub-two
17084 </li>
17085 </ul>
17086 </li>
17087 </ul>
17088
17089 !! end
17090
17091 !! test
17092 HTML nested ordered list, closed tags (bug 5497)
17093 !! wikitext
17094 <ol>
17095 <li>One</li>
17096 <li>Two:
17097 <ol>
17098 <li>Sub-one</li>
17099 <li>Sub-two</li>
17100 </ol>
17101 </li>
17102 </ol>
17103 !! html
17104 <ol>
17105 <li>One</li>
17106 <li>Two:
17107 <ol>
17108 <li>Sub-one</li>
17109 <li>Sub-two</li>
17110 </ol>
17111 </li>
17112 </ol>
17113
17114 !! end
17115
17116 !! test
17117 HTML nested ordered list, open tags (bug 5497)
17118 !! wikitext
17119 <ol>
17120 <li>One
17121 <li>Two:
17122 <ol>
17123 <li>Sub-one
17124 <li>Sub-two
17125 </ol>
17126 </ol>
17127 !! html/php
17128 <ol>
17129 <li>One
17130 <li>Two:
17131 <ol>
17132 <li>Sub-one
17133 <li>Sub-two
17134 </ol>
17135 </ol>
17136
17137 !! html/parsoid
17138 <ol>
17139 <li>One
17140 </li>
17141 <li>Two:
17142 <ol>
17143 <li>Sub-one
17144 </li>
17145 <li>Sub-two
17146 </li>
17147 </ol>
17148 </li>
17149 </ol>
17150
17151 !! end
17152
17153 !! test
17154 HTML ordered list item with parameters oddity
17155 !! wikitext
17156 <ol><li id="fragment">One</li>
17157 </ol>
17158 !! html
17159 <ol><li id="fragment">One</li>
17160 </ol>
17161
17162 !! end
17163
17164 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17165 !!test
17166 bug 5918: autonumbering
17167 !! wikitext
17168 [http://first/] [http://second] [ftp://ftp]
17169
17170 ftp://inlineftp
17171
17172 [mailto:enclosed@mail.tld With target]
17173
17174 [mailto:enclosed@mail.tld]
17175
17176 mailto:inline@mail.tld
17177 !! html/php
17178 <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>
17179 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17180 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17181 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17182 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17183 </p>
17184 !! html/parsoid
17185 <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>
17186 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17187 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17188 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17189 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17190 !! end
17191
17192
17193 #
17194 # Security and HTML correctness
17195 # From Nick Jenkins' fuzz testing
17196 #
17197
17198 !! test
17199 Fuzz testing: Parser13
17200 !! wikitext
17201 {|
17202 | http://a|
17203 !! html
17204 <table>
17205 <tr>
17206 <td>
17207 </td>
17208 </tr>
17209 </table>
17210
17211 !! end
17212
17213 !! test
17214 Fuzz testing: Parser14
17215 !! wikitext
17216 == onmouseover= ==
17217 http://__TOC__
17218 !! html
17219 <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>
17220 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17221 <ul>
17222 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17223 </ul>
17224 </div>
17225
17226
17227 !! html+tidy
17228 <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>
17229 <p>http://</p>
17230 <div id="toc" class="toc">
17231 <div id="toctitle">
17232 <h2>Contents</h2>
17233 </div>
17234 <ul>
17235 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17236 </ul>
17237 </div>
17238 <p></p>
17239 !! end
17240
17241 !! test
17242 Fuzz testing: Parser14-table
17243 !! options
17244 parsoid=wt2html,html2html
17245 !! wikitext
17246 ==a==
17247 {| STYLE=__TOC__
17248 !! html
17249 <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>
17250 <table style="&#95;_TOC&#95;_">
17251 <tr><td></td></tr>
17252 </table>
17253
17254 !! html+tidy
17255 <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>
17256 <table style="__TOC__">
17257 <tr>
17258 <td></td>
17259 </tr>
17260 </table>
17261 !! html/parsoid
17262 <h2>a</h2>
17263 <table style="__TOC__"></table>
17264 !! end
17265
17266 # Known to produce bogus xml (extra </td>)
17267 !! test
17268 Fuzz testing: Parser16
17269 !! wikitext
17270 {|
17271 !https://||||||
17272 !! html
17273 <table>
17274 <tr>
17275 <th>https://</th>
17276 <th></th>
17277 <th></th>
17278 <th>
17279 </td>
17280 </tr>
17281 </table>
17282
17283 !! html+tidy
17284 <table>
17285 <tr>
17286 <th>https://</th>
17287 <th></th>
17288 <th></th>
17289 <th></th>
17290 </tr>
17291 </table>
17292 !! end
17293
17294 !! test
17295 Fuzz testing: Parser21
17296 !! wikitext
17297 {|
17298 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17299 |
17300 !! html
17301 <table>
17302 <tr>
17303 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17304 </th>
17305 <td>
17306 </td>
17307 </tr>
17308 </table>
17309
17310 !! end
17311
17312 !! test
17313 Fuzz testing: Parser22
17314 !! wikitext
17315 http://===r:::https://b
17316
17317 {|
17318 !! html
17319 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17320 </p>
17321 <table>
17322 <tr><td></td></tr>
17323 </table>
17324
17325 !! end
17326
17327 # Known to produce bad XML for now
17328 !! test
17329 Fuzz testing: Parser24
17330 !! wikitext
17331 {|
17332 {{{|
17333 <u CLASS=
17334 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17335 <br style="onmouseover='alert(document.cookie);' " />
17336
17337 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17338 |
17339 !! html
17340 <table>
17341 {{{|
17342 <u class="&#124;">}}}} &gt;
17343 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17344
17345 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17346 <tr>
17347 <td></u>
17348 </td>
17349 </tr>
17350 </table>
17351
17352 !! end
17353
17354 # Note: the current result listed for this is not what the original one was,
17355 # but the original bug was JavaScript injection, which is fixed in any case.
17356 # It's not clear that the original result listed was any more correct than the
17357 # current one. Original result:
17358 # <p>{{{|
17359 # </p>
17360 # <li class="&#124;&#124;">
17361 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17362 !!test
17363 Fuzz testing: Parser25 (bug 6055)
17364 !! wikitext
17365 {{{
17366 |
17367 <LI CLASS=||
17368 >
17369 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17370 !! html
17371 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17372 </p>
17373 !! end
17374
17375 !!test
17376 Fuzz testing: URL adjacent extension (with space, clean)
17377 !! wikitext
17378 http://example.com <nowiki>junk</nowiki>
17379 !! html/php
17380 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17381 </p>
17382 !! html/parsoid
17383 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17384 !! end
17385
17386 !!test
17387 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17388 !! wikitext
17389 http://example.com<nowiki>junk</nowiki>
17390 !! html/php
17391 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17392 </p>
17393 !! html/parsoid
17394 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17395 !! end
17396
17397 !!test
17398 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17399 !! wikitext
17400 http://example.com<pre>junk</pre>
17401 !! html/php
17402 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17403
17404 !! html/php+tidy
17405 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17406 <pre>
17407 junk
17408 </pre>
17409 !! html/parsoid
17410 <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>
17411 !!end
17412
17413 !!test
17414 Fuzz testing: image with bogus manual thumbnail
17415 !! wikitext
17416 [[Image:foobar.jpg|thumbnail= ]]
17417 !! html/php
17418 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17419
17420 !! html/parsoid
17421 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17422 !!end
17423
17424 !! test
17425 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17426 !! wikitext
17427 <pre dir="&#10;"></pre>
17428 !! html
17429 <pre dir="&#10;"></pre>
17430
17431 !! end
17432
17433 !! test
17434 Parsing optional HTML elements (Bug 6171)
17435 !! options
17436 !! wikitext
17437 <table>
17438 <tr>
17439 <td> Some tabular data</td>
17440 <td> More tabular data ...
17441 <td> And yet som tabular data</td>
17442 </tr>
17443 </table>
17444 !! html
17445 <table>
17446 <tr>
17447 <td> Some tabular data</td>
17448 <td> More tabular data ...
17449 </td><td> And yet som tabular data</td>
17450 </tr>
17451 </table>
17452
17453 !! end
17454
17455 !! test
17456 Correct handling of <td>, <tr> (Bug 6171)
17457 !! options
17458 !! wikitext
17459 <table>
17460 <tr>
17461 <td> Some tabular data</td>
17462 <td> More tabular data ...</td>
17463 <td> And yet som tabular data</td>
17464 </tr>
17465 </table>
17466 !! html
17467 <table>
17468 <tr>
17469 <td> Some tabular data</td>
17470 <td> More tabular data ...</td>
17471 <td> And yet som tabular data</td>
17472 </tr>
17473 </table>
17474
17475 !! end
17476
17477
17478 !! test
17479 Parsing crashing regression (fr:JavaScript)
17480 !! wikitext
17481 </body></x>
17482 !! html
17483 <p>&lt;/body&gt;&lt;/x&gt;
17484 </p>
17485 !! end
17486
17487 !! test
17488 Inline wiki vs wiki block nesting
17489 !! wikitext
17490 '''Bold paragraph
17491
17492 New wiki paragraph
17493 !! html
17494 <p><b>Bold paragraph</b>
17495 </p><p>New wiki paragraph
17496 </p>
17497 !! end
17498
17499 # FIXME: The current php output is documented
17500 # and desired output is the parsoid target.
17501 !! test
17502 Inline HTML vs wiki block nesting
17503 !! wikitext
17504 <b>Bold paragraph
17505
17506 New wiki paragraph
17507 !! html/php
17508 <p><b>Bold paragraph
17509 </p><p>New wiki paragraph</b>
17510 </p>
17511 !! html/parsoid
17512 <p><b>Bold paragraph</b>
17513 </p><p>New wiki paragraph
17514 </p>
17515 !! end
17516
17517 # Original result was this:
17518 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17519 # </p>
17520 # While that might be marginally more intuitive, maybe, the six-apostrophe
17521 # construct is clearly pathological and the result stated here (which is what
17522 # the parser actually does) is about as reasonable as anything.
17523 !!test
17524 Mixing markup for italics and bold
17525 !! options
17526 !! wikitext
17527 '''bold''''''bold''bolditalics'''''
17528 !! html
17529 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17530 </p>
17531 !! end
17532
17533
17534 !! article
17535 Xyzzyx
17536 !! text
17537 Article for special page transclusion test
17538 !! endarticle
17539
17540 !! test
17541 Special page transclusion
17542 !! options
17543 !! wikitext
17544 {{Special:Prefixindex/Xyzzyx}}
17545 !! html
17546 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17547 </ul>
17548
17549 !! end
17550
17551 !! test
17552 Special page transclusion twice (bug 5021)
17553 !! options
17554 !! wikitext
17555 {{Special:Prefixindex/Xyzzyx}}
17556 {{Special:Prefixindex/Xyzzyx}}
17557 !! html
17558 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17559 </ul>
17560 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17561 </ul>
17562
17563 !! end
17564
17565 !! test
17566 Transclusion of default MediaWiki message
17567 !! wikitext
17568 {{MediaWiki:Mainpage}}
17569 !! html
17570 <p>Main Page
17571 </p>
17572 !! end
17573
17574 !! test
17575 Transclusion of nonexistent MediaWiki message
17576 !! wikitext
17577 {{MediaWiki:Mainpagexxx}}
17578 !! html
17579 <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>
17580 </p>
17581 !! end
17582
17583 !! test
17584 Transclusion of MediaWiki message with underscore
17585 !! wikitext
17586 {{MediaWiki:history_short}}
17587 !! html
17588 <p>History
17589 </p>
17590 !! end
17591
17592 !! test
17593 Transclusion of MediaWiki message with space
17594 !! wikitext
17595 {{MediaWiki:history short}}
17596 !! html
17597 <p>History
17598 </p>
17599 !! end
17600
17601 !! test
17602 Invalid header with following text
17603 !! wikitext
17604 = x = y
17605 !! html
17606 <p>= x = y
17607 </p>
17608 !! end
17609
17610
17611 !! test
17612 Section extraction test (section 0)
17613 !! options
17614 section=0
17615 !! wikitext
17616 start
17617 ==a==
17618 ===aa===
17619 ====aaa====
17620 ==b==
17621 ===ba===
17622 ===bb===
17623 ====bba====
17624 ===bc===
17625 ==c==
17626 ===ca===
17627 !! html/php
17628 start
17629 !! end
17630
17631 !! test
17632 Section extraction test (section 1)
17633 !! options
17634 section=1
17635 !! wikitext
17636 start
17637 ==a==
17638 ===aa===
17639 ====aaa====
17640 ==b==
17641 ===ba===
17642 ===bb===
17643 ====bba====
17644 ===bc===
17645 ==c==
17646 ===ca===
17647 !! html/php
17648 ==a==
17649 ===aa===
17650 ====aaa====
17651 !! end
17652
17653 !! test
17654 Section extraction test (section 2)
17655 !! options
17656 section=2
17657 !! wikitext
17658 start
17659 ==a==
17660 ===aa===
17661 ====aaa====
17662 ==b==
17663 ===ba===
17664 ===bb===
17665 ====bba====
17666 ===bc===
17667 ==c==
17668 ===ca===
17669 !! html/php
17670 ===aa===
17671 ====aaa====
17672 !! end
17673
17674 !! test
17675 Section extraction test (section 3)
17676 !! options
17677 section=3
17678 !! wikitext
17679 start
17680 ==a==
17681 ===aa===
17682 ====aaa====
17683 ==b==
17684 ===ba===
17685 ===bb===
17686 ====bba====
17687 ===bc===
17688 ==c==
17689 ===ca===
17690 !! html/php
17691 ====aaa====
17692 !! end
17693
17694 !! test
17695 Section extraction test (section 4)
17696 !! options
17697 section=4
17698 !! wikitext
17699 start
17700 ==a==
17701 ===aa===
17702 ====aaa====
17703 ==b==
17704 ===ba===
17705 ===bb===
17706 ====bba====
17707 ===bc===
17708 ==c==
17709 ===ca===
17710 !! html/php
17711 ==b==
17712 ===ba===
17713 ===bb===
17714 ====bba====
17715 ===bc===
17716 !! end
17717
17718 !! test
17719 Section extraction test (section 5)
17720 !! options
17721 section=5
17722 !! wikitext
17723 start
17724 ==a==
17725 ===aa===
17726 ====aaa====
17727 ==b==
17728 ===ba===
17729 ===bb===
17730 ====bba====
17731 ===bc===
17732 ==c==
17733 ===ca===
17734 !! html/php
17735 ===ba===
17736 !! end
17737
17738 !! test
17739 Section extraction test (section 6)
17740 !! options
17741 section=6
17742 !! wikitext
17743 start
17744 ==a==
17745 ===aa===
17746 ====aaa====
17747 ==b==
17748 ===ba===
17749 ===bb===
17750 ====bba====
17751 ===bc===
17752 ==c==
17753 ===ca===
17754 !! html/php
17755 ===bb===
17756 ====bba====
17757 !! end
17758
17759 !! test
17760 Section extraction test (section 7)
17761 !! options
17762 section=7
17763 !! wikitext
17764 start
17765 ==a==
17766 ===aa===
17767 ====aaa====
17768 ==b==
17769 ===ba===
17770 ===bb===
17771 ====bba====
17772 ===bc===
17773 ==c==
17774 ===ca===
17775 !! html/php
17776 ====bba====
17777 !! end
17778
17779 !! test
17780 Section extraction test (section 8)
17781 !! options
17782 section=8
17783 !! wikitext
17784 start
17785 ==a==
17786 ===aa===
17787 ====aaa====
17788 ==b==
17789 ===ba===
17790 ===bb===
17791 ====bba====
17792 ===bc===
17793 ==c==
17794 ===ca===
17795 !! html/php
17796 ===bc===
17797 !! end
17798
17799 !! test
17800 Section extraction test (section 9)
17801 !! options
17802 section=9
17803 !! wikitext
17804 start
17805 ==a==
17806 ===aa===
17807 ====aaa====
17808 ==b==
17809 ===ba===
17810 ===bb===
17811 ====bba====
17812 ===bc===
17813 ==c==
17814 ===ca===
17815 !! html/php
17816 ==c==
17817 ===ca===
17818 !! end
17819
17820 !! test
17821 Section extraction test (section 10)
17822 !! options
17823 section=10
17824 !! wikitext
17825 start
17826 ==a==
17827 ===aa===
17828 ====aaa====
17829 ==b==
17830 ===ba===
17831 ===bb===
17832 ====bba====
17833 ===bc===
17834 ==c==
17835 ===ca===
17836 !! html/php
17837 ===ca===
17838 !! end
17839
17840 !! test
17841 Section extraction test (nonexistent section 11)
17842 !! options
17843 section=11
17844 !! wikitext
17845 start
17846 ==a==
17847 ===aa===
17848 ====aaa====
17849 ==b==
17850 ===ba===
17851 ===bb===
17852 ====bba====
17853 ===bc===
17854 ==c==
17855 ===ca===
17856 !! html/php
17857 !! end
17858
17859 !! test
17860 Section extraction test with bogus heading (section 1)
17861 !! options
17862 section=1
17863 !! wikitext
17864 ==a==
17865 ==bogus== not a legal section
17866 ==b==
17867 !! html/php
17868 ==a==
17869 ==bogus== not a legal section
17870 !! end
17871
17872 !! test
17873 Section extraction test with bogus heading (section 2)
17874 !! options
17875 section=2
17876 !! wikitext
17877 ==a==
17878 ==bogus== not a legal section
17879 ==b==
17880 !! html/php
17881 ==b==
17882 !! end
17883
17884 !! test
17885 Section extraction test with comment after heading (section 1)
17886 !! options
17887 section=1
17888 !! wikitext
17889 ==a==
17890 ==b== <!-- -->
17891 ==c==
17892 !! html/php
17893 ==a==
17894 !! end
17895
17896 !! test
17897 Section extraction test with comment after heading (section 2)
17898 !! options
17899 section=2
17900 !! wikitext
17901 ==a==
17902 ==b== <!-- -->
17903 ==c==
17904 !! html/php
17905 ==b== <!-- -->
17906 !! end
17907
17908 !! test
17909 Section extraction test with bogus <nowiki> heading (section 1)
17910 !! options
17911 section=1
17912 !! wikitext
17913 ==a==
17914 ==bogus== <nowiki>not a legal section</nowiki>
17915 ==b==
17916 !! html/php
17917 ==a==
17918 ==bogus== <nowiki>not a legal section</nowiki>
17919 !! end
17920
17921 !! test
17922 Section extraction test with bogus <nowiki> heading (section 2)
17923 !! options
17924 section=2
17925 !! wikitext
17926 ==a==
17927 ==bogus== <nowiki>not a legal section</nowiki>
17928 ==b==
17929 !! html/php
17930 ==b==
17931 !! end
17932
17933 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17934 # instead of respecting commented sections
17935 !! test
17936 Section extraction prefixed by comment (section 1)
17937 !! options
17938 section=1
17939 !! wikitext
17940 <!-- -->==sec1==
17941 ==sec2==
17942 !! html/php
17943 ==sec2==
17944 !!end
17945
17946 !! test
17947 Section extraction prefixed by comment (section 2)
17948 !! options
17949 section=2
17950 !! wikitext
17951 <!-- -->==sec1==
17952 ==sec2==
17953 !! html/php
17954
17955 !!end
17956
17957 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17958 # instead of respecting HTML-style headings
17959 !! test
17960 Section extraction, mixed wiki and html (section 1)
17961 !! options
17962 section=1
17963 !! wikitext
17964 <h2>unmarked</h2>
17965 unmarked
17966 ==1==
17967 one
17968 ==2==
17969 two
17970 !! html/php
17971 ==1==
17972 one
17973 !! end
17974
17975 !! test
17976 Section extraction, mixed wiki and html (section 2)
17977 !! options
17978 section=2
17979 !! wikitext
17980 <h2>unmarked</h2>
17981 unmarked
17982 ==1==
17983 one
17984 ==2==
17985 two
17986 !! html/php
17987 ==2==
17988 two
17989 !! end
17990
17991
17992 # Formerly testing for bug 3342
17993 !! test
17994 Section extraction, heading surrounded by <noinclude>
17995 !! options
17996 section=1
17997 !! wikitext
17998 <noinclude>==unmarked==</noinclude>
17999 ==marked==
18000 !! html/php
18001 ==marked==
18002 !!end
18003
18004 # Test behavior of bug 19910
18005 !! test
18006 Sectiion with all-equals
18007 !! options
18008 section=2
18009 !! wikitext
18010 ===
18011 The line above must have a trailing space
18012 === <!--
18013 --> <!-- -->
18014 But just in case it doesn't...
18015 !! html/php
18016 === <!--
18017 --> <!-- -->
18018 But just in case it doesn't...
18019 !! end
18020
18021 !! test
18022 Section replacement test (section 0)
18023 !! options
18024 replace=0,"xxx"
18025 !! wikitext
18026 start
18027 ==a==
18028 ===aa===
18029 ====aaa====
18030 ==b==
18031 ===ba===
18032 ===bb===
18033 ====bba====
18034 ===bc===
18035 ==c==
18036 ===ca===
18037 !! html/php
18038 xxx
18039
18040 ==a==
18041 ===aa===
18042 ====aaa====
18043 ==b==
18044 ===ba===
18045 ===bb===
18046 ====bba====
18047 ===bc===
18048 ==c==
18049 ===ca===
18050 !! end
18051
18052 !! test
18053 Section replacement test (section 1)
18054 !! options
18055 replace=1,"xxx"
18056 !! wikitext
18057 start
18058 ==a==
18059 ===aa===
18060 ====aaa====
18061 ==b==
18062 ===ba===
18063 ===bb===
18064 ====bba====
18065 ===bc===
18066 ==c==
18067 ===ca===
18068 !! html/php
18069 start
18070 xxx
18071
18072 ==b==
18073 ===ba===
18074 ===bb===
18075 ====bba====
18076 ===bc===
18077 ==c==
18078 ===ca===
18079 !! end
18080
18081 !! test
18082 Section replacement test (section 2)
18083 !! options
18084 replace=2,"xxx"
18085 !! wikitext
18086 start
18087 ==a==
18088 ===aa===
18089 ====aaa====
18090 ==b==
18091 ===ba===
18092 ===bb===
18093 ====bba====
18094 ===bc===
18095 ==c==
18096 ===ca===
18097 !! html/php
18098 start
18099 ==a==
18100 xxx
18101
18102 ==b==
18103 ===ba===
18104 ===bb===
18105 ====bba====
18106 ===bc===
18107 ==c==
18108 ===ca===
18109 !! end
18110
18111 !! test
18112 Section replacement test (section 3)
18113 !! options
18114 replace=3,"xxx"
18115 !! wikitext
18116 start
18117 ==a==
18118 ===aa===
18119 ====aaa====
18120 ==b==
18121 ===ba===
18122 ===bb===
18123 ====bba====
18124 ===bc===
18125 ==c==
18126 ===ca===
18127 !! html/php
18128 start
18129 ==a==
18130 ===aa===
18131 xxx
18132
18133 ==b==
18134 ===ba===
18135 ===bb===
18136 ====bba====
18137 ===bc===
18138 ==c==
18139 ===ca===
18140 !! end
18141
18142 !! test
18143 Section replacement test (section 4)
18144 !! options
18145 replace=4,"xxx"
18146 !! wikitext
18147 start
18148 ==a==
18149 ===aa===
18150 ====aaa====
18151 ==b==
18152 ===ba===
18153 ===bb===
18154 ====bba====
18155 ===bc===
18156 ==c==
18157 ===ca===
18158 !! html/php
18159 start
18160 ==a==
18161 ===aa===
18162 ====aaa====
18163 xxx
18164
18165 ==c==
18166 ===ca===
18167 !! end
18168
18169 !! test
18170 Section replacement test (section 5)
18171 !! options
18172 replace=5,"xxx"
18173 !! wikitext
18174 start
18175 ==a==
18176 ===aa===
18177 ====aaa====
18178 ==b==
18179 ===ba===
18180 ===bb===
18181 ====bba====
18182 ===bc===
18183 ==c==
18184 ===ca===
18185 !! html/php
18186 start
18187 ==a==
18188 ===aa===
18189 ====aaa====
18190 ==b==
18191 xxx
18192
18193 ===bb===
18194 ====bba====
18195 ===bc===
18196 ==c==
18197 ===ca===
18198 !! end
18199
18200 !! test
18201 Section replacement test (section 6)
18202 !! options
18203 replace=6,"xxx"
18204 !! wikitext
18205 start
18206 ==a==
18207 ===aa===
18208 ====aaa====
18209 ==b==
18210 ===ba===
18211 ===bb===
18212 ====bba====
18213 ===bc===
18214 ==c==
18215 ===ca===
18216 !! html/php
18217 start
18218 ==a==
18219 ===aa===
18220 ====aaa====
18221 ==b==
18222 ===ba===
18223 xxx
18224
18225 ===bc===
18226 ==c==
18227 ===ca===
18228 !! end
18229
18230 !! test
18231 Section replacement test (section 7)
18232 !! options
18233 replace=7,"xxx"
18234 !! wikitext
18235 start
18236 ==a==
18237 ===aa===
18238 ====aaa====
18239 ==b==
18240 ===ba===
18241 ===bb===
18242 ====bba====
18243 ===bc===
18244 ==c==
18245 ===ca===
18246 !! html/php
18247 start
18248 ==a==
18249 ===aa===
18250 ====aaa====
18251 ==b==
18252 ===ba===
18253 ===bb===
18254 xxx
18255
18256 ===bc===
18257 ==c==
18258 ===ca===
18259 !! end
18260
18261 !! test
18262 Section replacement test (section 8)
18263 !! options
18264 replace=8,"xxx"
18265 !! wikitext
18266 start
18267 ==a==
18268 ===aa===
18269 ====aaa====
18270 ==b==
18271 ===ba===
18272 ===bb===
18273 ====bba====
18274 ===bc===
18275 ==c==
18276 ===ca===
18277 !! html/php
18278 start
18279 ==a==
18280 ===aa===
18281 ====aaa====
18282 ==b==
18283 ===ba===
18284 ===bb===
18285 ====bba====
18286 xxx
18287
18288 ==c==
18289 ===ca===
18290 !!end
18291
18292 !! test
18293 Section replacement test (section 9)
18294 !! options
18295 replace=9,"xxx"
18296 !! wikitext
18297 start
18298 ==a==
18299 ===aa===
18300 ====aaa====
18301 ==b==
18302 ===ba===
18303 ===bb===
18304 ====bba====
18305 ===bc===
18306 ==c==
18307 ===ca===
18308 !! html/php
18309 start
18310 ==a==
18311 ===aa===
18312 ====aaa====
18313 ==b==
18314 ===ba===
18315 ===bb===
18316 ====bba====
18317 ===bc===
18318 xxx
18319 !! end
18320
18321 !! test
18322 Section replacement test (section 10)
18323 !! options
18324 replace=10,"xxx"
18325 !! wikitext
18326 start
18327 ==a==
18328 ===aa===
18329 ====aaa====
18330 ==b==
18331 ===ba===
18332 ===bb===
18333 ====bba====
18334 ===bc===
18335 ==c==
18336 ===ca===
18337 !! html/php
18338 start
18339 ==a==
18340 ===aa===
18341 ====aaa====
18342 ==b==
18343 ===ba===
18344 ===bb===
18345 ====bba====
18346 ===bc===
18347 ==c==
18348 xxx
18349 !! end
18350
18351 !! test
18352 Section replacement test with initial whitespace (bug 13728)
18353 !! options
18354 replace=2,"xxx"
18355 !! wikitext
18356 Preformatted initial line
18357 ==a==
18358 ===a===
18359 !! html/php
18360 Preformatted initial line
18361 ==a==
18362 xxx
18363 !! end
18364
18365
18366 !! test
18367 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18368 !! options
18369 section=1
18370 !! wikitext
18371 ==a==
18372 a
18373 !! html/php
18374 ==a==
18375 a
18376 !! end
18377
18378 !! test
18379 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18380 !! options
18381 section=1
18382 !! wikitext
18383 ==a==
18384 a
18385 !! html/php
18386 ==a==
18387 a
18388 !! end
18389
18390
18391 !! test
18392 Section extraction, <pre> around bogus header (bug 10309)
18393 !! options
18394 section=2
18395 !! wikitext
18396 == Section One ==
18397 <pre>
18398 =======
18399 </pre>
18400
18401 == Section Two ==
18402 stuff
18403 !! html/php
18404 == Section Two ==
18405 stuff
18406 !! end
18407
18408 !! test
18409 Section replacement, <pre> around bogus header (bug 10309)
18410 !! options
18411 replace=2,"xxx"
18412 !! wikitext
18413 == Section One ==
18414 <pre>
18415 =======
18416 </pre>
18417
18418 == Section Two ==
18419 stuff
18420 !! html/php
18421 == Section One ==
18422 <pre>
18423 =======
18424 </pre>
18425
18426 xxx
18427 !! end
18428
18429
18430 !! test
18431 Handling of &#x0A; in URLs
18432 !! wikitext
18433 ** irc://&#x0A;a
18434 !! html/php
18435 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18436
18437 !! html/parsoid
18438 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18439 a">irc://
18440 a</a></li></ul></li></ul>
18441 !! end
18442
18443 !! test
18444 Handling of %0A in URLs
18445 !! wikitext
18446 ** irc://%0Aa
18447 !! html/php
18448 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18449
18450 !! html/parsoid
18451 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18452 !! end
18453
18454
18455 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18456 !! test
18457 5 quotes, code coverage +1 line
18458 !! options
18459 parsoid=wt2html
18460 !! wikitext
18461 '''''
18462 !! html/php
18463 !! html/parsoid
18464 <p><b><i></i></b></p>
18465 !! end
18466
18467 # same html as previous, but wikitext adjusted to match parsoid html2wt
18468 # note that wt2html and html2html will put the <i> before the <b>
18469 !! test
18470 5 quotes, code coverage +1 line w/ nowiki (1)
18471 !! options
18472 parsoid=wt2wt,html2wt
18473 !! wikitext
18474 '''''<nowiki/>'''''
18475 !! html/php
18476 <p><i></i>
18477 </p>
18478 !! html/parsoid
18479 <p><b><i></i></b></p>
18480 !! end
18481
18482 # same as previous, just swapping the <i> and <b>
18483 !! test
18484 5 quotes, code coverage +1 line w/ nowiki (2)
18485 !! wikitext
18486 '''''<nowiki/>'''''
18487 !! html/php
18488 <p><i></i>
18489 </p>
18490 !! html/parsoid
18491 <p><i><b></b></i></p>
18492 !! end
18493
18494 !! test
18495 Special:Search page linking.
18496 !! wikitext
18497 {{Special:search}}
18498 !! html
18499 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18500 </p>
18501 !! end
18502
18503 !! test
18504 {{!}} is a magic word
18505 !! wikitext
18506 {{!}} is a magic word there and {{!}} is still a magic word here
18507 | is not a magic word here but {{!}} is still a magic word here
18508 !! html/php
18509 <p>| is a magic word there and | is still a magic word here
18510 | is not a magic word here but | is still a magic word here
18511 </p>
18512 !! html/parsoid
18513 <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
18514 | 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>
18515
18516 !! end
18517
18518 !! test
18519 Say the magic word
18520 !! options
18521 title=[[Parser test]]
18522 !! wikitext
18523 * {{PAGENAME}}
18524 * {{PAGENAMEE}}
18525 * {{FULLPAGENAME}}
18526 * {{FULLPAGENAMEE}}
18527 * {{BASEPAGENAME}}
18528 * {{BASEPAGENAMEE}}
18529 * {{SUBPAGENAME}}
18530 * {{SUBPAGENAMEE}}
18531 * {{ROOTPAGENAME}}
18532 * {{ROOTPAGENAMEE}}
18533 * {{TALKPAGENAME}}
18534 * {{TALKPAGENAMEE}}
18535 * {{SUBJECTPAGENAME}}
18536 * {{SUBJECTPAGENAMEE}}
18537 * {{NAMESPACEE}}
18538 * {{NAMESPACE}}
18539 * {{NAMESPACENUMBER}}
18540 * {{TALKSPACE}}
18541 * {{TALKSPACEE}}
18542 * {{SUBJECTSPACE}}
18543 * {{SUBJECTSPACEE}}
18544 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18545 !! html
18546 <ul><li> Parser test</li>
18547 <li> Parser_test</li>
18548 <li> Parser test</li>
18549 <li> Parser_test</li>
18550 <li> Parser test</li>
18551 <li> Parser_test</li>
18552 <li> Parser test</li>
18553 <li> Parser_test</li>
18554 <li> Parser test</li>
18555 <li> Parser_test</li>
18556 <li> Talk:Parser test</li>
18557 <li> Talk:Parser_test</li>
18558 <li> Parser test</li>
18559 <li> Parser_test</li>
18560 <li> </li>
18561 <li> </li>
18562 <li> 0</li>
18563 <li> Talk</li>
18564 <li> Talk</li>
18565 <li> </li>
18566 <li> </li>
18567 <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>
18568
18569 !! end
18570 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18571
18572 !! test
18573 Gallery
18574 !! wikitext
18575 <gallery>
18576 image1.png |
18577 image2.gif|||||
18578
18579 image3|
18580 image4 |300px| centre
18581 image5.svg| http://///////
18582 [[x|xx]]]]
18583 * image6
18584 </gallery>
18585 !! html
18586 <ul class="gallery mw-gallery-traditional">
18587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18588 <div class="thumb" style="height: 150px;">Image1.png</div>
18589 <div class="gallerytext">
18590 </div>
18591 </div></li>
18592 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18593 <div class="thumb" style="height: 150px;">Image2.gif</div>
18594 <div class="gallerytext">
18595 </div>
18596 </div></li>
18597 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18598 <div class="thumb" style="height: 150px;">Image3</div>
18599 <div class="gallerytext">
18600 </div>
18601 </div></li>
18602 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18603 <div class="thumb" style="height: 150px;">Image4</div>
18604 <div class="gallerytext">
18605 <pre>centre
18606 </pre>
18607 </div>
18608 </div></li>
18609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18610 <div class="thumb" style="height: 150px;">Image5.svg</div>
18611 <div class="gallerytext">
18612 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18613 </p>
18614 </div>
18615 </div></li>
18616 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18617 <div class="thumb" style="height: 150px;">* image6</div>
18618 <div class="gallerytext">
18619 </div>
18620 </div></li>
18621 </ul>
18622
18623 !! end
18624
18625 !! test
18626 Gallery (with options)
18627 !! wikitext
18628 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18629 File:Nonexistent.jpg|caption
18630 File:Nonexistent.jpg
18631 image:foobar.jpg|some '''caption''' [[Main Page]]
18632 image:foobar.jpg
18633 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18634 </gallery>
18635 !! html
18636 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18637 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18638 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18639 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18640 <div class="gallerytext">
18641 <p>caption
18642 </p>
18643 </div>
18644 </div></li>
18645 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18646 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18647 <div class="gallerytext">
18648 </div>
18649 </div></li>
18650 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18651 <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>
18652 <div class="gallerytext">
18653 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18654 </p>
18655 </div>
18656 </div></li>
18657 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18658 <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>
18659 <div class="gallerytext">
18660 </div>
18661 </div></li>
18662 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18663 <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>
18664 <div class="gallerytext">
18665 <p>blabla.
18666 </p>
18667 </div>
18668 </div></li>
18669 </ul>
18670
18671 !! end
18672
18673 !! test
18674 Gallery with link that has fragment
18675 !! wikitext
18676 <gallery>
18677 image:foobar.jpg|link=Main_Page
18678 image:foobar.jpg|link=Main_Page#section
18679 image:foobar.jpg|link=Main Page#section|caption
18680 </gallery>
18681 !! html
18682 <ul class="gallery mw-gallery-traditional">
18683 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18684 <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>
18685 <div class="gallerytext">
18686 </div>
18687 </div></li>
18688 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18689 <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>
18690 <div class="gallerytext">
18691 </div>
18692 </div></li>
18693 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18694 <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>
18695 <div class="gallerytext">
18696 <p>caption
18697 </p>
18698 </div>
18699 </div></li>
18700 </ul>
18701
18702 !! end
18703
18704 !! test
18705 Gallery with wikitext inside caption
18706 !! wikitext
18707 <gallery>
18708 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18709 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18710 </gallery>
18711 !! html
18712 <ul class="gallery mw-gallery-traditional">
18713 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18714 <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>
18715 <div class="gallerytext">
18716 <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>
18717 </p>
18718 </div>
18719 </div></li>
18720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18721 <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>
18722 <div class="gallerytext">
18723 <p>This is a test template
18724 </p>
18725 </div>
18726 </div></li>
18727 </ul>
18728
18729 !! end
18730
18731 !! test
18732 gallery (with showfilename option)
18733 !! wikitext
18734 <gallery showfilename>
18735 File:Nonexistent.jpg|caption
18736 File:Nonexistent.jpg
18737 image:foobar.jpg|some '''caption''' [[Main Page]]
18738 File:Foobar.jpg
18739 </gallery>
18740 !! html
18741 <ul class="gallery mw-gallery-traditional">
18742 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18743 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18744 <div class="gallerytext">
18745 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18746 caption
18747 </p>
18748 </div>
18749 </div></li>
18750 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18751 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18752 <div class="gallerytext">
18753 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18754 </p>
18755 </div>
18756 </div></li>
18757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18758 <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>
18759 <div class="gallerytext">
18760 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18761 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18762 </p>
18763 </div>
18764 </div></li>
18765 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18766 <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>
18767 <div class="gallerytext">
18768 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18769 </p>
18770 </div>
18771 </div></li>
18772 </ul>
18773
18774 !! end
18775
18776 !! test
18777 Gallery (with namespace-less filenames)
18778 !! wikitext
18779 <gallery>
18780 File:Nonexistent.jpg
18781 Nonexistent.jpg
18782 image:foobar.jpg
18783 foobar.jpg
18784 </gallery>
18785 !! html
18786 <ul class="gallery mw-gallery-traditional">
18787 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18788 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18789 <div class="gallerytext">
18790 </div>
18791 </div></li>
18792 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18793 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18794 <div class="gallerytext">
18795 </div>
18796 </div></li>
18797 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18798 <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>
18799 <div class="gallerytext">
18800 </div>
18801 </div></li>
18802 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18803 <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>
18804 <div class="gallerytext">
18805 </div>
18806 </div></li>
18807 </ul>
18808
18809 !! end
18810
18811 !! test
18812 HTML Hex character encoding (spells the word "JavaScript")
18813 !! options
18814 parsoid=wt2html,wt2wt,html2html
18815 !! wikitext
18816 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18817 !! html/php
18818 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18819 </p>
18820 !! html/php+tidy
18821 <p>JavaScript</p>
18822 !! html/parsoid
18823 <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>
18824 !! end
18825
18826 !! test
18827 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18828 !! wikitext
18829 &#xsee;&#XSEE;
18830 !! html/php
18831 <p>&amp;#xsee;&amp;#XSEE;
18832 </p>
18833 !! html/parsoid
18834 <p>&amp;#xsee;&amp;#XSEE;</p>
18835 !! end
18836
18837 !! test
18838 HTML Hex character encoding mixed case
18839 !! options
18840 parsoid=wt2html,wt2wt,html2html
18841 !! wikitext
18842 &#xEE;&#Xee;
18843 !! html/php
18844 <p>&#xee;&#xee;
18845 </p>
18846 !! html/php+tidy
18847 <p>îî</p>
18848 !! html/parsoid
18849 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18850 !! end
18851
18852 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18853 # Note that U+000C (form feed) is not a valid XML character, so
18854 # it is banned even though allowed in HTML5.
18855 !! test
18856 Illegal character references (T106578)
18857 !! wikitext
18858 ; Null: &#00;
18859 ; FF: &#xC;
18860 ; CR: &#xD;
18861 ; Control (low): &#8;
18862 ; Control (high): &#x7F; &#x9F;
18863 ; Surrogate: &#xD83D;&#xDCA9;
18864 ; This is an okay astral character: &#x1F4A9;
18865 !! html+tidy
18866 <dl>
18867 <dt>Null</dt>
18868 <dd>&amp;#00;</dd>
18869 <dt>FF</dt>
18870 <dd>&amp;#xC;</dd>
18871 <dt>CR</dt>
18872 <dd>&amp;#xD;</dd>
18873 <dt>Control (low)</dt>
18874 <dd>&amp;#8;</dd>
18875 <dt>Control (high)</dt>
18876 <dd>&amp;#x7F; &amp;#x9F;</dd>
18877 <dt>Surrogate</dt>
18878 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18879 <dt>This is an okay astral character</dt>
18880 <dd>💩</dd>
18881 </dl>
18882 !! end
18883
18884 !! test
18885 __FORCETOC__ override
18886 !! wikitext
18887 __NEWSECTIONLINK__
18888 __FORCETOC__
18889 !! html/php
18890 <p><br />
18891 </p>
18892 !! end
18893
18894 !! test
18895 ISBN code coverage
18896 !! wikitext
18897 ISBN 978-0-1234-56&#x20;789
18898 !! html
18899 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18900 </p>
18901 !! html+tidy
18902 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18903 !! html/parsoid
18904 <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>
18905 !! end
18906
18907 !! test
18908 ISBN followed by 5 spaces
18909 !! wikitext
18910 ISBN
18911 !! html
18912 <p>ISBN
18913 </p>
18914 !! end
18915
18916 !! test
18917 Double ISBN
18918 !! wikitext
18919 ISBN ISBN 1234567890
18920 !! html/php
18921 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18922 </p>
18923 !! html/parsoid
18924 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18925 !! end
18926
18927 # Uppercase X and lowercase x as well
18928 !! test
18929 ISBN with an X
18930 !! wikitext
18931 ISBN 3-462-04561-X
18932 ISBN 3-462-04561-x
18933 ISBN 080442957X
18934 ISBN 080442957x
18935 ISBN 978080442957X
18936 ISBN 978080442957x
18937 !! html/php
18938 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18939 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18940 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18941 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18942 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18943 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18944 </p>
18945 !! html/parsoid
18946 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18947 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18948 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18949 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18950 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18951 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18952 !! end
18953
18954 !! test
18955 ISBN with empty prefix (parsoid test)
18956 !! wikitext
18957 ISBN 1234567890
18958 !! html/php
18959 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18960 </p>
18961 !! html/parsoid
18962 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18963 !! end
18964
18965 !! test
18966 Bug 22905: <abbr> followed by ISBN followed by </a>
18967 !! wikitext
18968 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18969 !! html/php
18970 <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>
18971 </p>
18972 !! html/parsoid
18973 <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>
18974 !! end
18975
18976 !! test
18977 Double RFC
18978 !! wikitext
18979 RFC RFC 1234
18980 !! html
18981 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18982 </p>
18983 !! end
18984
18985 !! test
18986 Double RFC with a wiki link
18987 !! wikitext
18988 RFC [[RFC 1234]]
18989 !! html
18990 <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>
18991 </p>
18992 !! end
18993
18994 !! test
18995 RFC code coverage
18996 !! wikitext
18997 RFC 983&#x20;987
18998 !! html
18999 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19000 </p>
19001 !! html+tidy
19002 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19003 !! end
19004
19005 !! test
19006 Centre-aligned image
19007 !! wikitext
19008 [[Image:foobar.jpg|centre]]
19009 !! html
19010 <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>
19011
19012 !!end
19013
19014 !! test
19015 None-aligned image
19016 !! wikitext
19017 [[Image:foobar.jpg|none]]
19018 !! html
19019 <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>
19020
19021 !!end
19022
19023 !! test
19024 Width + Height sized image (using px) (height is ignored)
19025 !! wikitext
19026 [[Image:foobar.jpg|640x480px]]
19027 !! html
19028 <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>
19029 </p>
19030 !!end
19031
19032 !! test
19033 Width-sized image (using px, no following whitespace)
19034 !! wikitext
19035 [[Image:foobar.jpg|640px]]
19036 !! html
19037 <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>
19038 </p>
19039 !!end
19040
19041 !! test
19042 Width-sized image (using px, with following whitespace - test regression from r39467)
19043 !! wikitext
19044 [[Image:foobar.jpg|640px ]]
19045 !! html
19046 <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>
19047 </p>
19048 !!end
19049
19050 !! test
19051 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19052 !! wikitext
19053 [[Image:foobar.jpg| 640px]]
19054 !! html
19055 <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>
19056 </p>
19057 !!end
19058
19059 !! test
19060 Image with page parameter
19061 !! options
19062 djvu
19063 !! wikitext
19064 [[File:LoremIpsum.djvu|page=2]]
19065 !! html/php
19066 <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>
19067 </p>
19068 !! html/parsoid
19069 <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>
19070 !! end
19071
19072 !! test
19073 Another italics / bold test
19074 !! wikitext
19075 ''' ''x'
19076 !! html
19077 <pre>'<i> </i>x'
19078 </pre>
19079 !!end
19080
19081 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19082 !! test
19083 dt/dd/dl test
19084 !! wikitext
19085 :;;;::
19086 !! html/php
19087 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19088
19089 !! html/parsoid
19090 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19091
19092 !!end
19093
19094
19095 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19096 !! test
19097 Images with the "|" character in the comment
19098 !! wikitext
19099 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19100 !! html/php
19101 <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>
19102
19103 !! html/parsoid
19104 <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>
19105 !! end
19106
19107 !! test
19108 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19109 !! wikitext
19110 <html><script>alert(1);</script></html>
19111 !! html
19112 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19113 </p>
19114 !! end
19115
19116 !! test
19117 HTML with raw HTML ($wgRawHtml==true)
19118 !! options
19119 wgRawHtml=1
19120 !! wikitext
19121 <html><script>alert(1);</script></html>
19122 !! html
19123 <p><script>alert(1);</script>
19124 </p>
19125 !! end
19126
19127 !! test
19128 Parents of subpages, one level up
19129 !! options
19130 subpage title=[[Subpage test/L1/L2/L3]]
19131 !! wikitext
19132 [[../|L2]]
19133 !! html
19134 <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>
19135 </p>
19136 !! end
19137
19138
19139 !! test
19140 Parents of subpages, one level up, not named
19141 !! options
19142 subpage title=[[Subpage test/L1/L2/L3]]
19143 !! wikitext
19144 [[../]]
19145 !! html
19146 <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>
19147 </p>
19148 !! end
19149
19150
19151
19152 !! test
19153 Parents of subpages, two levels up
19154 !! options
19155 subpage title=[[Subpage test/L1/L2/L3]]
19156 !! wikitext
19157 [[../../|L1]]2
19158
19159 [[../../|L1]]l
19160 !! html
19161 <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
19162 </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>
19163 </p>
19164 !! end
19165
19166 !! test
19167 Parents of subpages, two levels up, without trailing slash or name.
19168 !! options
19169 subpage title=[[Subpage test/L1/L2/L3]]
19170 !! wikitext
19171 [[../..]]
19172 !! html
19173 <p>[[../..]]
19174 </p>
19175 !! end
19176
19177 !! test
19178 Parents of subpages, two levels up, with lots of extra trailing slashes.
19179 !! options
19180 subpage title=[[Subpage test/L1/L2/L3]]
19181 !! wikitext
19182 [[../../////]]
19183 !! html
19184 <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>
19185 </p>
19186 !! end
19187
19188 !! article
19189 Subpage test/L1/L2/L3Sibling
19190 !! text
19191 Sibling article
19192 !! endarticle
19193
19194 !! test
19195 Transclusion of a sibling page (one level up)
19196 !! options
19197 subpage title=[[Subpage test/L1/L2/L3]]
19198 !! wikitext
19199 {{../L3Sibling}}
19200 !! html
19201 <p>Sibling article
19202 </p>
19203 !! end
19204
19205 !! test
19206 Transclusion of a child page
19207 !! options
19208 subpage title=[[Subpage test/L1/L2]]
19209 !! wikitext
19210 {{/L3Sibling}}
19211 !! html
19212 <p>Sibling article
19213 </p>
19214 !! end
19215
19216 !! test
19217 Non-transclusion because of too many up levels
19218 !! options
19219 subpage title=[[Subpage test/L1/L2/L3]]
19220 !! wikitext
19221 {{../../../../More than parent}}
19222 !! html
19223 <p>{{../../../../More than parent}}
19224 </p>
19225 !! end
19226
19227 !! test
19228 Definition list code coverage
19229 !! wikitext
19230 ; title : def
19231 ; title : def
19232 ;title: def
19233 !! html/php
19234 <dl><dt> title &#160;</dt>
19235 <dd> def</dd>
19236 <dt> title&#160;</dt>
19237 <dd> def</dd>
19238 <dt>title</dt>
19239 <dd> def</dd></dl>
19240
19241 !! html/parsoid
19242 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19243 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19244 <dt>title</dt><dd> def</dd></dl>
19245 !! end
19246
19247 !! test
19248 Don't fall for the self-closing div
19249 !! wikitext
19250 <div>hello world</div/>
19251 !! html
19252 <div>hello world</div>
19253
19254 !! end
19255
19256 !! test
19257 MSGNW magic word
19258 !! wikitext
19259 {{MSGNW:msg}}
19260 !! html/php
19261 <p>&#91;&#91;:Template:Msg&#93;&#93;
19262 </p>
19263 !! end
19264
19265 !! test
19266 RAW magic word
19267 !! wikitext
19268 {{RAW:QUERTY}}
19269 !! html
19270 <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>
19271 </p>
19272 !! end
19273
19274 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19275 !! test
19276 Always escape literal '>' in output, not just after '<'
19277 !! wikitext
19278 ><>
19279 !! html
19280 <p>&gt;&lt;&gt;
19281 </p>
19282 !! end
19283
19284 !! test
19285 Template caching
19286 !! wikitext
19287 {{Test}}
19288 {{Test}}
19289 !! html
19290 <p>This is a test template
19291 This is a test template
19292 </p>
19293 !! end
19294
19295
19296 !! article
19297 MediaWiki:Fake
19298 !! text
19299 ==header==
19300 !! endarticle
19301
19302 !! test
19303 Inclusion of !userCanEdit() content
19304 !! wikitext
19305 {{MediaWiki:Fake}}
19306 !! html
19307 <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>
19308
19309 !! end
19310
19311
19312 !! test
19313 Out-of-order TOC heading levels
19314 !! wikitext
19315 ==2==
19316 ======6======
19317 ===3===
19318 =1=
19319 =====5=====
19320 ==2==
19321 !! html
19322 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19323 <ul>
19324 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19325 <ul>
19326 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19327 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19328 </ul>
19329 </li>
19330 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19331 <ul>
19332 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19333 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19334 </ul>
19335 </li>
19336 </ul>
19337 </div>
19338
19339 <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>
19340 <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>
19341 <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>
19342 <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>
19343 <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>
19344 <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>
19345
19346 !! end
19347
19348
19349 !! test
19350 ISBN with a dummy number
19351 !! wikitext
19352 ISBN ---
19353 !! html
19354 <p>ISBN ---
19355 </p>
19356 !! end
19357
19358
19359 !! test
19360 ISBN with space-delimited number
19361 !! wikitext
19362 ISBN 92 9017 032 8
19363 !! html
19364 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19365 </p>
19366 !! end
19367
19368
19369 !! test
19370 ISBN with multiple spaces, no number
19371 !! wikitext
19372 ISBN foo
19373 !! html
19374 <p>ISBN foo
19375 </p>
19376 !! end
19377
19378
19379 !! test
19380 ISBN length
19381 !! wikitext
19382 ISBN 123456789
19383
19384 ISBN 1234567890
19385
19386 ISBN 12345678901
19387 !! html
19388 <p>ISBN 123456789
19389 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19390 </p><p>ISBN 12345678901
19391 </p>
19392 !! end
19393
19394
19395 !! test
19396 ISBN with trailing year (bug 8110)
19397 !! wikitext
19398 ISBN 1-234-56789-0 - 2006
19399
19400 ISBN 1 234 56789 0 - 2006
19401 !! html
19402 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19403 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19404 </p>
19405 !! end
19406
19407
19408 !! test
19409 anchorencode
19410 !! wikitext
19411 {{anchorencode:foo bar©#%n}}
19412 !! html
19413 <p>foo_bar.C2.A9.23.25n
19414 </p>
19415 !! end
19416
19417 !! test
19418 anchorencode trims spaces
19419 !! wikitext
19420 {{anchorencode: __pretty__please__}}
19421 !! html
19422 <p>pretty_please
19423 </p>
19424 !! end
19425
19426 !! test
19427 anchorencode deals with links
19428 !! wikitext
19429 {{anchorencode: [[hello|world]] [[hi]]}}
19430 !! html
19431 <p>world_hi
19432 </p>
19433 !! end
19434
19435 !! test
19436 anchorencode deals with templates
19437 !! wikitext
19438 {{anchorencode: {{Foo}} }}
19439 !! html
19440 <p>FOO
19441 </p>
19442 !! end
19443
19444 !! test
19445 anchorencode encodes like the TOC generator: (bug 18431)
19446 !! wikitext
19447 === _ +:.3A%3A&&amp;]] ===
19448 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19449 __NOEDITSECTION__
19450 !! html
19451 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19452 <p>.2B:.3A.253A.26.26.5D.5D
19453 </p>
19454 !! end
19455
19456 !! test
19457 Bug 6200: blockquotes and paragraph formatting
19458 !! wikitext
19459 <blockquote>
19460 foo
19461 </blockquote>
19462
19463 bar
19464
19465 baz
19466 !! html
19467 <blockquote>
19468 <p>foo
19469 </p>
19470 </blockquote>
19471 <p>bar
19472 </p>
19473 <pre>baz
19474 </pre>
19475 !! end
19476
19477 !! test
19478 Bug 8293: Use of center tag ruins paragraph formatting
19479 !! wikitext
19480 <center>
19481 foo
19482 </center>
19483
19484 bar
19485
19486 baz
19487 !! html
19488 <center>
19489 <p>foo
19490 </p>
19491 </center>
19492 <p>bar
19493 </p>
19494 <pre>baz
19495 </pre>
19496 !! end
19497
19498 !!test
19499 Parsing of overlapping (improperly nested) inline html tags
19500 !! wikitext
19501 <span><s>x</span></s>
19502 !! html/php
19503 <p><span><s>x&lt;/span&gt;</s></span>
19504 </p>
19505 !! html/parsoid
19506 <p><span><s>x</s></span>
19507 </p>
19508 !!end
19509
19510 ###
19511 ### Language variants related tests
19512 ###
19513 !! test
19514 Self-link in language variants
19515 !! options
19516 title=[[Dunav]] language=sr
19517 !! wikitext
19518 Both [[Dunav]] and [[Дунав]] are names for this river.
19519 !! html
19520 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19521 </p>
19522 !!end
19523
19524 !! article
19525 Дуна
19526 !! text
19527 content
19528 !! endarticle
19529
19530 !! test
19531 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19532 !! options
19533 title=[[Duna]] language=sr
19534 !! wikitext
19535 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19536 !! html
19537 <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.
19538 </p>
19539 !! end
19540
19541 !! test
19542 Link to a section of a variant of this title shouldn't be parsed as self-link
19543 !! options
19544 title=[[Duna]] language=sr
19545 !! wikitext
19546 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19547 !! html
19548 <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.
19549 </p>
19550 !! end
19551
19552 !! test
19553 Link to pages in language variants
19554 !! options
19555 language=sr
19556 !! wikitext
19557 Main Page can be written as [[Маин Паге]]
19558 !! html
19559 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19560 </p>
19561 !!end
19562
19563
19564 !! test
19565 Multiple links to pages in language variants
19566 !! options
19567 language=sr
19568 !! wikitext
19569 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19570 !! html
19571 <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>.
19572 </p>
19573 !!end
19574
19575
19576 !! test
19577 Simple template in language variants
19578 !! options
19579 language=sr
19580 !! wikitext
19581 {{тест}}
19582 !! html
19583 <p>This is a test template
19584 </p>
19585 !! end
19586
19587
19588 !! test
19589 Template with explicit namespace in language variants
19590 !! options
19591 language=sr
19592 !! wikitext
19593 {{Template:тест}}
19594 !! html
19595 <p>This is a test template
19596 </p>
19597 !! end
19598
19599
19600 !! test
19601 Basic test for template parameter in language variants
19602 !! options
19603 language=sr
19604 !! wikitext
19605 {{парамтест|param=foo}}
19606 !! html
19607 <p>This is a test template with parameter foo
19608 </p>
19609 !! end
19610
19611
19612 !! test
19613 Simple category in language variants
19614 !! options
19615 language=sr cat
19616 !! wikitext
19617 [[Category:МедиаWики Усер'с Гуиде]]
19618 !! html
19619 <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>
19620 !! end
19621
19622
19623 !! article
19624 Category:分类
19625 !! text
19626 blah
19627 !! endarticle
19628
19629 !! article
19630 Category:分類
19631 !! text
19632 blah
19633 !! endarticle
19634
19635 ## We used to, but no longer wt2wt this test since the default serializer
19636 ## will normalize all categories to serialize on their own line.
19637 ## This wikitext usage is going to be fairly uncommon in production and
19638 ## selser will take care of preserving formatting in those scenarios.
19639 !! test
19640 Don't convert blue categorylinks to another variant (bug 33210)
19641 !! options
19642 cat
19643 language=zh
19644 parsoid=wt2html
19645 !! wikitext
19646 [[A]][[Category:分类]]
19647 !! html/php
19648 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19649 !! html/parsoid
19650 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19651 <link rel="mw:PageProp/Category" href="Category:分类"/>
19652 !! end
19653
19654 !! test
19655 Stripping -{}- tags (language variants)
19656 !! options
19657 language=sr
19658 !! wikitext
19659 Latin proverb: -{Ne nuntium necare}-
19660 !! html
19661 <p>Latin proverb: Ne nuntium necare
19662 </p>
19663 !! end
19664
19665
19666 !! test
19667 Prevent conversion with -{}- tags (language variants)
19668 !! options
19669 language=sr variant=sr-ec
19670 !! wikitext
19671 Latinski: -{Ne nuntium necare}-
19672 !! html
19673 <p>Латински: Ne nuntium necare
19674 </p>
19675 !! end
19676
19677
19678 !! test
19679 Prevent conversion of text with -{}- tags (language variants)
19680 !! options
19681 language=sr variant=sr-ec
19682 !! wikitext
19683 Latinski: -{Ne nuntium necare}-
19684 !! html
19685 <p>Латински: Ne nuntium necare
19686 </p>
19687 !! end
19688
19689
19690 !! test
19691 Prevent conversion of links with -{}- tags (language variants)
19692 !! options
19693 language=sr variant=sr-ec
19694 !! wikitext
19695 -{[[Main Page]]}-
19696 !! html
19697 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19698 </p>
19699 !! end
19700
19701
19702 !! test
19703 -{}- tags within headlines (within html for parserConvert())
19704 !! options
19705 language=sr variant=sr-ec
19706 !! wikitext
19707 == -{Naslov}- ==
19708 !! html
19709 <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>
19710
19711 !! end
19712
19713
19714 !! test
19715 Explicit definition of language variant alternatives
19716 !! options
19717 language=zh variant=zh-tw
19718 !! wikitext
19719 -{zh:China;zh-tw:Taiwan}-, not China
19720 !! html
19721 <p>Taiwan, not China
19722 </p>
19723 !! end
19724
19725
19726 !! test
19727 Conversion around HTML tags
19728 !! options
19729 language=sr variant=sr-ec
19730 !! wikitext
19731 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19732 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19733 !! html
19734 <p>
19735 <span title="ЛаCтин">ски</span>
19736 </p>
19737 !! end
19738
19739
19740 !! test
19741 Explicit session-wise language variant mapping (A flag and - flag)
19742 !! options
19743 language=zh variant=zh-tw
19744 !! wikitext
19745 Taiwan is not China.
19746 But -{A|zh:China;zh-tw:Taiwan}- is China,
19747 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19748 and -{China}- is China.
19749 !! html
19750 <p>Taiwan is not China.
19751 But Taiwan is Taiwan,
19752 (This should be stripped!)
19753 and China is China.
19754 </p>
19755 !! end
19756
19757 !! test
19758 Explicit session-wise language variant mapping (H flag for hide)
19759 !! options
19760 language=zh variant=zh-tw
19761 !! wikitext
19762 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19763 Taiwan is China.
19764 !! html
19765 <p>(This should be stripped!)
19766 Taiwan is Taiwan.
19767 </p>
19768 !! end
19769
19770 !! test
19771 Adding explicit conversion rule for title (T flag)
19772 !! options
19773 language=zh variant=zh-tw showtitle
19774 !! wikitext
19775 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19776 !! html
19777 Taiwan
19778 <p>Should be stripped!
19779 </p>
19780 !! end
19781
19782 !! test
19783 Testing that changing the language variant here in the tests actually works
19784 !! options
19785 language=zh variant=zh showtitle
19786 !! wikitext
19787 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19788 !! html
19789 China
19790 <p>Should be stripped!
19791 </p>
19792 !! end
19793
19794 !! test
19795 Recursive conversion of alt and title attrs shouldn't clear converter state
19796 !! options
19797 language=zh variant=zh-cn showtitle
19798 !! wikitext
19799 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19800 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19801 !! html
19802 China
19803 <p>
19804 Should be stripped<span title="Exclamation">!</span>
19805 </p>
19806 !! end
19807
19808 !! test
19809 Bug 24072: more test on conversion rule for title
19810 !! options
19811 language=zh variant=zh-tw showtitle
19812 !! wikitext
19813 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19814 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19815 !! html
19816 Taiwan
19817 <p>This should be stripped!
19818 This won't take interferes with the title rule.
19819 </p>
19820 !! end
19821
19822 !! test
19823 Partly disable title conversion if variant == main language code
19824 !! options
19825 language=zh variant=zh title=[[ZH]] showtitle
19826 !! wikitext
19827 -{T|zh-cn:CN;zh-tw:TW}-
19828 !! html
19829 ZH
19830 <p>
19831 </p>
19832 !! end
19833
19834 !! test
19835 Partly disable title conversion if variant == main language code, more
19836 !! options
19837 language=zh variant=zh title=[[ZH]] showtitle
19838 !! wikitext
19839 -{T|TW}-
19840 !! html
19841 ZH
19842 <p>
19843 </p>
19844 !! end
19845
19846 !! test
19847 Raw output of variant escape tags (R flag)
19848 !! options
19849 language=zh variant=zh-tw
19850 !! wikitext
19851 Raw: -{R|zh:China;zh-tw:Taiwan}-
19852 !! html
19853 <p>Raw: zh:China;zh-tw:Taiwan
19854 </p>
19855 !! end
19856
19857 !! test
19858 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19859 !! options
19860 language=zh variant=zh-cn
19861 !! input
19862 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19863 !! result
19864 <p>0
19865 </p>
19866 !! end
19867
19868 !! test
19869 Conversion rules from [numeric-only string] to [something else] (T48634)
19870 !! options
19871 language=zh variant=zh-cn
19872 !! input
19873 -{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
19874 !! result
19875 <p>D12345EE12345
19876 </p>
19877 !! end
19878
19879 !! test
19880 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19881 !! options
19882 language=zh variant=zh-cn
19883 !! input
19884 -{H|zh-cn:foo;zh-tw:;}-foobar
19885 !! result
19886 <p>foobar
19887 </p>
19888 !! end
19889
19890 !! test
19891 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19892 !! options
19893 language=zh variant=zh-cn
19894 !! input
19895 -{H|=>zh-cn:foo;}-foobar
19896 !! result
19897 <p>foobar
19898 </p>
19899 !! end
19900
19901 !! test
19902 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19903 !! options
19904 language=zh variant=zh-cn
19905 !! input
19906 -{H|}-foobar
19907 !! result
19908 <p>foobar
19909 </p>
19910 !! end
19911
19912 !! test
19913 Nested using of manual convert syntax
19914 !! options
19915 language=zh variant=zh-hk
19916 !! wikitext
19917 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19918 !! html
19919 <p>Nested: Hello Hong Kong!
19920 </p>
19921 !! end
19922
19923 !! test
19924 Proper conversion of text in external links
19925 !! options
19926 language=sr variant=sr-ec
19927 !! wikitext
19928 http://www.google.com
19929 gopher://www.google.com
19930 [http://www.google.com http://www.google.com]
19931 [gopher://www.google.com gopher://www.google.com]
19932 [https://www.google.com irc://www.google.com]
19933 [ftp://www.google.com www.google.com/ftp://dir]
19934 [//www.google.com www.google.com]
19935 !! html
19936 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19937 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19938 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19939 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19940 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19941 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19942 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19943 </p>
19944 !! end
19945
19946 !! test
19947 Do not convert roman numbers to language variants
19948 !! options
19949 language=sr variant=sr-ec
19950 !! wikitext
19951 Fridrih IV je car.
19952 !! html
19953 <p>Фридрих IV је цар.
19954 </p>
19955 !! end
19956
19957 !! test
19958 Unclosed language converter markup "-{"
19959 !! options
19960 language=sr
19961 !! wikitext
19962 -{T|hello
19963 !! html
19964 <p>-{T|hello
19965 </p>
19966 !! end
19967
19968 !! test
19969 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19970 !! options
19971 language=sr
19972 !! wikitext
19973 -{R|=&gt;}-
19974 !! html
19975 <p>=&gt;
19976 </p>
19977 !!end
19978
19979 !! test
19980 Don't break link parsing if language converter markup is in the caption.
19981 !! options
19982 language=sr variant=sr-ec
19983 !! wikitext
19984 [[Main Page|-{R|main page}-]]
19985 !! html
19986 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19987 </p>
19988 !! end
19989
19990 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19991 !! test
19992 Don't break image parsing if language converter markup is in the caption.
19993 !! options
19994 language=sr
19995 !! wikitext
19996 [[File:Foobar.jpg|-{R|caption}-]]
19997 !! html/parsoid
19998 <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>
19999 </p>
20000 !! end
20001
20002 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20003 !! test
20004 Don't break list handling if language converter markup is in the item.
20005 !! options
20006 language=zh variant=zh-cn
20007 !! wikitext
20008 ;-{zh-cn:AAA;zh-tw:BBB}-
20009 !! html/php
20010 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20011
20012 !! html/parsoid
20013 <dl><dt>AAA
20014 </dt></dl>
20015 !! end
20016
20017 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20018 !! test
20019 Don't break table handling if language converter markup is in the cell.
20020 !! options
20021 language=sr variant=sr-ec
20022 !! wikitext
20023 {|
20024 |-
20025 | -{R|B}-
20026 |}
20027 !! html/php
20028 <table>
20029
20030 <tr>
20031 <td>Б}-
20032 </td></tr></table>
20033
20034 !! html/parsoid
20035 <table>
20036
20037 <tr>
20038 <td> B
20039 </td></tr></table>
20040
20041 !! end
20042
20043 !! test
20044 Bug 529: Uncovered bullet
20045 !! wikitext
20046 * Foo {{bullet}}
20047 !! html
20048 <ul><li> Foo </li>
20049 <li> Bar</li></ul>
20050
20051 !! end
20052
20053 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20054 # Templates in Wikipedia rely on this behavior, as tidy has always been
20055 # enabled there. These tests are normally run *without* tidy, so specify the
20056 # full output here.
20057 # To test realistic parsing behavior, apply a tidy-like transformation to both
20058 # the expected output and your parser's output.
20059 !! test
20060 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20061 !! wikitext
20062 ******* Foo {{bullet}}
20063 !! html
20064 <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>
20065 <li> Bar</li></ul>
20066
20067 !! end
20068
20069 !! test
20070 Bug 529: Uncovered table already at line-start
20071 !! wikitext
20072 x
20073
20074 {{table}}
20075 y
20076 !! html
20077 <p>x
20078 </p>
20079 <table>
20080 <tr>
20081 <td> 1 </td>
20082 <td> 2
20083 </td></tr>
20084 <tr>
20085 <td> 3 </td>
20086 <td> 4
20087 </td></tr></table>
20088 <p>y
20089 </p>
20090 !! end
20091
20092 !! test
20093 Bug 529: Uncovered bullet in parser function result
20094 !! wikitext
20095 * Foo {{lc:{{bullet}} }}
20096 !! html
20097 <ul><li> Foo </li>
20098 <li> bar</li></ul>
20099
20100 !! end
20101
20102 !! test
20103 Bug 5678: Double-parsed template argument
20104 !! wikitext
20105 {{lc:{{{1}}}|hello}}
20106 !! html
20107 <p>{{{1}}}
20108 </p>
20109 !! end
20110
20111 !! test
20112 Bug 5678: Double-parsed template invocation
20113 !! wikitext
20114 {{lc:{{paramtest {{!}} param = hello }} }}
20115 !! html
20116 <p>{{paramtest | param = hello }}
20117 </p>
20118 !! end
20119
20120 !! test
20121 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20122 !! options
20123 language=cs
20124 title=[[Main Page]]
20125 !! wikitext
20126 {{PRVNÍVELKÉ:ěščř}}
20127 {{prvnívelké:ěščř}}
20128 {{PRVNÍMALÉ:ěščř}}
20129 {{prvnímalé:ěščř}}
20130 {{MALÁ:ěščř}}
20131 {{malá:ěščř}}
20132 {{VELKÁ:ěščř}}
20133 {{velká:ěščř}}
20134 !! html
20135 <p>Ěščř
20136 Ěščř
20137 ěščř
20138 ěščř
20139 ěščř
20140 ěščř
20141 ĚŠČŘ
20142 ĚŠČŘ
20143 </p>
20144 !! end
20145
20146 !! test
20147 Morwen/13: Unclosed link followed by heading
20148 !! wikitext
20149 [[link
20150 ==heading==
20151 !! html
20152 <p>[[link
20153 </p>
20154 <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>
20155
20156 !! end
20157
20158 !! test
20159 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20160 !! wikitext
20161 {{foo|
20162 =heading=
20163 !! html
20164 <p>{{foo|
20165 </p>
20166 <h1><span class="mw-headline" id="heading">heading</span></h1>
20167
20168 !! end
20169
20170 !! test
20171 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20172 !! wikitext
20173 {{foo|
20174 ==heading==
20175 !! html
20176 <p>{{foo|
20177 </p>
20178 <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>
20179
20180 !! end
20181
20182 !! test
20183 Tildes in comments
20184 !! options
20185 pst
20186 !! wikitext
20187 <!-- ~~~~ -->
20188 !! html/php
20189 <!-- ~~~~ -->
20190 !! end
20191
20192 !! test
20193 Paragraphs inside divs (no extra line breaks)
20194 !! wikitext
20195 <div>Line one
20196
20197 Line two</div>
20198 !! html
20199 <div>Line one
20200 Line two</div>
20201
20202 !! end
20203
20204 !! test
20205 Paragraphs inside divs (extra line break on open)
20206 !! wikitext
20207 <div>
20208 Line one
20209
20210 Line two</div>
20211 !! html
20212 <div>
20213 <p>Line one
20214 </p>
20215 Line two</div>
20216
20217 !! end
20218
20219 !! test
20220 Paragraphs inside divs (extra line break on close)
20221 !! wikitext
20222 <div>Line one
20223
20224 Line two
20225 </div>
20226 !! html
20227 <div>Line one
20228 <p>Line two
20229 </p>
20230 </div>
20231
20232 !! end
20233
20234 !! test
20235 Paragraphs inside divs (extra line break on open and close)
20236 !! wikitext
20237 <div>
20238 Line one
20239
20240 Line two
20241 </div>
20242 !! html
20243 <div>
20244 <p>Line one
20245 </p><p>Line two
20246 </p>
20247 </div>
20248
20249 !! end
20250
20251 !! test
20252 Nesting tags, paragraphs on lines which begin with <div>
20253 !! wikitext
20254 <div></div><strong>A
20255 B</strong>
20256 !! html/php+tidy
20257 <p><strong>A</strong></p>
20258 <p><strong>B</strong></p>
20259 !! html/parsoid
20260 <div></div>
20261 <p><strong>A
20262 B</strong>
20263 </p>
20264 !! end
20265
20266 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20267 !! test
20268 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20269 !! wikitext
20270 <blockquote>Line one
20271
20272 Line two</blockquote>
20273 !! html
20274 <blockquote>Line one
20275 Line two</blockquote>
20276
20277 !! html+tidy
20278 <blockquote>
20279 <p>Line one Line two</p>
20280 </blockquote>
20281 !! end
20282
20283 !! test
20284 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20285 !! wikitext
20286 <blockquote>
20287 Line one
20288
20289 Line two</blockquote>
20290 !! html
20291 <blockquote>
20292 <p>Line one
20293 </p>
20294 Line two</blockquote>
20295
20296 !! html+tidy
20297 <blockquote>
20298 <p>Line one</p>
20299 Line two</blockquote>
20300 !! end
20301
20302 !! test
20303 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20304 !! wikitext
20305 <blockquote>Line one
20306
20307 Line two
20308 </blockquote>
20309 !! html
20310 <blockquote>Line one
20311 <p>Line two
20312 </p>
20313 </blockquote>
20314
20315 !! html+tidy
20316 <blockquote>
20317 <p>Line one</p>
20318 <p>Line two</p>
20319 </blockquote>
20320 !! end
20321
20322 !! test
20323 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20324 !! wikitext
20325 <blockquote>
20326 Line one
20327
20328 Line two
20329 </blockquote>
20330 !! html
20331 <blockquote>
20332 <p>Line one
20333 </p><p>Line two
20334 </p>
20335 </blockquote>
20336
20337 !! html+tidy
20338 <blockquote>
20339 <p>Line one</p>
20340 <p>Line two</p>
20341 </blockquote>
20342 !! end
20343
20344 !! test
20345 Paragraphs inside blockquotes/divs (no extra line breaks)
20346 !! wikitext
20347 <blockquote><div>Line one
20348
20349 Line two</div></blockquote>
20350 !! html
20351 <blockquote><div>Line one
20352 Line two</div></blockquote>
20353
20354 !! end
20355
20356 !! test
20357 Paragraphs inside blockquotes/divs (extra line break on open)
20358 !! wikitext
20359 <blockquote><div>
20360 Line one
20361
20362 Line two</div></blockquote>
20363 !! html
20364 <blockquote><div>
20365 <p>Line one
20366 </p>
20367 Line two</div></blockquote>
20368
20369 !! end
20370
20371 !! test
20372 Paragraphs inside blockquotes/divs (extra line break on close)
20373 !! wikitext
20374 <blockquote><div>Line one
20375
20376 Line two
20377 </div></blockquote>
20378 !! html
20379 <blockquote><div>Line one
20380 <p>Line two
20381 </p>
20382 </div></blockquote>
20383
20384 !! end
20385
20386 !! test
20387 Paragraphs inside blockquotes/divs (extra line break on open and close)
20388 !! wikitext
20389 <blockquote><div>
20390 Line one
20391
20392 Line two
20393 </div></blockquote>
20394 !! html
20395 <blockquote><div>
20396 <p>Line one
20397 </p><p>Line two
20398 </p>
20399 </div></blockquote>
20400
20401 !! end
20402
20403 !! test
20404 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20405 !! options
20406 wgLinkHolderBatchSize=0
20407 !! wikitext
20408 [[meatball:1]]
20409 [[meatball:2]]
20410 [[meatball:3]]
20411 !! html
20412 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20413 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20414 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20415 </p>
20416 !! end
20417
20418 !! test
20419 Free external link invading image caption
20420 !! wikitext
20421 [[Image:Foobar.jpg|thumb|http://x|hello]]
20422 !! html
20423 <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>
20424
20425 !! end
20426
20427 !! test
20428 Bug 15196: localised external link numbers
20429 !! options
20430 language=fa
20431 !! wikitext
20432 [http://en.wikipedia.org/]
20433 !! html/php
20434 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20435 </p>
20436 !! html/parsoid
20437 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20438 !! end
20439
20440 !! test
20441 Multibyte character in padleft
20442 !! wikitext
20443 {{padleft:-Hello|7|Æ}}
20444 !! html
20445 <p>Æ-Hello
20446 </p>
20447 !! end
20448
20449 !! test
20450 Multibyte character in padright
20451 !! wikitext
20452 {{padright:Hello-|7|Æ}}
20453 !! html
20454 <p>Hello-Æ
20455 </p>
20456 !! end
20457
20458 !!test
20459 formatdate parser function
20460 !! wikitext
20461 {{#formatdate:2009-03-24}}
20462 !! html
20463 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20464 </p>
20465 !! end
20466
20467 !!test
20468 formatdate parser function, with default format
20469 !! wikitext
20470 {{#formatdate:2009-03-24|mdy}}
20471 !! html
20472 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20473 </p>
20474 !! end
20475
20476 !! test
20477 Spacing of numbers in formatted dates
20478 !! wikitext
20479 {{#formatdate:January 15}}
20480 !! html
20481 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20482 </p>
20483 !! end
20484
20485 !! test
20486 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
20487 !! options
20488 language=nl title=[[MediaWiki:Common.css]]
20489 !! wikitext
20490 {{#formatdate:2009-03-24|dmy}}
20491 !! html
20492 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20493 </p>
20494 !! end
20495
20496 #
20497 #
20498 #
20499
20500 #
20501 # Edit comments
20502 #
20503
20504 !! test
20505 Edit comment with link
20506 !! options
20507 comment
20508 !! wikitext
20509 I like the [[Main Page]] a lot
20510 !! html/php
20511 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20512 !!end
20513
20514 !! test
20515 Edit comment with link and link text
20516 !! options
20517 comment
20518 !! wikitext
20519 I like the [[Main Page|best pages]] a lot
20520 !! html/php
20521 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20522 !!end
20523
20524 !! test
20525 Edit comment with link and link text with suffix
20526 !! options
20527 comment
20528 !! wikitext
20529 I like the [[Main Page|best page]]s a lot
20530 !! html/php
20531 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20532 !!end
20533
20534 !! test
20535 Edit comment with section link (non-local, eg in history list)
20536 !! options
20537 comment title=[[Main Page]]
20538 !! wikitext
20539 /* External links */ removed bogus entries
20540 !! html/php
20541 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20542 !!end
20543
20544 !! test
20545 Edit comment with section link and text before it (non-local, eg in history list)
20546 !! options
20547 comment title=[[Main Page]]
20548 !! wikitext
20549 pre-comment text /* External links */ removed bogus entries
20550 !! html/php
20551 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>
20552 !!end
20553
20554 !! test
20555 Edit comment with section link (local, eg in diff view)
20556 !! options
20557 comment local title=[[Main Page]]
20558 !! wikitext
20559 /* External links */ removed bogus entries
20560 !! html/php
20561 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20562 !!end
20563
20564 !! test
20565 Edit comment with subpage link (bug 14080)
20566 !! options
20567 comment
20568 subpage
20569 title=[[Subpage test]]
20570 !! wikitext
20571 Poked at a [[/subpage]] here...
20572 !! html/php
20573 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20574 !!end
20575
20576 !! test
20577 Edit comment with subpage link and link text (bug 14080)
20578 !! options
20579 comment
20580 subpage
20581 title=[[Subpage test]]
20582 !! wikitext
20583 Poked at a [[/subpage|neat little page]] here...
20584 !! html/php
20585 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20586 !!end
20587
20588 !! test
20589 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20590 !! options
20591 comment
20592 title=[[Subpage test]]
20593 !! wikitext
20594 Poked at a [[/subpage]] here...
20595 !! html/php
20596 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...
20597 !!end
20598
20599 !! test
20600 Edit comment with bare anchor link (local, as on diff)
20601 !! options
20602 comment
20603 local
20604 title=[[Main Page]]
20605 !! wikitext
20606 [[#section]]
20607 !! html/php
20608 <a href="#section">#section</a>
20609 !! end
20610
20611 !! test
20612 Edit comment with bare anchor link (non-local, as on history)
20613 !! options
20614 comment
20615 title=[[Main Page]]
20616 !! wikitext
20617 [[#section]]
20618 !! html/php
20619 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20620 !! end
20621
20622 !! test
20623 Anchor starting with underscore
20624 !! options
20625 title=[[Foo]]
20626 !! wikitext
20627 [[#_ref|One]]
20628 !! html/php
20629 <p><a href="#_ref">One</a>
20630 </p>
20631 !! html/parsoid
20632 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20633 !! end
20634
20635 !! test
20636 Id starting with underscore
20637 !! wikitext
20638 <div id="_ref"></div>
20639 !! html/*
20640 <div id="_ref"></div>
20641
20642 !! end
20643
20644 !! test
20645 Space normalisation on autocomment (bug 22784)
20646 !! options
20647 comment
20648 title=[[Main Page]]
20649 !! wikitext
20650 /* __hello__world__ */
20651 !! html/php
20652 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20653 !! end
20654
20655 !! test
20656 percent-encoding and + signs in comments (Bug 26410)
20657 !! options
20658 comment
20659 !! wikitext
20660 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20661 !! html/php
20662 <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>
20663 !! end
20664
20665 # Parsoid doesn't support this yet: see bug 73581
20666 # but it *should* omit the 'src' attribute if the image is bad.
20667 # PHP side of tests was disabled in
20668 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20669 # because of issues in the PHP parserTests infrastructure
20670 # (but the output below is indeed what the PHP side emits)
20671 !! test
20672 Bad images - basic functionality
20673 !! wikitext
20674 [[File:Bad.jpg]]
20675 !! DISABLED/html/php
20676 !! html/parsoid
20677 <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>
20678 !! end
20679
20680 !! test
20681 Bad images - bug 16039: text after bad image disappears
20682 !! wikitext
20683 Foo bar
20684 [[File:Bad.jpg]]
20685 Bar foo
20686 !! DISABLED/html/php
20687 <p>Foo bar
20688 </p><p>Bar foo
20689 </p>
20690 !! html/parsoid
20691 <p>Foo bar
20692 <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>
20693 Bar foo</p>
20694 !! end
20695
20696 !! test
20697 Verify that displaytitle works (bug #22501) no displaytitle
20698 !! options
20699 showtitle
20700 !! config
20701 wgAllowDisplayTitle=true
20702 wgRestrictDisplayTitle=false
20703 !! wikitext
20704 this is not the the title
20705 !! html/php
20706 Parser test
20707 <p>this is not the the title
20708 </p>
20709 !! end
20710
20711 !! test
20712 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20713 !! options
20714 showtitle
20715 title=[[Screen]]
20716 !! config
20717 wgAllowDisplayTitle=true
20718 wgRestrictDisplayTitle=false
20719 !! wikitext
20720 this is not the the title
20721 {{DISPLAYTITLE:whatever}}
20722 !! html/php
20723 whatever
20724 <p>this is not the the title
20725 </p>
20726 !! end
20727
20728 !! test
20729 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20730 !! options
20731 showtitle
20732 title=[[Screen]]
20733 !! config
20734 wgAllowDisplayTitle=true
20735 wgRestrictDisplayTitle=true
20736 !! wikitext
20737 this is not the the title
20738 {{DISPLAYTITLE:whatever}}
20739 !! html/php
20740 Screen
20741 <p>this is not the the title
20742 </p>
20743 !! end
20744
20745 !! test
20746 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20747 !! options
20748 showtitle
20749 title=[[Screen]]
20750 !! config
20751 wgAllowDisplayTitle=true
20752 wgRestrictDisplayTitle=true
20753 !! wikitext
20754 this is not the the title
20755 {{DISPLAYTITLE:screen}}
20756 !! html/php
20757 screen
20758 <p>this is not the the title
20759 </p>
20760 !! end
20761
20762 !! test
20763 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20764 !! options
20765 showtitle
20766 title=[[Screen]]
20767 !! config
20768 wgAllowDisplayTitle=false
20769 !! wikitext
20770 this is not the the title
20771 {{DISPLAYTITLE:screen}}
20772 !! html/php
20773 Screen
20774 <p>this is not the the title
20775 <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>
20776 </p>
20777 !! end
20778
20779 !! test
20780 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20781 !! options
20782 showtitle
20783 title=[[Screen]]
20784 !! config
20785 wgAllowDisplayTitle=false
20786 !! wikitext
20787 this is not the the title
20788 !! html/php
20789 Screen
20790 <p>this is not the the title
20791 </p>
20792 !! end
20793
20794 !! test
20795 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20796 !! options
20797 showtitle
20798 title=[[Screen]]
20799 !! config
20800 wgAllowDisplayTitle=true
20801 wgRestrictDisplayTitle=true
20802 !! wikitext
20803 this is not the the title
20804 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20805 !! html/php
20806 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20807 <p>this is not the the title
20808 </p>
20809 !! end
20810
20811 !! test
20812 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20813 !! options
20814 showtitle
20815 title=[[Screen]]
20816 !! config
20817 wgAllowDisplayTitle=true
20818 wgRestrictDisplayTitle=true
20819 !! wikitext
20820 this is not the the title
20821 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20822 !! html/php
20823 <span style="color: red;">s</span>creen
20824 <p>this is not the the title
20825 </p>
20826 !! end
20827
20828 !! test
20829 Page status indicators: Empty name is invalid
20830 !! options
20831 showindicators
20832 !! wikitext
20833 <indicator name=" "></indicator>
20834 <indicator></indicator>
20835 !! html
20836 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20837 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20838 </p>
20839 !! end
20840
20841 !! test
20842 Page status indicators: Weird syntaxes that are okay
20843 !! options
20844 showindicators
20845 !! wikitext
20846 <indicator name="empty" />
20847 <indicator name="name"></indicator>
20848 !! html
20849 empty=
20850 name=
20851 <p><br />
20852 </p>
20853 !! end
20854
20855 !! test
20856 Page status indicators: Torture test
20857 !! options
20858 showindicators
20859 !! wikitext
20860 <indicator name="01">hello world</indicator>
20861 <indicator name="02">[[Main Page]]</indicator>
20862 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20863 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20864 <indicator name="05">* foo
20865 * bar</indicator>
20866 <indicator name="06"><nowiki>foo</nowiki></indicator>
20867 <indicator name="07"> Preformatted</indicator>
20868 <indicator name="08"><div>Broken tag</indicator>
20869 <indicator name="09">{| class=wikitable
20870 | cell
20871 |}</indicator>
20872 <indicator name="10">Two
20873
20874 paragraphs</indicator>
20875 !! html
20876 01=hello world
20877 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20878 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" />
20879 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>
20880 05=<ul><li> foo</li>
20881 <li> bar</li></ul>
20882
20883 06=foo
20884 07=<pre>Preformatted
20885 </pre>
20886 08=<div>Broken tag</div>
20887
20888 09=<table class="wikitable">
20889 <tr>
20890 <td> cell
20891 </td></tr></table>
20892
20893 10=<p>Two
20894 </p><p>paragraphs
20895 </p>
20896 <p><br />
20897 </p><p><br />
20898 </p><p><br />
20899 </p><p><br />
20900 </p><p><br />
20901 </p>
20902 !! end
20903
20904 !! test
20905 preload: check <noinclude> and <includeonly>
20906 !! options
20907 preload
20908 !! wikitext
20909 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20910 !! html/php
20911 Hello kind world.
20912 !! end
20913
20914 !! test
20915 preload: check <onlyinclude>
20916 !! options
20917 preload
20918 !! wikitext
20919 Goodbye <onlyinclude>Hello world</onlyinclude>
20920 !! html/php
20921 Hello world
20922 !! end
20923
20924 !! test
20925 preload: can pass tags through if we want to
20926 !! options
20927 preload
20928 !! wikitext
20929 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20930 !! html/php
20931 <includeonly>Hello world</includeonly>
20932 !! end
20933
20934 !! test
20935 preload: check that it doesn't try to do tricks
20936 !! options
20937 preload
20938 !! wikitext
20939 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20940 !! html/php
20941 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20942 !! end
20943
20944 !! test
20945 Play a bit with r67090 and bug 3158
20946 !! wikitext
20947 <div style="width:50% !important">&nbsp;</div>
20948 <div style="width:50%&nbsp;!important">&nbsp;</div>
20949 <div style="width:50%&#160;!important">&nbsp;</div>
20950 <div style="border : solid;">&nbsp;</div>
20951 !! html/php
20952 <div style="width:50% !important">&#160;</div>
20953 <div style="width:50% !important">&#160;</div>
20954 <div style="width:50% !important">&#160;</div>
20955 <div style="border&#160;: solid;">&#160;</div>
20956
20957 !! html/parsoid
20958 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20959 <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>
20960 <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>
20961 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20962
20963 !! end
20964
20965 !! test
20966 HTML5 data attributes
20967 !! wikitext
20968 <span data-foo="bar">Baz</span>
20969 <p data-abc-def_hij="">Quuz</p>
20970 !! html/php
20971 <p><span data-foo="bar">Baz</span>
20972 </p>
20973 <p data-abc-def_hij="">Quuz</p>
20974
20975 !! html/parsoid
20976 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20977 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20978 !! end
20979
20980 !! test
20981 Strip reserved data attributes
20982 !! wikitext
20983 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20984 !! html/php
20985 <div data-ok="fred">d</div>
20986
20987 !! html/parsoid
20988 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
20989 !! end
20990
20991 !! test
20992 percent-encoding and + signs in internal links (Bug 26410)
20993 !! wikitext
20994 [[User:+%]] [[Page+title%]]
20995 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20996 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20997 [[%33%45]] [[%33%45+]]
20998 !! html/php
20999 <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>
21000 <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>
21001 <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>
21002 <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>
21003 </p>
21004 !! html/parsoid
21005 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
21006 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
21007 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
21008 <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>
21009 !! end
21010
21011 !! test
21012 Special characters in embedded file links (bug 27679)
21013 !! wikitext
21014 [[File:Contains & ampersand.jpg]]
21015 [[File:Does not exist.jpg|Title with & ampersand]]
21016 !! html/php
21017 <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>
21018 <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>
21019 </p>
21020 !! html/parsoid
21021 <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>
21022 <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>
21023 !! end
21024
21025 !! test
21026 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21027 !! wikitext
21028 Text&apos;s been normalized?
21029 !! html
21030 <p>Text&#39;s been normalized?
21031 </p>
21032 !! end
21033
21034 !! test
21035 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21036 !! wikitext
21037 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21038 !! html
21039 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21040 </p>
21041 !! end
21042
21043 !! test
21044 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21045 !! wikitext
21046 [http://www.example.org/ ideograms]
21047 !! html
21048 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21049 </p>
21050 !! end
21051
21052 !! test
21053 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21054 !! wikitext
21055 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21056 !! html
21057 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21058 </p>
21059 !! end
21060
21061 !! article
21062 Mediawiki:loop1
21063 !! text
21064 {{Identical|A}}
21065 !! endarticle
21066
21067 !! article
21068 Mediawiki:loop2
21069 !! text
21070 {{Identical|B}}
21071 !! endarticle
21072
21073 !! article
21074 Template:Identical
21075 !! text
21076 {{int:loop1}}
21077 {{int:loop2}}
21078 !! endarticle
21079
21080 !! test
21081 Bug 31098 Template which includes system messages which includes the template
21082 !! wikitext
21083 {{Identical}}
21084 !! html
21085 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21086 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21087 </p>
21088 !! end
21089
21090 !! test
21091 Bug31490 Turkish: ucfirst 'blah'
21092 !! options
21093 language=tr
21094 !! wikitext
21095 {{ucfirst:blah}}
21096 !! html
21097 <p>Blah
21098 </p>
21099 !! end
21100
21101 !! test
21102 Bug31490 Turkish: ucfirst 'ix'
21103 !! options
21104 language=tr
21105 !! wikitext
21106 {{ucfirst:ix}}
21107 !! html
21108 <p>İx
21109 </p>
21110 !! end
21111
21112 !! test
21113 Bug31490 Turkish: lcfirst 'BLAH'
21114 !! options
21115 language=tr
21116 !! wikitext
21117 {{lcfirst:BLAH}}
21118 !! html
21119 <p>bLAH
21120 </p>
21121 !! end
21122
21123 !! test
21124 Bug31490 Turkish: ucfırst (with a dotless i)
21125 !! options
21126 language=tr
21127 !! wikitext
21128 {{ucfırst:blah}}
21129 !! html
21130 <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>
21131 </p>
21132 !! end
21133
21134 !! test
21135 Bug31490 ucfırst (with a dotless i) with English language
21136 !! options
21137 language=en
21138 !! wikitext
21139 {{ucfırst:blah}}
21140 !! html
21141 <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>
21142 </p>
21143 !! end
21144
21145 !! test
21146 Bug 26375: TOC with italics
21147 !! options
21148 title=[[Main Page]]
21149 !! wikitext
21150 __TOC__
21151 == ''Lost'' episodes ==
21152 !! html
21153 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21154 <ul>
21155 <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>
21156 </ul>
21157 </div>
21158
21159 <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>
21160
21161 !! end
21162
21163 !! test
21164 Bug 26375: TOC with bold
21165 !! options
21166 title=[[Main Page]]
21167 !! wikitext
21168 __TOC__
21169 == '''should be bold''' then normal text ==
21170 !! html
21171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21172 <ul>
21173 <li class="toclevel-1 tocsection-1"><a href="#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>
21174 </ul>
21175 </div>
21176
21177 <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>
21178
21179 !! end
21180
21181 !! test
21182 Bug 33845: Headings become cursive in TOC when they contain an image
21183 !! options
21184 title=[[Main Page]]
21185 !! wikitext
21186 __TOC__
21187 == Image [[Image:foobar.jpg]] ==
21188 !! html
21189 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21190 <ul>
21191 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21192 </ul>
21193 </div>
21194
21195 <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>
21196
21197 !! end
21198
21199 !! test
21200 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21201 !! options
21202 title=[[Main Page]]
21203 !! wikitext
21204 __TOC__
21205 == <blockquote>Quote</blockquote> ==
21206 !! html
21207 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21208 <ul>
21209 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21210 </ul>
21211 </div>
21212
21213 <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>
21214
21215 !! html+tidy
21216 <p></p>
21217 <div id="toc" class="toc">
21218 <div id="toctitle">
21219 <h2>Contents</h2>
21220 </div>
21221 <ul>
21222 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21223 </ul>
21224 </div>
21225 <p></p>
21226 <h2><span class="mw-headline" id="Quote"></span></h2>
21227 <blockquote>
21228 <p><span class="mw-headline" id="Quote">Quote</span></p>
21229 </blockquote>
21230 <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>
21231 !! end
21232
21233 !! test
21234 Unclosed tags in TOC
21235 !! options
21236 title=[[Main Page]]
21237 !! wikitext
21238 __TOC__
21239 == Proof: 2 < 3 ==
21240 <small>Hanc marginis exiguitas non caperet.</small>
21241 QED
21242 !! html
21243 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21244 <ul>
21245 <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>
21246 </ul>
21247 </div>
21248
21249 <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>
21250 <p><small>Hanc marginis exiguitas non caperet.</small>
21251 QED
21252 </p>
21253 !! end
21254
21255 !! test
21256 Multiple tags in TOC
21257 !! wikitext
21258 __TOC__
21259 == <i>Foo</i> <b>Bar</b> ==
21260
21261 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21262 !! html
21263 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21264 <ul>
21265 <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>
21266 <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>
21267 </ul>
21268 </div>
21269
21270 <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>
21271 <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>
21272
21273 !! html+tidy
21274 <p></p>
21275 <div id="toc" class="toc">
21276 <div id="toctitle">
21277 <h2>Contents</h2>
21278 </div>
21279 <ul>
21280 <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>
21281 <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>
21282 </ul>
21283 </div>
21284 <p></p>
21285 <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>
21286 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21287 <blockquote>
21288 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21289 </blockquote>
21290 <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>
21291 !! end
21292
21293 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21294 # html5 tag parsing.
21295 !! test
21296 Tags with parameters in TOC
21297 !! options
21298 parsoid=wt2html
21299 !! wikitext
21300 __TOC__
21301 == <sup class="in-h2">Hello</sup> ==
21302
21303 == <sup class="a > b">Evilbye</sup> ==
21304 !! html/php
21305 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21306 <ul>
21307 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21308 <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>
21309 </ul>
21310 </div>
21311
21312 <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>
21313 <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>
21314
21315 !! html/parsoid
21316 <meta property="mw:PageProp/toc" />
21317 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21318
21319 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21320 !! end
21321
21322 !! test
21323 span tags with directionality in TOC
21324 !! wikitext
21325 __TOC__
21326 == <span dir="ltr">C++</span> ==
21327
21328 == <span dir="rtl">זבנג!</span> ==
21329
21330 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21331
21332 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21333
21334 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21335 !! html
21336 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21337 <ul>
21338 <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>
21339 <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>
21340 <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>
21341 <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>
21342 <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>
21343 </ul>
21344 </div>
21345
21346 <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>
21347 <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>
21348 <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>
21349 <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>
21350 <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>
21351
21352 !! end
21353
21354 !! test
21355 Bug 72884: bdi element in ToC
21356 !! wikitext
21357 __TOC__
21358 == <bdi>test</bdi> ==
21359 !! html
21360 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21361 <ul>
21362 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21363 </ul>
21364 </div>
21365
21366 <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>
21367
21368 !! end
21369
21370 # Note that the html output does not have the <p></p>, but the
21371 # html+tidy output *does*. This is because the empty <p></p> is
21372 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21373 !! test
21374 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21375 !! wikitext
21376 __TOC__
21377 == x ==
21378 !! html
21379 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21380 <ul>
21381 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21382 </ul>
21383 </div>
21384
21385 <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>
21386
21387 !! html+tidy
21388 <p></p>
21389 <div id="toc" class="toc">
21390 <div id="toctitle">
21391 <h2>Contents</h2>
21392 </div>
21393 <ul>
21394 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21395 </ul>
21396 </div>
21397 <p></p>
21398 <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>
21399 !! end
21400
21401 !! article
21402 MediaWiki:Bug32057
21403 !! text
21404 == {{int:headline_sample}} ==
21405 !! endarticle
21406
21407 !! test
21408 Bug 32057: Title needed when expanding <h> nodes.
21409 !! options
21410 title=[[Main Page]]
21411 !! wikitext
21412 {{int:Bug32057}}
21413 !! html
21414 <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>
21415
21416 !! end
21417
21418 !! test
21419 Strip marker in urlencode
21420 !! wikitext
21421 {{urlencode:x<nowiki/>y}}
21422 {{urlencode:x<nowiki/>y|wiki}}
21423 {{urlencode:x<nowiki/>y|path}}
21424 {{urlencode:x<pre id="one">two</pre>y}}
21425 !! html
21426 <p>xy
21427 xy
21428 xy
21429 xy
21430 </p>
21431 !! end
21432
21433 !! test
21434 Strip marker in lc
21435 !! wikitext
21436 {{lc:x<nowiki/>y}}
21437 !! html
21438 <p>xy
21439 </p>
21440 !! end
21441
21442 !! test
21443 Strip marker in uc
21444 !! wikitext
21445 {{uc:x<nowiki/>y}}
21446 !! html
21447 <p>XY
21448 </p>
21449 !! end
21450
21451 !! test
21452 Strip marker in formatNum
21453 !! wikitext
21454 {{formatnum:1<nowiki/>2}}
21455 {{formatnum:1<nowiki/>2|R}}
21456 !! html
21457 <p>12
21458 12
21459 </p>
21460 !! end
21461
21462 !! test
21463 Check noCommafy in formatNum
21464 !! options
21465 language=be-tarask
21466 !! wikitext
21467 {{formatnum:123456.78}}
21468 {{formatnum:123456.78|NOSEP}}
21469 !! html
21470 <p>123 456,78
21471 123456.78
21472 </p>
21473 !! end
21474
21475 !! test
21476 Wrong option for formatNum (bug 56199)
21477 !! wikitext
21478 {{formatnum:1,234.56|Random}}
21479 {{formatnum:1,234.56|EVERYTHING}}
21480 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21481 !! html
21482 <p>1,234.56
21483 1,234.56
21484 1,234.56
21485 </p>
21486 !! end
21487
21488 !! test
21489 Strip marker in grammar
21490 !! options
21491 language=fi
21492 !! wikitext
21493 {{grammar:elative|foo<nowiki/>bar}}
21494 !! html
21495 <p>foobarista
21496 </p>
21497 !! end
21498
21499 !! test
21500 Strip marker in padleft
21501 !! wikitext
21502 {{padleft:|2|x<nowiki/>y}}
21503 !! html
21504 <p>xy
21505 </p>
21506 !! end
21507
21508 !! test
21509 Strip marker in padright
21510 !! wikitext
21511 {{padright:|2|x<nowiki/>y}}
21512 !! html
21513 <p>xy
21514 </p>
21515 !! end
21516
21517 !! test
21518 Strip marker in anchorencode
21519 !! wikitext
21520 {{anchorencode:x<nowiki/>y}}
21521 !! html
21522 <p>xy
21523 </p>
21524 !! end
21525
21526 !! test
21527 nowiki inside link inside heading (bug 18295)
21528 !! wikitext
21529 ==[[foo|x<nowiki>y</nowiki>z]]==
21530 !! html
21531 <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>
21532
21533 !! end
21534
21535 !! test
21536 new support for bdi element (bug 31817)
21537 !! wikitext
21538 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21539 !! html
21540 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21541
21542 !!end
21543
21544 !! test
21545 Ignore pipe between table row attributes
21546 !! wikitext
21547 {|
21548 | quux
21549 |- id=foo | style='color: red'
21550 | bar
21551 |}
21552 !! html
21553 <table>
21554 <tr>
21555 <td> quux
21556 </td></tr>
21557 <tr id="foo" style="color: red">
21558 <td> bar
21559 </td></tr></table>
21560
21561 !! end
21562
21563 !!test
21564 Gallery override link with WikiLink (bug 34852)
21565 !! wikitext
21566 <gallery>
21567 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21568 </gallery>
21569 !! html
21570 <ul class="gallery mw-gallery-traditional">
21571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21572 <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>
21573 <div class="gallerytext">
21574 <p>caption
21575 </p>
21576 </div>
21577 </div></li>
21578 </ul>
21579
21580 !! end
21581
21582 !!test
21583 Gallery override link with absolute external link (bug 34852)
21584 !! wikitext
21585 <gallery>
21586 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21587 </gallery>
21588 !! html
21589 <ul class="gallery mw-gallery-traditional">
21590 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21591 <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>
21592 <div class="gallerytext">
21593 <p>caption
21594 </p>
21595 </div>
21596 </div></li>
21597 </ul>
21598
21599 !! end
21600
21601 !!test
21602 Gallery override link with malicious javascript (bug 34852)
21603 !! wikitext
21604 <gallery>
21605 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21606 </gallery>
21607 !! html
21608 <ul class="gallery mw-gallery-traditional">
21609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21610 <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>
21611 <div class="gallerytext">
21612 <p>caption
21613 </p>
21614 </div>
21615 </div></li>
21616 </ul>
21617
21618 !! end
21619
21620 !!test
21621 Gallery with invalid title as link (bug 43964)
21622 !! wikitext
21623 <gallery>
21624 File:foobar.jpg|link=<
21625 </gallery>
21626 !! html
21627 <ul class="gallery mw-gallery-traditional">
21628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21629 <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>
21630 <div class="gallerytext">
21631 </div>
21632 </div></li>
21633 </ul>
21634
21635 !! end
21636
21637 !!test
21638 Language parser function
21639 !! wikitext
21640 {{#language:ar}}
21641 !! html
21642 <p>العربية
21643 </p>
21644 !! end
21645
21646 !!test
21647 Padleft and padright as substr
21648 !! wikitext
21649 {{padleft:|3|abcde}}
21650 {{padright:|3|abcde}}
21651 !! html
21652 <p>abc
21653 abc
21654 </p>
21655 !! end
21656
21657 !!test
21658 Special parser function
21659 !! wikitext
21660 {{#special:RandomPage}}
21661 {{#special:BaDtItLe}}
21662 {{#special:Foobar}}
21663 !! html
21664 <p>Special:Random
21665 Special:Badtitle
21666 Special:Foobar
21667 </p>
21668 !! end
21669
21670 !!test
21671 Bug 34939 - Case insensitive link parsing ([HttP://])
21672 !! wikitext
21673 [HttP://MediaWiki.Org/]
21674 !! html/php
21675 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21676 </p>
21677 !! html/parsoid
21678 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21679 !! end
21680
21681 !!test
21682 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21683 !! wikitext
21684 [HttP://MediaWiki.Org/ MediaWiki]
21685 !! html
21686 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21687 </p>
21688 !! end
21689
21690 !!test
21691 Bug 34939 - Case insensitive link parsing (HttP://)
21692 !! wikitext
21693 HttP://MediaWiki.Org/
21694 !! html/php
21695 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21696 </p>
21697 !! html/parsoid
21698 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21699 !! end
21700
21701 !!test
21702 Disable TOC
21703 !! options
21704 notoc
21705 !! wikitext
21706 Lead
21707 == Section 1 ==
21708 == Section 2 ==
21709 == Section 3 ==
21710 == Section 4 ==
21711 == Section 5 ==
21712 !! html
21713 <p>Lead
21714 </p>
21715
21716 <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>
21717 <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>
21718 <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>
21719 <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>
21720 <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>
21721
21722 !! end
21723
21724
21725 ###
21726 ### Parsoid-specific tests
21727 ### Parsoid-PHP parser incompatibilities
21728 ###
21729 !!test
21730 1. SOL-sensitive wikitext tokens as template-args
21731 !!options
21732 parsoid=wt2html,wt2wt
21733 !! wikitext
21734 {{echo|*a}}
21735 {{echo|#a}}
21736 {{echo|:a}}
21737 !! html
21738 <span about="#mwt1" typeof="mw:Transclusion">
21739 </span><ul about="#mwt1"><li>a</li>
21740 </ul>
21741 <span about="#mwt2" typeof="mw:Transclusion">
21742 </span><ol about="#mwt2"><li>a</li>
21743 </ol>
21744 <span about="#mwt3" typeof="mw:Transclusion">
21745 </span><dl about="#mwt3"><dd>a</dd>
21746 </dl>
21747 !!end
21748
21749 #### -----------------------------------------------------------------
21750 #### Parsoid-specific functionality tests
21751 #### -----------------------------------------------------------------
21752
21753 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21754 # We know wt2wt will fail, but we expect selser to pass.
21755 # Due to the nature of our testing, wt2wt and selser tests will enter the
21756 # blacklist and we'll catch selser regressions based on changes to the
21757 # blacklist entries for selser tests.
21758 !! test
21759 1. Bad treebuilder fixup of formatting elt is cleaned up
21760 !! options
21761 parsoid=wt2html,wt2wt
21762 !! wikitext
21763 {|
21764 |
21765 <small>
21766 [[Image:Foobar.jpg|right|Test]]
21767 </small>
21768 |}
21769 !! html/parsoid
21770 <table>
21771 <tbody><tr><td>
21772 <small>
21773 <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>
21774 </small>
21775 </td></tr>
21776 </tbody></table>
21777 !! end
21778
21779 !! test
21780 2. Bad treebuilder fixup of formatting elt is cleaned up
21781 !! options
21782 parsoid=wt2html,wt2wt
21783 !! wikitext
21784 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21785
21786 <small>[[Image:Foobar.jpg|right|300px]]</small>
21787 !! html/parsoid
21788
21789 <p><b>foo</b></p>
21790 <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>
21791 <p><b>bar</b></p>
21792 <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>
21793 !! end
21794
21795 !! test
21796 3. Bad treebuilder fixup of formatting elt is cleaned up
21797 !! options
21798 parsoid=wt2html,wt2wt
21799 !! wikitext
21800 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21801 !! html/parsoid
21802 <p><small><b>foo</b></small></p>
21803 <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>
21804 <p><small><b>bar</b></small></p>
21805 !! end
21806
21807 !! test
21808 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21809 !! options
21810 parsoid=wt2html,wt2wt
21811 !! wikitext
21812 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21813 !! html/parsoid
21814 <p><b><small></small></b></p>
21815 <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>
21816 <p></p>
21817 !! end
21818
21819 #### ----------------------------------------------------------------
21820 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21821 #### tags. Parsoid's output for these tags differs from that of the
21822 #### PHP parser.
21823 #### ----------------------------------------------------------------
21824
21825 !!test
21826 Ref: 1. ref-location should be replaced with an index span
21827 !! wikitext
21828 A <ref>foo</ref>
21829 B <ref name="x">foo</ref>
21830 C <ref name="y" />
21831 <references />
21832 !! html/parsoid
21833 <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>
21834 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>
21835 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>
21836 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21837 <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>
21838 <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>
21839 <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>
21840 </ol>
21841 !!end
21842
21843 !!test
21844 Ref: 2. ref-tags with identical names should all get the same index
21845 !! wikitext
21846 A <ref name="x">foo</ref>
21847 B <ref name="x" />
21848 <references />
21849 !! html/parsoid
21850 <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>
21851 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>
21852 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21853 <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>
21854 </ol>
21855 !!end
21856
21857 !!test
21858 Ref: 3. spaces in ref-names should be ignored
21859 !! wikitext
21860 A <ref name="x">foo</ref>
21861 B <ref name=" x " />
21862 C <ref name= x />
21863 <references />
21864 !! html/parsoid
21865 <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>
21866 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>
21867 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>
21868 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21869 <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>
21870 </ol>
21871 !!end
21872
21873 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21874 !!test
21875 Ref: 4. 'constructor' should be accepted as a valid ref-name
21876 !! wikitext
21877 A <ref name="constructor">foo</ref>
21878 <references />
21879 !! html/parsoid
21880 <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>
21881 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21882 <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>
21883 </ol>
21884 !!end
21885
21886 !!test
21887 Ref: 5. body should accept generic wikitext
21888 !! wikitext
21889 A <ref>
21890 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21891 </ref>
21892
21893 <references />
21894 !! html/parsoid
21895 <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>
21896
21897 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21898 <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>
21899 </span></li>
21900 </ol>
21901 !!end
21902
21903 !!test
21904 Ref: 6. indent-pres should not be output in ref-body
21905 !! wikitext
21906 A <ref>
21907 foo
21908 bar
21909 baz
21910 </ref>
21911
21912 <references />
21913 !! html/parsoid
21914 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21915
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21917 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21918 bar
21919 baz
21920 </span></li>
21921 </ol>
21922 !!end
21923
21924 !!test
21925 Ref: 7. No p-wrapping in ref-body
21926 !! wikitext
21927 A <ref>
21928 foo
21929
21930 bar
21931
21932
21933 baz
21934
21935
21936
21937 booz
21938 </ref>
21939
21940 <references />
21941 !! html/parsoid
21942 <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>
21943
21944 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21945 <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
21946
21947 bar
21948
21949
21950 baz
21951
21952
21953
21954 booz
21955 </span></li>
21956 </ol>
21957 !!end
21958
21959 !!test
21960 Ref: 8. transclusion wikitext has lower precedence
21961 !! wikitext
21962 A <ref> foo {{echo|</ref> B C}}
21963
21964 <references />
21965 !! html/parsoid
21966 <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>
21967 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21968 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
21969 </ol>
21970 !!end
21971
21972 !!test
21973 Ref: 9. unclosed comments should not leak out of ref-body
21974 !! wikitext
21975 A <ref> foo <!--</ref> B C
21976 <references />
21977 !! html/parsoid
21978 <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>
21979 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21980 <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>
21981 </ol>
21982 !!end
21983
21984 !!test
21985 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21986 !! wikitext
21987 A <ref> <b> foo </ref> B C
21988
21989 <references />
21990 !! html/parsoid
21991 <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>
21992
21993
21994 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21995 <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>
21996 </ol>
21997 !!end
21998
21999 !!test
22000 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22001 !! wikitext
22002 A <ref>foo</ref> B
22003 C <ref>bar</ref> D
22004 <references />
22005 !! html/parsoid
22006 <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
22007 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>
22008 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22009 <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>
22010 <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>
22011 </ol>
22012 !!end
22013
22014 !!test
22015 Ref: 12. ref-tags act as trailing newline migration barrier
22016 !! wikitext
22017 <!--the newline at the end of this line moves out of the p tag-->a
22018
22019 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22020 <ref />
22021
22022 c
22023 <references />
22024 !! html/parsoid
22025 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22026
22027
22028 <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>
22029 <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>
22030
22031 <p>c</p>
22032 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22033 <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>
22034 <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>
22035 !!end
22036
22037 !!test
22038 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22039 !! wikitext
22040 <ref>foo</ref> A
22041 <ref>bar
22042 </ref> B
22043 <references />
22044 !! html/parsoid
22045 <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
22046 <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>
22047 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22048 <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>
22049 <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
22050 </span></li>
22051 </ol>
22052 !!end
22053
22054 !!test
22055 Ref: 14. A nested ref-tag should be emitted as plain text
22056 !! wikitext
22057 <ref>foo <ref>bar</ref> baz</ref>
22058
22059 <references />
22060 !! html/parsoid
22061 <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>
22062 </p>
22063 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22064 <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>
22065 </ol>
22066 !!end
22067
22068 !!test
22069 Ref: 15. ref-tags with identical names should get identical indexes
22070 !! wikitext
22071 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22072 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22073
22074 <references />
22075 !! html/parsoid
22076 <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>
22077 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>
22078
22079 <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>
22080 </ol>
22081 !!end
22082
22083 ## We don't bother wt2wt-ing non-standard whitespace
22084 !!test
22085 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22086 !!options
22087 parsoid=wt2html
22088 !! wikitext
22089 A <ref >foo</ref >
22090
22091 <references />
22092 !! html/parsoid
22093 <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>
22094 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22095 <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>
22096 !!end
22097
22098 !!test
22099 Ref: 17. Generate valid HTML5 id/about attributes
22100 !!wikitext
22101 <ref name="a b">foo</ref>
22102
22103 <references />
22104 !!html/parsoid
22105 <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>
22106 </p>
22107
22108 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22109 <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>
22110 </ol>
22111 !!end
22112
22113 !!test
22114 Ref: 18. T58916: Extension attributes should be parsed as plain text
22115 !!wikitext
22116 <ref name="{{echo|a}}">foo</ref>
22117
22118 <references />
22119 !!html/parsoid
22120 <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>
22121 </p>
22122
22123 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22124 <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>
22125 </ol>
22126 !!end
22127
22128 !!test
22129 Ref: 19. ref-tags with identical name encodings should get identical indexes
22130 !! wikitext
22131 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22132
22133 <references />
22134 !! html/parsoid
22135 <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>
22136 </p>
22137 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22138 <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>
22139 </ol>
22140 !!end
22141
22142 !!test
22143 Ref: 20. ref-tags with identical names but different content should keep it
22144 !! wikitext
22145 A <ref name="foo">Foo one</ref>
22146 B <ref name="foo">Foo two</ref>
22147 C <ref name="foo" />
22148
22149 <references />
22150 !! html/parsoid
22151 <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>
22152 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>
22153 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>
22154
22155 <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>
22156 </ol>
22157 !!end
22158
22159 !!test
22160 References: 1. references tag without any refs should be handled properly
22161 !! wikitext
22162 <references />
22163 !! html/parsoid
22164 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22165 !!end
22166
22167 !!test
22168 References: 2. references tag with group only outputs references from that group
22169 !! wikitext
22170 A <ref group="a">foo</ref>
22171 B <ref group="b">bar</ref>
22172 C <ref>baz</ref>
22173
22174 <references group="a" />
22175 <references />
22176 <references group="b" />
22177 !! html/parsoid
22178 <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>
22179 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>
22180 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>
22181
22182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22183 <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>
22184 </ol>
22185 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22186 <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>
22187 </ol>
22188 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22189 <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>
22190 </ol>
22191 !!end
22192
22193 !!test
22194 References: 3. ref list should be cleared after processing references
22195 !! wikitext
22196 A <ref>foo</ref>
22197
22198 <references />
22199
22200 B <ref>bar</ref>
22201
22202 <references />
22203 !! html/parsoid
22204 <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>
22205
22206 <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>
22207 </ol>
22208
22209 <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>
22210
22211 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22212 <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>
22213 </ol>
22214 !!end
22215
22216 !!test
22217 References: 4. only referenced group should be cleared after processing references
22218 !! wikitext
22219 A <ref group="a">afoo</ref>
22220 B <ref>bfoo</ref>
22221
22222 <references group="a" />
22223
22224 C <ref>cfoo</ref>
22225
22226 <references />
22227 !! html/parsoid
22228 <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>
22229 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>
22230
22231 <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>
22232 </ol>
22233
22234 <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>
22235
22236 <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>
22237 </ol>
22238 !!end
22239
22240 ## Don't expect this to rt since we're dropping content
22241 !! test
22242 References: 5. ref tags in references should be processed while ignoring all other content
22243 !! options
22244 parsoid=wt2html,html2html
22245 !! wikitext
22246 A <ref name="a" />
22247 B <ref name="b">bar</ref>
22248
22249 <references>
22250 <ref name="a">foo</ref>
22251 This should just get lost.
22252 </references>
22253 !! html/parsoid
22254 <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>
22255 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>
22256
22257
22258 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22259 </ol>
22260 !! end
22261
22262 !! test
22263 References: 6. <references /> from a transclusion
22264 !! wikitext
22265 <ref>Foo</ref> {{echo|<references />}}
22266 !! html/parsoid
22267 <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>
22268 </ol>
22269 !! end
22270
22271 !! test
22272 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22273 !! wikitext
22274 A <ref>foo bar for a</ref>
22275 B <ref group="X" name="b" />
22276
22277 <references />
22278
22279 <references group="X">
22280 <ref name="b">foo</ref>
22281 </references>
22282 !! html/parsoid
22283 <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>
22284 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>
22285 </p>
22286
22287 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22288 <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>
22289 </ol>
22290
22291 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22292 <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>
22293 </ol>
22294 !! end
22295
22296 !! test
22297 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22298 !! wikitext
22299 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22300 <references />
22301 !! html/parsoid
22302 <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>
22303 <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>
22304 </ol>
22305 !!end
22306
22307 # This test only works in wt2html now as the <references /> are always generated
22308 # unless selser is active. Once T72722 is fixed, we should add a changes test
22309 # here to ensure that unrelated changes don't add the new <references />
22310 # when selser is active.
22311 !! test
22312 References: 9. Generate missing references list at the end
22313 !! wikitext
22314 A <ref>foo</ref>
22315 B <ref group="inexistent">bar</ref>
22316 !! html/parsoid
22317 <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>
22318 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22319 <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>
22320 </ol>
22321 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22322 <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>
22323 </ol>
22324 !! end
22325
22326 !! test
22327 References: 10. New <references/> shouldn't be added for unrelated edits.
22328 !! options
22329 parsoid={
22330 "modes": ["selser"],
22331 "changes": [["#x", "remove"]],
22332 "selser": "noauto"
22333 }
22334 !! wikitext
22335 Unrelated text<span id="x"> that's going to disappear</span>.
22336 A <ref>foo</ref>
22337 !! wikitext/edited
22338 Unrelated text.
22339 A <ref>foo</ref>
22340 !!end
22341
22342 !! test
22343 Entities in ref name
22344 !! wikitext
22345 <ref name="test &amp; me">hi</ref>
22346 <references />
22347 !! html/parsoid
22348 <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>
22349 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22350 <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>
22351 </ol>
22352 !! end
22353
22354 ## The output here may look funny, but it's what the php parser will do. The
22355 ## unclosed references tag becomes escaped text, and then a new references
22356 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22357 ## nowiki tags, and the auto-generated references tag is only dropped in
22358 ## rtTestMode.
22359 !! test
22360 Generate references for unclosed references tag
22361 !! options
22362 parsoid=wt2html
22363 !! wikitext
22364 a<ref>foo</ref>
22365
22366 <references>
22367 !! html/parsoid
22368 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22369
22370 <p>&lt;references></p>
22371 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22372 !! end
22373
22374 !! test
22375 New reference serializes on its own line
22376 !! options
22377 parsoid=wt2wt,html2wt
22378 !! wikitext
22379 foo
22380 <references />
22381 !! html/parsoid
22382 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22383 !! end
22384
22385 #### ----------------------------------------------------------------
22386 #### Parsoid-only testing of Parsoid's impl of LST
22387 #### Not implemented yet, see
22388 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22389 #### ----------------------------------------------------------------
22390
22391 !! test
22392 LST Sections: 1. Simple section start and end
22393 !! options
22394 parsoid={ "suppressErrors": true }
22395 !! wikitext
22396 <section begin="2011-05-16" />
22397 <section end="2014-04-10 (MW 1.23wmf22)" />
22398 !! html/parsoid
22399 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22400 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22401 !! end
22402
22403 #--------- Test stripping of empty nodes in template content ----------
22404 !!test
22405 Empty LI and TR nodes should be stripped from template content
22406 !!wikitext
22407 {{EmptyLITest}}
22408 {{EmptyTRTest}}
22409 !!html/parsoid
22410 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22411 <li>a</li>
22412 <li>b</li>
22413 </ul>
22414 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22415 <tbody>
22416 <tr>
22417 <td>foo</td>
22418 </tr>
22419 <tr>
22420 <td>bar</td>
22421 </tr>
22422 </tbody>
22423 </table>
22424 !!end
22425
22426 !!test
22427 Empty LI and TR nodes should not be stripped from top-level content
22428 !!wikitext
22429 * a
22430 *
22431 * b
22432 {|
22433 |-
22434 |-
22435 |foo
22436 |}
22437 !!html/parsoid
22438 <ul>
22439 <li> a</li>
22440 <li></li>
22441 <li> b</li>
22442 </ul>
22443 <table>
22444 <tbody>
22445 <tr></tr>
22446 <tr>
22447 <td>foo</td>
22448 </tr>
22449 </tbody>
22450 </table>
22451 !!end
22452
22453 !!test
22454 Empty TR nodes should not be stripped if they have any attributes set
22455 !!wikitext
22456 {{EmptyTRWithHTMLAttrTest}}
22457 !!html/parsoid
22458 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22459 <tr align="center"></tr>
22460 <tr><td>foo</td></tr>
22461 <tr align="center"></tr>
22462 <tr><td>bar</td></tr>
22463 </table>
22464 !!end
22465
22466 #### ----------------------------------------------------------------
22467 #### The following section of tests are primarily to test
22468 #### wikitext escaping capabilities of Parsoid. Given that
22469 #### escaping can be done any number of ways, the wikitext (input)
22470 #### is always adjusted to reflect how Parsoid adds nowiki
22471 #### escape tags.
22472 ####
22473 #### We are marking several tests as parsoid-only since the
22474 #### HTML in the result section is different from what the
22475 #### PHP parser generates for it.
22476 #### ----------------------------------------------------------------
22477
22478
22479 #### --------------- Headings ---------------
22480 #### 0. Unnested
22481 #### 1. Nested inside html <h1>=foo=</h1>
22482 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22483 #### 3. Nested inside html with wikitext split by html tags
22484 #### 4. No escape needed
22485 #### 5. Empty headings <h1></h1>
22486 #### 6. Heading chars in SOL context
22487 #### ----------------------------------------
22488 !! test
22489 Headings: 0. Unnested
22490 !! options
22491 parsoid=html2wt
22492 !! html/parsoid
22493 <p>=foo=</p>
22494
22495 <p> =foo=
22496 <!--cmt-->
22497 =foo=</p>
22498
22499 <p>=foo<i>a</i>=</p>
22500 !! wikitext
22501 <nowiki>=foo=</nowiki>
22502
22503 <nowiki> </nowiki>=foo=
22504 <!--cmt-->
22505 <nowiki>=foo=</nowiki>
22506
22507 =foo''a''<nowiki>=</nowiki>
22508 !!end
22509
22510 # New headings and existing headings are handled differently
22511 !! test
22512 Headings: 1. Nested inside html
22513 !! options
22514 parsoid=html2wt
22515 !! html/parsoid
22516 <h1>=foo=</h1>
22517 <h2>=foo=</h2>
22518 <h3>=foo=</h3>
22519
22520 <h1 data-parsoid=''>=foo=</h1>
22521 <h2 data-parsoid=''>=foo=</h2>
22522 <h3 data-parsoid=''>=foo=</h3>
22523 <h4 data-parsoid=''>=foo=</h4>
22524 <h5 data-parsoid=''>=foo=</h5>
22525 <h6 data-parsoid=''>=foo=</h6>
22526 !! wikitext
22527 = =foo= =
22528
22529 == =foo= ==
22530
22531 === =foo= ===
22532
22533 =<nowiki>=foo=</nowiki>=
22534 ==<nowiki>=foo=</nowiki>==
22535 ===<nowiki>=foo=</nowiki>===
22536 ====<nowiki>=foo=</nowiki>====
22537 =====<nowiki>=foo=</nowiki>=====
22538 ======<nowiki>=foo=</nowiki>======
22539
22540 !!end
22541
22542 !! test
22543 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22544 !! options
22545 parsoid=html2wt
22546 !! html/parsoid
22547 <h1>foo</h1>*bar
22548 <h1>foo</h1>=bar
22549 <h1>foo</h1>=bar=
22550 !! wikitext
22551 = foo =
22552 <nowiki>*</nowiki>bar
22553
22554 = foo =
22555 =bar
22556
22557 = foo =
22558 <nowiki>=bar=</nowiki>
22559 !!end
22560
22561 !! test
22562 Headings: 3. Nested inside html with wikitext split by html tags
22563 !! options
22564 parsoid=html2wt
22565 !! html/parsoid
22566 <h1>=<b>bold</b>foo=</h1>
22567 !! wikitext
22568 = ='''bold'''foo= =
22569 !!end
22570
22571 !! test
22572 Headings: 4a. No escaping needed (testing just h1 and h2)
22573 !! options
22574 parsoid=html2wt
22575 !! html/parsoid
22576 <h1>=foo</h1>
22577 <h1>foo=</h1>
22578 <h1> =foo= </h1>
22579 <h1>=foo= bar</h1>
22580 <h2>=foo</h2>
22581 <h2>foo=</h2>
22582 <h1>=</h1>
22583 <h1><i>=</i>foo=</h1>
22584 !! wikitext
22585 = =foo =
22586
22587 = foo= =
22588
22589 = =foo= =
22590
22591 = =foo= bar =
22592
22593 == =foo ==
22594
22595 == foo= ==
22596
22597 = = =
22598
22599 = ''=''foo= =
22600 !!end
22601
22602 !! test
22603 Headings: 4b. No escaping needed (inside p-tags)
22604 !! options
22605 parsoid=html2wt
22606 !! html/parsoid
22607 <p>===
22608 =foo= x
22609 =foo= <s></s>
22610 </p>
22611 !! wikitext
22612 ===
22613 =foo= x
22614 =foo= <s></s>
22615 !!end
22616
22617 !! test
22618 Headings: 5. Empty headings
22619 !! options
22620 parsoid=html2wt
22621 !! html/parsoid
22622 <h1 data-parsoid='{}'></h1>
22623
22624 <h2 data-parsoid='{}'></h2>
22625
22626 <h3 data-parsoid='{}'></h3>
22627
22628 <h4 data-parsoid='{}'></h4>
22629
22630 <h5 data-parsoid='{}'></h5>
22631
22632 <h6 data-parsoid='{}'></h6>
22633 !! wikitext
22634 =<nowiki/>=
22635
22636 ==<nowiki/>==
22637
22638 ===<nowiki/>===
22639
22640 ====<nowiki/>====
22641
22642 =====<nowiki/>=====
22643
22644 ======<nowiki/>======
22645 !!end
22646
22647 !! test
22648 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22649 !! options
22650 parsoid=html2wt
22651 !! html/parsoid
22652 <p>=a=</p>
22653
22654 <p>=a=</p>
22655
22656 <p>=a=</p>
22657 !! wikitext
22658 <nowiki>=a=</nowiki>
22659
22660 <nowiki>=a=</nowiki>
22661
22662 <nowiki>=a=</nowiki>
22663 !!end
22664
22665 !! test
22666 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22667 !! options
22668 parsoid=html2wt
22669 !! html/parsoid
22670 <p>=a=
22671 b</p>
22672
22673 <p>=a=
22674 b</p>
22675
22676 <p>=a=
22677 b</p>
22678 !! wikitext
22679 <nowiki>=a=</nowiki>
22680 b
22681
22682 <nowiki>=a=</nowiki>
22683 b
22684
22685 <nowiki>=a=</nowiki>
22686 b
22687 !!end
22688
22689 !! test
22690 Headings: 6c. Heading chars in SOL context (leading newline break)
22691 !! options
22692 parsoid=html2wt
22693 !! html/parsoid
22694 <p>a
22695 =b=</p>
22696 !! wikitext
22697 a
22698 <nowiki>=b=</nowiki>
22699 !!end
22700
22701 !! test
22702 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22703 !! options
22704 parsoid=html2wt
22705 !! html/parsoid
22706 <!--c0--><p>=a=</p>
22707
22708 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22709 !! wikitext
22710 <!--c0--><nowiki>=a=</nowiki>
22711
22712 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22713 !!end
22714
22715 !! test
22716 Headings: 6d. Heading chars in SOL context (No escaping needed)
22717 !! options
22718 parsoid=html2wt
22719 !! html/parsoid
22720 =a=<div>b</div>
22721 !! wikitext
22722 =a=<div>b</div>
22723 !!end
22724
22725 !! test
22726 Headings: 7. Insert a newline between new content and headings
22727 !! options
22728 parsoid=html2wt
22729 !! html/parsoid
22730 <h2>NEW</h2>
22731 <p>new</p>
22732 <h2 data-parsoid='{}'>A</h2>
22733 <p data-parsoid='{}'>a</p>
22734 !! wikitext
22735 == NEW ==
22736 new
22737
22738 ==A==
22739 a
22740
22741 !! end
22742
22743 #### --------------- Lists ---------------
22744 #### 0. Outside nests (*foo, etc.)
22745 #### 1. Nested inside html <ul><li>*foo</li></ul>
22746 #### 2. Inside definition lists
22747 #### 3. Only bullets at start should be escaped
22748 #### 4. No escapes needed
22749 #### 5. No unnecessary escapes
22750 #### 6. Escape bullets in SOL position
22751 #### 7. Escape bullets in a multi-line context
22752 #### ----------------------------------------
22753
22754 !! test
22755 Lists: 0. Outside nests
22756 !! options
22757 parsoid=html2wt
22758 !! html/parsoid
22759 <p>*foo</p>
22760
22761 <p>#foo</p>
22762
22763 <p>;Foo:bar</p>
22764 !! wikitext
22765 <nowiki>*</nowiki>foo
22766
22767 <nowiki>#</nowiki>foo
22768
22769 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22770 !!end
22771
22772 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22773 ## to test wikitext escaping, and insignificant whitespace diffs
22774 ## cause PHP parser tests to barf
22775 !! test
22776 Lists: 1. Nested inside html (No unnecessary escapes)
22777 !! options
22778 parsoid=html2wt
22779 !! html/parsoid
22780 <ul>
22781 <li>*foo</li>
22782 <li>#foo</li>
22783 <li>:foo</li>
22784 <li>;foo</li>
22785 <li data-parsoid='{}'>*foo</li>
22786 <li data-parsoid='{}'>#foo</li>
22787 <li data-parsoid='{}'>:foo</li>
22788 <li data-parsoid='{}'>;foo</li>
22789 </ul>
22790
22791 <ol>
22792 <li>*foo</li>
22793 <li>#foo</li>
22794 <li>:foo</li>
22795 <li>;foo</li>
22796 <li data-parsoid='{}'>*foo</li>
22797 <li data-parsoid='{}'>#foo</li>
22798 <li data-parsoid='{}'>:foo</li>
22799 <li data-parsoid='{}'>;foo</li>
22800 </ol>
22801 !! wikitext
22802 * *foo
22803 * #foo
22804 * :foo
22805 * ;foo
22806 *<nowiki>*foo</nowiki>
22807 *<nowiki>#foo</nowiki>
22808 *<nowiki>:foo</nowiki>
22809 *<nowiki>;foo</nowiki>
22810
22811 # *foo
22812 # #foo
22813 # :foo
22814 # ;foo
22815 #<nowiki>*foo</nowiki>
22816 #<nowiki>#foo</nowiki>
22817 #<nowiki>:foo</nowiki>
22818 #<nowiki>;foo</nowiki>
22819 !!end
22820
22821 !! test
22822 Lists: 2. Inside definition lists
22823 !! options
22824 parsoid=html2wt
22825 !! html/parsoid
22826 <dl><dt>;foo</dt></dl>
22827 <dl><dt>:foo</dt></dl>
22828 <dl><dt>:foo</dt>
22829 <dd>bar</dd></dl>
22830 <dl><dd>:foo</dd></dl>
22831 !! wikitext
22832 ; ;foo
22833
22834 ; <nowiki>:foo</nowiki>
22835
22836 ; <nowiki>:foo</nowiki>
22837 : bar
22838
22839 : :foo
22840 !!end
22841
22842 !! test
22843 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22844 !! options
22845 parsoid=html2wt
22846 !! html/parsoid
22847 <ul>
22848 <li>*foo*bar</li>
22849 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22850 </ul>
22851 !! wikitext
22852 * *foo*bar
22853 *<nowiki>*foo</nowiki>''it''*bar
22854 !!end
22855
22856 !! test
22857 Lists: 4. No escapes needed
22858 !! options
22859 parsoid=html2wt
22860 !! html/parsoid
22861 <ul>
22862 <li>foo*bar
22863 </li>
22864 </ul>
22865 <ul>
22866 <li><i>foo</i>*bar
22867 </li>
22868 </ul>
22869 <ul>
22870 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22871 </li>
22872 </ul>
22873 <ul>
22874 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22875 </li>
22876 </ul>
22877 !! wikitext
22878 *foo*bar
22879
22880 *''foo''*bar
22881
22882 *[[Foo]]: bar
22883
22884 *[[Foo]]*bar
22885 !!end
22886
22887 !! test
22888 Lists: 5. No unnecessary escapes
22889 !! options
22890 parsoid=html2wt
22891 !! html/parsoid
22892 <ul><li> bar <span>[[foo]]</span></li></ul>
22893 <ul><li> =bar <span>[[foo]]</span></li></ul>
22894 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22895 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22896 <ul><li> =bar <span>foo]]</span>=</li></ul>
22897 <ul><li> <s></s>: a</li></ul>
22898 <ul><li> <i>* foo</i></li></ul>
22899
22900 !! wikitext
22901 * bar <span><nowiki>[[foo]]</nowiki></span>
22902
22903 * =bar <span><nowiki>[[foo]]</nowiki></span>
22904
22905 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22906
22907 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22908
22909 * =bar <span>foo]]</span>=
22910
22911 * <s></s>: a
22912
22913 * ''* foo''
22914 !!end
22915
22916 !! test
22917 Lists: 6. Escape bullets in SOL position
22918 !! options
22919 parsoid=html2wt
22920 !! html/parsoid
22921 <p><!--cmt-->*foo</p>
22922 !! wikitext
22923 <!--cmt--><nowiki>*</nowiki>foo
22924 !!end
22925
22926 !! test
22927 Lists: 7. Escape bullets in a multi-line context
22928 !! options
22929 parsoid=html2wt
22930 !! html/parsoid
22931 <p>a
22932 *b
22933 </p>
22934 !! wikitext
22935 a
22936 <nowiki>*</nowiki>b
22937 !!end
22938
22939 !! test
22940 Lists: 8. Escape colons only if not present in tags
22941 !! options
22942 parsoid=html2wt
22943 !! html/parsoid
22944 <dl><dt>a:b<i>c:d</i></dt></dl>
22945 !! wikitext
22946 ; <nowiki>a:b</nowiki>''c:d''
22947 !! end
22948
22949 #### --------------- HRs ---------------
22950 #### 1. Single line
22951 #### -----------------------------------
22952
22953 !! test
22954 HRs: 1. Single line
22955 !! options
22956 parsoid=html2wt
22957 !! html/parsoid
22958 <hr />----
22959 <hr />=foo=
22960 <hr />*foo
22961 !! wikitext
22962 ----<nowiki>----</nowiki>
22963 ----=foo=
22964 ----*foo
22965 !! end
22966
22967 #### --------------- Tables ---------------
22968 #### 1a. Simple example
22969 #### 1b. No escaping needed (!foo)
22970 #### 1c. No escaping needed (|foo)
22971 #### 1d. No escaping needed (|}foo)
22972 ####
22973 #### 2a. Nested in td (<td>foo|bar</td>)
22974 #### 2b. Nested in td (<td>foo||bar</td>)
22975 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22976 ####
22977 #### 3a. Nested in th (<th>foo!bar</th>)
22978 #### 3b. Nested in th (<th>foo!!bar</th>)
22979 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22980 ####
22981 #### 4a. Escape -
22982 #### 4b. Escape +
22983 #### 4c. No escaping needed
22984 #### --------------------------------------
22985
22986 !! test
22987 Tables: 1a. Simple example
22988 !! options
22989 parsoid=html2wt
22990 !! html/parsoid
22991 <p>{|
22992 |}
22993 </p>
22994 !! wikitext
22995 <nowiki>{|</nowiki>
22996 |}
22997 !! end
22998
22999 !! test
23000 Tables: 1b. No escaping needed
23001 !! options
23002 parsoid=html2wt
23003 !! html/parsoid
23004 <p>!foo
23005 </p>
23006 !! wikitext
23007 !foo
23008 !! end
23009
23010 !! test
23011 Tables: 1c. No escaping needed
23012 !! options
23013 parsoid=html2wt
23014 !! html/parsoid
23015 <p>|foo
23016 </p>
23017 !! wikitext
23018 |foo
23019 !! end
23020
23021 !! test
23022 Tables: 1d. No escaping needed
23023 !! options
23024 parsoid=html2wt
23025 !! html/parsoid
23026 <p>|}foo
23027 </p>
23028 !! wikitext
23029 |}foo
23030 !! end
23031
23032 !! test
23033 Tables: 2a. Nested in td
23034 !! options
23035 parsoid=html2wt
23036 !! html/parsoid
23037 <table><tbody><tr>
23038 <td>foo|bar</td></tr>
23039 <tr><td>x<div>a|b</div></td>
23040 </tbody></table>
23041 !! wikitext
23042 {|
23043 |<nowiki>foo|bar</nowiki>
23044 |-
23045 |x<div><nowiki>a|b</nowiki></div>
23046 |}
23047 !! html/php+tidy
23048 <table>
23049 <tr>
23050 <td>foo|bar</td>
23051 </tr>
23052 <tr>
23053 <td>x
23054 <div>a|b</div>
23055 </td>
23056 </tr>
23057 </table>
23058 !! end
23059
23060 !! test
23061 Tables: 2b. Nested in td
23062 !! options
23063 parsoid=html2wt
23064 !! html/parsoid
23065 <table><tbody><tr>
23066 <td>foo||bar</td>
23067 <td>a<i>b||c</i></td>
23068 <td>a<i><div>b||c</div></i></td>
23069 </tr></tbody></table>
23070 !! wikitext
23071 {|
23072 |<nowiki>foo||bar</nowiki>
23073 |a''<nowiki>b||c</nowiki>''
23074 |a''<div><nowiki>b||c</nowiki></div>''
23075 |}
23076 !! html/php
23077 <table>
23078 <tr>
23079 <td>foo||bar
23080 </td>
23081 <td>a<i>b||c</i>
23082 </td>
23083 <td>a<i><div>b||c</div></i>
23084 </td></tr></table>
23085
23086 !! end
23087
23088 !! test
23089 Tables: 2c. Nested in td -- no escaping needed
23090 !! options
23091 parsoid=html2wt
23092 !! html/*
23093 <table>
23094
23095 <tr>
23096 <td>foo!!bar
23097 </td></tr></table>
23098
23099 !! wikitext
23100 {|
23101
23102 |foo!!bar
23103 |}
23104 !! end
23105
23106 !! test
23107 Tables: 3a. Nested in th
23108 !! options
23109 parsoid=html2wt
23110 !! html/*
23111 <table>
23112
23113 <tr>
23114 <th>foo!bar
23115 </th></tr></table>
23116
23117 !! wikitext
23118 {|
23119
23120 !foo!bar
23121 |}
23122 !! end
23123
23124 !! test
23125 Tables: 3b. Nested in th
23126 !! options
23127 parsoid=html2wt
23128 !! html/parsoid
23129 <table><tbody>
23130 <tr><th>foo!!bar</th>
23131 <th><i>foo|bar</i></th>
23132 <th><i>foo!!bar</i></th>
23133 <th><i><span>foo!!bar</span></i></th>
23134 </tr></tbody></table>
23135 !! wikitext
23136 {|
23137 !<nowiki>foo!!bar</nowiki>
23138 !''<nowiki>foo|bar</nowiki>''
23139 !''<nowiki>foo!!bar</nowiki>''
23140 !''<span><nowiki>foo!!bar</nowiki></span>''
23141 |}
23142 !! html/php
23143 <table>
23144 <tr>
23145 <th>foo!!bar
23146 </th>
23147 <th><i>foo|bar</i>
23148 </th>
23149 <th><i>foo!!bar</i>
23150 </th>
23151 <th><i><span>foo!!bar</span></i>
23152 </th></tr></table>
23153
23154 !! end
23155
23156 !! test
23157 Tables: 3c. Nested in th
23158 !! options
23159 parsoid=html2wt
23160 !! html/parsoid
23161 <table><tbody>
23162 <tr><th>foo||bar</th>
23163 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23164 </tr></tbody></table>
23165 !! wikitext
23166 {|
23167 !<nowiki>foo||bar</nowiki>
23168 !<nowiki>foo||bar</nowiki>
23169 |}
23170 !! html/php
23171 <table>
23172 <tr>
23173 <th>foo||bar
23174 </th>
23175 <th>foo||bar
23176 </th></tr></table>
23177
23178 !! end
23179
23180 !! test
23181 Tables: 4a. Escape -
23182 !! options
23183 parsoid=html2wt
23184 !! html/*
23185 <table>
23186
23187 <tr>
23188 <th>-bar
23189 </th></tr>
23190 <tr>
23191 <td>-bar
23192 </td></tr></table>
23193
23194 !! wikitext
23195 {|
23196
23197 !-bar
23198
23199 |-
23200 |<nowiki>-bar</nowiki>
23201 |}
23202 !! end
23203
23204 !! test
23205 Tables: 4b. Escape +
23206 !! options
23207 parsoid=html2wt
23208 !! html/*
23209 <table>
23210
23211 <tr>
23212 <th>+bar
23213 </th></tr>
23214 <tr>
23215 <td>+bar
23216 </td></tr></table>
23217
23218 !! wikitext
23219 {|
23220
23221 !+bar
23222
23223 |-
23224 |<nowiki>+bar</nowiki>
23225 |}
23226 !! end
23227
23228 !! test
23229 Tables: 4c. No escaping needed
23230 !! options
23231 parsoid=html2wt
23232 !! html/parsoid
23233 <table><tbody>
23234 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23235 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23236 <tr><td>foo
23237 <p>bar|baz
23238 +bar
23239 -bar</p></td></tr>
23240 <tr><td>x
23241 <div>a|b</div></td>
23242 </tbody></table>
23243 !! wikitext
23244 {|
23245 |foo-bar
23246 |foo+bar
23247 |-
23248 |''foo''-bar
23249 |''foo''+bar
23250 |-
23251 |foo
23252 bar|baz
23253 +bar
23254 -bar
23255 |-
23256 |x
23257 <div>a|b</div>
23258 |}
23259 !! html/php
23260 <table>
23261 <tr>
23262 <td>foo-bar
23263 </td>
23264 <td>foo+bar
23265 </td></tr>
23266 <tr>
23267 <td><i>foo</i>-bar
23268 </td>
23269 <td><i>foo</i>+bar
23270 </td></tr>
23271 <tr>
23272 <td>foo
23273 <p>bar|baz
23274 +bar
23275 -bar
23276 </p>
23277 </td></tr>
23278 <tr>
23279 <td>x
23280 <div>a|b</div>
23281 </td></tr></table>
23282
23283 !! end
23284
23285 !! test
23286 Tables: 4d. No escaping needed
23287 !! options
23288 parsoid=html2wt
23289 !! html/parsoid
23290 <table>
23291 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23292 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23293 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23294 </tbody></table>
23295 !! wikitext
23296 {|
23297 |[[Foo]]-bar
23298 ||+1
23299 ||-2
23300 |}
23301 !! html/php
23302 <table>
23303 <tr>
23304 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23305 </td>
23306 <td>+1
23307 </td>
23308 <td>-2
23309 </td></tr></table>
23310
23311 !! end
23312
23313 !! test
23314 T97430: Don't emit empty nowiki pairs around marker meta tags
23315 !! options
23316 parsoid=html2wt
23317 !! html/parsoid
23318 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23319 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23320 !! wikitext
23321 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23322 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23323 !! end
23324
23325 !! test
23326 Unclosed xmlish element in table line shouldn't eat end delimiters
23327 !! options
23328 parsoid=html2wt
23329 !! html/parsoid
23330 <table>
23331 <tbody><tr><td> &lt;foo</td>
23332 <td> bar></td></tr>
23333 </tbody></table>
23334 !! wikitext
23335 {|
23336 | <foo
23337 | bar>
23338 |}
23339 !! html/php
23340 <table>
23341 <tr>
23342 <td> &lt;foo
23343 </td>
23344 <td> bar&gt;
23345 </td></tr></table>
23346
23347 !! end
23348
23349 #### --------------- Links ----------------
23350 #### 1. Quote marks in link text
23351 #### 2. Wikilinks: Escapes needed
23352 #### 3. Wikilinks: No escapes needed
23353 #### 4. Extlinks: Escapes needed
23354 #### 5. Extlinks: No escapes needed
23355 #### --------------------------------------
23356 !! test
23357 Links 1. WikiLinks: No escapes needed
23358 !! options
23359 parsoid=html2wt
23360 !! html/parsoid
23361 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23362 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23363 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23364 !! wikitext
23365 [[Foo|Foo''boo'']]
23366 [[Foo|[Foobar]]]
23367 [[Foo|x [Foobar] x]]
23368 !! html/php
23369 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23370 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23371 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23372 </p>
23373 !! end
23374
23375 !! test
23376 Links 2. WikiLinks: Escapes needed
23377 !! options
23378 parsoid=html2wt
23379 !! html/parsoid
23380 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23381 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23382 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23383 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23384 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23385 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23386 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23387 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23388 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23389 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23390 !! wikitext
23391 [[Foo|<nowiki>Foobar]</nowiki>]]
23392 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23393 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23394 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23395 [[Foo|<nowiki>|Bar</nowiki>]]
23396 [[Foo|<nowiki>]]bar</nowiki>]]
23397 [[Foo|<nowiki>[[bar</nowiki>]]
23398 [[Foo|<nowiki>x [[ y</nowiki>]]
23399 [[Foo|<nowiki>x ]] y</nowiki>]]
23400 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23401 !! html/php
23402 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23403 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23404 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23405 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23406 <a href="/wiki/Foo" title="Foo">|Bar</a>
23407 <a href="/wiki/Foo" title="Foo">]]bar</a>
23408 <a href="/wiki/Foo" title="Foo">[[bar</a>
23409 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23410 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23411 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23412 </p>
23413 !! end
23414
23415 !! test
23416 Links 3. WikiLinks: No escapes needed
23417 !! options
23418 parsoid=html2wt
23419 !! html/parsoid
23420 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23421 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23422 !! wikitext
23423 [[Foo|[Foobar]]
23424 [[Foo|foo|bar]]
23425 !! html/php
23426 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23427 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23428 </p>
23429 !! end
23430
23431 !! test
23432 Links 4. ExtLinks: Escapes needed
23433 !! options
23434 parsoid=html2wt
23435 !! html/parsoid
23436 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23437 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23438 <p>[http://google.com]</p>
23439 <p>[http://google.com google]</p>
23440 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23441 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
23442 !! wikitext
23443 [http://google.com <nowiki>[google]</nowiki>]
23444 [http://google.com <nowiki>google]</nowiki>]
23445
23446 <nowiki>[http://google.com]</nowiki>
23447
23448 <nowiki>[http://google.com google]</nowiki>
23449
23450 [http://google.com<nowiki>]</nowiki>
23451
23452 [{{echo|http://google.com}}<nowiki>]</nowiki>
23453 !! html/php
23454 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23455 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23456 </p><p>[http://google.com]
23457 </p><p>[http://google.com google]
23458 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23459 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23460 </p>
23461 !! end
23462
23463 !! test
23464 Links 5. ExtLinks: No escapes needed
23465 !! options
23466 parsoid=html2wt
23467 !! html/parsoid
23468 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23469 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23470 !! wikitext
23471 [http://google.com [google]
23472
23473 [[http://google.com]]
23474 !! html/php
23475 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23476 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23477 </p>
23478 !! end
23479
23480 !! test
23481 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23482 !! options
23483 parsoid=html2wt
23484 !! html/parsoid
23485 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23486 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23487 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23488 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23489 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23490 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23491 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23492 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23493 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23494 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23495 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23496 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23497 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23498 </p>
23499 !! wikitext
23500 x<nowiki/>http://example.com<nowiki/>y
23501 http://example.com<nowiki/>?x
23502 http://example.com<nowiki/>&x
23503 http://example.com<nowiki/>'x
23504 http://example.com<nowiki/>,x
23505 http://example.com<nowiki/>.x
23506 http://example.com<nowiki/>;x
23507 http://example.com<nowiki/>:x
23508 http://example.com<nowiki/>;x
23509 http://example.com<nowiki/>!x
23510 http://example.com<nowiki/>=x
23511 http://example.com<nowiki/>(x)
23512 http://example.com(x<nowiki/>)
23513 !! end
23514
23515 !! test
23516 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23517 !! options
23518 parsoid=html2wt
23519 !! html/parsoid
23520 <p>x
23521 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23522 y
23523 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23524 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23525 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23526 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23527 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23528 </p>
23529 !! wikitext
23530 x
23531 http://example.com
23532 y
23533 "http://example.com"
23534 (http://example.com)
23535 (http://example.com) foo
23536 http://example.com,
23537 http://example.com, foo
23538 !! html/php
23539 <p>x
23540 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23541 y
23542 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23543 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23544 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23545 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23546 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23547 </p>
23548 !! end
23549
23550 !! test
23551 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23552 !! options
23553 parsoid=html2wt
23554 !! html/parsoid
23555 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23556 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23557 !! wikitext
23558 http://example.com.,;:!?\
23559 -http://example.com:
23560 !! html/php
23561 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23562 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23563 </p>
23564 !! end
23565
23566 !! test
23567 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23568 !! options
23569 parsoid=html2wt
23570 !! html/parsoid
23571 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23572 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23573 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23574 !! wikitext
23575 RFC 123<nowiki/>4
23576 RFC 123<nowiki/>y
23577 X<nowiki/>RFC 123<nowiki/>y
23578 !! end
23579
23580 !! test
23581 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23582 !! options
23583 parsoid=html2wt
23584 !! html/parsoid
23585 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23586 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23587 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23588 </p>
23589 !! wikitext
23590 RFC 123?foo
23591 RFC 123&foo
23592 -RFC 123-
23593 !! html/php
23594 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23595 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23596 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23597 </p>
23598 !! end
23599
23600 !! test
23601 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23602 !! options
23603 parsoid=html2wt
23604 !! html/parsoid
23605 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23606 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23607 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23608 !! wikitext
23609 PMID 123<nowiki/>4
23610 PMID 123<nowiki/>y
23611 X<nowiki/>PMID 123<nowiki/>y
23612 !! end
23613
23614 !! test
23615 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23616 !! options
23617 parsoid=html2wt
23618 !! html/parsoid
23619 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23620 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23621 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23622 </p>
23623 !! wikitext
23624 PMID 123?foo
23625 PMID 123&foo
23626 -PMID 123-
23627 !! html/php
23628 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23629 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23630 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23631 </p>
23632 !! end
23633
23634 !! test
23635 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23636 !! options
23637 parsoid=html2wt
23638 !! html/parsoid
23639 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23640 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23641 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23642 </p>
23643 !! wikitext
23644 ISBN 1234567890<nowiki/>1
23645 ISBN 1234567890<nowiki/>x
23646 a<nowiki/>ISBN 1234567890<nowiki/>b
23647 !! end
23648
23649 !! test
23650 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23651 !! options
23652 parsoid=html2wt
23653 !! html/parsoid
23654 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23655 !! wikitext
23656 -ISBN 1234567890's
23657 !! html/php
23658 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23659 </p>
23660 !! end
23661
23662 !! test
23663 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23664 !! options
23665 parsoid=html2wt
23666 !! html/*
23667 <p>this is not a link: http://example.com
23668 </p>
23669 !! wikitext
23670 this is not a link: <nowiki>http://example.com</nowiki>
23671 !! end
23672
23673 !! test
23674 Links 15. Link trails can't become link prefixes.
23675 !! options
23676 language=is
23677 parsoid=html2wt
23678 !! html/parsoid
23679 <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>
23680 !! wikitext
23681 [[Söfnuður]]-[[00]]
23682 !! html/php
23683 <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>
23684 </p>
23685 !! end
23686
23687 #### --------------- Quotes ---------------
23688 #### 1. Quotes inside <b> and <i>
23689 #### 2. Link fragments separated by <i> and <b> tags
23690 #### 3. Link fragments inside <i> and <b>
23691 #### 4. No escaping needed
23692 #### --------------------------------------
23693 !! test
23694 1a. Quotes inside <b> and <i>
23695 !! options
23696 parsoid=html2wt
23697 !! html/*
23698 <p><i>'foo'</i>
23699 <i>''foo''</i>
23700 <i>'''foo'''</i>
23701 <i>foo</i>'s
23702 <b>'foo'</b>
23703 <b>''foo''</b>
23704 <b>'''foo'''</b>
23705 <b>foo'<i>bar'</i>baz</b>
23706 <b>foo</b>'s
23707 '<i>foo</i>
23708 <i>foo</i>'
23709 <i>foo'</i>'
23710 '<i>foo</i>'
23711 '<b>foo</b>
23712 <b>foo</b>'
23713 '<b>foo</b>'
23714 <i>fools'<span> errand</span></i>
23715 <i><span>fool</span>'s errand</i>
23716 '<i>foo</i> bar '<i>baz</i>
23717 a|!*#-:;+-~[]{}b'<i>x</i>
23718 </p>
23719 !! wikitext
23720 ''<nowiki/>'foo'''
23721 ''<nowiki>''foo''</nowiki>''
23722 ''<nowiki>'''foo'''</nowiki>''
23723 ''foo''<nowiki/>'s
23724 '''<nowiki/>'foo''''
23725 '''<nowiki>''foo''</nowiki>'''
23726 '''<nowiki>'''foo'''</nowiki>'''
23727 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23728 '''foo'''<nowiki/>'s
23729 '''foo''
23730 ''foo''<nowiki/>'
23731 ''foo'''<nowiki/>'
23732 '''foo''<nowiki/>'
23733 ''''foo'''
23734 '''foo'''<nowiki/>'
23735 ''''foo'''<nowiki/>'
23736 ''fools'<span> errand</span>''
23737 ''<span>fool</span>'s errand''
23738 '<nowiki/>''foo'' bar '''baz''
23739 a|!*#-:;+-~[]{}b'''x''
23740 !! end
23741
23742 !! test
23743 1b. Quotes inside <b> and <i> with other tags on same line
23744 !! options
23745 parsoid=html2wt
23746 !! html/parsoid
23747 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23748 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23749 <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>
23750 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23751 '<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>
23752 '<i>foo</i> <div title="name">test</div>
23753 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23754 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23755 <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>
23756 </ol>
23757 !! wikitext
23758 '''a'' foo ''[[bar]]''
23759 ''a''' foo ''[[bar]]''
23760 ''a''' foo '''{{echo|[[bar]]}}'''
23761 [[foo]] x'''[[bar]]''
23762 '''foo'' <ref>test</ref>
23763 '''foo'' <div title="name">test</div>
23764 '''foo'' and <br> bar
23765 <references />
23766 !! end
23767
23768 !! test
23769 2. Link fragments separated by <i> and <b> tags
23770 !! options
23771 parsoid=html2wt
23772 !! html/parsoid
23773 <p>[[<i>foo</i>hello]]</p>
23774 <p>[[<b>foo</b>hello]]</p>
23775 !! wikitext
23776 [[''foo''<nowiki>hello]]</nowiki>
23777
23778 [['''foo'''<nowiki>hello]]</nowiki>
23779 !! end
23780
23781 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23782 # this is one of the shortcomings of this format
23783 !! test
23784 3. Link fragments inside <i> and <b>
23785 !! options
23786 parsoid=html2wt
23787 !! html/parsoid
23788 <p><i>[[foo</i>]]</p>
23789 <p><b>[[foo</b>]]</p>
23790 !! wikitext
23791 ''[[foo''<nowiki>]]</nowiki>
23792
23793 '''[[foo'''<nowiki>]]</nowiki>
23794 !! end
23795
23796 !! test
23797 4. No escaping needed
23798 !! options
23799 options=html2wt
23800 !! html/parsoid
23801 <p>'<span><i>bar</i></span>'
23802 '<span><b>bar</b></span>'
23803 'a:b'foo
23804 </p>
23805 !! wikitext
23806 '<span>''bar''</span>'
23807 '<span>'''bar'''</span>'
23808 'a:b'foo
23809 !! end
23810
23811 #### ----------- Paragraphs ---------------
23812 #### 1. No unnecessary escapes
23813 #### --------------------------------------
23814
23815 !! test
23816 1. No unnecessary escapes
23817 !! options
23818 parsoid=html2wt
23819 !! html/parsoid
23820 <p>bar <span>[[foo]]</span>
23821 </p><p>=bar <span>[[foo]]</span>
23822 </p><p>[[bar <span>[[foo]]</span>
23823 </p><p>]]bar <span>[[foo]]</span>
23824 </p><p>=bar <span>foo]]</span>=
23825 </p>
23826 !! wikitext
23827 bar <span><nowiki>[[foo]]</nowiki></span>
23828
23829 =bar <span><nowiki>[[foo]]</nowiki></span>
23830
23831 [[bar <span><nowiki>[[foo]]</nowiki></span>
23832
23833 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23834
23835 =bar <span>foo]]</span><nowiki>=</nowiki>
23836 !!end
23837
23838 #### ----------------------- PRE --------------------------
23839 #### 1. Leading whitespace in SOL context should be escaped
23840 #### ------------------------------------------------------
23841 !! test
23842 1. Leading whitespace in SOL context should be escaped
23843 !! options
23844 parsoid=html2wt
23845 !! html/parsoid
23846 <p> a</p>
23847
23848 <p> a</p>
23849
23850 <p> a(tab)</p>
23851
23852 <p> a
23853 <!--cmt-->
23854 a</p>
23855
23856 <p>a
23857 b</p>
23858
23859 <p>a
23860 b</p>
23861
23862 <p>a
23863 b</p>
23864 !! wikitext
23865 <nowiki> </nowiki>a
23866
23867 <nowiki> </nowiki> a
23868
23869 a(tab)
23870
23871 <nowiki> </nowiki> a
23872 <!--cmt-->
23873 <nowiki> </nowiki>a
23874
23875 a
23876 <nowiki> </nowiki>b
23877
23878 a
23879 b
23880
23881 a
23882 b
23883 !! html/php
23884 <p> a
23885 </p><p> a
23886 </p><p> a(tab)
23887 </p><p> a
23888 a
23889 </p><p>a
23890 b
23891 </p><p>a
23892 b
23893 </p><p>a
23894 b
23895 </p>
23896 !! end
23897
23898 !! test
23899 2. Leading whitespace in non-indent-pre contexts should not be escaped
23900 !! options
23901 parsoid=html2wt
23902 !! html/parsoid
23903 <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>
23904 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23905 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
23906 b</span></li>
23907 </ol>
23908 !! wikitext
23909 foo <ref>''a''
23910 b</ref>
23911 <references />
23912 !! end
23913
23914 !! test
23915 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23916 !! options
23917 parsoid=html2wt
23918 !! html/parsoid
23919 <blockquote>
23920 <p>
23921 a
23922 <span>b</span>
23923 c</p>
23924 </blockquote>
23925 !! wikitext
23926 <blockquote>
23927 a
23928 <span>b</span>
23929 c
23930 </blockquote>
23931 !! end
23932
23933 !! test
23934 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23935 !! options
23936 options=html2wt
23937 !! html/parsoid
23938 <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>
23939 !! wikitext
23940 [[File:Foobar.jpg|thumb|caption]]
23941 !! end
23942
23943 !! test
23944 5. Nowiki escaping should account for indent-pres
23945 !! options
23946 parsoid=html2wt
23947 !! html/parsoid
23948 <pre>==foo==</pre>
23949 !! wikitext
23950 ==foo==
23951 !! end
23952
23953 !!test
23954 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23955 !! options
23956 parsoid=html2wt
23957 !! html/parsoid
23958 <pre>
23959 * foo
23960 * bar
23961 </pre>
23962 !! wikitext
23963 * foo
23964 * bar
23965 !! end
23966
23967 #### --------------- Behavior Switches --------------------
23968
23969 !! test
23970 1. Valid behavior switches should be escaped
23971 !! options
23972 parsoid=html2wt
23973 !! html/parsoid
23974 __TOC__
23975 <i>__TOC__</i>
23976 !! wikitext
23977 <nowiki>__TOC__</nowiki>
23978 ''<nowiki>__TOC__</nowiki>''
23979 !! end
23980
23981 !! test
23982 2. Invalid behavior switches should not be escaped
23983 !! options
23984 parsoid=html2wt
23985 !! html/parsoid
23986 __TOO__
23987 __|__
23988 !! wikitext
23989 __TOO__
23990 __|__
23991 !! end
23992
23993 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23994 !! test
23995 Behavior switches should be SOL-transparent
23996 !! options
23997 parsoid=html2wt
23998 !! html/parsoid
23999 <meta property="mw:PageProp/toc" />
24000
24001 <!-- this one's bogus -->
24002 <pre>__TOO__</pre>
24003
24004 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24005
24006 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24007 !! wikitext
24008 __TOC__
24009
24010 <!-- this one's bogus -->
24011 __TOO__
24012
24013 __TOC__ foo
24014
24015 __TOC__
24016 bar
24017 !! end
24018
24019 #### --------------- HTML tags ---------------
24020 #### 1. a tags
24021 #### 2. other tags
24022 #### 3. multi-line html tag
24023 #### 4. extension tags
24024 #### -----------------------------------------
24025 !! test
24026 1. a tags
24027 !! options
24028 parsoid=html2wt
24029 !! html/parsoid
24030 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24031 !! wikitext
24032 <a href="http://google.com">google</a>
24033 !! end
24034
24035 !! test
24036 2. other tags
24037 !! options
24038 parsoid=html2wt
24039 !! html/parsoid
24040 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24041 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24042 <li> &lt;td&gt;</li></ul>
24043
24044 !! wikitext
24045 * <nowiki><div>foo</div></nowiki>
24046 * <nowiki><div style="color:red">foo</div></nowiki>
24047 * <nowiki><td></nowiki>
24048 !! end
24049
24050 !! test
24051 3. multi-line html tag
24052 !! options
24053 parsoid=html2wt
24054 !! html/parsoid
24055 <p>&lt;div
24056 &gt;foo&lt;/div
24057 &gt;
24058 </p>
24059 !! wikitext
24060 <nowiki><div
24061 >foo</div
24062 ></nowiki>
24063 !! end
24064
24065 !! test
24066 4. extension tags
24067 !! options
24068 parsoid=html2wt
24069 !! html/parsoid
24070 <p>&lt;ref&gt;foo&lt;/ref&gt;
24071 </p><p>&lt;ref&gt;bar
24072 </p><p>baz&lt;/ref&gt;
24073 </p>
24074 !! wikitext
24075 <nowiki><ref>foo</ref></nowiki>
24076
24077 <nowiki><ref>bar</nowiki>
24078
24079 baz<nowiki></ref></nowiki>
24080 !! end
24081
24082 #### --------------- Others ---------------
24083 !! test
24084 Escaping nowikis
24085 !! options
24086 parsoid=html2wt
24087 !! html/parsoid
24088 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24089 </p>
24090 !! wikitext
24091 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24092 !! end
24093
24094 ## The quote-char in the input is necessary for triggering the bug
24095 !! test
24096 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24097 !! options
24098 parsoid=html2wt
24099 !! html/parsoid
24100 <p>foo's bar :</p>
24101 !! wikitext
24102 foo's bar :
24103 !! end
24104
24105 #----------- End of wikitext escaping tests --------------
24106
24107 !! test
24108
24109 Tag-like HTML structures are passed through as text
24110 !! wikitext
24111 <x y>
24112
24113 <x.y>
24114
24115 <x-y>
24116
24117 1>2
24118
24119 x<y
24120
24121 a>b
24122
24123 1<d e>f
24124 !! html
24125 <p>&lt;x y&gt;
24126 </p><p>&lt;x.y&gt;
24127 </p><p>&lt;x-y&gt;
24128 </p><p>1&gt;2
24129 </p><p>x&lt;y
24130 </p><p>a&gt;b
24131 </p><p>1&lt;d e&gt;f
24132 </p>
24133 !! end
24134
24135 !! test
24136 HTML tag with necessary entities in attributes
24137 !! wikitext
24138 <span title="&amp;amp;">foo</span>
24139 !! html
24140 <p><span title="&amp;amp;">foo</span>
24141 </p>
24142 !! end
24143
24144 !! test
24145 HTML tag with 'unnecessary' entity encoding in attributes
24146 !! wikitext
24147 <span title="&amp;">foo</span>
24148 !! html
24149 <p><span title="&amp;">foo</span>
24150 </p>
24151 !! end
24152
24153 !! test
24154 HTML tag with broken attribute value quoting
24155 !! options
24156 parsoid=wt2html,html2html
24157 !! wikitext
24158 <span title="Hello world>Foo</span>
24159 !! html/php
24160 <p><span title="Hello world">Foo</span>
24161 </p>
24162 !! html/parsoid
24163 <p><span title="Hello world">Foo</span></p>
24164 !! end
24165
24166 !! test
24167 Self-closed tag with broken attribute value quoting
24168 !! options
24169 parsoid=wt2html,html2html
24170 !! wikitext
24171 <div title="Hello world />Foo
24172 !! html/php+tidy
24173 <div title="Hello world"></div>
24174 <p>Foo</p>
24175 !! html/parsoid
24176 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24177 !! end
24178
24179 !! test
24180 Table with broken attribute value quoting
24181 !! options
24182 parsoid=wt2html,html2html
24183 !! wikitext
24184 {|
24185 | title="Hello world|Foo
24186 |}
24187 !! html/php
24188 <table>
24189 <tr>
24190 <td title="Hello world">Foo
24191 </td></tr></table>
24192
24193 !! html/parsoid
24194 <table>
24195 <tr>
24196 <td title="Hello world">Foo
24197 </td></tr></table>
24198
24199 !! end
24200
24201 !! test
24202 Table with broken attribute value quoting on consecutive lines
24203 !! options
24204 parsoid=wt2html,html2html
24205 !! wikitext
24206 {|
24207 | title="Hello world|Foo
24208 | style="color:red|Bar
24209 |}
24210 !! html/php
24211 <table>
24212 <tr>
24213 <td title="Hello world">Foo
24214 </td>
24215 <td style="color:red">Bar
24216 </td></tr></table>
24217
24218 !! html/parsoid
24219 <table><tbody>
24220 <tr>
24221 <td title="Hello world">Foo
24222 </td><td style="color: red">Bar
24223 </td></tr></tbody></table>
24224
24225 !! end
24226
24227 !!test
24228 Accept empty td cell attribute
24229 !! wikitext
24230 {|
24231 | align="center" | foo || |
24232 |}
24233 !! html
24234 <table>
24235 <tr>
24236 <td align="center"> foo </td>
24237 <td>
24238 </td></tr></table>
24239
24240 !!end
24241
24242 !!test
24243 Non-empty attributes in th-cells
24244 !! wikitext
24245 {|
24246 ! Foo !! style="color: red" | Bar
24247 |}
24248 !! html
24249 <table>
24250 <tr>
24251 <th> Foo </th>
24252 <th style="color: red"> Bar
24253 </th></tr></table>
24254
24255 !!end
24256
24257 !!test
24258 Accept empty attributes in th-cells
24259 !! wikitext
24260 {|
24261 !| foo !!| bar
24262 |}
24263 !! html
24264 <table>
24265 <tr>
24266 <th> foo </th>
24267 <th> bar
24268 </th></tr></table>
24269
24270 !!end
24271
24272 !!test
24273 Empty table rows go away
24274 !! wikitext
24275 {|
24276 | Hello
24277 | there
24278 |- class="foo"
24279 |-
24280 |}
24281 !! html
24282 <table>
24283 <tr>
24284 <td> Hello
24285 </td>
24286 <td> there
24287 </td></tr>
24288
24289 </table>
24290
24291 !! end
24292
24293 ###
24294 ### Parsoid-centric tests for testing RTing of inter-element separators
24295 ### Edge cases not tested by existing parser tests and specific to
24296 ### Parsoid-specific serialization strategies.
24297 ###
24298
24299 !!test
24300 RT-ed inter-element separators should be valid separators
24301 !! wikitext
24302 {|
24303 |- [[foo]]
24304 |}
24305 !! html/php
24306 <table>
24307
24308 </table>
24309
24310 !! html/parsoid
24311 <table>
24312 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24313 </tbody></table>
24314 !!end
24315
24316 # Parsoid-only since PHP parser relies on Tidy for correct output
24317 !!test
24318 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24319 !!options
24320 parsoid
24321 !! wikitext
24322 {|
24323 |<small>foo
24324 bar
24325 |}
24326
24327 {|
24328 |<small>foo<small>
24329 |}
24330 !! html
24331 <table>
24332 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24333 <p>bar</p></small></td></tr>
24334 </tbody></table>
24335
24336 <table>
24337 <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>
24338 </tbody></table>
24339 !!end
24340
24341 # Note that the "style" attribute is really a template parameter here.
24342 # The = would have to be {{=}} if you wanted the literal.
24343 !!test
24344 Empty TD followed by TD with tpl-generated attribute
24345 !! wikitext
24346 {|
24347 |-
24348 |
24349 |{{echo|style='color:red'}}|foo
24350 |}
24351 !! html
24352 <table>
24353
24354 <tr>
24355 <td>
24356 </td>
24357 <td>foo
24358 </td></tr></table>
24359
24360 !!end
24361
24362 !!test
24363 Indented table with an empty td
24364 !! wikitext
24365 {|
24366 |-
24367 |
24368 |foo
24369 |}
24370 !! html
24371 <table>
24372
24373 <tr>
24374 <td>
24375 </td>
24376 <td>foo
24377 </td></tr></table>
24378
24379 !!end
24380
24381 ## We have some newline diffs RT-ing this edge case
24382 ## and it is not important enough -- we seem to be emitting
24383 ## at most 2 newlines after a </tr> and this is unrelated to
24384 ## the issue from T85627 that this is testing.
24385 !!test
24386 Indented table with blank lines in between (T85627)
24387 !! options
24388 parsoid=wt2html
24389 !! wikitext
24390 {|
24391 |foo
24392
24393
24394 |}
24395 !! html
24396 <table>
24397
24398 <tr>
24399 <td>foo
24400 </td></tr></table>
24401
24402 !!end
24403
24404 !!test
24405 Indented block & table
24406 !! wikitext
24407 <div>foo</div>
24408 {|
24409 |foo
24410 |}
24411 !! html/php
24412 <div>foo</div>
24413 <table>
24414 <tr>
24415 <td>foo
24416 </td></tr></table>
24417
24418 !! html/parsoid
24419 <div data-parsoid='{"stx":"html"}'>foo</div>
24420 <table><tbody>
24421 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24422 </tbody></table>
24423 !!end
24424
24425 !! test
24426 Indent and comment before table row
24427 !! wikitext
24428 {|
24429 <!--hi-->|-
24430 | there
24431 |}
24432 !! html/php
24433 <table>
24434
24435 <tr>
24436 <td> there
24437 </td></tr></table>
24438
24439 !! html/parsoid
24440 <table>
24441 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24442 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24443 </tbody></table>
24444 !! end
24445
24446 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24447 !!test
24448 Empty TR followed by a template-generated TR
24449 !!options
24450 parsoid
24451 !! wikitext
24452 {|
24453 |-
24454 {{echo|<tr><td>foo</td></tr>}}
24455 |}
24456 !! html
24457 <table>
24458 <tbody>
24459 <tr></tr>
24460 <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}}]}'>
24461 <td>foo</td></tr>
24462 </tbody></table>
24463 !!end
24464
24465 ## PHP and parsoid output differ for this, and since this is primarily
24466 ## for testing Parsoid's serializer, marking this Parsoid only
24467 !!test
24468 Empty TR followed by mixed-ws-comment line should RT correctly
24469 !!options
24470 parsoid
24471 !! wikitext
24472 {|
24473 |-
24474 <!--c-->
24475 |-
24476 <!--c--> <!--d-->
24477 |}
24478 !! html
24479 <table>
24480 <tbody>
24481 <tr></tr>
24482 <!--c-->
24483 <tr>
24484 <!--c--> </tr><!--d-->
24485 </tbody></table>
24486
24487 !!end
24488
24489 !!test
24490 Multi-line image caption generated by templates with/without trailing newlines
24491 !! wikitext
24492 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24493 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24494 !! html/parsoid
24495 <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>
24496 <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>
24497 !!end
24498
24499 !! test
24500 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24501 !! options
24502 parsoid=html2wt
24503 !! html/parsoid
24504 <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>
24505
24506 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24507 !! wikitext
24508 <includeonly>foo</includeonly>
24509 new para
24510
24511 [[Category:Foo]]
24512
24513 = new heading =
24514 !! end
24515
24516 ## PHP emits broken html for this, and since this is primarily
24517 ## a Parsoid serializer test, marking this Parsoid only
24518 !!test
24519 Improperly nested inline or quotes tags with whitespace in between
24520 !! wikitext
24521 <span> <s>x</span> </s>
24522 ''' ''x''' ''
24523 !! html/parsoid
24524 <p><span> <s>x</s></span><s> </s>
24525 <b> <i>x</i></b><i> </i>
24526 </p>
24527 !!end
24528
24529 !!test
24530 Encapsulate protected attributes from wt
24531 !! wikitext
24532 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24533 !! html/parsoid
24534 <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>
24535 </body>
24536 !!end
24537
24538 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24539 ## Having nested or stray pre tags results in the attempt to add duplicates,
24540 ## causing an assertion fail. This test tries to prevent that situation.
24541 !!test
24542 Ensure ParagraphWrapper can deal with stray closing pre tags
24543 !!options
24544 parsoid=wt2html
24545 !! wikitext
24546 plain text</pre>
24547 !! html/parsoid
24548 plain text
24549 !!end
24550
24551 !!test
24552 1. Ensure fostered text content is wrapped in element nodes
24553 !!options
24554 parsoid=wt2html
24555 !! wikitext
24556 <table>hi</table><table>ho</table>
24557 !! html/parsoid
24558 <p>hi</p>
24559 <table></table>
24560 <p>ho</p>
24561 <table></table>
24562 !!end
24563
24564 !!test
24565 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24566 !!options
24567 parsoid=wt2html,wt2wt
24568 !! wikitext
24569 <table>
24570 <tr> || ||
24571 <td> a
24572 </table>
24573 !! html/parsoid
24574 <p> || ||
24575 </p><table>
24576 <tbody><tr><td> a</td></tr>
24577 </tbody></table>
24578 !!end
24579
24580 !!test
24581 Encapsulation properly handles null DSR information from foster box
24582 !!options
24583 parsoid=wt2html,wt2wt
24584 !! wikitext
24585 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24586 !! html/parsoid
24587 <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>
24588 !!end
24589
24590 !!test
24591 1. Encapsulate foster-parented transclusion content
24592 !!options
24593 parsoid=wt2wt,wt2html
24594 !! wikitext
24595 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24596 !! html/parsoid
24597 <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>
24598 <tbody>
24599 <tr>
24600 <td>bar</td>
24601 </tr>
24602 </tbody>
24603 </table>
24604 !!end
24605
24606 !!test
24607 2. Encapsulate foster-parented transclusion content
24608 !!options
24609 parsoid=wt2wt,wt2html
24610 !! wikitext
24611 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24612 !! html/parsoid
24613 <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>
24614 <table>
24615 <tbody>
24616 <tr>
24617 <td>bar</td>
24618 </tr>
24619 </tbody>
24620 </table>
24621 !!end
24622
24623 !!test
24624 3. Encapsulate foster-parented transclusion content
24625 !!options
24626 parsoid=wt2wt,wt2html
24627 !! wikitext
24628 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24629 !! html/parsoid
24630 <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;]}">
24631 <p>foo</p>
24632 </div>
24633 <table>
24634 <tbody>
24635 <tr>
24636 <td>bar</td>
24637 </tr>
24638 </tbody>
24639 </table>
24640 !!end
24641
24642 !!test
24643 4. Encapsulate foster-parented transclusion content
24644 !!options
24645 parsoid=wt2wt,wt2html
24646 !! wikitext
24647 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24648 !! html/parsoid
24649 <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;]}">
24650 <p>foo</p>
24651 </div>
24652 <table>
24653 <tbody>
24654 <tr>
24655 <td>bar</td>
24656 </tr>
24657 </tbody>
24658 </table>
24659 !!end
24660
24661 !!test
24662 5. Encapsulate foster-parented transclusion content
24663 !!options
24664 parsoid=wt2wt,wt2html
24665 !! wikitext
24666 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24667 !! html/parsoid
24668 <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>
24669 <table>
24670 <tbody>
24671 <tr>
24672 <td>
24673 <div>
24674 <p>foo</p>
24675 </div>
24676 </td>
24677 </tr>
24678 </tbody>
24679 </table>
24680 !!end
24681
24682 !!test
24683 6. Encapsulate foster-parented transclusion content
24684 !!options
24685 parsoid=wt2wt,wt2html
24686 !! wikitext
24687 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24688 !! html/parsoid
24689 <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>
24690 <table>
24691 <tbody>
24692 <tr>
24693 <td>
24694 <div>
24695 <p>foo</p>
24696 </div>
24697 </td>
24698 </tr>
24699 </tbody>
24700 </table>
24701 <p>ok</p>
24702 !!end
24703
24704 !!test
24705 7. Encapsulate foster-parented transclusion content
24706 !!options
24707 parsoid=wt2wt,wt2html
24708 !! wikitext
24709 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24710 !! html/parsoid
24711 <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>
24712 <table>
24713 <tbody>
24714 <tr>
24715 <td>bar</td>
24716 </tr>
24717 </tbody>
24718 </table>
24719 !!end
24720
24721 # Note that the wt is broken on purpose: the = should be {{=}} if you
24722 # don't want it to be a template parameter key.
24723 !!test
24724 8. Encapsulate foster-parented transclusion content
24725 !!options
24726 parsoid=wt2wt,wt2html
24727 !! wikitext
24728 {{echo|a
24729 }}{|{{echo|style='color:red'}}
24730 |-
24731 |b
24732 |}
24733 !! html/parsoid
24734 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24735 <span> </span>
24736 <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>
24737 <table>
24738 <tbody>
24739 <tr>
24740 <td>b</td>
24741 </tr>
24742 </tbody>
24743 </table>
24744 !!end
24745
24746 !!test
24747 9. Encapsulate foster-parented transclusion content
24748 !!options
24749 parsoid=wt2wt,wt2html
24750 !! wikitext
24751 <table>{{echo|hi</table>hello}}
24752 !! html/parsoid
24753 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
24754 !!end
24755
24756 !!test
24757 Table in fosterable position
24758 !!options
24759 parsoid=wt2html
24760 !! wikitext
24761 {{OpenTable}}
24762 <div>
24763 {|
24764 |}
24765 </div>
24766 |}
24767 !! html/parsoid
24768 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
24769 </span>
24770 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24771
24772 <table>
24773 </table>
24774 !!end
24775
24776 # Parsoid only for bug 64747
24777 !! test
24778 Properly encapsulate empty-content transclusions in fosterable positions
24779 !! wikitext
24780 <table>
24781 {{#if:|
24782 <td>foo</td>
24783 }}
24784 </table>
24785 !! html/parsoid
24786 <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"}]]}'>
24787
24788 </table>
24789 !! end
24790
24791 !! test
24792 Always encapsulate foster box when template range is expanded to table
24793 !! options
24794 parsoid=wt2wt
24795 !! wikitext
24796 {|
24797 hello
24798 {{OpenTable}}
24799 |}
24800 !! html/parsoid
24801
24802 !! end
24803
24804 !! test
24805 T115289: Unclosed table
24806 !! wikitext
24807 {{echo|<table>}}<!--c-->[[Category:Two]]
24808 !! html/parsoid
24809 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
24810 !! end
24811
24812 !! test
24813 T115289: Don't migrate newlines out of tables with fostered content
24814 !! wikitext
24815 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24816 !! html/parsoid
24817 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24818 !! end
24819
24820 !! test
24821 T73074: More fostering fun
24822 !! wikitext
24823 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24824 !! html/parsoid
24825 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
24826 !! end
24827
24828 !!test
24829 Support <object> element with .data attribute
24830 !!options
24831 parsoid=html2wt
24832 !! html/parsoid
24833 <object data="test.swf"></object>
24834 !! wikitext
24835 <object data="test.swf"></object>
24836 !!end
24837
24838 !! test
24839 Don't block XML namespace declaration
24840 !! wikitext
24841 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24842 !! html/php
24843 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24844 </p>
24845 !! html/parsoid
24846 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24847 !! end
24848
24849 # -----------------------------------------------------------------
24850 # The following section of tests are primarily to spec requirements
24851 # around serialization of new/edited content.
24852 #
24853 # All these tests are marked Parsoid html2wt and html2html only
24854 # ----------------------------------------------------------------
24855
24856 # 'mi' is a localinterwiki prefix as well as a language
24857 !! test
24858 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24859 !! options
24860 parsoid=html2wt
24861 !! html/parsoid
24862 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24863 !! wikitext
24864 [[Foo]]
24865 !! end
24866
24867 # See T93839
24868 !! test
24869 New wikilinks should be serialized properly
24870 !! options
24871 parsoid=html2wt
24872 !! html/parsoid
24873 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24874 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24875 !! wikitext
24876 [[Foo]]
24877 [[Foo]]
24878 !! end
24879
24880 !! test
24881 New wiki links (href variations)
24882 !! options
24883 parsoid=html2wt
24884 !! html/parsoid
24885 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24886 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24887 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24888 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24889 !! wikitext
24890 [[Foo_bar]]
24891 [[Foo_bar]]
24892 [[Foo_bar]]
24893 [[Toxine bactérienne]]
24894 !! end
24895
24896 !! test
24897 New wiki links (content string variations)
24898 !! options
24899 parsoid=html2wt
24900 !! html/parsoid
24901 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24902 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24903 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24904 !! wikitext
24905 [[Foo_bar]]
24906 [[Foo bar]]
24907 [[Foo_bar|./Foo_bar]]
24908 !! end
24909
24910 !! test
24911 New category links (href variations)
24912 !! options
24913 parsoid=html2wt
24914 !! html/parsoid
24915 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24916 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24917 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24918 !! wikitext
24919 [[Category:Toxine bactérienne]]
24920 [[Category:Toxine bactérienne]]
24921 [[Category:Toxine bactérienne]]
24922 !! end
24923
24924 !! test
24925 New sol transparent links don't need indent-pre nowiki protection
24926 !! options
24927 parsoid=html2wt
24928 language=de
24929 !! html/parsoid
24930 <link rel="mw:PageProp/redirect" href="./Main_Page">
24931 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24932 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24933 !! wikitext
24934 #WEITERLEITUNG [[Main Page]]
24935 <!-- this is good --> [[Category:Good]]
24936 <!-- this is great --> [[Kategorie:Great]]
24937 !! end
24938
24939 !! test
24940 New interlanguage links (href variations)
24941 !! options
24942 parsoid=html2wt
24943 !! html/parsoid
24944 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24945 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24946 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24947 !! wikitext
24948 [[es:Toxine bactérienne]]
24949 [[es:Toxine_bactérienne]]
24950 [[es:Toxine_bactérienne]]
24951 !! end
24952
24953 !! test
24954 Image: Modifying size of an image (1)
24955 !! options
24956 parsoid={
24957 "modes": ["wt2wt"],
24958 "changes": [
24959 ["img[height]", "attr", "height", "22"],
24960 ["img[width]", "attr", "width", "200"]
24961 ]
24962 }
24963 !! wikitext
24964 [[Image:Foobar.jpg|230x230px]]
24965 !! wikitext/edited
24966 [[Image:Foobar.jpg|200x200px]]
24967 !!end
24968
24969 !! test
24970 Image: Modifying size of an image (2)
24971 !! options
24972 parsoid={
24973 "modes": ["wt2wt"],
24974 "changes": [
24975 ["img[height]", "attr", "height", "100"],
24976 ["img[width]", "attr", "width", "500"]
24977 ]
24978 }
24979 !! wikitext
24980 [[Image:Foobar.jpg|230x230px]]
24981 !! wikitext/edited
24982 [[Image:Foobar.jpg|500x500px]]
24983 !!end
24984
24985 # Change in size is ignored so long as class='mw-default-size'
24986 !! test
24987 Image: Modifying size of an image (3)
24988 !! options
24989 parsoid={
24990 "modes": ["wt2wt"],
24991 "changes": [
24992 ["figure[class]", "removeClass", "mw-default-size"],
24993 ["figure img", "attr", "height", "19"],
24994 ["figure img", "attr", "width", "170"]
24995 ]
24996 }
24997 !! wikitext
24998 [[Image:Foobar.jpg|thumb]]
24999 !! wikitext/edited
25000 [[Image:Foobar.jpg|thumb|170x170px]]
25001 !!end
25002
25003 !! test
25004 Image: Modifying alignment of an image (bug 48665)
25005 !! options
25006 parsoid={
25007 "modes": ["wt2wt"],
25008 "changes": [
25009 ["figure[class]", "removeClass", "mw-halign-right"],
25010 ["figure[class]", "addClass", "mw-halign-left"]
25011 ]
25012 }
25013 !! wikitext
25014 [[Image:Foobar.jpg|thumb|caption|right]]
25015 !! wikitext/edited
25016 [[Image:Foobar.jpg|thumb|caption|left]]
25017 !! end
25018
25019 !! test
25020 Image: Modifying mw-default-size of an frameless image (bug 62805)
25021 !! options
25022 parsoid={
25023 "modes": ["wt2wt"],
25024 "changes": [
25025 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25026 ]
25027 }
25028 !! wikitext
25029 [[Image:Foobar.jpg|frameless|right]]
25030 !! wikitext/edited
25031 [[Image:Foobar.jpg|frameless|right|220x220px]]
25032 !! end
25033
25034 !! test
25035 Image: Modifying valign of an image (bug 49221)
25036 !! options
25037 parsoid={
25038 "modes": ["wt2wt"],
25039 "changes": [
25040 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25041 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25042 ]
25043 }
25044 !! wikitext
25045 [[File:Foobar.jpg|20px|middle]]
25046 !! wikitext/edited
25047 [[File:Foobar.jpg|20px|text-top]]
25048 !! end
25049
25050 !! test
25051 Image: Modifying alt attribute of an image (bug 56400)
25052 !! options
25053 parsoid={
25054 "modes": ["wt2wt"],
25055 "changes": [
25056 ["img[alt]", "attr", "alt", "some alternate edited text"]
25057 ]
25058 }
25059 !! wikitext
25060 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25061 !! wikitext/edited
25062 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25063 !!end
25064
25065 !! test
25066 Image: Modifying caption of an image
25067 !! options
25068 parsoid={
25069 "modes": ["wt2wt"],
25070 "changes": [
25071 ["figcaption", "text", "new caption"]
25072 ]
25073 }
25074 !! wikitext
25075 [[Image:Foobar.jpg|thumb|original caption]]
25076 !! wikitext/edited
25077 [[Image:Foobar.jpg|thumb|new caption]]
25078 !!end
25079
25080 !! test
25081 Image: empty alt attribute (bug 48924)
25082 !! options
25083 parsoid
25084 !! wikitext
25085 [[File:Foobar.jpg|thumb|alt=|bar]]
25086 !! html
25087 <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>
25088 !! end
25089
25090 !! test
25091 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25092 !! options
25093 parsoid=html2wt
25094 language=ar
25095 disabled
25096 !! html/parsoid
25097 <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>
25098 !! wikitext
25099 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25100 !! end
25101
25102 !! test
25103 Image: Block level image should have \n before and after
25104 !! wikitext
25105 123
25106 [[File:Foobar.jpg|right|thumb|150x150px]]
25107 456
25108 !! html/parsoid
25109 <p>123</p>
25110 <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>
25111 <p>456</p>
25112 !!end
25113
25114 !! test
25115 Image: New block level image should have \n before and after (existing content)
25116 !! wikitext
25117 123
25118 [[File:Foobar.jpg|right|thumb|150x150px]]
25119 456
25120 !! html/parsoid
25121 <p>123</p>
25122 <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>
25123 <p>456</p>
25124 !!end
25125
25126 !! test
25127 Image: upright option (parsoid)
25128 !! wikitext
25129 [[File:Foobar.jpg|thumb|upright|caption]]
25130 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25131 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25132 !! html/parsoid
25133 <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>
25134 <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>
25135 <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>
25136 !!end
25137
25138 !! test
25139 Image: upright option is ignored on inline and frame images (parsoid)
25140 !! wikitext
25141 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25142 !! html/parsoid
25143 <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>
25144 !!end
25145
25146 !! test
25147 Image: from basic HTML (1)
25148 !! options
25149 parsoid=html2wt
25150 !! html/parsoid
25151 <span typeof="mw:Image">
25152 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25153 </span>
25154 !! wikitext
25155 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25156 !! end
25157
25158 !! test
25159 Image: from basic HTML (2)
25160 !! options
25161 parsoid=html2wt
25162 !! html/parsoid
25163 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25164 !! wikitext
25165 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25166 !! end
25167
25168 !! test
25169 Image: from basic HTML (3)
25170 !! options
25171 parsoid=html2wt
25172 !! html/parsoid
25173 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25174 !! wikitext
25175 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25176 !! end
25177
25178 !! test
25179 Image: from basic HTML (4)
25180 !! options
25181 parsoid=html2wt
25182 !! html/parsoid
25183 <img src="./File:Foobar.jpg">
25184 !! wikitext
25185 [[File:Foobar.jpg|link=]]
25186 !! end
25187
25188 !! test
25189 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25190 !! options
25191 parsoid=html2wt
25192 !! html/parsoid
25193 <ul>
25194 <li><p>foo</p></li>
25195 </ul>
25196 !! wikitext
25197 * foo
25198 !! end
25199
25200 !! test
25201 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <ul> <li>foo</li></ul>
25206 !! wikitext
25207 * foo
25208 !! end
25209
25210 !! test
25211 Don't strip leading whitespace when handling indent-pre suppressing tags
25212 !! options
25213 parsoid=html2wt
25214 !! html/parsoid
25215 <table>
25216 <tr><td> indented row</td></tr>
25217 </table>
25218 <blockquote><p>
25219 <b>This is very bold of you!</b>
25220 </p>
25221 <table><tr><td>
25222 indented cell (no pre-wrapping!)
25223 </td></tr></table>
25224 </blockquote>
25225 <p>foo</p>
25226 <div>bar</div>
25227 !! wikitext
25228 {|
25229 | indented row
25230 |}
25231 <blockquote>
25232 '''This is very bold of you!'''
25233
25234 {|
25235 |
25236 indented cell (no pre-wrapping!)
25237 |}
25238 </blockquote>
25239 foo
25240 <div>bar</div>
25241 !! end
25242
25243 !! test
25244 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25245 !! options
25246 parsoid=html2wt
25247 !! html/parsoid
25248 <p>foo</p>
25249 <span>bar</span>
25250
25251 <span>foo2
25252 </span>bar2
25253
25254 <div>foo</div>
25255 <span>bar</span>
25256
25257 <div>
25258 <span>foo</span>
25259 </div>
25260 !! wikitext
25261 foo
25262
25263 <span>bar</span>
25264
25265 <span>foo2
25266 <nowiki> </nowiki></span>bar2
25267
25268 <div>foo</div>
25269 <nowiki> </nowiki><span>bar</span>
25270
25271 <div>
25272 <nowiki> </nowiki><span>foo</span>
25273 </div>
25274 !! end
25275
25276 !! test
25277 Lists: Dont insert newlines in a serialized list item.
25278 !! options
25279 parsoid=html2wt
25280 !! html/parsoid
25281 <ul><li>a<br>b</li><li>c</li></ul>
25282 !! wikitext
25283 * a<br>b
25284 * c
25285 !! end
25286
25287 !! test
25288 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25289 !! options
25290 parsoid={
25291 "modes": ["html2wt"],
25292 "scrubWikitext": false
25293 }
25294 !! html/parsoid
25295 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25296 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25297
25298 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25299 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25300
25301 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25302
25303 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25304 !! wikitext
25305 == hello there [[Category:A1]] ==
25306
25307 == [[Category:A2]] hi pal ==
25308
25309 == <!--foo--> [[Category:A3]] how goes it ==
25310
25311 == it goes well [[Category:A4]] <!--bar--> ==
25312
25313 ==howdy [[Category:A5]]==
25314
25315 == __TOC__ ok ==
25316 !! end
25317
25318 !! test
25319 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25320 !! options
25321 parsoid={
25322 "modes": ["html2wt"],
25323 "scrubWikitext": true
25324 }
25325 !! html/parsoid
25326 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25327 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25328
25329 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25330 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25331
25332 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25333 !! wikitext
25334 == hello there ==
25335 [[Category:A1]]
25336 [[Category:A2]]
25337
25338 == hi pal ==
25339
25340 <!--foo--> [[Category:A3]]
25341
25342 == how goes it ==
25343
25344 == it goes well ==
25345 [[Category:A4]] <!--bar-->
25346
25347 __TOC__
25348
25349 == ok ==
25350 !! end
25351
25352 !! test
25353 Headings: Don't hoist metas that come from templates
25354 !! options
25355 parsoid={
25356 "modes": ["html2wt"],
25357 "scrubWikitext": true
25358 }
25359 !! html/parsoid
25360 <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>
25361 !! wikitext
25362 == {{echo|foo [[Category:Foo]]}} ==
25363 !! end
25364
25365 !! test
25366 Headings: Category in ref isn't hoisted
25367 !! options
25368 parsoid={
25369 "modes": ["html2wt"],
25370 "scrubWikitext": true
25371 }
25372 !! html/parsoid
25373 <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>
25374
25375 <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>
25376 !! wikitext
25377 == foo <ref>bar
25378 [[Category:Baz]] </ref> ==
25379
25380 <references />
25381 !! end
25382
25383 !! test
25384 Parsoid: Serialize positional parameters with = in them as named parameter
25385 !! options
25386 parsoid=html2wt
25387 !! html/parsoid
25388 <p about="#mwt1" typeof="mw:Transclusion"
25389 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25390
25391 <p about="#mwt1" typeof="mw:Transclusion"
25392 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25393
25394 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25395 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25396 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25397 !! wikitext
25398 {{echo|1=f=oo}}
25399
25400 {{echo|1=f=oo|2=bar}}
25401
25402 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25403 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25404 {{echo|<nowiki>f=oo</nowiki>|bar}}
25405 !! end
25406
25407 !! test
25408 Parsoid: Serialize positional parameters with = in extlink as named parameter
25409 !! options
25410 parsoid=html2wt
25411 !! html/parsoid
25412 <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>
25413 !! wikitext
25414 {{echo|1=http://stuff?is=ok}}
25415 !! end
25416
25417 !! test
25418 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25419 !! options
25420 parsoid=html2wt
25421 !! html/parsoid
25422 <div>a<p>b</p></div>
25423 <div>a
25424 <p>b</p></div>
25425 <div>
25426 a
25427 <p>b</p></div>
25428 !! wikitext
25429 <div>a
25430 b
25431 </div>
25432 <div>a
25433 b
25434 </div>
25435 <div>
25436 a
25437
25438 b
25439 </div>
25440 !! end
25441
25442 !! test
25443 Substrings resembling wikitext in hrefs should not get nowiki escapes
25444 !! options
25445 parsoid=html2wt
25446 !! html/parsoid
25447 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25448 !! wikitext
25449 [[Foo''bar''baz]]
25450 !! end
25451
25452 !! test
25453 Enforce single-line context in the serializer
25454 !! options
25455 parsoid=html2wt
25456 !! html/parsoid
25457 <h2>testing
25458 123</h2>
25459
25460 <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">
25461 </span><span about="#mwt1">you</span> </h2>
25462
25463 <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>
25464
25465 <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
25466 there</span></li></ol>
25467
25468 <ul><li>asd
25469 sdf</li></ul>
25470
25471 <ul><li>foo
25472 bar
25473 baz</li>
25474 <li>foo <b>bar</b>
25475 baz</li></ul>
25476
25477 <dl><dt>hi
25478 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25479 ho</dd></dl>
25480
25481 <dl><dd> <table>
25482 <tbody><tr><td> ha
25483 ha
25484 ha</td></tr>
25485 </tbody></table></dd></dl>
25486 !! wikitext
25487 == testing 123 ==
25488
25489 == hi {{bogus|there
25490 you}} ==
25491
25492 == foo <ref>hello
25493 there</ref> ==
25494
25495 <references />
25496
25497 * asd sdf
25498
25499 * foo bar baz
25500 * foo '''bar''' baz
25501
25502 ; hi ho : hi ho
25503
25504 : {|
25505 | ha
25506 ha
25507 ha
25508 |}
25509 !! end
25510
25511 !! test
25512 Serialize new placeholder space without spans
25513 !! options
25514 parsoid=html2wt
25515 !! html/parsoid
25516 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25517
25518 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25519
25520 <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>
25521 !! wikitext
25522 foo : bar
25523
25524 foo : bar
25525
25526 <ref>foo : bar</ref>ok
25527 !! end
25528
25529
25530 #-----------------------
25531 # Tag minimization tests
25532 #-----------------------
25533
25534 !! test
25535 1. I/B quote minimization: wikitext-only tags should be combined
25536 !! options
25537 parsoid=html2wt
25538 !! html/parsoid
25539 <p><i>A</i><i>B</i></p>
25540 <p><b>A</b><b>B</b></p>
25541 <p><i>A</i><b><i>B</i></b></p>
25542 <p><b>A</b><i><b>B</b></i></p>
25543 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25544 <p><i><b>A</b></i><i><b>B</b></i></p>
25545 <p><i><b>A</b></i><b><i>B</i></b></p>
25546 <p><b><i>A</i></b><i><b>B</b></i></p>
25547 !! wikitext
25548 ''AB''
25549
25550 '''AB'''
25551
25552 ''A'''B'''''
25553
25554 '''A''B'''''
25555
25556 '''A''BC''D'''
25557
25558 '''''AB'''''
25559
25560 '''''AB'''''
25561
25562 '''''AB'''''
25563 !! end
25564
25565 !! test
25566 2. I/B quote minimization: wikitext and html tags should not be combined
25567 !! options
25568 parsoid=html2wt
25569 !! html/parsoid
25570 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25571 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25572 !! wikitext
25573 ''A''<i>B</i>
25574
25575 ''A''<nowiki/>'''<i>B</i>'''
25576 !! end
25577
25578 !! test
25579 3. I/B quote minimization: templated content stops minimization
25580 !! options
25581 parsoid=html2wt
25582 !! html/parsoid
25583 <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>
25584 <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>
25585 !! wikitext
25586 ''A''{{echo|''B''}}
25587
25588 ''A''{{echo|'''''B'''''}}
25589 !! end
25590
25591 !! test
25592 4. I/B quote minimization: new content should be mimimized with adjacent old content
25593 !! options
25594 parsoid=html2wt
25595 !! html/parsoid
25596 <p><i>A</i><i>B</i></p>
25597 <p><b>A</b><b>B</b></p>
25598 <p><i>A</i><b><i>B</i></b></p>
25599 !! wikitext
25600 ''AB''
25601
25602 '''AB'''
25603
25604 ''A'''B'''''
25605 !! end
25606
25607 !! test
25608 5a. Merge adjacent quote nodes if they've been edited
25609 !! options
25610 parsoid={
25611 "modes": ["wt2wt", "selser"],
25612 "changes": [
25613 ["p", "contents", "remove", ":contains('b')"]
25614 ]
25615 }
25616 !! wikitext
25617 ''a''b''c''
25618 !! wikitext/edited
25619 ''ac''
25620 !! end
25621
25622 !! test
25623 5b. Merge adjacent quote nodes if they've been edited
25624 !! options
25625 parsoid={
25626 "modes": ["wt2wt", "selser"],
25627 "changes": [
25628 ["#x", "remove"]
25629 ]
25630 }
25631 !! wikitext
25632 ''a''<span id="x">b</span>''c''
25633 !! wikitext/edited
25634 ''ac''
25635 !! end
25636
25637 !! test
25638 1. Merge adjacent link nodes as long as at least one element is new
25639 !! options
25640 parsoid={
25641 "modes": ["html2wt"],
25642 "scrubWikitext": true
25643 }
25644 !! html/parsoid
25645 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25646 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25647 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25648 !! wikitext
25649 [[Football]]
25650 [[Football]]
25651 [[Football|Foot]][[Football|ball]]
25652 !! end
25653
25654 !! test
25655 2. Merge adjacent link nodes and enable additional normalizations
25656 !! options
25657 parsoid={
25658 "modes": ["html2wt"],
25659 "scrubWikitext": true
25660 }
25661 !! html/parsoid
25662 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25663 !! wikitext
25664 [[Football|''Football'']]
25665 !! end
25666
25667 !! test
25668 3. Don't merge adjacent link nodes if scrubWikitext is false
25669 !! options
25670 parsoid={
25671 "modes": ["html2wt"],
25672 "scrubWikitext": false
25673 }
25674 !! html/parsoid
25675 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25676 !! wikitext
25677 [[Football|Foot]][[Football|ball]]
25678 !! end
25679
25680 #------------------------------
25681 # End of tag minimization tests
25682 #------------------------------
25683
25684 !!test
25685 Bug 54262: New entities
25686 !! options
25687 parsoid=html2wt
25688 !! html/parsoid
25689 <span typeof="mw:Entity">&nbsp;</span>
25690 !! wikitext
25691 &nbsp;
25692 !! end
25693
25694 ## Note that there is no wikitext output for 'unknownproperty' ##
25695 ## Unknown magic words are silently dropped ##
25696
25697 !! test
25698 Magic words
25699 !! options
25700 parsoid=html2wt
25701 !! html/parsoid
25702 <meta property='mw:PageProp/toc' />
25703 <meta property='mw:PageProp/notoc' />
25704 <meta property='mw:PageProp/forcetoc' />
25705 <meta property='mw:PageProp/index' />
25706 <meta property='mw:PageProp/noindex' />
25707 <meta property='mw:PageProp/nogallery' />
25708 <meta property='mw:PageProp/noeditsection' />
25709 <meta property='mw:PageProp/notitleconvert' />
25710 <meta property='mw:PageProp/nocontentconvert' />
25711 <meta property='mw:PageProp/unknownproperty' />
25712 !! wikitext
25713 __TOC__
25714 __NOTOC__
25715 __FORCETOC__
25716 __INDEX__
25717 __NOINDEX__
25718 __NOGALLERY__
25719 __NOEDITSECTION__
25720 __NOTITLECONVERT__
25721 __NOCONTENTCONVERT__
25722 !! end
25723
25724 !! test
25725 Consecutive <pre>s should not get merged
25726 !! options
25727 parsoid=html2wt,html2html
25728 !! html/parsoid
25729 <pre>a</pre><pre>b</pre>
25730
25731 <pre>c
25732 </pre><pre>
25733 d</pre>
25734
25735 <pre>e
25736
25737 </pre><pre>
25738
25739 f</pre>
25740 !! wikitext
25741 a
25742
25743 b
25744
25745 c
25746
25747 d
25748
25749 e
25750
25751
25752
25753 f
25754 !! end
25755
25756 !! test
25757 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25758 !! options
25759 parsoid=html2wt
25760 !! html/parsoid
25761 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25762 !! wikitext
25763 [[Special:BookSources/1234567890|ISBN 1234567895]]
25764 !! end
25765
25766 !! test
25767 Edited RFC links not serializable as RFC links should serialize as extlinks
25768 !! options
25769 parsoid=html2wt
25770 !! html/parsoid
25771 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25772 !! wikitext
25773 [//tools.ietf.org/html/rfc123 New RFC]
25774 !! end
25775
25776 !! test
25777 Edited PMID links not serializable as PMID links should serialize as extlinks
25778 !! options
25779 parsoid=html2wt
25780 !! html/parsoid
25781 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25782 !! wikitext
25783 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25784 !! end
25785
25786 !! test
25787 WTS of autolinks with trailing/surrounding context
25788 !! options
25789 parsoid=html2wt
25790 !! html/parsoid
25791 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25792 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25793 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25794 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25795 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25796 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25797 !! wikitext
25798 http://cscott.net'''foo'''
25799
25800 http://cscott.net<b>foo</b>
25801
25802 '''http://cscott.net'''
25803
25804 '''http://cscott.net '''
25805
25806 '''http://cscott.net<nowiki/>x'''
25807
25808 http://cscott.net<nowiki/>x
25809 !! end
25810
25811 !! test
25812 WTS of autolinks with nowikis (round-trip)
25813 !! wikitext
25814 x<nowiki/>http://cscott.net<nowiki/>x
25815 !! html/parsoid
25816 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25817 !! end
25818
25819 # this is the "easy" test because it leaves in place all the
25820 # data-parsoid information indicating this is an autolink
25821 !! test
25822 WTS of autolinks with escapes (editing)
25823 !! options
25824 parsoid={
25825 "modes": ["wt2wt"],
25826 "changes": [
25827 [ "meta", "remove" ]
25828 ]
25829 }
25830 !! wikitext
25831 x<nowiki/>http://cscott.net<nowiki/>x
25832 !! wikitext/edited
25833 x<nowiki/>http://cscott.net<nowiki/>x
25834 !! end
25835
25836 !! test
25837 WTS of edited autolink-like text (T103364)
25838 !! options
25839 parsoid={
25840 "modes": ["wt2wt"],
25841 "changes": [
25842 [ "span[typeof]", "removeAttr", "typeof" ]
25843 ]
25844 }
25845 !! wikitext
25846 Not a link: <nowiki>http://example.com</nowiki>.
25847 !! wikitext/edited
25848 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25849 !! end
25850
25851 !! test
25852 WTS of newly-authored autolink-like text (T103364)
25853 !! options
25854 parsoid=html2wt
25855 !! html/parsoid
25856 <p>http://example.com is not a link.</p>
25857 !! wikitext
25858 <nowiki>http://example.com</nowiki> is not a link.
25859 !! end
25860
25861 !! test
25862 WTS of autolink-like text after an autolink (T108563)
25863 !! options
25864 parsoid=html2wt
25865 !! html/parsoid
25866 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25867 !! wikitext
25868 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25869 !! end
25870
25871 !! test
25872 Magic links inside links (not autolinked)
25873 !! wikitext
25874 [[Foo|http://example.com]]
25875 [[Foo|RFC 1234]]
25876 [[Foo|PMID 1234]]
25877 [[Foo|ISBN 123456789x]]
25878
25879 [http://foo.com http://example.com]
25880 [http://foo.com RFC 1234]
25881 [http://foo.com PMID 1234]
25882 [http://foo.com ISBN 123456789x]
25883 !! html+tidy
25884 <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>
25885 <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>
25886 !! html/parsoid
25887 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25888 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25889 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25890 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25891
25892 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25893 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25894 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25895 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25896 !! end
25897
25898 !! test
25899 Magic links inside image captions (autolinked)
25900 !! wikitext
25901 [[File:Foobar.jpg|thumb|http://example.com]]
25902 [[File:Foobar.jpg|thumb|RFC 1234]]
25903 [[File:Foobar.jpg|thumb|PMID 1234]]
25904 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25905 !! html+tidy
25906 <div class="thumb tright">
25907 <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>
25908 <div class="thumbcaption">
25909 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25910 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25911 </div>
25912 </div>
25913 <div class="thumb tright">
25914 <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>
25915 <div class="thumbcaption">
25916 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25917 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25918 </div>
25919 </div>
25920 <div class="thumb tright">
25921 <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>
25922 <div class="thumbcaption">
25923 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25924 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25925 </div>
25926 </div>
25927 <div class="thumb tright">
25928 <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>
25929 <div class="thumbcaption">
25930 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25931 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25932 </div>
25933 </div>
25934 !! html/parsoid
25935 <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>
25936 <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>
25937 <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>
25938 <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>
25939 !! end
25940
25941 !! test
25942 WTS of magic word text (T109371)
25943 !! options
25944 parsoid=html2wt
25945 !! html/parsoid
25946 <p>RFC 1234</p>
25947 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25948 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25949 !! wikitext
25950 <nowiki>RFC 1234</nowiki>
25951
25952 [http://foo.com RFC 1234]
25953
25954 [[Foo|RFC 1234]]
25955 !! end
25956
25957 !! test
25958 Edited Redirect link should emit a non-piped wikitext link
25959 !! options
25960 parsoid=html2wt
25961 !! html/parsoid
25962 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25963 !! wikitext
25964 #REDIRECT [[Bar]]
25965 !! end
25966
25967 !! test
25968 T75121: Infer extension name from typeOf if data-mw is not present
25969 !! options
25970 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25971 !! html/parsoid
25972 <div typeOf="mw:Extension/foo"></div>
25973 !! wikitext
25974 <foo />
25975 !! end
25976
25977 # Note that the <p> wrapping isn't present in PHP parser output
25978 # The important thing for this test is that P-wrapping doesn't
25979 # interfere with the <nowiki> protection for leading - in <td>
25980 # (which isn't necessary for <th>).
25981 !! test
25982 T88318: p-wrapped dash in table.
25983 !! options
25984 parsoid=html2wt,wt2wt
25985 !! html/parsoid
25986 <table><tbody>
25987 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25988 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25989 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25990 </tbody></table>
25991 !! wikitext
25992 {|
25993 !-
25994 !-
25995 |-
25996 |<nowiki>-</nowiki>
25997 |<nowiki>- </nowiki>
25998 |-
25999 |<small>-</small>
26000 |<br>
26001 -
26002 |<br>
26003 -
26004 |}
26005 !! html/php+tidy
26006 <table>
26007 <tr>
26008 <th>-</th>
26009 <th>-</th>
26010 </tr>
26011 <tr>
26012 <td>-</td>
26013 <td>-</td>
26014 </tr>
26015 <tr>
26016 <td><small>-</small></td>
26017 <td><br />
26018 <p>-</p>
26019 </td>
26020 <td><br />
26021 <p>-</p>
26022 </td>
26023 </tr>
26024 </table>
26025 !! end
26026
26027 !! test
26028 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26029 !! options
26030 parsoid=html2wt
26031 !! html/parsoid
26032 <table id='mwAb'>
26033 <td id='mwAc'>foo</td>
26034 <td id='serialize-this'>bar</td>
26035 </table>
26036 !! wikitext
26037 {|
26038 |foo
26039 | id="serialize-this" |bar
26040 |}
26041 !! end
26042
26043 !! test
26044 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26045 !! options
26046 parsoid=html2wt
26047 !! html/parsoid
26048 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26049 !! wikitext
26050 <div id="hello">ok</div>
26051 !! end
26052
26053 !! test
26054 WTS change modes
26055 !! options
26056 parsoid={
26057 "modes": ["wt2wt"],
26058 "changes": [
26059 [ "#xyz", "before", "<b>before</b> stuff " ],
26060 [ "#xyz", "after", " stuff <i>after</i>" ],
26061 [ "#xyz", "html", "x <b>y</b> z" ]
26062 ]
26063 }
26064 !! wikitext
26065 <span id="xyz">hello</span>
26066 !! wikitext/edited
26067 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26068 !! end
26069
26070 !! test
26071 Never serialize a-tag as html, regardless of what data-parsoid has to say
26072 !! options
26073 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26074 !! html/parsoid
26075 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26076 !! wikitext
26077 [[Foo]]
26078 !! end
26079
26080 ## SSS FIXME: This is broken output nevertheless.
26081 ## What might be a reasonable non-broken output for this?
26082 ## This is an edge case unlikely to be seen in production
26083 ## that I am not wasting more time on this right now.
26084 !! test
26085 Never serialize a-tag as html, no matter what attributes it has
26086 !! options
26087 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26088 !! html/parsoid
26089 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26090 !! wikitext
26091 [http://boo.org http://boohoo.org]
26092 !! end
26093
26094 # Misnested is an indication that selser can reuse the source but these have
26095 # shown to sneak through on occasion. See T101768.
26096 # The original wikitext here is: [http://test.com [[one]] two three]
26097 !! test
26098 Strip span tags added to mark misnested links
26099 !! options
26100 parsoid=html2wt
26101 !! html/parsoid
26102 <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>
26103 !! wikitext
26104 [http://test.com][[one]] two three
26105 !! end
26106
26107 !! test
26108 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26109 !! options
26110 parsoid=html2wt
26111 !! html/parsoid
26112 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
26113 <tbody><tr><td>d
26114 </td></tr>
26115 </tbody></table>
26116 !! wikitext
26117 {{echo|a}}
26118 {|{{echo|c
26119 {{!}}d
26120 }}
26121 |}
26122 !! end
26123
26124 ## This test verifies the presence and computation of this attribute indirectly
26125 ## by making an edit and ensuring that the serialization is correct (which it would be
26126 ## only if firstWikitextNode is properly set).
26127 !! test
26128 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26129 !! options
26130 parsoid= {
26131 "modes": ["wt2wt"],
26132 "changes": [
26133 [ "div#x", "remove" ],
26134 [ "div", "before", "<div>new</div>" ]
26135 ]
26136 }
26137 !! wikitext
26138 <div id="x">foo</div>
26139 {|
26140 {{echo|<div>boo</div>
26141 {{!}}b}}
26142 |c
26143 |}
26144 !! wikitext/edited
26145
26146 <div>new</div>
26147 {|
26148 {{echo|<div>boo</div>
26149 {{!}}b}}
26150 |c
26151 |}
26152 !! end
26153
26154 # --------------------------------------------
26155 # Tests spec'ing wikitext serialization norms |
26156 # --------------------------------------------
26157
26158 !! test
26159 1. Categories should always be serialized on their own line
26160 !! options
26161 parsoid=html2wt
26162 !! html/parsoid
26163 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26164 !! wikitext
26165 foo
26166 [[Category:Foo]]
26167 bar
26168 !! end
26169
26170 !! test
26171 2. Categories that are part of templates should not introduce a line break
26172 !! wikitext
26173 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26174 !! html/parsoid
26175 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
26176 !! end
26177
26178 # Careful while editing these next 2 tests. There are \u200f characters
26179 # before and after the <link> tags in the HTML and following some
26180 # of the categories in wikitext
26181 # Do not remove these characters in edits.
26182 #
26183 # As part of the serialization, these bidi characters will get stripped.
26184 !! test
26185 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26186 !! options
26187 parsoid={
26188 "modes": ["html2wt"],
26189 "scrubWikitext": true
26190 }
26191 !! html/parsoid
26192 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26193 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26194 !! wikitext
26195 [[קטגוריה:טקסים]]
26196 [[קטגוריה: שיטות משפט]]
26197 !! end
26198
26199 !! test
26200 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26201 !! options
26202 parsoid={
26203 "modes": ["html2wt"],
26204 "scrubWikitext": true
26205 }
26206 !! html/parsoid
26207 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26208 !! wikitext
26209 [[קטגוריה:טקסים]]
26210 ‏y
26211 !! end
26212
26213 !! test
26214 Lists: Add space after bullets
26215 !! options
26216 parsoid=html2wt
26217 !! html/parsoid
26218 <ul>
26219 <li>foo</li>
26220 <li> bar</li>
26221 <li><span> baz</span></li>
26222 </ul>
26223 !! wikitext
26224 * foo
26225 * bar
26226 * <span> baz</span>
26227 !! end
26228
26229 !! test
26230 1. Headings: Add space before/after == (T53744)
26231 !! options
26232 parsoid=html2wt
26233 !! html/parsoid
26234 <h2>foo</h2>
26235 <h2> bar</h2>
26236 <h2>baz </h2>
26237 <h2><span> baz</span></h2>
26238 !! wikitext
26239 == foo ==
26240
26241 == bar ==
26242
26243 == baz ==
26244
26245 == <span> baz</span> ==
26246 !! end
26247
26248 !! test
26249 2. Headings: Add space before/after == even after hoisted content
26250 !! options
26251 parsoid={
26252 "modes": ["html2wt"],
26253 "scrubWikitext": true
26254 }
26255 !! html/parsoid
26256 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26257 !! wikitext
26258 [[Category:A2]]
26259
26260 == ok ==
26261 !! end
26262
26263 !! test
26264 1. Headings: suppress newly created empty headings
26265 !! options
26266 parsoid={
26267 "modes": ["html2wt"],
26268 "scrubWikitext": true
26269 }
26270 !! html/parsoid
26271 <h2></h2>
26272 !! wikitext
26273 !! end
26274
26275 !! test
26276 2. Headings: don't suppress empty headings if scrubWikitext is false
26277 !! options
26278 parsoid=html2wt
26279 !! html/parsoid
26280 <h2></h2>
26281 !! wikitext
26282 ==<nowiki/>==
26283 !! end
26284
26285 !! test
26286 3. Headings: suppress empty headings on edits
26287 !! options
26288 parsoid={
26289 "modes": ["selser"],
26290 "scrubWikitext": true,
26291 "changes": [
26292 [ "#x", "remove"]
26293 ]
26294 }
26295 !! wikitext
26296 ==<span id="x">foo</span>==
26297 !! wikitext/edited
26298 !! end
26299
26300 !! test
26301 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26302 !! options
26303 parsoid={
26304 "modes": ["html2wt"],
26305 "scrubWikitext": true
26306 }
26307 !! html/parsoid
26308 <h2>foo<br/>bar</h2>
26309 <h2>foo <span><br/>bar</span> baz</h2>
26310 !! wikitext
26311 == foo bar ==
26312
26313 == foo <span> bar</span> baz ==
26314 !! end
26315
26316 !! test
26317 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26318 !! options
26319 parsoid={
26320 "modes": ["html2wt"],
26321 "scrubWikitext": false
26322 }
26323 !! html/parsoid
26324 <h2>foo<br/>bar</h2>
26325 !! wikitext
26326 == foo<br> bar ==
26327 !! end
26328
26329 !! test
26330 1. WT Quote Tags: suppress newly created empty style tags
26331 !! options
26332 parsoid={
26333 "modes": ["html2wt"],
26334 "scrubWikitext": true
26335 }
26336 !! html/parsoid
26337 <i></i><b></b>
26338 !! wikitext
26339 !! end
26340
26341 !! test
26342 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26343 !! options
26344 parsoid=html2wt
26345 !! html/parsoid
26346 <i></i><b></b>
26347 !! wikitext
26348 ''<nowiki/>'''''<nowiki/>'''
26349 !! end
26350
26351 !! test
26352 3. WT Quote Tags: suppress empty style tags on edits
26353 !! options
26354 parsoid={
26355 "modes": ["selser"],
26356 "scrubWikitext": true,
26357 "changes": [
26358 [ "#x", "remove"]
26359 ]
26360 }
26361 !! wikitext
26362 '''<span id="x">foo</span>'''
26363 !! wikitext/edited
26364 !! end
26365
26366 !! test
26367 1. Anchors: suppress newly created empty anchors
26368 !! options
26369 parsoid={
26370 "modes": ["html2wt"],
26371 "scrubWikitext": true
26372 }
26373 !! html/parsoid
26374 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26375 !! wikitext
26376 !! end
26377
26378 !! test
26379 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26380 !! options
26381 parsoid={
26382 "modes": ["html2wt"],
26383 "scrubWikitext": false
26384 }
26385 !! html/parsoid
26386 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26387 !! wikitext
26388 [[Test|<nowiki/>]]
26389 !! end
26390
26391 !! test
26392 3. Anchors: suppress empty anchors on edits
26393 !! options
26394 parsoid={
26395 "modes": ["selser"],
26396 "scrubWikitext": true,
26397 "changes": [
26398 [ "#x", "remove"]
26399 ]
26400 }
26401 !! wikitext
26402 [[Test|<span id="x">foo</span>]]
26403 !! wikitext/edited
26404 !! end
26405
26406 !! test
26407 3a. Anchors: do not suppress numbered extlinks
26408 !! options
26409 parsoid={
26410 "modes": ["wt2wt"],
26411 "scrubWikitext": true
26412 }
26413 !! wikitext
26414 [http://foo.com]
26415 !! html/parsoid
26416 <a rel="mw:ExtLink" href="http://foo.com"></a>
26417 !! end
26418
26419 !! test
26420 3b. Anchors: do not suppress numbered extlinks
26421 !! options
26422 parsoid={
26423 "modes": ["wt2wt"],
26424 "scrubWikitext": true,
26425 "changes": [
26426 [ "#x", "remove"]
26427 ]
26428 }
26429 !! wikitext
26430 [http://foo.com <span id="x">foo</span>]
26431 !! wikitext/edited
26432 [http://foo.com]
26433 !! end
26434
26435 !!test
26436 Normalizations should be restricted to edited content
26437 !!options
26438 parsoid={
26439 "modes": ["selser"],
26440 "scrubWikitext": true,
26441 "changes": [
26442 [ "h1", "before", "<i></i>"]
26443 ]
26444 }
26445 !!wikitext
26446 a
26447 = =
26448 b
26449 !!wikitext/edited
26450 a
26451 = =
26452 b
26453 !!end
26454
26455 !! test
26456 1. Multiple normalizations (html2wt)
26457 !! options
26458 parsoid={
26459 "modes": ["html2wt"],
26460 "scrubWikitext": true
26461 }
26462 !! html
26463 <h2><i></i></h2>
26464 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26465 </a><b><i></i></b>x</p>
26466 !! wikitext
26467
26468 [[foo]]
26469 x
26470
26471 !! end
26472
26473 !! test
26474 2. Multiple normalizations (selser)
26475 !! options
26476 parsoid={
26477 "modes": ["selser"],
26478 "scrubWikitext": true,
26479 "changes": [
26480 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26481 ]
26482 }
26483 !! wikitext
26484 <span id="x">foo</span>
26485 !! wikitext/edited
26486 <span id="x">foo</span>
26487
26488 x
26489 !! end
26490
26491 !! test
26492 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26493 !! options
26494 parsoid={
26495 "modes": ["html2wt"],
26496 "scrubWikitext": true
26497 }
26498 !! html/parsoid
26499 <p> hi</p>
26500 <p> hello</p>
26501 !! wikitext
26502 hi
26503
26504 hello
26505 !! end
26506
26507 !! test
26508 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26509 !! options
26510 parsoid=html2wt
26511 !! html/parsoid
26512 <p> hi</p>
26513 <p> hello</p>
26514 !! wikitext
26515 <nowiki> </nowiki>hi
26516
26517 <nowiki> </nowiki> hello
26518 !! end
26519
26520 !! test
26521 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26522 !! options
26523 parsoid={
26524 "modes": ["html2wt"],
26525 "scrubWikitext": true
26526 }
26527 !! html/parsoid
26528 <p>Foo
26529 bar
26530 baz</p>
26531
26532 <table><tr><td>Foo
26533 bar
26534 baz bang</td></tr></table>
26535
26536 <p><!--boo--> foo
26537 bar</p>
26538
26539 <p> foo
26540 bar<span>boo</span></p>
26541 !! wikitext
26542 Foo
26543 bar
26544 baz
26545
26546 {|
26547 |Foo
26548 bar
26549 baz bang
26550 |}
26551
26552 <!--boo-->foo
26553 bar
26554
26555 foo
26556 bar<span>boo</span>
26557 !! end
26558
26559 !! test
26560 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26561 !! options
26562 parsoid={
26563 "modes": ["selser"],
26564 "scrubWikitext": true,
26565 "changes": [
26566 [ "p", "html", " a\n b" ]
26567 ]
26568 }
26569 !! wikitext
26570 xyz
26571 !! wikitext/edited
26572 a
26573 b
26574 !! end
26575
26576 !! test
26577 1. New links that end in spaces
26578 !! options
26579 parsoid={
26580 "modes": ["html2wt"],
26581 "scrubWikitext": false
26582 }
26583 !! html/parsoid
26584 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26585 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26586 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26587 !! wikitext
26588 [[Berlin ]]<nowiki/>is the capital of Germany.
26589
26590 [[Foo ]]'''bar'''
26591
26592 [[Boston ]] is a city.
26593 !! end
26594
26595 !! test
26596 2. New links that end in spaces
26597 !! options
26598 parsoid={
26599 "modes": ["html2wt"],
26600 "scrubWikitext": true
26601 }
26602 !! html/parsoid
26603 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26604 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26605 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26606 !! wikitext
26607 [[Berlin]] is the capital of Germany.
26608
26609 [[Foo]] '''bar'''
26610
26611 [[Boston]] is a city.
26612 !! end
26613
26614 !! test
26615 1. Table cells with escapable prefixes
26616 !! options
26617 parsoid={
26618 "modes": ["html2wt"],
26619 "scrubWikitext": false
26620 }
26621 !! html
26622 <table>
26623 <tr><td>a</td></tr>
26624 <tr><td>-</td></tr>
26625 <tr><td>+</td></tr>
26626 </table>
26627 !! wikitext
26628 {|
26629 |a
26630 |-
26631 |<nowiki>-</nowiki>
26632 |-
26633 |<nowiki>+</nowiki>
26634 |}
26635 !! end
26636
26637 !! test
26638 2. Table cells with escapable prefixes
26639 !! options
26640 parsoid={
26641 "modes": ["html2wt"],
26642 "scrubWikitext": true
26643 }
26644 !! html
26645 <table>
26646 <tr><td>a</td></tr>
26647 <tr><td>-</td></tr>
26648 <tr><td>+</td></tr>
26649 </table>
26650 !! wikitext
26651 {|
26652 |a
26653 |-
26654 | -
26655 |-
26656 | +
26657 |}
26658 !! end
26659
26660 !! test
26661 3a. Table cells with escapable prefixes after edits
26662 !! options
26663 parsoid={
26664 "modes": ["selser"],
26665 "scrubWikitext": true,
26666 "changes": [
26667 [ "table tbody tr:first-child td:first-child", "remove"]
26668 ]
26669 }
26670 !! wikitext
26671 {|
26672 |a||-
26673 |}
26674 !! wikitext/edited
26675 {|
26676 | -
26677 |}
26678 !! end
26679
26680 !! test
26681 3b. Table cells with escapable prefixes after edits
26682 !! options
26683 parsoid={
26684 "modes": ["selser"],
26685 "scrubWikitext": true,
26686 "changes": [
26687 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26688 [ "#x", "remove" ]
26689 ]
26690 }
26691 !! wikitext
26692 {|
26693 |pqr
26694 |<span id="x">foo</span>+
26695 |}
26696 !! wikitext/edited
26697 {|
26698 | -
26699 | +
26700 |}
26701 !! end
26702
26703 # FIXME: This test will fail because
26704 # normalization doesn't realize that the id attribute
26705 # will eliminate the escapable scenario
26706 !! test
26707 4a. Table cells without escapable prefixes after edits
26708 !! options
26709 parsoid={
26710 "modes": ["selser"],
26711 "scrubWikitext": true,
26712 "changes": [
26713 [ "#x", "html", "-" ]
26714 ]
26715 }
26716 !! wikitext
26717 {|
26718 | id="x" |abcd
26719 |}
26720 !! wikitext/edited
26721 {|
26722 | id="x" |-
26723 |}
26724 !! end
26725
26726 ## This tests normalizer's ability to discriminate between
26727 ## cells having identical content.
26728 !! test
26729 4b. Table cells without escapable prefixes after edits
26730 !! options
26731 parsoid={
26732 "modes": ["selser"],
26733 "scrubWikitext": true,
26734 "changes": [
26735 [ "td", "html", "-" ]
26736 ]
26737 }
26738 !! wikitext
26739 {|
26740 |a||b
26741 |}
26742 !! wikitext/edited
26743 {|
26744 | -||-
26745 |}
26746 !! end
26747
26748 ## This tests normalizer's ability to not be tripped by
26749 ## comments (and whitespace)
26750 !! test
26751 4c. Table cells without escapable prefixes after edits
26752 !! options
26753 parsoid={
26754 "modes": ["selser"],
26755 "scrubWikitext": true,
26756 "changes": [
26757 [ "table tbody tr td:first-child", "remove" ]
26758 ]
26759 }
26760 !! wikitext
26761 {|
26762 |-
26763 <!--foo--> |a||-
26764 |}
26765 !! wikitext/edited
26766 {|
26767 |-
26768 <!--foo--> | -
26769 |}
26770 !! end
26771
26772 ## This tests normalizer's ability to handle HTML cells
26773 !! test
26774 4d. Table cells without escapable prefixes after edits
26775 !! options
26776 parsoid={
26777 "modes": ["selser"],
26778 "scrubWikitext": true,
26779 "changes": [
26780 [ "td", "html", "-" ]
26781 ]
26782 }
26783 !! wikitext
26784 <table>
26785 <tr><td>a</td></tr>
26786 </table>
26787 !! wikitext/edited
26788 <table>
26789 <tr><td>-</td></tr>
26790 </table>
26791 !! end
26792
26793 ## T111151 Remove font elements without attributes
26794 !! test
26795 5a. font tags without attributes should be dropped in scrubWikitext mode
26796 !! options
26797 parsoid={
26798 "modes": ["html2wt"],
26799 "scrubWikitext": true
26800 }
26801 !! html
26802 <font>foo</font>
26803 <font><font>bar</font></font>
26804 <font class="x">boo</font>
26805 !! wikitext
26806 foo
26807 bar
26808 <font class="x">boo</font>
26809 !! end
26810
26811 !! test
26812 5b. font tags should not be dropped without scrubWikitext being enabled
26813 !! options
26814 parsoid={
26815 "modes": ["html2wt"],
26816 "scrubWikitext": false
26817 }
26818 !! html
26819 <font>foo</font>
26820 !! wikitext
26821 <font>foo</font>
26822 !! end
26823
26824 !! test
26825 Escape nowiki DOM elements
26826 !! options
26827 parsoid=html2wt
26828 !! html/parsoid
26829 <nowiki><i>foo</i></nowiki>
26830 !! wikitext
26831 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26832 !! end
26833
26834 # This is meant to be an interim fix while we go about figuring out
26835 # how to not introduce these trailing <nowiki/>s in the first place.
26836 !! test
26837 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26838 !! options
26839 parsoid=html2wt
26840 !! html/parsoid
26841 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26842 y</p>
26843 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26844 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26845 !! wikitext
26846 x
26847 y
26848
26849 {{echo|
26850 1 = <nowiki/>}}
26851
26852 {{echo|
26853 1 = <nowiki/>
26854 }}
26855 !! end
26856
26857 # ---------------------------------------------------
26858 # End of tests spec'ing wikitext serialization norms |
26859 # ---------------------------------------------------
26860
26861 # T104032
26862 !! test
26863 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26864 !! options
26865 parsoid=html2wt
26866 !! html/parsoid
26867 a<p>b</p>
26868 <b>c</b><p>d</p>
26869 <table><tr>
26870 <td>a<p>b</p></td>
26871 <td><b>c</b><p>d</p></td>
26872 </tr></table>
26873 !! wikitext
26874 a
26875
26876 b
26877
26878 '''c'''
26879
26880 d
26881 {|
26882 |a
26883 b
26884 |'''c'''
26885 d
26886 |}
26887 !! end
26888
26889 # -----------------------------------------------------------------
26890 # End of section for Parsoid-only html2wt tests for serialization
26891 # of new content
26892 # -----------------------------------------------------------------
26893
26894 # -----------------------------------------------------------------
26895 # The following section of tests are primarily to spec behavior of
26896 # the selective serializer. All these tests have manual selser
26897 # changes. The automated selser changes for all tests handle the
26898 # wide variation of changes, but these tests here capture specs
26899 # deterministically.
26900 # ----------------------------------------------------------------
26901
26902 ## T90517
26903 !! test
26904 Selser: New comments should not be lost
26905 !! options
26906 parsoid={
26907 "modes": ["selser"],
26908 "changes": [
26909 [ "#a", "after", "<!--c1-->" ],
26910 [ "#b", "before", "<!--c2-->" ]
26911 ]
26912 }
26913 !! wikitext
26914 <span id="a">a</span>
26915
26916 <span id="b">b</span>
26917 !! wikitext/edited
26918 <span id="a">a</span><!--c1-->
26919
26920 <!--c2--><span id="b">b</span>
26921 !! end
26922
26923 ## T89383
26924 !! test
26925 Selser: Check for validity of DSR before using it
26926 !! options
26927 parsoid={
26928 "modes": ["selser"],
26929 "changes": [
26930 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26931 ]
26932 }
26933 !! wikitext
26934 <span id="a">a</span>
26935 !! wikitext/edited
26936 {{DISPLAYTITLE:foo}}
26937 <span id="a">a</span>
26938 !! end
26939
26940 !! test
26941 1. DOMDiff: Changes to <ref> content should be looked up using id
26942 !! options
26943 parsoid={
26944 "modes": ["selser"],
26945 "changes": [
26946 ["#X", "after", "bar"],
26947 ["#Y", "after", "baz"]
26948 ]
26949 }
26950 !! wikitext
26951 X <ref><span id="X">foo</span></ref>
26952 Y <ref name="a" />
26953 <references>
26954 <ref name="a"><span id="Y">foo</span></ref>
26955 </references>
26956 !! wikitext/edited
26957 X <ref><span id="X">foo</span>bar</ref>
26958 Y <ref name="a" />
26959 <references>
26960 <ref name="a"><span id="Y">foo</span>baz</ref>
26961 </references>
26962 !! end
26963
26964 !! test
26965 2. DOMDiff: Changes to <ref> content should be looked up using id
26966 !! options
26967 parsoid={
26968 "modes": ["selser"],
26969 "changes": [
26970 ["#Z", "after", "bar"]
26971 ]
26972 }
26973 !! wikitext
26974 A <ref>foo bar for a</ref>
26975 B <ref group="X" name="b" />
26976
26977 <references />
26978
26979 <references group="X">
26980 <ref name="b"><span id="Z">foo</span></ref>
26981 </references>
26982 !! wikitext/edited
26983 A <ref>foo bar for a</ref>
26984 B <ref group="X" name="b" />
26985
26986 <references />
26987
26988 <references group="X">
26989 <ref name="b"><span id="Z">foo</span>bar</ref>
26990 </references>
26991 !! end
26992
26993 !! test
26994 Empty LI (T49673)
26995 !! wikitext
26996 * a
26997 *
26998 *
26999 * b
27000 !! html/php+tidy
27001 <ul>
27002 <li>a</li>
27003 <li class="mw-empty-li"></li>
27004 <li class="mw-empty-li"></li>
27005 <li>b</li>
27006 </ul>
27007 !! end